Differences From Artifact [4cea821d7a]:
- File
src/OFFile.m
— part of check-in
[c9621825fc]
at
2017-06-04 18:48:03
on branch trunk
— Treat MorphOS + ixemul as a separate platform
This reduces the ifdef hell and makes much more sense, as with ixemul,
no native calls are allowed. (user: js, size: 10653) [annotate] [blame] [check-ins using]
To Artifact [c3e373372b]:
- File
src/OFFile.m
— part of check-in
[f9cd4f9cab]
at
2017-06-05 15:51:48
on branch trunk
— OFStream: Don't throw when at end of stream
Instead, let reads return 0 and let writes append after the end. (user: js, size: 10565) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFFile.h" #import "OFString.h" #import "OFLocalization.h" #import "OFDataArray.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" #ifdef OF_WINDOWS | > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #import "OFFile.h" #import "OFString.h" #import "OFLocalization.h" #import "OFDataArray.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotOpenException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" #ifdef OF_WINDOWS |
︙ | ︙ | |||
305 306 307 308 309 310 311 | return self; } - (bool)lowlevelIsAtEndOfStream { if (!OF_FILE_HANDLE_IS_VALID(_handle)) | | | | < | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | return self; } - (bool)lowlevelIsAtEndOfStream { if (!OF_FILE_HANDLE_IS_VALID(_handle)) @throw [OFNotOpenException exceptionWithObject: self]; return _atEndOfStream; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { ssize_t ret; if (!OF_FILE_HANDLE_IS_VALID(_handle)) @throw [OFNotOpenException exceptionWithObject: self]; #if defined(OF_WINDOWS) if (length > UINT_MAX) @throw [OFOutOfRangeException exception]; if ((ret = read(_handle, buffer, (unsigned int)length)) < 0) @throw [OFReadFailedException exceptionWithObject: self |
︙ | ︙ | |||
350 351 352 353 354 355 356 | return ret; } - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { | | | < | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | return ret; } - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { if (!OF_FILE_HANDLE_IS_VALID(_handle)) @throw [OFNotOpenException exceptionWithObject: self]; #if defined(OF_WINDOWS) if (length > INT_MAX) @throw [OFOutOfRangeException exception]; if (write(_handle, buffer, (int)length) != (int)length) @throw [OFWriteFailedException exceptionWithObject: self |
︙ | ︙ | |||
393 394 395 396 397 398 399 | - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { of_offset_t ret; if (!OF_FILE_HANDLE_IS_VALID(_handle)) | | < < | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { of_offset_t ret; if (!OF_FILE_HANDLE_IS_VALID(_handle)) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_MORPHOS # if defined(OF_WINDOWS) ret = _lseeki64(_handle, offset, whence); # elif defined(OF_HAVE_OFF64_T) ret = lseek64(_handle, offset, whence); # else |
︙ | ︙ |