Differences From Artifact [27bf821a65]:
- File src/OFString.m — part of check-in [94ea6848a8] at 2009-05-24 18:04:09 on branch trunk — Always use #include "config.h" instead of #import "config.h". (user: js, size: 7696) [annotate] [blame] [check-ins using]
To Artifact [aeeb03c826]:
- File
src/OFString.m
— part of check-in
[033054ad75]
at
2009-05-29 19:21:57
on branch trunk
— A few renames.
OFExceptions:
* OFNoMemException to OFOutOfMemoryException.
* OFMemNotPartOfObjException to OFMemoryNotPartOfObjectException.OFObject:
* -[addItemToMemoryPool:] to -[addMemoryToPool:].
* -[allocWithSize:] to -[allocMemoryWithSize:].
* -[allocNItems:withSize] to -[allocMemoryForNItems:withSize:].
* -[resizeMem:toSize] to -[resizeMemory:toSize:].
* -[resizeMem:toNItems:withSize:] to
-[resizeMemoryToNItems:withSize:].
* -[freeMem] to -[freeMemory:].OFString:
* -[urlencode] to -[urlEncodedString].
* -[urldecode] to -[urlDecodedString]. (user: js, size: 7706) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
161 162 163 164 165 166 167 | c = isa; [super dealloc]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | c = isa; [super dealloc]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { string = [self allocMemoryWithSize: length + 1]; } @catch (OFException *e) { /* * We can't use [super dealloc] on OS X here. * Compiler bug? Anyway, [self dealloc] will do here as * we don't reimplement dealloc. */ [self dealloc]; |
︙ | ︙ | |||
223 224 225 226 227 228 229 | free(string); c = isa; [super dealloc]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { | | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | free(string); c = isa; [super dealloc]; @throw [OFInvalidEncodingException newWithClass: c]; } @try { [self addMemoryToPool: string]; } @catch (OFException *e) { free(string); @throw e; } return self; } - initWithString: (OFString*)str { self = [super init]; string = strdup([str cString]); length = [str length]; @try { [self addMemoryToPool: string]; } @catch (OFException *e) { /* * We can't use [super dealloc] on OS X here. * Compiler bug? Anyway, [self dealloc] will do here as we * don't reimplement dealloc. */ free(string); |
︙ | ︙ | |||
391 392 393 394 395 396 397 | for (i = 0, last = 0; i <= length - delim_len; i++) { char *tmp; if (memcmp(string + i, delim, delim_len)) continue; /* | | | > | | | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | for (i = 0, last = 0; i <= length - delim_len; i++) { char *tmp; if (memcmp(string + i, delim, delim_len)) continue; /* * We can't use [self allocMemoryWithSize:] here as self might * be a @""-literal. */ if ((tmp = malloc(i - last + 1)) == NULL) @throw [OFOutOfMemoryException newWithClass: isa andSize: i - last + 1]; memcpy(tmp, string + last, i - last); tmp[i - last] = '\0'; @try { str = [OFString stringWithCString: tmp]; } @finally { free(tmp); } |
︙ | ︙ |