Comment: | Clean up exceptions a little
This removes several initializers that omitted the errNo. Removing those |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4f36894ce7c7ad9f05fbb2ed4821e64a |
User & Date: | js on 2017-06-05 17:36:28 |
Other Links: | manifest | tags |
2017-06-05
| ||
18:56 | Doxyfile: Add missing defines check-in: 4b6dfe02f2 user: js tags: trunk | |
17:36 | Clean up exceptions a little check-in: 4f36894ce7 user: js tags: trunk | |
15:51 | OFStream: Don't throw when at end of stream check-in: f9cd4f9cab user: js tags: trunk | |
Modified src/OFFile.m from [c3e373372b] to [89ce8091b7].
︙ | ︙ | |||
260 261 262 263 264 265 266 | handle.index = SIZE_MAX; if ((flags = parseMode([mode UTF8String], &handle.append)) == -1) @throw [OFInvalidArgumentException exception]; if ((handle.handle = Open([path cStringWithEncoding: | | > > > > > > > > > > > > > > > > > > > > > > | > > | > | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | handle.index = SIZE_MAX; if ((flags = parseMode([mode UTF8String], &handle.append)) == -1) @throw [OFInvalidArgumentException exception]; if ((handle.handle = Open([path cStringWithEncoding: [OFLocalization encoding]], flags)) == 0) { int errNo; switch (IoErr()) { case ERROR_OBJECT_IN_USE: case ERROR_DISK_NOT_VALIDATED: errNo = EBUSY; break; case ERROR_OBJECT_NOT_FOUND: errNo = ENOENT; break; case ERROR_DISK_WRITE_PROTECTED: errNo = EROFS; break; case ERROR_WRITE_PROTECTED: case ERROR_READ_PROTECTED: errNo = EACCES; break; default: errNo = 0; break; } @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errNo]; } [openHandles addItem: &handle.handle]; handle.index = [openHandles count] - 1; if (handle.append) { if (Seek64(handle.handle, 0, OFFSET_END) == -1) { closeHandle(handle); @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: EIO]; } } #endif objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; |
︙ | ︙ | |||
333 334 335 336 337 338 339 | errNo: errno]; #elif defined(OF_MORPHOS) if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if ((ret = Read(_handle.handle, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self | | > | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | errNo: errno]; #elif defined(OF_MORPHOS) if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if ((ret = Read(_handle.handle, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; #else if ((ret = read(_handle, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: errno]; #endif |
︙ | ︙ | |||
369 370 371 372 373 374 375 | if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if (_handle.append) { if (Seek64(_handle.handle, 0, OFFSET_END) == -1) @throw [OFWriteFailedException exceptionWithObject: self | | > | > | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if (_handle.append) { if (Seek64(_handle.handle, 0, OFFSET_END) == -1) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; } if (Write(_handle.handle, (void *)buffer, length) != (LONG)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; #else if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if (write(_handle, buffer, length) != (ssize_t)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length |
︙ | ︙ | |||
427 428 429 430 431 432 433 | ret = -1; break; } if (ret == -1) @throw [OFSeekFailedException exceptionWithStream: self offset: offset | | > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | ret = -1; break; } if (ret == -1) @throw [OFSeekFailedException exceptionWithStream: self offset: offset whence: whence errNo: EINVAL]; #endif _atEndOfStream = false; return ret; } |
︙ | ︙ |
Modified src/OFFileManager.m from [ce2f7bd650] to [2b969b9f4d].
︙ | ︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 | #ifndef OF_WINDOWS DIR *dir; encoding = [OFLocalization encoding]; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errno]; # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) [readdirMutex lock]; # endif @try { for (;;) { | > | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | #ifndef OF_WINDOWS DIR *dir; encoding = [OFLocalization encoding]; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithPath: path mode: nil errNo: errno]; # if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS) [readdirMutex lock]; # endif @try { for (;;) { |
︙ | ︙ | |||
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | &fd)) == INVALID_HANDLE_VALUE) { int errNo = 0; if (GetLastError() == ERROR_FILE_NOT_FOUND) errNo = ENOENT; @throw [OFOpenItemFailedException exceptionWithPath: path errNo: errNo]; } @try { do { void *pool2 = objc_autoreleasePoolPush(); OFString *file; if (!wcscmp(fd.cFileName, L".") || !wcscmp(fd.cFileName, L"..")) continue; file = [OFString stringWithUTF16String: fd.cFileName]; [files addObject: file]; objc_autoreleasePoolPop(pool2); } while (FindNextFileW(handle, &fd)); if (GetLastError() != ERROR_NO_MORE_FILES) @throw [OFReadFailedException exceptionWithObject: self | > | > | 390 391 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 | &fd)) == INVALID_HANDLE_VALUE) { int errNo = 0; if (GetLastError() == ERROR_FILE_NOT_FOUND) errNo = ENOENT; @throw [OFOpenItemFailedException exceptionWithPath: path mode: nil errNo: errNo]; } @try { do { void *pool2 = objc_autoreleasePoolPush(); OFString *file; if (!wcscmp(fd.cFileName, L".") || !wcscmp(fd.cFileName, L"..")) continue; file = [OFString stringWithUTF16String: fd.cFileName]; [files addObject: file]; objc_autoreleasePoolPop(pool2); } while (FindNextFileW(handle, &fd)); if (GetLastError() != ERROR_NO_MORE_FILES) @throw [OFReadFailedException exceptionWithObject: self requestedLength: 0 errNo: EIO]; } @finally { FindClose(handle); } objc_autoreleasePoolPop(pool); #endif |
︙ | ︙ | |||
938 939 940 941 942 943 944 | pool = objc_autoreleasePoolPush(); if (!CreateHardLinkW([destination UTF16String], [source UTF16String], NULL)) @throw [OFLinkFailedException exceptionWithSourcePath: source | | > | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | pool = objc_autoreleasePoolPush(); if (!CreateHardLinkW([destination UTF16String], [source UTF16String], NULL)) @throw [OFLinkFailedException exceptionWithSourcePath: source destinationPath: destination errNo: 0]; objc_autoreleasePoolPop(pool); } #endif #if defined(OF_HAVE_SYMLINK) - (void)createSymbolicLinkAtPath: (OFString *)destination |
︙ | ︙ | |||
985 986 987 988 989 990 991 | pool = objc_autoreleasePoolPush(); if (!func_CreateSymbolicLinkW([destination UTF16String], [source UTF16String], 0)) @throw [OFCreateSymbolicLinkFailedException exceptionWithSourcePath: source | | > | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | pool = objc_autoreleasePoolPush(); if (!func_CreateSymbolicLinkW([destination UTF16String], [source UTF16String], 0)) @throw [OFCreateSymbolicLinkFailedException exceptionWithSourcePath: source destinationPath: destination errNo: 0]; objc_autoreleasePoolPop(pool); } #endif #ifdef OF_HAVE_READLINK - (OFString *)destinationOfSymbolicLinkAtPath: (OFString *)path |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | if (path == nil) @throw [OFInvalidArgumentException exception]; if ((handle = CreateFileW([path UTF16String], 0, (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT, NULL)) == INVALID_HANDLE_VALUE) | | > | > | > | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | if (path == nil) @throw [OFInvalidArgumentException exception]; if ((handle = CreateFileW([path UTF16String], 0, (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT, NULL)) == INVALID_HANDLE_VALUE) @throw [OFStatItemFailedException exceptionWithPath: path errNo: 0]; @try { union { char bytes[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; REPARSE_DATA_BUFFER data; } buffer; DWORD size; wchar_t *tmp; if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer.bytes, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &size, NULL)) @throw [OFStatItemFailedException exceptionWithPath: path errNo: 0]; if (buffer.data.ReparseTag != IO_REPARSE_TAG_SYMLINK) @throw [OFStatItemFailedException exceptionWithPath: path errNo: 0]; #define slrb buffer.data.SymbolicLinkReparseBuffer tmp = slrb.PathBuffer + (slrb.SubstituteNameOffset / sizeof(wchar_t)); return [OFString stringWithUTF16String: tmp |
︙ | ︙ |
Modified src/OFPlugin.m from [5175fba523] to [5fa3fa154b].
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #endif #import "OFPlugin.h" #import "OFString.h" #import "OFLocalization.h" #import "OFInitializationFailedException.h" typedef OFPlugin *(*init_plugin_t)(void); of_plugin_handle_t of_dlopen(OFString *path, int flags) { #ifndef OF_WINDOWS | > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #endif #import "OFPlugin.h" #import "OFString.h" #import "OFLocalization.h" #import "OFInitializationFailedException.h" #import "OFOpenItemFailedException.h" typedef OFPlugin *(*init_plugin_t)(void); of_plugin_handle_t of_dlopen(OFString *path, int flags) { #ifndef OF_WINDOWS |
︙ | ︙ | |||
72 73 74 75 76 77 78 | of_plugin_handle_t handle; init_plugin_t initPlugin; OFPlugin *plugin; path = [path stringByAppendingString: @PLUGIN_SUFFIX]; if ((handle = of_dlopen(path, OF_RTLD_LAZY)) == NULL) | | | > < > > | 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 | of_plugin_handle_t handle; init_plugin_t initPlugin; OFPlugin *plugin; path = [path stringByAppendingString: @PLUGIN_SUFFIX]; if ((handle = of_dlopen(path, OF_RTLD_LAZY)) == NULL) @throw [OFOpenItemFailedException exceptionWithPath: path mode: nil errNo: 0]; objc_autoreleasePoolPop(pool); initPlugin = (init_plugin_t)(uintptr_t)of_dlsym(handle, "init_plugin"); if (initPlugin == (init_plugin_t)0 || (plugin = initPlugin()) == nil) { of_dlclose(handle); @throw [OFInitializationFailedException exceptionWithClass: self]; } plugin->_handle = handle; return plugin; } - init { if (object_getClass(self) == [OFPlugin class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; } abort(); } return [super init]; } - (void)dealloc { |
︙ | ︙ |
Modified src/OFProcess.m from [ea4c0fa50a] to [a980832db2].
︙ | ︙ | |||
469 470 471 472 473 474 475 | if (!ReadFile(_readPipe[0], buffer, (DWORD)length, &ret, NULL)) { if (GetLastError() == ERROR_BROKEN_PIPE) { _atEndOfStream = true; return 0; } @throw [OFReadFailedException exceptionWithObject: self | | > | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | if (!ReadFile(_readPipe[0], buffer, (DWORD)length, &ret, NULL)) { if (GetLastError() == ERROR_BROKEN_PIPE) { _atEndOfStream = true; return 0; } @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; } #endif if (ret == 0) _atEndOfStream = true; return ret; |
︙ | ︙ | |||
504 505 506 507 508 509 510 | @throw [OFOutOfRangeException exception]; if (_writePipe[1] == NULL) @throw [OFNotOpenException exceptionWithObject: self]; if (!WriteFile(_writePipe[1], buffer, (DWORD)length, &ret, NULL) || ret != (DWORD)length) { | | | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | @throw [OFOutOfRangeException exception]; if (_writePipe[1] == NULL) @throw [OFNotOpenException exceptionWithObject: self]; if (!WriteFile(_writePipe[1], buffer, (DWORD)length, &ret, NULL) || ret != (DWORD)length) { int errNo = EIO; if (GetLastError() == ERROR_BROKEN_PIPE) errNo = EPIPE; @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: errNo]; |
︙ | ︙ |
Modified src/OFStdIOStream.m from [fac79ea11f] to [ed0f11c59f].
︙ | ︙ | |||
204 205 206 207 208 209 210 | @throw [OFNotOpenException exceptionWithObject: self]; if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if ((ret = Read(_handle, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self | | > | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | @throw [OFNotOpenException exceptionWithObject: self]; if (length > LONG_MAX) @throw [OFOutOfRangeException exception]; if ((ret = Read(_handle, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; #endif if (ret == 0) _atEndOfStream = true; return ret; } |
︙ | ︙ | |||
246 247 248 249 250 251 252 | @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if (Write(_handle, (void *)buffer, length) != (LONG)length) @throw [OFWriteFailedException exceptionWithObject: self | | > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if (Write(_handle, (void *)buffer, length) != (LONG)length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length errNo: EIO]; #endif } #if !defined(OF_WINDOWS) && !defined(OF_MORPHOS) - (int)fileDescriptorForReading { return _fd; |
︙ | ︙ |
Modified src/OFStdIOStream_Win32Console.m from [b94d48eb9c] to [e75a0d88c9].
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | */ #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFInvalidArgumentException.h" | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | */ #define OF_STDIO_STREAM_WIN32_CONSOLE_M #include "config.h" #include <assert.h> #include <errno.h> #import "OFStdIOStream_Win32Console.h" #import "OFStdIOStream+Private.h" #import "OFString.h" #import "OFDataArray.h" #import "OFInvalidArgumentException.h" |
︙ | ︙ | |||
118 119 120 121 122 123 124 | OFDataArray *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, NULL)) @throw [OFReadFailedException exceptionWithObject: self | | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | OFDataArray *rest = nil; size_t i = 0; if (!ReadConsoleW(_handle, UTF16, (DWORD)length, &UTF16Len, NULL)) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length * 2 errNo: EIO]; if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) { of_unichar_t c = (((_incompleteUTF16Surrogate & 0x3FF) << 10) | (UTF16[0] & 0x3FF)) + 0x10000; char UTF8[4]; size_t UTF8Len; |
︙ | ︙ | |||
269 270 271 272 273 274 275 | } } if (!WriteConsoleW(_handle, UTF16, UTF16Len, &written, NULL) || written != UTF16Len) @throw [OFWriteFailedException exceptionWithObject: self | | > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | } } if (!WriteConsoleW(_handle, UTF16, UTF16Len, &written, NULL) || written != UTF16Len) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: UTF16Len * 2 errNo: EIO]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } tmp = [self allocMemoryWithSize: sizeof(char16_t) count: length * 2]; |
︙ | ︙ | |||
320 321 322 323 324 325 326 | if (j > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (!WriteConsoleW(_handle, tmp, (DWORD)j, &written, NULL) || written != j) @throw [OFWriteFailedException exceptionWithObject: self | | > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | if (j > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (!WriteConsoleW(_handle, tmp, (DWORD)j, &written, NULL) || written != j) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: j * 2 errNo: EIO]; } @finally { [self freeMemory: tmp]; } } @end |
Modified src/OFTCPSocket+SOCKS5.m from [4fe5e359bb] to [f778008a7d].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFTCPSocket+SOCKS5.h" #import "OFDataArray.h" #import "OFConnectionFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" | > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <errno.h> #import "OFTCPSocket+SOCKS5.h" #import "OFDataArray.h" #import "OFConnectionFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" |
︙ | ︙ | |||
72 73 74 75 76 77 78 | /* 5 1 0 -> no authentication */ send_or_exception(self, _socket, request, 3); recv_exact(self, _socket, reply, 2); if (reply[0] != 5 || reply[1] != 0) { [self close]; | | > | > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /* 5 1 0 -> no authentication */ send_or_exception(self, _socket, request, 3); recv_exact(self, _socket, reply, 2); if (reply[0] != 5 || reply[1] != 0) { [self close]; @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self errNo: EPROTONOSUPPORT]; } /* CONNECT request */ pool = objc_autoreleasePoolPush(); connectRequest = [OFDataArray dataArray]; [connectRequest addItems: request |
︙ | ︙ | |||
104 105 106 107 108 109 110 | send_or_exception(self, _socket, [connectRequest items], (int)[connectRequest count]); objc_autoreleasePoolPop(pool); recv_exact(self, _socket, reply, 4); | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > | > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | send_or_exception(self, _socket, [connectRequest items], (int)[connectRequest count]); objc_autoreleasePoolPop(pool); recv_exact(self, _socket, reply, 4); if (reply[0] != 5 || reply[2] != 0) { [self close]; @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self errNo: EPROTONOSUPPORT]; } if (reply[1] != 0) { int errNo; [self close]; switch (reply[1]) { case 0x02: errNo = EACCES; break; case 0x03: errNo = ENETUNREACH; break; case 0x04: errNo = EHOSTUNREACH; break; case 0x05: errNo = ECONNREFUSED; break; case 0x06: errNo = ETIMEDOUT; break; case 0x07: errNo = EPROTONOSUPPORT; break; case 0x08: errNo = EAFNOSUPPORT; break; default: errNo = 0; break; } @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self errNo: errNo]; } /* Skip the rest of the reply */ switch (reply[3]) { case 1: /* IPv4 */ recv_exact(self, _socket, reply, 4); break; case 3: /* Domain name */ recv_exact(self, _socket, reply, 1); recv_exact(self, _socket, reply, reply[0]); break; case 4: /* IPv6 */ recv_exact(self, _socket, reply, 16); break; default: [self close]; @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self errNo: EPROTONOSUPPORT]; } recv_exact(self, _socket, reply, 2); } @end |
Modified src/exceptions/OFChangePermissionsFailedException.m from [4170ffb974] to [bcf2de59e3].
︙ | ︙ | |||
24 25 26 27 28 29 30 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path permissions: (uint16_t)permissions errNo: (int)errNo { return [[[self alloc] initWithPath: path permissions: permissions errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithPath: (OFString *)path permissions: (uint16_t)permissions errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; _permissions = permissions; |
︙ | ︙ |
Modified src/exceptions/OFConnectionFailedException.h from [db737cf790] to [3d845cb880].
︙ | ︙ | |||
60 61 62 63 64 65 66 | /*! * @brief Creates a new, autoreleased connection failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect | < < < < < < < < < < < < < < < < < < < < < < < < | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /*! * @brief Creates a new, autoreleased connection failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return A new, autoreleased connection failed exception */ + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated connection failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred |
︙ | ︙ |
Modified src/exceptions/OFConnectionFailedException.m from [58a22b0050] to [b27bc422f6].
︙ | ︙ | |||
28 29 30 31 32 33 34 | { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket | < < < < < < < < < < < < < < < < < < < | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo { return [[[self alloc] initWithHost: host port: port socket: socket errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo { self = [super init]; |
︙ | ︙ | |||
90 91 92 93 94 95 96 | [_socket release]; [super dealloc]; } - (OFString *)description { | < < < < < < | 71 72 73 74 75 76 77 78 79 80 81 82 83 | [_socket release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"A connection to %@ on port %" @PRIu16 @" could not be " @"established in socket of type %@: %@", _host, _port, [_socket class], of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFCreateSymbolicLinkFailedException.h from [6b7c04ec31] to [3eec281c64].
︙ | ︙ | |||
47 48 49 50 51 52 53 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased create symbolic link failed exception. * | < < < < < < < < < < < < < < < < < < < < < | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased create symbolic link failed exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @param errNo The errno of the error that occurred * @return A new, autoreleased create symbolic link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated create symbolic link failed * exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @param errNo The errno of the error that occurred |
︙ | ︙ |
Modified src/exceptions/OFCreateSymbolicLinkFailedException.m from [cf0b1e7a4c] to [71facb8b37].
︙ | ︙ | |||
26 27 28 29 30 31 32 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath | < < < < < < < < < < < < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo { self = [super init]; @try { |
︙ | ︙ | |||
81 82 83 84 85 86 87 | [_destinationPath release]; [super dealloc]; } - (OFString *)description { | < | < < < < < | | 66 67 68 69 70 71 72 73 74 75 76 77 | [_destinationPath release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to create symbolic link %@ with destination %@: %@", _destinationPath, _sourcePath, of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFException.h from [d8d69a707c] to [c52839786d].
︙ | ︙ | |||
128 129 130 131 132 133 134 | # endif # ifndef EUSERS # define EUSERS WSAEUSERS # endif # ifndef EWOULDBLOCK # define EWOULDBLOCK WSAEWOULDBLOCK # endif | < | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | # endif # ifndef EUSERS # define EUSERS WSAEUSERS # endif # ifndef EWOULDBLOCK # define EWOULDBLOCK WSAEWOULDBLOCK # endif #endif /*! * @class OFException OFException.h ObjFW/OFException.h * * @brief The base class for all exceptions in ObjFW * |
︙ | ︙ |
Modified src/exceptions/OFException.m from [254309bfd5] to [a4f5d8c32c].
︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | of_strerror(int errNo) { OFString *ret; #ifdef HAVE_STRERROR_R char buffer[256]; #endif #ifdef OF_WINDOWS /* * These were translated from WSAE* errors to errno and thus Win32's * strerror_r() does not know about them. * * FIXME: These could have better descriptions! */ | > > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | of_strerror(int errNo) { OFString *ret; #ifdef HAVE_STRERROR_R char buffer[256]; #endif if (errNo == 0) return @"Unknown error"; #ifdef OF_WINDOWS /* * These were translated from WSAE* errors to errno and thus Win32's * strerror_r() does not know about them. * * FIXME: These could have better descriptions! */ |
︙ | ︙ |
Modified src/exceptions/OFLinkFailedException.h from [27038c4511] to [dc4516a136].
︙ | ︙ | |||
46 47 48 49 50 51 52 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased link failed exception. * | < < < < < < < < < < < < < < < < < < < < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @param errNo The errno of the error that occurred * @return A new, autoreleased link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @param errNo The errno of the error that occurred * @return An initialized link failed exception |
︙ | ︙ |
Modified src/exceptions/OFLinkFailedException.m from [ced71e0c8a] to [c7dbe92309].
︙ | ︙ | |||
26 27 28 29 30 31 32 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath | < < < < < < < < < < < < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath destinationPath: destinationPath errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithSourcePath: (OFString *)sourcePath destinationPath: (OFString *)destinationPath errNo: (int)errNo { self = [super init]; @try { |
︙ | ︙ | |||
81 82 83 84 85 86 87 | [_destinationPath release]; [super dealloc]; } - (OFString *)description { | < | < < < < < | 66 67 68 69 70 71 72 73 74 75 76 | [_destinationPath release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to link file %@ to %@: %@", _sourcePath, _destinationPath, of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFOpenItemFailedException.h from [faec693cdb] to [b2b63457a8].
︙ | ︙ | |||
46 47 48 49 50 51 52 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased open item failed exception. * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | @property (readonly, nonatomic) int errNo; + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased open item failed exception. * * @param path A string with the path of the item tried to open * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return A new, autoreleased open item failed exception */ + (instancetype)exceptionWithPath: (OFString *)path mode: (nullable OFString *)mode errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated open item failed exception. * * @param path A string with the path of the item which could not be opened * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return An initialized open item failed exception |
︙ | ︙ |
Modified src/exceptions/OFOpenItemFailedException.m from [850e9c668c] to [649447f7ba].
︙ | ︙ | |||
23 24 25 26 27 28 29 | @synthesize path = _path, mode = _mode, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | @synthesize path = _path, mode = _mode, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path mode: (OFString *)mode errNo: (int)errNo { return [[[self alloc] initWithPath: path mode: mode errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithPath: (OFString *)path mode: (OFString *)mode errNo: (int)errNo { self = [super init]; @try { |
︙ | ︙ | |||
107 108 109 110 111 112 113 | [_mode release]; [super dealloc]; } - (OFString *)description { | | < < < < < < | < < < < < | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | [_mode release]; [super dealloc]; } - (OFString *)description { if (_mode != nil) return [OFString stringWithFormat: @"Failed to open item %@ with mode %@: %@", _path, _mode, of_strerror(_errNo)]; else return [OFString stringWithFormat: @"Failed to open item %@: %@", _path, of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFReadFailedException.m from [afe0beee73] to [07f395fcc4].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFReadFailedException.h" #import "OFString.h" @implementation OFReadFailedException - (OFString *)description { | < < < < < | 18 19 20 21 22 23 24 25 26 27 28 29 | #import "OFReadFailedException.h" #import "OFString.h" @implementation OFReadFailedException - (OFString *)description { return [OFString stringWithFormat: @"Failed to read %zu bytes from an object of type %@: %@", _requestedLength, [_object class], of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFReadOrWriteFailedException.h from [3fcd66685f] to [76630b46c4].
︙ | ︙ | |||
51 52 53 54 55 56 57 | /*! * @brief Creates a new, autoreleased read or write failed exception. * * @param object The object from which reading or to which writing failed * @param requestedLength The requested length of the data that could not be * read / written | < < < < < < < < < < < < < < < < < < < < < < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /*! * @brief Creates a new, autoreleased read or write failed exception. * * @param object The object from which reading or to which writing failed * @param requestedLength The requested length of the data that could not be * read / written * @param errNo The errno of the error that occurred * @return A new, autoreleased read or write failed exception */ + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated read or write failed exception. * * @param object The object from which reading or to which writing failed * @param requestedLength The requested length of the data that could not be * read / written * @param errNo The errno of the error that occurred |
︙ | ︙ |
Modified src/exceptions/OFReadOrWriteFailedException.m from [64f51c8ea5] to [91f716863e].
︙ | ︙ | |||
26 27 28 29 30 31 32 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength | < < < < < < < < < < < < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo { return [[[self alloc] initWithObject: object requestedLength: requestedLength errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo { self = [super init]; _object = [object retain]; |
︙ | ︙ | |||
75 76 77 78 79 80 81 | [_object release]; [super dealloc]; } - (OFString *)description { | < | | < < < < < | 60 61 62 63 64 65 66 67 68 69 70 71 72 | [_object release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to read or write %zu bytes from / to an object of type " @"%@: %@", _requestedLength, [_object class], of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFSeekFailedException.h from [a5d3e23d40] to [fec6187850].
︙ | ︙ | |||
56 57 58 59 60 61 62 | /*! * @brief Creates a new, autoreleased seek failed exception. * * @param stream The stream for which seeking failed * @param offset The offset to which seeking failed * @param whence To what the offset is relative | < < < < < < < < < < < < < < < < < < < < < < < < | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /*! * @brief Creates a new, autoreleased seek failed exception. * * @param stream The stream for which seeking failed * @param offset The offset to which seeking failed * @param whence To what the offset is relative * @param errNo The errno of the error that occurred * @return A new, autoreleased seek failed exception */ + (instancetype)exceptionWithStream: (OFSeekableStream *)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated seek failed exception. * * @param stream The stream for which seeking failed * @param offset The offset to which seeking failed * @param whence To what the offset is relative * @param errNo The errno of the error that occurred |
︙ | ︙ |
Modified src/exceptions/OFSeekFailedException.m from [001a049def] to [61374f4d60].
︙ | ︙ | |||
28 29 30 31 32 33 34 | { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithStream: (OFSeekableStream *)stream offset: (of_offset_t)offset whence: (int)whence | < < < < < < < < < < < < < < < < < < < | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithStream: (OFSeekableStream *)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo { return [[[self alloc] initWithStream: stream offset: offset whence: whence errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithStream: (OFSeekableStream *)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo { self = [super init]; |
︙ | ︙ | |||
84 85 86 87 88 89 90 | [_stream release]; [super dealloc]; } - (OFString *)description { | < < < < | 65 66 67 68 69 70 71 72 73 74 75 76 | [_stream release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Seeking failed in stream of type %@: %@", [_stream class], of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFStatItemFailedException.h from [a0a4efff1c] to [1a609b0774].
︙ | ︙ | |||
43 44 45 46 47 48 49 | + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased stat item failed exception. * * @param path A string with the path of the item whose status could not be * retrieved | < < < < < < < < < < < < < < < < < < | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | + (instancetype)exception OF_UNAVAILABLE; /*! * @brief Creates a new, autoreleased stat item failed exception. * * @param path A string with the path of the item whose status could not be * retrieved * @param errNo The errno of the error that occurred * @return A new, autoreleased stat item failed exception */ + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated stat item failed exception. * * @param path A string with the path of the item whose status could not be * retrieved * @param errNo The errno of the error that occurred * @return An initialized stat item failed exception */ - initWithPath: (OFString *)path errNo: (int)errNo OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/exceptions/OFStatItemFailedException.m from [947a3cd491] to [80e4300493].
︙ | ︙ | |||
23 24 25 26 27 28 29 | @synthesize path = _path, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } | < < < < < < < < < < < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | @synthesize path = _path, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithPath: (OFString *)path errNo: (int)errNo { self = [super init]; @try { _path = [path copy]; |
︙ | ︙ | |||
71 72 73 74 75 76 77 | [_path release]; [super dealloc]; } - (OFString *)description { | < < < < | 60 61 62 63 64 65 66 67 68 69 70 | [_path release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"Failed to stat item %@: %@", _path, of_strerror(_errNo)]; } @end |
Modified src/exceptions/OFWriteFailedException.m from [c720bc4acd] to [e7b34fe947].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFWriteFailedException.h" #import "OFString.h" @implementation OFWriteFailedException - (OFString *)description { | < < < < < | 18 19 20 21 22 23 24 25 26 27 28 29 | #import "OFWriteFailedException.h" #import "OFString.h" @implementation OFWriteFailedException - (OFString *)description { return [OFString stringWithFormat: @"Failed to write %zu bytes to an object of type %@: %@", _requestedLength, [_object class], of_strerror(_errNo)]; } @end |