Differences From Artifact [526afc5ebd]:
- File src/OFFile.m — part of check-in [c01ed004b0] at 2013-04-26 22:25:13 on branch trunk — Better checks for functions used in OFFile. (user: js, size: 18074) [annotate] [blame] [check-ins using]
To Artifact [8a99cd99a6]:
- File
src/OFFile.m
— part of check-in
[085bfc12a0]
at
2013-04-27 01:26:35
on branch trunk
— Add OFStdIOStream.
This is used for of_std{in,out,err} now instead of OFFile. (user: js, size: 16470) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
45 46 47 48 49 50 51 | #import "OFFile.h" #import "OFString.h" #import "OFArray.h" #ifdef OF_HAVE_THREADS # import "threading.h" #endif #import "OFDate.h" | < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #import "OFFile.h" #import "OFString.h" #import "OFArray.h" #ifdef OF_HAVE_THREADS # import "threading.h" #endif #import "OFDate.h" #import "OFSystemInfo.h" #import "OFChangeDirectoryFailedException.h" #import "OFChangeFileModeFailedException.h" #import "OFChangeFileOwnerFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFDeleteDirectoryFailedException.h" |
︙ | ︙ | |||
95 96 97 98 99 100 101 | #ifndef S_IWOTH # define S_IWOTH 0 #endif #define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH #define DIR_MODE DEFAULT_MODE | S_IXUSR | S_IXGRP | S_IXOTH | < < < < | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #ifndef S_IWOTH # define S_IWOTH 0 #endif #define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH #define DIR_MODE DEFAULT_MODE | S_IXUSR | S_IXGRP | S_IXOTH #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; #endif static int parse_mode(const char *mode) { if (!strcmp(mode, "r")) |
︙ | ︙ | |||
133 134 135 136 137 138 139 | return O_RDWR | O_CREAT | O_APPEND; if (!strcmp(mode, "ab+") || !strcmp(mode, "a+b")) return O_RDWR | O_CREAT | O_APPEND | O_BINARY; return -1; } | < < < < < < < < < < < < < < < < < < < < < < < < < < | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | return O_RDWR | O_CREAT | O_APPEND; if (!strcmp(mode, "ab+") || !strcmp(mode, "a+b")) return O_RDWR | O_CREAT | O_APPEND | O_BINARY; return -1; } @implementation OFFile #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) + (void)initialize { if (self != [OFFile class]) return; |
︙ | ︙ | |||
693 694 695 696 697 698 699 | if ((_fd = _wopen([path UTF16String], flags, DEFAULT_MODE)) == -1) #endif @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: mode]; | < < | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | if ((_fd = _wopen([path UTF16String], flags, DEFAULT_MODE)) == -1) #endif @throw [OFOpenFileFailedException exceptionWithClass: [self class] path: path mode: mode]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
776 777 778 779 780 781 782 | close(_fd); _fd = -1; } - (void)dealloc { | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 743 744 745 746 747 748 749 750 751 752 753 754 755 | close(_fd); _fd = -1; } - (void)dealloc { if (_fd != -1) close(_fd); [super dealloc]; } @end |