Overview
Comment: | OFString+*.m: Add a few missing autorelease pools
Those were only a problem if the user created its own OFString subclass, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b5c8b625337ba127938395d18b4ff350 |
User & Date: | js on 2014-07-06 11:04:57 |
Other Links: | manifest | tags |
Context
2014-07-07
| ||
00:50 | OFURL: Don't include the leading "/" in path check-in: d2487bc7e1 user: js tags: trunk | |
2014-07-06
| ||
11:04 | OFString+*.m: Add a few missing autorelease pools check-in: b5c8b62533 user: js tags: trunk | |
11:04 | OFString+URLEncoding.m: Better RFC 1738 compliance check-in: 2ca121fd19 user: js tags: trunk | |
Changes
Modified src/OFString+JSONValue.m from [f9c7af6229] to [2d16a6d32f].
︙ | ︙ | |||
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - (id)JSONValue { return [self JSONValueWithDepthLimit: 32]; } - (id)JSONValueWithDepthLimit: (size_t)depthLimit { const char *pointer = [self UTF8String]; const char *stop = pointer + [self UTF8StringLength]; id object; size_t line = 1; object = nextObject(&pointer, stop, &line, 0, depthLimit); skipWhitespacesAndComments(&pointer, stop, &line); if (pointer < stop || object == nil) @throw [OFInvalidJSONException exceptionWithString: self line: line]; | > | | > > > > | 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 675 676 | - (id)JSONValue { return [self JSONValueWithDepthLimit: 32]; } - (id)JSONValueWithDepthLimit: (size_t)depthLimit { void *pool = objc_autoreleasePoolPush(); const char *pointer = [self UTF8String]; const char *stop = pointer + [self UTF8StringLength]; id object; size_t line = 1; object = nextObject(&pointer, stop, &line, 0, depthLimit); skipWhitespacesAndComments(&pointer, stop, &line); if (pointer < stop || object == nil) @throw [OFInvalidJSONException exceptionWithString: self line: line]; [object retain]; objc_autoreleasePoolPop(pool); return [object autorelease]; } @end |
Modified src/OFString+URLEncoding.m from [3a4097c573] to [89405889ad].
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* Reference for static linking */ int _OFString_URLEncoding_reference; @implementation OFString (URLEncoding) - (OFString*)stringByURLEncoding { const char *string = [self UTF8String]; char *retCString; size_t i; OFString *ret; /* * Worst case: 3 times longer than before. | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | /* Reference for static linking */ int _OFString_URLEncoding_reference; @implementation OFString (URLEncoding) - (OFString*)stringByURLEncoding { void *pool = objc_autoreleasePoolPush(); const char *string = [self UTF8String]; char *retCString; size_t i; OFString *ret; /* * Worst case: 3 times longer than before. |
︙ | ︙ | |||
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 | retCString[i++] = (high > 9 ? high - 10 + 'A' : high + '0'); retCString[i++] = (low > 9 ? low - 10 + 'A' : low + '0'); } } @try { ret = [OFString stringWithUTF8String: retCString length: i]; } @finally { free(retCString); } return ret; } - (OFString*)stringByURLDecoding { OFString *ret; const char *string = [self UTF8String]; char *retCString; char byte = 0; int state = 0; size_t i; | > > > | 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 | retCString[i++] = (high > 9 ? high - 10 + 'A' : high + '0'); retCString[i++] = (low > 9 ? low - 10 + 'A' : low + '0'); } } objc_autoreleasePoolPop(pool); @try { ret = [OFString stringWithUTF8String: retCString length: i]; } @finally { free(retCString); } return ret; } - (OFString*)stringByURLDecoding { void *pool = objc_autoreleasePoolPush(); OFString *ret; const char *string = [self UTF8String]; char *retCString; char byte = 0; int state = 0; size_t i; |
︙ | ︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | byte = 0; } break; } } retCString[i] = '\0'; if (state != 0) { free(retCString); @throw [OFInvalidFormatException exception]; } @try { | > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | byte = 0; } break; } } retCString[i] = '\0'; objc_autoreleasePoolPop(pool); if (state != 0) { free(retCString); @throw [OFInvalidFormatException exception]; } @try { |
︙ | ︙ |
Modified src/OFString+XMLEscaping.m from [e80aafd4d3] to [fb650f788f].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #import "OFOutOfMemoryException.h" int _OFString_XMLEscaping_reference; @implementation OFString (XMLEscaping) - (OFString*)stringByXMLEscaping { char *retCString; const char *string, *append; size_t length, retLength, appendLen; size_t i, j; OFString *ret; string = [self UTF8String]; | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #import "OFOutOfMemoryException.h" int _OFString_XMLEscaping_reference; @implementation OFString (XMLEscaping) - (OFString*)stringByXMLEscaping { void *pool = objc_autoreleasePoolPush(); char *retCString; const char *string, *append; size_t length, retLength, appendLen; size_t i, j; OFString *ret; string = [self UTF8String]; |
︙ | ︙ | |||
93 94 95 96 97 98 99 | retLength += appendLen - 1; memcpy(retCString + j, append, appendLen); j += appendLen; } else retCString[j++] = string[i]; } | < > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | retLength += appendLen - 1; memcpy(retCString + j, append, appendLen); j += appendLen; } else retCString[j++] = string[i]; } assert(j == retLength); objc_autoreleasePoolPop(pool); @try { ret = [OFString stringWithUTF8String: retCString length: retLength]; } @finally { free(retCString); } return ret; } @end |
Modified src/OFString+XMLUnescaping.m from [196faf3bb5] to [966d2aeae2].
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 | length: i]; } static OFString* parseEntities(OFString *self, id (*lookup)(void*, OFString*, OFString*), void *context) { const char *string; size_t i, last, length; bool inEntity; | > > > | > > < < | 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 | length: i]; } static OFString* parseEntities(OFString *self, id (*lookup)(void*, OFString*, OFString*), void *context) { OFMutableString *ret; void *pool; const char *string; size_t i, last, length; bool inEntity; ret = [OFMutableString string]; pool = objc_autoreleasePoolPush(); string = [self UTF8String]; length = [self UTF8StringLength]; last = 0; inEntity = false; for (i = 0; i < length; i++) { if (!inEntity && string[i] == '&') { [ret appendUTF8String: string + last length: i - last]; |
︙ | ︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | if (inEntity) @throw [OFInvalidFormatException exception]; [ret appendUTF8String: string + last length: i - last]; [ret makeImmutable]; return ret; } static id lookupUsingDelegate(void *context, OFString *self, OFString *entity) { | > > | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | if (inEntity) @throw [OFInvalidFormatException exception]; [ret appendUTF8String: string + last length: i - last]; [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; } static id lookupUsingDelegate(void *context, OFString *self, OFString *entity) { |
︙ | ︙ |