Differences From Artifact [69833cd0ab]:
- File
src/OFFile.m
— part of check-in
[b7cf59038a]
at
2012-04-20 13:59:10
on branch trunk
— Set of_std{in,out,err} in OFFileSingleton.
Referencing subclasses of the current class in +[load] sounds like a bad
idea. (user: js, size: 18992) [annotate] [blame] [check-ins using] [more...]
To Artifact [be7cb0fa5d]:
- File src/OFFile.m — part of check-in [0d4059306a] at 2012-06-07 12:03:10 on branch trunk — Rework OFStream API. (user: js, size: 19015) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
521 522 523 524 525 526 527 | @try { sourceFile = [OFFile fileWithPath: source mode: @"rb"]; destinationFile = [OFFile fileWithPath: destination mode: @"wb"]; while (![sourceFile isAtEndOfStream]) { | | > | > | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | @try { sourceFile = [OFFile fileWithPath: source mode: @"rb"]; destinationFile = [OFFile fileWithPath: destination mode: @"wb"]; while (![sourceFile isAtEndOfStream]) { size_t length; length = [sourceFile readIntoBuffer: buffer length: of_pagesize]; [destinationFile writeBuffer: buffer length: length]; } #if !defined(_WIN32) && !defined(_PSP) if (!override) { struct stat s; if (fstat(sourceFile->fileDescriptor, &s) == 0) |
︙ | ︙ | |||
692 693 694 695 696 697 698 | { if (fileDescriptor == -1) return YES; return atEndOfStream; } | < | > < | > | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | { if (fileDescriptor == -1) return YES; return atEndOfStream; } - (size_t)_readIntoBuffer: (void*)buffer length: (size_t)length { ssize_t ret; if (fileDescriptor == -1 || atEndOfStream || (ret = read(fileDescriptor, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithClass: isa stream: self requestedLength: length]; if (ret == 0) atEndOfStream = YES; return ret; } - (void)_writeBuffer: (const void*)buffer length: (size_t)length { if (fileDescriptor == -1 || atEndOfStream || write(fileDescriptor, buffer, length) < length) @throw [OFWriteFailedException exceptionWithClass: isa stream: self requestedLength: length]; } |
︙ | ︙ |