Remove use of deprecated functions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23260 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-08-12 15:09:23 +00:00
parent b553c9a361
commit a1076344b8

View file

@ -1150,16 +1150,20 @@ canBeConvertedToEncoding_u(GSStr self, NSStringEncoding enc)
static inline unichar static inline unichar
characterAtIndex_c(GSStr self, unsigned index) characterAtIndex_c(GSStr self, unsigned index)
{ {
unichar c; unichar u;
if (index >= self->_count) if (index >= self->_count)
[NSException raise: NSRangeException format: @"Invalid index."]; [NSException raise: NSRangeException format: @"Invalid index."];
c = self->_contents.c[index]; u = self->_contents.c[index];
if (c > 127) if (u > 127)
{ {
c = encode_chartouni(c, internalEncoding); unsigned char c = (unsigned char)u;
unsigned int s = 1;
unichar *d = &u;
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
} }
return c; return u;
} }
static inline unichar static inline unichar
@ -2431,13 +2435,17 @@ rangeOfCharacter_c(GSStr self, NSCharacterSet *aSet, unsigned mask,
for (i = start; i != stop; i += step) for (i = start; i != stop; i += step)
{ {
unichar letter = self->_contents.c[i]; unichar u = self->_contents.c[i];
if (letter > 127) if (u > 127)
{ {
letter = encode_chartouni(letter, internalEncoding); unsigned char c = (unsigned char)u;
unsigned int s = 1;
unichar *d = &u;
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
} }
if ((*mImp)(aSet, cMemberSel, letter)) if ((*mImp)(aSet, cMemberSel, u))
{ {
range = NSMakeRange(i, 1); range = NSMakeRange(i, 1);
break; break;
@ -4221,6 +4229,9 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
if (other == 0) if (other == 0)
{ {
unsigned l; unsigned l;
unsigned s = 1;
unichar u;
unsigned char *d;
/* /*
* Since getCString appends a '\0' terminator, we must ask for * Since getCString appends a '\0' terminator, we must ask for
@ -4234,8 +4245,9 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
maxLength: l+1 maxLength: l+1
encoding: internalEncoding]; encoding: internalEncoding];
} }
_contents.c[l] u = [aString characterAtIndex: l];
= encode_unitochar([aString characterAtIndex: l], internalEncoding); d = _contents.c + l;
GSFromUnicode(&d, &s, &u, 1, internalEncoding, 0, 0);
} }
else else
{ {
@ -4856,13 +4868,17 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
p = _self->_contents.c; p = _self->_contents.c;
while (char_count++ < len) while (char_count++ < len)
{ {
unichar c = *p++; unichar u = *p++;
if (c > 127) if (u > 127)
{ {
c = encode_chartouni(c, internalEncoding); unsigned char c = (unsigned char)u;
unsigned int s = 1;
unichar *d = &u;
GSToUnicode(&d, &s, &c, 1, internalEncoding, 0, 0);
} }
ret = (ret << 5) + ret + c; ret = (ret << 5) + ret + u;
} }
/* /*