Ticket #242: patch7.patch
File patch7.patch, 3.8 KB (added by , 17 years ago) |
---|
-
common/utils.cc
149 149 while (true) { 150 150 errno = 0; 151 151 struct dirent * entry = readdir(dir); 152 int tmp =errno; 152 153 if (entry == NULL) { 153 if ( errno == 0)154 if ((errno == 0) || (errno == ENOENT)) 154 155 break; 155 156 throw Xapian::DatabaseError("Cannot read entry from directory at '" + dirname + "'", errno); 156 157 } -
net/remoteconnection.cc
78 78 if (buffer.length() >= min_len) return; 79 79 80 80 #ifdef __WIN32__ 81 // FIXME transforming handles this way isn't recommended. In particular 82 // file offsets are not preserved through subsequent ReadFile calls, so 83 // we have to do this manually (although this will only manifest when using 84 // an actual file) 81 85 HANDLE hin = fd_to_handle(fdin); 86 off_t ofs; 82 87 do { 83 88 char buf[CHUNKSIZE]; 84 89 DWORD received; … … 104 109 throw Xapian::NetworkError("Received EOF", context); 105 110 106 111 buffer.append(buf, received); 112 113 // We must move the offset in the OVERLAPPED structure manually 114 ofs = (((off_t)overlapped.OffsetHigh)<<32) + overlapped.Offset + received; 115 overlapped.Offset = ofs & 0xFFFFFFFF; 116 overlapped.OffsetHigh = ofs >> 32; 117 107 118 } while (buffer.length() < min_len); 108 119 #else 109 120 // If there's no end_time, just use blocking I/O. … … 196 207 header += encode_length(message.size()); 197 208 198 209 #ifdef __WIN32__ 210 // FIXME transforming handles this way isn't recommended. In particular 211 // file offsets are not preserved through subsequent WriteFile calls, so 212 // we have to do this manually (although this will only manifest when using 213 // an actual file) 199 214 HANDLE hout = fd_to_handle(fdout); 200 215 const string * str = &header; 216 off_t ofs; 201 217 202 218 size_t count = 0; 203 219 while (true) { … … 221 237 } 222 238 223 239 count += n; 240 241 // We must move the offset in the OVERLAPPED structure manually 242 ofs = (((off_t)overlapped.OffsetHigh)<<32) + overlapped.Offset + n; 243 overlapped.Offset = ofs & 0xFFFFFFFF; 244 overlapped.OffsetHigh = ofs >> 32; 245 224 246 if (count == str->size()) { 225 247 if (str == &message || message.empty()) return; 226 248 str = &message; 227 249 count = 0; 228 250 } 251 229 252 } 253 254 230 255 #else 231 256 // If there's no end_time, just use blocking I/O. 232 257 if (fcntl(fdout, F_SETFL, end_time.is_set() ? O_NONBLOCK : 0) < 0) { … … 325 350 } 326 351 327 352 #ifdef __WIN32__ 353 // FIXME transforming handles this way isn't recommended. In particular 354 // file offsets are not preserved through subsequent WriteFile calls, so 355 // we have to do this manually (although this will only manifest when using 356 // an actual file) 328 357 HANDLE hout = fd_to_handle(fdout); 329 358 off_t ofs; 330 359 size_t count = 0; 331 360 while (true) { 332 361 DWORD n; … … 349 378 } 350 379 351 380 count += n; 381 382 // We must move the offset in the OVERLAPPED structure manually 383 ofs = (((off_t)overlapped.OffsetHigh)<<32) + overlapped.Offset + n; 384 overlapped.Offset = ofs & 0xFFFFFFFF; 385 overlapped.OffsetHigh = ofs >> 32; 386 352 387 if (count == c) { 353 388 if (size == 0) return; 354 389 … … 363 398 count = 0; 364 399 } 365 400 } 401 366 402 #else 367 403 // If there's no end_time, just use blocking I/O. 368 404 if (fcntl(fdout, F_SETFL, end_time.is_set() ? O_NONBLOCK : 0) < 0) { -
tests/api_replicate.cc
175 175 176 176 check_equal_dbs(masterpath, replicapath); 177 177 178 replica.close(); 178 179 rmtmpdir(tempdir); 179 180 return true; 180 181 }