Differences From Artifact [4986f53819]:
- File src/OFString+XMLEscaping.m — part of check-in [e6fd39d11e] at 2011-09-12 19:57:39 on branch trunk — Rename -[cString] to -[UTF8String]. (user: js, size: 2349) [annotate] [blame] [check-ins using]
To Artifact [4bad4e66f4]:
- File
src/OFString+XMLEscaping.m
— part of check-in
[e1e7ffa903]
at
2011-09-22 23:25:42
on branch trunk
— Exceptions are now autoreleased.
This is safe as an "exception loop" can't happen, since if allocating
an exception fails, it throws an OFAllocFailedException which is
preallocated and can always be thrown.So, the worst case would be that an autorelease of an exception fails,
triggering an OFOutOfMemoryException for which there is no memory,
resulting in an OFAllocFailedException to be thrown. (user: js, size: 2359) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
41 42 43 44 45 46 47 | j = 0; retLength = length; /* * We can't use allocMemoryWithSize: here as it might be a @"" literal */ if ((retCString = malloc(retLength)) == NULL) | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | j = 0; retLength = length; /* * We can't use allocMemoryWithSize: here as it might be a @"" literal */ if ((retCString = malloc(retLength)) == NULL) @throw [OFOutOfMemoryException exceptionWithClass: isa requestedSize: retLength]; for (i = 0; i < length; i++) { switch (string[i]) { case '<': append = "<"; appendLen = 4; break; |
︙ | ︙ | |||
82 83 84 85 86 87 88 | if (append != NULL) { char *newRetCString; if ((newRetCString = realloc(retCString, retLength + appendLen)) == NULL) { free(retCString); @throw [OFOutOfMemoryException | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | if (append != NULL) { char *newRetCString; if ((newRetCString = realloc(retCString, retLength + appendLen)) == NULL) { free(retCString); @throw [OFOutOfMemoryException exceptionWithClass: isa requestedSize: retLength + appendLen]; } retCString = newRetCString; retLength += appendLen - 1; memcpy(retCString + j, append, appendLen); j += appendLen; } else |
︙ | ︙ |