Fixes from previous string fix

This commit is contained in:
Airy ANDRE 2014-01-16 17:39:49 +01:00
parent dff52ad197
commit c0273cfb39
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ NSDate* NSDateFromPlistString(NSString* string)
NSLog(@"%@: failed to allocate buffer of size %d", NSStringFromSelector(_cmd), length);
return nil;
}
unichar *result = NSZoneMalloc(NULL, sizeof(uint8_t)*length);
uint8_t *result = NSZoneMalloc(NULL, sizeof(uint8_t)*length);
if (result == NULL) {
NSLog(@"%@: failed to allocate buffer of size %d", NSStringFromSelector(_cmd), length);
NSZoneFree(NULL, buffer);

View File

@ -858,16 +858,16 @@ static inline void reverseString(unichar *buf, NSUInteger len) {
U+000D (\r or CR), U+2028 (Unicode line separator), U+000A (\n or LF)
U+2029 (Unicode paragraph separator), \r\n, in that order (also known as CRLF)
*/
unichar prevChar = [self characterAtIndex:start];
unichar nextChar = start<length?[self characterAtIndex:start]:0;
for(;start!=0;start--) {
unichar check=[self characterAtIndex:start-1];
if(check==0x2028 || check==0x000A || check==0x2029)
break;
if(check==0x000D && prevChar!=0x000A)
if(check==0x000D && nextChar!=0x000A)
break;
prevChar = check;
nextChar = check;
}
for(;end<length && state!=done;end++){