Revert subtly broken change

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21391 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-07-01 17:31:07 +00:00
parent 9ac16024f5
commit 6d0751af3e
56 changed files with 333 additions and 444 deletions

View file

@ -410,8 +410,7 @@ setup(void)
unichar *u = 0;
unsigned l = 0;
if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc,
GSObjCZone(self), 0) == NO)
if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO)
{
return nil;
}
@ -445,8 +444,7 @@ setup(void)
unichar *u = 0;
unsigned l = 0;
if (GSToUnicode(&u, &l, (const unsigned char*)chars, length, defEnc,
GSObjCZone(self), 0) == NO)
if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO)
{
self = nil;
}
@ -694,7 +692,7 @@ UTF8String_c(GSStr self)
NSZoneFree(NSDefaultMallocZone(), u);
}
return (char*)r;
return r;
}
static inline char*
@ -717,7 +715,7 @@ UTF8String_u(GSStr self)
[NSException raise: NSCharacterConversionException
format: @"Can't get UTF8 from Unicode string."];
}
return (char*)r;
return r;
}
}
@ -753,7 +751,7 @@ boolValue_c(GSStr self)
memcpy(buf, self->_contents.c, len);
buf[len] = '\0';
return atoi((const char*)buf);
return atoi(buf);
}
}
}
@ -789,7 +787,7 @@ boolValue_u(GSStr self)
}
else
{
return atoi((const char*)buf);
return atoi(buf);
}
}
}
@ -985,7 +983,7 @@ cString_c(GSStr self, NSStringEncoding enc)
NSZoneFree(NSDefaultMallocZone(), u);
}
return (char*)r;
return r;
}
static inline char*
@ -1017,7 +1015,7 @@ cString_u(GSStr self, NSStringEncoding enc)
[NSException raise: NSCharacterConversionException
format: @"Can't get cString from Unicode string."];
}
return (char*)r;
return r;
}
}
@ -1397,7 +1395,7 @@ intValue_c(GSStr self)
memcpy(buf, self->_contents.c, len);
buf[len] = '\0';
return atol((const char*)buf);
return atol(buf);
}
}
@ -1415,7 +1413,7 @@ intValue_u(GSStr self)
unsigned char *b = buf;
GSFromUnicode(&b, &l, self->_contents.u, l, intEnc, 0, GSUniTerminate);
return atol((const char*)buf);
return atol(buf);
}
}
@ -1688,7 +1686,7 @@ static void GSStrMakeSpace(GSStr s, unsigned size)
static void GSStrWiden(GSStr s)
{
unichar *tmp = 0;
unsigned len = 0;
int len = 0;
NSCAssert(s->_flags.wide == 0, @"string is not wide");
@ -1949,7 +1947,7 @@ substring_c(GSStr self, NSRange aRange)
if (self->_flags.free == 1)
{
sub = NSAllocateObject(GSCSubStringClass, 0, NSDefaultMallocZone());
sub = [sub initWithCString: (char*)self->_contents.c + aRange.location
sub = [sub initWithCString: self->_contents.c + aRange.location
length: aRange.length
fromParent: (GSCString *)self];
}
@ -1957,7 +1955,7 @@ substring_c(GSStr self, NSRange aRange)
{
sub = NSAllocateObject(GSCInlineStringClass,
aRange.length, NSDefaultMallocZone());
sub = [sub initWithCString: (char*)self->_contents.c + aRange.location
sub = [sub initWithCString: self->_contents.c + aRange.location
length: aRange.length];
}
AUTORELEASE(sub);
@ -2281,7 +2279,7 @@ transmute(GSStr self, NSString *aString)
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0,
NSDefaultMallocZone());
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
@ -2290,7 +2288,7 @@ transmute(GSStr self, NSString *aString)
GSMutableString *obj;
obj = (GSMutableString*)NSAllocateObject(GSMutableStringClass, 0, z);
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
@ -2348,7 +2346,7 @@ agree, create a new GSCInlineString otherwise.
NSString *obj;
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z);
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
else
@ -2372,7 +2370,7 @@ agree, create a new GSCInlineString otherwise.
format: @"re-initialisation of string"];
}
_count = length;
_contents.c = (unsigned char*)chars;
_contents.c = chars;
_flags.wide = 0;
if (flag == YES)
{
@ -2444,7 +2442,7 @@ agree, create a new GSCInlineString otherwise.
NSString *obj;
obj = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z);
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
@ -2904,7 +2902,7 @@ agree, create a new GSUnicodeInlineString otherwise.
else
{
copy = (NSString*)NSAllocateObject(GSCInlineStringClass, _count, z);
copy = [copy initWithCString: (char*)_contents.c length: _count];
copy = [copy initWithCString: _contents.c length: _count];
}
return copy;
}
@ -3132,8 +3130,7 @@ agree, create a new GSUnicodeInlineString otherwise.
unichar *u = 0;
unsigned l = 0;
if (GSToUnicode(&u, &l, (unsigned char*)chars, length, defEnc,
GSObjCZone(self), 0) == NO)
if (GSToUnicode(&u, &l, chars, length, defEnc, GSObjCZone(self), 0) == NO)
{
DESTROY(self);
}
@ -3163,7 +3160,7 @@ agree, create a new GSUnicodeInlineString otherwise.
}
_count = length;
_capacity = length;
_contents.c = (unsigned char*)chars;
_contents.c = chars;
_flags.wide = 0;
return self;
@ -3273,7 +3270,7 @@ agree, create a new GSUnicodeInlineString otherwise.
if (_flags.wide == 1)
obj = [obj initWithCharacters: _contents.u length: _count];
else
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
@ -3286,7 +3283,7 @@ agree, create a new GSUnicodeInlineString otherwise.
if (_flags.wide == 1)
obj = [obj initWithCharacters: _contents.u length: _count];
else
obj = [obj initWithCString: (char*)_contents.c length: _count];
obj = [obj initWithCString: _contents.c length: _count];
return obj;
}
@ -3396,7 +3393,7 @@ agree, create a new GSUnicodeInlineString otherwise.
{
unsigned char tmp = _contents.c[aRange.location + length];
[aString getCString: (char*)&_contents.c[aRange.location]
[aString getCString: &_contents.c[aRange.location]
maxLength: length];
_contents.c[aRange.location + length] = tmp;
}
@ -3409,7 +3406,7 @@ agree, create a new GSUnicodeInlineString otherwise.
if (l > 0)
{
[aString getCString: (char*)&_contents.c[aRange.location]
[aString getCString: &_contents.c[aRange.location]
maxLength: l];
}
u = [aString characterAtIndex: l];
@ -3478,7 +3475,7 @@ agree, create a new GSUnicodeInlineString otherwise.
l = len - 1;
if (l > 0)
{
[aString getCString: (char*)_contents.c maxLength: l];
[aString getCString: _contents.c maxLength: l];
}
_contents.c[l]
= encode_unitochar([aString characterAtIndex: l], intEnc);
@ -3517,7 +3514,7 @@ agree, create a new GSUnicodeInlineString otherwise.
{
sub = (NSString*)NSAllocateObject(GSCInlineStringClass,
_count, NSDefaultMallocZone());
sub = [sub initWithCString: (char*)self->_contents.c + aRange.location
sub = [sub initWithCString: self->_contents.c + aRange.location
length: aRange.length];
}
AUTORELEASE(sub);
@ -3543,7 +3540,7 @@ agree, create a new GSUnicodeInlineString otherwise.
sub = (NSString*)NSAllocateObject(GSCInlineStringClass,
aRange.length,
NSDefaultMallocZone());
sub = [sub initWithCString: (char*)self->_contents.c + aRange.location
sub = [sub initWithCString: self->_contents.c + aRange.location
length: aRange.length];
}
AUTORELEASE(sub);
@ -4008,7 +4005,7 @@ agree, create a new GSUnicodeInlineString otherwise.
- (const char*) cString
{
return (char*)_self->_contents.c;
return _self->_contents.c;
}
- (id) retain
@ -4215,13 +4212,13 @@ agree, create a new GSUnicodeInlineString otherwise.
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
count: count
at: chars];
self = [self initWithCStringNoCopy: (char*)chars
self = [self initWithCStringNoCopy: chars
length: count
freeWhenDone: YES];
}
else
{
self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO];
self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
}
return self;
}
@ -4246,13 +4243,13 @@ agree, create a new GSUnicodeInlineString otherwise.
[aCoder decodeArrayOfObjCType: @encode(unsigned char)
count: count
at: chars];
self = [self initWithCStringNoCopy: (char*)chars
self = [self initWithCStringNoCopy: chars
length: count
freeWhenDone: YES];
}
else
{
self = [self initWithCStringNoCopy: (char*)0 length: 0 freeWhenDone: NO];
self = [self initWithCStringNoCopy: 0 length: 0 freeWhenDone: NO];
}
return self;
}