Differences From Artifact [b2ec5b887b]:
- File
src/OFFile.m
— part of check-in
[a9b2bd12eb]
at
2017-06-11 02:34:04
on branch trunk
— OFFile: Rework handle on MorphOS
The previous one didn't work, as the index was part of the handle, but
the index could change. (user: js, size: 11334) [annotate] [blame] [check-ins using]
To Artifact [72431db710]:
- File
src/OFFile.m
— part of check-in
[2ae01218ef]
at
2017-06-12 22:29:41
on branch trunk
— OFWriteFailedException: Add -[bytesWritten]
This allows retrieving the number of bytes already written before the
write failed, allowing to retry without writing data that has already
been written. (user: js, size: 11711) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 | - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; #if defined(OF_WINDOWS) if (length > INT_MAX) @throw [OFOutOfRangeException exception]; | > > | > > > > | > > > | > > > > > > > | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (_handle == OF_INVALID_FILE_HANDLE) @throw [OFNotOpenException exceptionWithObject: self]; #if defined(OF_WINDOWS) int bytesWritten; if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = write(_handle, buffer, (int)length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: errno]; #elif defined(OF_MORPHOS) LONG bytesWritten; if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if (_handle->append) { if (Seek64(_handle->handle, 0, OFFSET_END) == -1) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: EIO]; } if ((bytesWritten = Write(_handle->handle, (void *)buffer, length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: EIO]; #else ssize_t bytesWritten; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = write(_handle, buffer, length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: errno]; #endif if ((size_t)bytesWritten != length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: bytesWritten errNo: 0]; } - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { of_offset_t ret; |
︙ | ︙ |