Comment: | Rename of_malloc and of_calloc
The new names should be more accurate. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
627511b03299811c7f92ab775e1b361e |
User & Date: | js on 2020-11-14 12:23:55 |
Other Links: | manifest | tags |
2020-11-14
| ||
14:51 | runtime: Fix recursive call in Amiga linklib check-in: b14e3d5ba6 user: js tags: trunk | |
12:28 | Merge trunk into branch "amiga-library" check-in: a55863c2ed user: js tags: amiga-library | |
12:23 | Rename of_malloc and of_calloc check-in: 627511b032 user: js tags: trunk | |
2020-11-12
| ||
00:37 | Add a test for weak references check-in: 171461008d user: js tags: trunk | |
Modified src/OFArray.m from [6e7407d49b] to [5b6a2f3354].
︙ | |||
237 238 239 240 241 242 243 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | - + | for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } - (id const *)objects { size_t count = self.count; |
︙ | |||
379 380 381 382 383 384 385 | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | - + | range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) return [OFSubarray arrayWithArray: self range: range]; |
︙ | |||
854 855 856 857 858 859 860 | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | - + - + | } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block { OFArray *ret; size_t count = self.count; |
︙ |
Modified src/OFBytesValue.m from [54953a495e] to [bf70f130e6].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | objCType: (const char *)objCType { self = [super init]; @try { _size = of_sizeof_type_encoding(objCType); _objCType = objCType; |
︙ |
Modified src/OFConstantString.m from [4db8f4cb59] to [1a5c26a192].
︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - + | { @synchronized (self) { struct of_string_utf8_ivars *ivars; if ([self isMemberOfClass: [OFConstantUTF8String class]]) return; |
︙ |
Modified src/OFDNSResolver.m from [3373845de9] to [2df523d351].
︙ | |||
1134 1135 1136 1137 1138 1139 1140 | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | - + | [context->_TCPSocket release]; context->_TCPSocket = nil; context->_responseLength = 0; return nil; } if (context->_TCPBuffer == nil) |
︙ |
Modified src/OFData.m from [aa10f00100] to [7ddb882b03].
︙ | |||
129 130 131 132 133 134 135 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - + | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; |
︙ | |||
193 194 195 196 197 198 199 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | - + | attributesOfItemAtPath: path].fileSize; # if ULLONG_MAX > SIZE_MAX if (size > SIZE_MAX) @throw [OFOutOfRangeException exception]; # endif |
︙ | |||
245 246 247 248 249 250 251 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + | mode: @"r"]; _count = 0; _itemSize = 1; _freeWhenDone = true; pageSize = [OFSystemInfo pageSize]; |
︙ | |||
288 289 290 291 292 293 294 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | - + | const char *cString; if (count % 2 != 0) @throw [OFInvalidFormatException exception]; count /= 2; |
︙ |
Modified src/OFDate.m from [cf1b1da641] to [2f04475c25].
︙ | |||
775 776 777 778 779 780 781 | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | - + | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; |
︙ | |||
835 836 837 838 839 840 841 | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | - + | } @finally { [mutex unlock]; } # endif #endif pageSize = [OFSystemInfo pageSize]; |
︙ |
Modified src/OFFile.m from [edd10634f5] to [23492381a4].
︙ | |||
239 240 241 242 243 244 245 | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | - + | if (handle == -1) @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno]; #else |
︙ |
Modified src/OFFileManager.m from [50c6f8c9c9] to [97ff5cb871].
︙ | |||
661 662 663 664 665 666 667 | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | - + | } } else if ([type isEqual: of_file_type_regular]) { size_t pageSize = [OFSystemInfo pageSize]; OFStream *sourceStream = nil; OFStream *destinationStream = nil; char *buffer; |
︙ |
Modified src/OFHTTPClient.m from [72f7071464] to [5174ef54a9].
︙ | |||
511 512 513 514 515 516 517 | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | - + | } lineC = line.UTF8String; if ((tmp = strchr(lineC, ':')) == NULL) @throw [OFInvalidServerReplyException exception]; |
︙ |
Modified src/OFInflateStream.m from [b112db9229] to [95c86a8053].
︙ | |||
192 193 194 195 196 197 198 | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + | _bitIndex = 8; #ifdef OF_INFLATE64_STREAM_M _slidingWindowMask = 0xFFFF; #else _slidingWindowMask = 0x7FFF; #endif |
︙ | |||
376 377 378 379 380 381 382 | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | - + | if OF_UNLIKELY (!tryReadBits(self, &bits, 4)) return bytesWritten; CTX.codeLenCodesCount = bits; } if OF_LIKELY (CTX.lengths == NULL) |
︙ | |||
399 400 401 402 403 404 405 | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | - + | free(CTX.lengths); CTX.lengths = NULL; CTX.receivedCount = 0; CTX.value = 0xFF; } if OF_LIKELY (CTX.lengths == NULL) |
︙ |
Modified src/OFLHADecompressingStream.m from [548b68c743] to [9b1fbea443].
︙ | |||
106 107 108 109 110 111 112 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + | /* 0-7 address the bit, 8 means fetch next byte */ _bitIndex = 8; _distanceBits = distanceBits; _dictionaryBits = dictionaryBits; _slidingWindowMask = (1u << dictionaryBits) - 1; |
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + | if OF_UNLIKELY (bits == 0) { _state = STATE_CODE_LEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; |
︙ | |||
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + | _state = STATE_LITLEN_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; |
︙ | |||
344 345 346 347 348 349 350 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | - + | if OF_UNLIKELY (bits == 0) { _state = STATE_DIST_TREE_SINGLE; goto start; } _codesCount = bits; _codesReceived = 0; |
︙ |
Modified src/OFList.m from [17f16f253f] to [5f900e9ac3].
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + | [super dealloc]; } - (of_list_object_t *)appendObject: (id)object { of_list_object_t *listObject; |
︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + | return listObject; } - (of_list_object_t *)prependObject: (id)object { of_list_object_t *listObject; |
︙ | |||
139 140 141 142 143 144 145 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - + | } - (of_list_object_t *)insertObject: (id)object beforeListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; |
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - + | } - (of_list_object_t *)insertObject: (id)object afterListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; |
︙ | |||
297 298 299 300 301 302 303 | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + | listObject = NULL; previous = NULL; @try { for (of_list_object_t *iter = _firstListObject; iter != NULL; iter = iter->next) { |
︙ |
Modified src/OFMapTable.m from [bb1c57067e] to [6adf8ae2bb].
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + | if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; |
︙ | |||
321 322 323 324 325 326 327 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | - + | /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; |
︙ | |||
410 411 412 413 414 415 416 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | - + | for (i = 0; i < last && _buckets[i] != NULL && _buckets[i] != &deleted; i++); } if (i >= last) @throw [OFOutOfRangeException exception]; |
︙ |
Modified src/OFMapTableDictionary.m from [afa073ac3b] to [3854d30085].
︙ | |||
340 341 342 343 344 345 346 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - + | - (OFArray *)allKeys { OFArray *ret; id *keys; size_t count; count = _mapTable.count; |
︙ | |||
374 375 376 377 378 379 380 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - + | - (OFArray *)allObjects { OFArray *ret; id *objects; size_t count; count = _mapTable.count; |
︙ |
Modified src/OFMethodSignature.m from [67a687aa14] to [69e0a6b22a].
︙ | |||
593 594 595 596 597 598 599 | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | - + | @throw [OFInvalidArgumentException exception]; length = strlen(types); if (length == 0) @throw [OFInvalidFormatException exception]; |
︙ |
Modified src/OFMutableAdjacentArray.m from [73c0aec03a] to [40b1b9e5f0].
︙ | |||
239 240 241 242 243 244 245 | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | - + | size_t count = _array.count; id *copy; if (range.length > SIZE_MAX - range.location || range.location >= count || range.length > count - range.location) @throw [OFOutOfRangeException exception]; |
︙ |
Modified src/OFMutableData.m from [8aa04f6052] to [c52dab0d6d].
︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - + | { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; |
︙ |
Modified src/OFMutableSet.m from [247e02065c] to [4037992100].
︙ | |||
168 169 170 171 172 173 174 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - + | - (void)intersectSet: (OFSet *)set { void *pool = objc_autoreleasePoolPush(); size_t count = self.count; id *cArray; |
︙ |
Modified src/OFMutableUTF8String.m from [e2512a1c1d] to [32655d5053].
︙ | |||
97 98 99 100 101 102 103 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | - + | _s->cString[i] = t; } return; } unicodeLen = self.length; |
︙ | |||
151 152 153 154 155 156 157 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + | @throw [OFInvalidEncodingException exception]; } i += cLen; } @try { |
︙ | |||
371 372 373 374 375 376 377 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | - + | } else _s->isUTF8 = true; } - (void)appendCharacters: (const of_unichar_t *)characters length: (size_t)length { |
︙ |
Modified src/OFObject+KeyValueCoding.m from [060fc086b7] to [8a9fc8e1ab].
︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + | char *name; if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); return [self valueForUndefinedKey: key]; } |
︙ | |||
158 159 160 161 162 163 164 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + | if ((keyLength = key.UTF8StringLength) < 1) { objc_autoreleasePoolPop(pool); [self setValue: value forUndefinedKey: key]; return; } |
︙ |
Modified src/OFObject.h from [3aacd2e524] to [ec746b369b].
︙ | |||
1235 1236 1237 1238 1239 1240 1241 | 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | - + + - + - - + + - + - + | @end #endif #ifdef __cplusplus extern "C" { #endif /** |
︙ |
Modified src/OFObject.m from [e2e795413b] to [dfafb38c1f].
︙ | |||
95 96 97 98 99 100 101 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + - + | static struct { Class isa; } allocFailedException; uint32_t of_hash_seed; void * |
︙ |
Modified src/OFOptionsParser.m from [93ab00cf42] to [a5d08e3dd3].
︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + | *iter->isSpecifiedPtr = false; if (iter->argumentPtr) *iter->argumentPtr = nil; count++; } |
︙ |
Modified src/OFPollKernelEventObserver.m from [4cf3bcee3f] to [f6b8ae522e].
︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | struct pollfd p = { _cancelFD[0], POLLIN, 0 }; _FDs = [[OFMutableData alloc] initWithItemSize: sizeof(struct pollfd)]; [_FDs addItem: &p]; _maxFD = _cancelFD[0]; |
︙ |
Modified src/OFSecureData.m from [8a522b1fcf] to [960649af1d].
︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - + - + | # endif } return page; } } |
︙ | |||
290 291 292 293 294 295 296 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + | size_t numPreallocatedPages; # endif size_t i; if (preallocatedPages != NULL) @throw [OFInvalidArgumentException exception]; |
︙ | |||
411 412 413 414 415 416 417 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | - + | size_t pageSize = [OFSystemInfo pageSize]; #endif if (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; if (allowsSwappableMemory) { |
︙ |
Modified src/OFStream.m from [b13d6173e0] to [c6022abcb0].
︙ | |||
147 148 149 150 151 152 153 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - + | bytesRead = [self lowlevelReadIntoBuffer: tmp length: MIN_READ_SIZE]; if (bytesRead > length) { memcpy(buffer, tmp, length); |
︙ | |||
639 640 641 642 643 644 645 | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | - + - + | { OFData *ret; char *buffer; if OF_UNLIKELY (count > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exception]; |
︙ | |||
690 691 692 693 694 695 696 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | - + | encoding: OF_STRING_ENCODING_UTF_8]; } - (OFString *)readStringWithLength: (size_t)length encoding: (of_string_encoding_t)encoding { OFString *ret; |
︙ | |||
737 738 739 740 741 742 743 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | - + | return ret; } } } /* Read and see if we got a newline or \0 */ pageSize = [OFSystemInfo pageSize]; |
︙ | |||
773 774 775 776 777 778 779 | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | - + | length: pageSize]; /* Look if there's a newline or \0 */ for (size_t i = 0; i < bufferLength; i++) { if OF_UNLIKELY (buffer[i] == '\n' || buffer[i] == '\0') { size_t retLength = _readBufferLength + i; |
︙ | |||
796 797 798 799 800 801 802 | 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | - + | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ |
︙ | |||
818 819 820 821 822 823 824 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | - + - + | } @throw e; } @finally { free(retCString); } |
︙ | |||
975 976 977 978 979 980 981 | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | - + | return ret; } } } /* Read and see if we got a delimiter or \0 */ pageSize = [OFSystemInfo pageSize]; |
︙ | |||
1013 1014 1015 1016 1017 1018 1019 | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | - + | char *retCString; if (buffer[i] == '\0') delimiterLength = 1; retLength = _readBufferLength + i + 1 - delimiterLength; |
︙ | |||
1037 1038 1039 1040 1041 1042 1043 | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | - + | length: retLength]; } @catch (id e) { if (bufferLength > 0) { /* * Append data to _readBuffer * to prevent loss of data. */ |
︙ | |||
1059 1060 1061 1062 1063 1064 1065 | 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | - + - + | } @throw e; } @finally { free(retCString); } |
︙ | |||
1332 1333 1334 1335 1336 1337 1338 | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | - + | size = count * sizeof(uint16_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1362 1363 1364 1365 1366 1367 1368 | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | - + | size = count * sizeof(uint32_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1392 1393 1394 1395 1396 1397 1398 | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | - + | size = count * sizeof(uint64_t); #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1422 1423 1424 1425 1426 1427 1428 | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 | - + | size = count * sizeof(float); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1452 1453 1454 1455 1456 1457 1458 | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | - + | size = count * sizeof(double); #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1522 1523 1524 1525 1526 1527 1528 | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | - + | size = count * sizeof(uint16_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1552 1553 1554 1555 1556 1557 1558 | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | - + | size = count * sizeof(uint32_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1582 1583 1584 1585 1586 1587 1588 | 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | - + | size = count * sizeof(uint64_t); #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1612 1613 1614 1615 1616 1617 1618 | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | - + | size = count * sizeof(float); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1642 1643 1644 1645 1646 1647 1648 | 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | - + | size = count * sizeof(double); #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else |
︙ | |||
1715 1716 1717 1718 1719 1720 1721 | 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | - + | - (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; |
︙ | |||
1870 1871 1872 1873 1874 1875 1876 | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | - + | length: (size_t)length { char *readBuffer; if (length > SIZE_MAX - _readBufferLength) @throw [OFOutOfRangeException exception]; |
︙ |
Modified src/OFString+JSONParsing.m from [c0346b7fe9] to [57caefd874].
︙ | |||
144 145 146 147 148 149 150 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + | char *buffer; size_t i = 0; char delimiter = **pointer; if (++(*pointer) + 1 >= stop) return nil; |
︙ | |||
290 291 292 293 294 295 296 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + | static inline OFString * parseIdentifier(const char **pointer, const char *stop) { char *buffer; size_t i = 0; |
︙ |
Modified src/OFString+URLEncoding.m from [329955234f] to [387a1fe7bd].
︙ | |||
85 86 87 88 89 90 91 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + | const char *string = self.UTF8String; size_t length = self.UTF8StringLength; char *retCString; char byte = 0; int state = 0; size_t i = 0; |
︙ |
Modified src/OFString+XMLEscaping.m from [e1df224af8] to [9d2e4926e1].
︙ | |||
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + | OFString *ret; string = self.UTF8String; length = self.UTF8StringLength; j = 0; retLength = length; |
︙ |
Modified src/OFString.m from [3f36b9543e] to [8c96d0cf6e].
︙ | |||
1017 1018 1019 1020 1021 1022 1023 | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | - + | /* * We need one extra byte for the terminating zero if we want * to use -[initWithUTF8StringNoCopy:length:freeWhenDone:]. */ if (SIZE_MAX - (size_t)fileSize < 1) @throw [OFOutOfRangeException exception]; |
︙ | |||
1378 1379 1380 1381 1382 1383 1384 | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | - + | { size_t length = self.length; char *cString; size_t cStringLength; switch (encoding) { case OF_STRING_ENCODING_UTF_8: |
︙ | |||
1411 1412 1413 1414 1415 1416 1417 | 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | - + | case OF_STRING_ENCODING_WINDOWS_1252: case OF_STRING_ENCODING_CODEPAGE_437: case OF_STRING_ENCODING_CODEPAGE_850: case OF_STRING_ENCODING_CODEPAGE_858: case OF_STRING_ENCODING_MAC_ROMAN: case OF_STRING_ENCODING_KOI8_R: case OF_STRING_ENCODING_KOI8_U: |
︙ | |||
1865 1866 1867 1868 1869 1870 1871 | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | - + | if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; |
︙ | |||
1933 1934 1935 1936 1937 1938 1939 | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | - + | if (range.length == 0) return OF_NOT_FOUND; if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; |
︙ | |||
2176 2177 2178 2179 2180 2181 2182 | 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | - + | of_unichar_t *tmp; size_t prefixLength; bool hasPrefix; if ((prefixLength = prefix.length) > self.length) return false; |
︙ | |||
2206 2207 2208 2209 2210 2211 2212 | 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 | - + | bool hasSuffix; if ((suffixLength = suffix.length) > self.length) return false; length = self.length; |
︙ | |||
2499 2500 2501 2502 2503 2504 2505 | 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 | - + | } - (const of_unichar_t *)characters { size_t length = self.length; of_unichar_t *buffer; |
︙ | |||
2529 2530 2531 2532 2533 2534 2535 | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 | - + | const of_unichar_t *characters = self.characters; size_t length = self.length; of_char16_t *buffer; size_t j; bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); /* Allocate memory for the worst case */ |
︙ | |||
2601 2602 2603 2604 2605 2606 2607 | 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 | - + | } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { size_t length = self.length; of_char32_t *buffer; |
︙ |
Modified src/OFUTF8String.m from [4cdd46e0d2] to [4b2268ed9f].
︙ | |||
177 178 179 180 181 182 183 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + | - (instancetype)init { self = [super init]; @try { _s = &_storage; |
︙ | |||
243 244 245 246 247 248 249 | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | - + | memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; |
︙ | |||
448 449 450 451 452 453 454 | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | - + - + | [string isKindOfClass: [OFMutableUTF8String class]]) _s->isUTF8 = ((OFUTF8String *)string)->_s->isUTF8; else _s->isUTF8 = true; _s->length = string.length; |
︙ | |||
525 526 527 528 529 530 531 | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | - + | string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; |
︙ | |||
610 611 612 613 614 615 616 | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | - + | characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; |
︙ | |||
685 686 687 688 689 690 691 | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - + | case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } |
︙ | |||
1151 1152 1153 1154 1155 1156 1157 | 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | - + | objc_autoreleasePoolPop(pool); return array; } - (const of_unichar_t *)characters { |
︙ | |||
1178 1179 1180 1181 1182 1183 1184 | 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | - + | count: _s->length itemSize: sizeof(of_unichar_t) freeWhenDone: true] items]; } - (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder { |
︙ |
Modified src/OFValue.m from [3be7f2e37d] to [fcc7bff050].
︙ | |||
179 180 181 182 183 184 185 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - + - + | objCType = self.objCType; if (strcmp([object objCType], objCType) != 0) return false; size = of_sizeof_type_encoding(objCType); |
︙ | |||
208 209 210 211 212 213 214 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - + | - (unsigned long)hash { size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; uint32_t hash; |
︙ | |||
309 310 311 312 313 314 315 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - + | - (OFString *)description { OFMutableString *ret = [OFMutableString stringWithString: @"<OFValue: "]; size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; |
︙ |
Modified src/OFWin32ConsoleStdIOStream.m from [7dd85d6178] to [01349f1730].
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | - + | char *buffer = buffer_; of_char16_t *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; |
︙ | |||
360 361 362 363 364 365 366 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | - + | bytesWritten: bytesWritten * 2 errNo: 0]; _incompleteUTF8SurrogateLen = 0; i += toCopy; } |
︙ |
Modified src/OFXMLComment.m from [2577a47d50] to [ed66bc6cfa].
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | - + | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { |
︙ |
Modified src/OFXMLElement.m from [d12879cd95] to [c47060e7f9].
︙ | |||
458 459 460 461 462 463 464 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | - + | else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; else defaultNS = _defaultNamespace; i = 0; length = _name.UTF8StringLength + 3 + (level * indentation); |
︙ |
Modified src/OFXMLParser.m from [8b036ac867] to [0dd447c3c4].
︙ | |||
274 275 276 277 278 279 280 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | - + | [self parseBuffer: string.UTF8String length: string.UTF8StringLength]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; |
︙ |
Modified src/OFXMLProcessingInstructions.m from [5705c589f5] to [3f7941e3fa].
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { OFString *ret; if (indentation > 0 && level > 0) { |
︙ |
Modified src/huffman_tree.m from [f65a681bbc] to [f9e711d791].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - + | #import "OFOutOfMemoryException.h" static struct of_huffman_tree * newTree(void) { struct of_huffman_tree *tree; |
︙ |
Modified src/platform/posix/OFProcess.m from [39ae31952e] to [e683854d10].
︙ | |||
238 239 240 241 242 243 244 | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | - + | forProgramName: (OFString *)programName andArguments: (OFArray *)arguments { OFString *const *objects = arguments.objects; size_t i, count = arguments.count; of_string_encoding_t encoding; |
︙ | |||
263 264 265 266 267 268 269 | 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 | - + - + | if (environment == nil) return NULL; encoding = [OFLocale encoding]; count = environment.count; |
︙ |
Modified src/platform/windows/OFProcess.m from [1de0e5d870] to [b53baca85e].
︙ | |||
191 192 193 194 195 196 197 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + + | si.cb = sizeof(si); si.hStdInput = _writePipe[0]; si.hStdOutput = _readPipe[1]; si.hStdError = GetStdHandle(STD_ERROR_HANDLE); si.dwFlags |= STARTF_USESTDHANDLES; length = argumentsString.UTF16StringLength; |
︙ |
Modified tests/OFDataTests.m from [b5f79a4b6c] to [2bd92fc7fc].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - + + | OFData *immutable; void *raw[2]; of_range_t range; TEST(@"+[dataWithItemSize:]", (mutable = [OFMutableData dataWithItemSize: 4096])) |
︙ |
Modified tests/OFStreamTests.m from [5c572f840c] to [7eb72ee0e3].
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - + | { void *pool = objc_autoreleasePoolPush(); size_t pageSize = [OFSystemInfo pageSize]; StreamTester *t = [[[StreamTester alloc] init] autorelease]; OFString *str; char *cstr; |
Modified utils/ofhttp/OFHTTP.m from [121d87bdd5] to [0d0e8ff125].
︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | - + | _clientHeaders = [[OFMutableDictionary alloc] initWithObject: @"OFHTTP" forKey: @"User-Agent"]; _HTTPClient = [[OFHTTPClient alloc] init]; _HTTPClient.delegate = self; |
︙ |