mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
fix initialisation bug
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33982 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fcd8fefb9a
commit
9f68d90c98
2 changed files with 11 additions and 19 deletions
|
@ -1,6 +1,8 @@
|
|||
2011-10-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSString.m: Implement -hash for literal UTF-8 performance.
|
||||
* Source/NSScanner.m: Fix initialisation bug which could cause
|
||||
scanning to fail on some strings.
|
||||
|
||||
2011-10-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -201,35 +201,20 @@ typedef GSString *ivars;
|
|||
}
|
||||
|
||||
c = object_getClass(aString);
|
||||
if (GSObjCIsKindOf(c, GSMutableStringClass) == YES)
|
||||
{
|
||||
_string = [_holder initWithString: aString];
|
||||
}
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if (GSObjCIsKindOf(c, GSCStringClass) == YES)
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = RETAIN(aString);
|
||||
}
|
||||
else if (GSObjCIsKindOf(c, GSMutableStringClass) == YES)
|
||||
{
|
||||
if (((ivars)aString)->_flags.wide == 1)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [_holder initWithCharacters: ((ivars)aString)->_contents.u
|
||||
length: ((ivars)aString)->_count];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isUnicode = NO;
|
||||
_string = [_holder initWithBytes: ((ivars)aString)->_contents.c
|
||||
length: ((ivars)aString)->_count
|
||||
encoding: internalEncoding];
|
||||
}
|
||||
}
|
||||
else if ([aString isKindOfClass: NSStringClass])
|
||||
{
|
||||
_isUnicode = YES;
|
||||
_string = [_holder initWithString: aString];
|
||||
}
|
||||
else
|
||||
|
@ -238,6 +223,11 @@ typedef GSString *ivars;
|
|||
NSLog(@"Scanner initialised with something not a string");
|
||||
return nil;
|
||||
}
|
||||
c = object_getClass(_string);
|
||||
if (GSObjCIsKindOf(c, GSUnicodeStringClass) == YES)
|
||||
{
|
||||
_isUnicode = YES;
|
||||
}
|
||||
[self setCharactersToBeSkipped: defaultSkipSet];
|
||||
_decimal = '.';
|
||||
return self;
|
||||
|
|
Loading…
Reference in a new issue