Differences From Artifact [d8b3a6972a]:
- File
src/OFUTF8String.m
— part of check-in
[aeb403a1ed]
at
2020-10-10 14:27:37
on branch trunk
— OFObject: Change type of -[hash] to unsigned long
The internal hash is still 32 bit in most places, but this way, it is at
least not baked into the API and ABI and can be upgraded later, should
that ever be necessary. (user: js, size: 28429) [annotate] [blame] [check-ins using]
To Artifact [e04f7e1202]:
- File
src/OFUTF8String.m
— part of check-in
[0f260e0fd5]
at
2020-11-06 02:37:02
on branch trunk
— OFString: Make freeWhenDone behave like in OFData
In particular, this means that if initialization fails, the buffer is
NOT free'd. While freeing it on error in convenient when not handling
the error, it makes handling the error and retrying impossible (e.g.
retrying with a different encoding). (user: js, size: 28345) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
400 401 402 403 404 405 406 | } - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String length: (size_t)UTF8StringLength freeWhenDone: (bool)freeWhenDone { | < | < < < < < < < < < < < > > > > > > | 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 427 428 429 430 431 432 433 434 435 436 437 438 | } - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String length: (size_t)UTF8StringLength freeWhenDone: (bool)freeWhenDone { self = [super init]; @try { _s = &_storage; if (UTF8StringLength >= 3 && memcmp(UTF8String, "\xEF\xBB\xBF", 3) == 0) { UTF8String += 3; UTF8StringLength -= 3; } switch (of_string_utf8_check(UTF8String, UTF8StringLength, &_s->length)) { case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->cString = (char *)UTF8String; _s->cStringLength = UTF8StringLength; if (freeWhenDone) _s->freeWhenDone = UTF8String; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |