Differences From Artifact [398809665b]:
- File
src/OFURLHandler_file.m
— part of check-in
[fe2cbe0021]
at
2018-04-22 16:13:04
on branch trunk
— runtime: Define BOOL to be the same as bool
As we define the ABI, we can just replace BOOL with bool everywhere,
including in ObjFW itself. For the Apple platforms where BOOL and bool
are different, this is not a problem as BOOL and bool are passed and
returned the same way in the ABI.This still defines BOOL to bool for compatibility, except on AmigaOS and
Wii, which both have its own BOOL type. (user: js, size: 27907) [annotate] [blame] [check-ins using]
To Artifact [08b70171c7]:
- File src/OFURLHandler_file.m — part of check-in [b16fc262c0] at 2018-04-23 22:19:10 on branch trunk — Use more native AmigaOS APIs on AmigaOS 3 (user: js, size: 28095) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
62 63 64 65 66 67 68 | #ifdef OF_WINDOWS # include <windows.h> # include <direct.h> # include <ntdef.h> #endif | | > > > | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #ifdef OF_WINDOWS # include <windows.h> # include <direct.h> # include <ntdef.h> #endif #ifdef OF_AMIGAOS # ifdef OF_AMIGAOS3 # define INTUITION_CLASSES_H # endif # include <proto/dos.h> # include <proto/locale.h> #endif #if defined(OF_WINDOWS) typedef struct __stat64 of_stat_t; #elif defined(OF_AMIGAOS) typedef struct { of_offset_t st_size; mode_t st_mode; of_time_interval_t st_atime, st_mtime, st_ctime; } of_stat_t; #elif defined(OF_HAVE_OFF64_T) typedef struct stat64 of_stat_t; #else typedef struct stat of_stat_t; #endif #ifndef S_ISLNK # define S_ISLNK(s) 0 #endif #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) && !defined(OF_AMIGAOS) static OFMutex *passwdMutex; #endif #if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) && !defined(OF_WINDOWS) static OFMutex *readdirMutex; #endif #ifdef OF_WINDOWS static WINAPI BOOLEAN (*func_CreateSymbolicLinkW)(LPCWSTR, LPCWSTR, DWORD); #endif static int of_stat(OFString *path, of_stat_t *buffer) { #if defined(OF_WINDOWS) return _wstat64([path UTF16String], buffer); #elif defined(OF_AMIGAOS) BPTR lock; struct FileInfoBlock fib; of_time_interval_t timeInterval; struct Locale *locale; if ((lock = Lock([path cStringWithEncoding: [OFLocalization encoding]], SHARED_LOCK)) == 0) { |
︙ | ︙ | |||
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | errno = 0; break; } return -1; } if (!Examine64(lock, &fib, TAG_DONE)) { UnLock(lock); errno = 0; return -1; } UnLock(lock); buffer->st_size = fib.fib_Size64; buffer->st_mode = (fib.fib_DirEntryType > 0 ? S_IFDIR : S_IFREG); timeInterval = 252460800; /* 1978-01-01 */ locale = OpenLocale(NULL); /* * FIXME: This does not take DST into account. But unfortunately, there | > > > > > > > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | errno = 0; break; } return -1; } # ifdef OF_MORPHOS if (!Examine64(lock, &fib, TAG_DONE)) { # else if (!Examine(lock, &fib)) { # endif UnLock(lock); errno = 0; return -1; } UnLock(lock); # ifdef OF_MORPHOS buffer->st_size = fib.fib_Size64; # else buffer->st_size = fib.fib_Size; # endif buffer->st_mode = (fib.fib_DirEntryType > 0 ? S_IFDIR : S_IFREG); timeInterval = 252460800; /* 1978-01-01 */ locale = OpenLocale(NULL); /* * FIXME: This does not take DST into account. But unfortunately, there |
︙ | ︙ | |||
168 169 170 171 172 173 174 | buffer); #endif } static int of_lstat(OFString *path, of_stat_t *buffer) { | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | buffer); #endif } static int of_lstat(OFString *path, of_stat_t *buffer) { #if defined(HAVE_LSTAT) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS) # ifdef OF_HAVE_OFF64_T return lstat64([path cStringWithEncoding: [OFLocalization encoding]], buffer); # else return lstat([path cStringWithEncoding: [OFLocalization encoding]], buffer); # endif |
︙ | ︙ | |||
656 657 658 659 660 661 662 | path = [URL fileSystemRepresentation]; #if defined(OF_WINDOWS) if (_wmkdir([path UTF16String]) != 0) @throw [OFCreateDirectoryFailedException exceptionWithURL: URL errNo: errno]; | | | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | path = [URL fileSystemRepresentation]; #if defined(OF_WINDOWS) if (_wmkdir([path UTF16String]) != 0) @throw [OFCreateDirectoryFailedException exceptionWithURL: URL errNo: errno]; #elif defined(OF_AMIGAOS) BPTR lock; if ((lock = CreateDir( [path cStringWithEncoding: [OFLocalization encoding]])) == 0) { int errNo; switch (IoErr()) { |
︙ | ︙ | |||
758 759 760 761 762 763 764 | if (GetLastError() != ERROR_NO_MORE_FILES) @throw [OFReadFailedException exceptionWithObject: self requestedLength: 0 errNo: EIO]; } @finally { FindClose(handle); } | | | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | if (GetLastError() != ERROR_NO_MORE_FILES) @throw [OFReadFailedException exceptionWithObject: self requestedLength: 0 errNo: EIO]; } @finally { FindClose(handle); } #elif defined(OF_AMIGAOS) of_string_encoding_t encoding = [OFLocalization encoding]; BPTR lock; struct FileInfoBlock fib; if ((lock = Lock([path cStringWithEncoding: encoding], SHARED_LOCK)) == 0) { int errNo; |
︙ | ︙ | |||
936 937 938 939 940 941 942 | [self removeItemAtURL: [OFURL fileURLWithPath: [path stringByAppendingPathComponent: item]]]; objc_autoreleasePoolPop(pool2); } | | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | [self removeItemAtURL: [OFURL fileURLWithPath: [path stringByAppendingPathComponent: item]]]; objc_autoreleasePoolPop(pool2); } #ifndef OF_AMIGAOS # ifndef OF_WINDOWS if (rmdir([path cStringWithEncoding: [OFLocalization encoding]]) != 0) # else if (_wrmdir([path UTF16String]) != 0) # endif @throw [OFRemoveItemFailedException |
︙ | ︙ | |||
959 960 961 962 963 964 965 | # endif @throw [OFRemoveItemFailedException exceptionWithURL: URL errNo: errno]; #endif } | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | # endif @throw [OFRemoveItemFailedException exceptionWithURL: URL errNo: errno]; #endif } #ifdef OF_AMIGAOS if (!DeleteFile( [path cStringWithEncoding: [OFLocalization encoding]])) { int errNo; switch (IoErr()) { case ERROR_OBJECT_IN_USE: case ERROR_DISK_NOT_VALIDATED: |
︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 | #if defined(OF_WINDOWS) if (_wrename([[source fileSystemRepresentation] UTF16String], [[destination fileSystemRepresentation] UTF16String]) != 0) @throw [OFMoveItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: errno]; | | | 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | #if defined(OF_WINDOWS) if (_wrename([[source fileSystemRepresentation] UTF16String], [[destination fileSystemRepresentation] UTF16String]) != 0) @throw [OFMoveItemFailedException exceptionWithSourceURL: source destinationURL: destination errNo: errno]; #elif defined(OF_AMIGAOS) of_string_encoding_t encoding = [OFLocalization encoding]; if (!Rename([[source fileSystemRepresentation] cStringWithEncoding: encoding], [[destination fileSystemRepresentation] cStringWithEncoding: encoding]) != 0) { int errNo; |
︙ | ︙ |