A few more string fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13180 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-03-20 22:37:22 +00:00
parent 8275cd6629
commit e7affc80ba
4 changed files with 12 additions and 8 deletions

View file

@ -1264,8 +1264,8 @@ lossyCString_u(ivars self)
unsigned l = 0;
unsigned char *r = 0;
GSFromUnicode(&r, &l, self->_contents.u, self->_count, defEnc, 0,
GSUniTemporary|GSUniTerminate);
GSFromUnicode(&r, &l, self->_contents.u, self->_count, defEnc,
NSDefaultMallocZone(), GSUniTemporary|GSUniTerminate);
return (const char*)r;
}

View file

@ -1621,9 +1621,10 @@ tables:
GROW();
outbuf = (char*)&ptr[dpos];
outbytesleft = (bsize - old) * sizeof(unichar);
outbytesleft += (bsize - old) * sizeof(unichar);
}
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar);
if (rval == (size_t)-1)
{
if (errno == E2BIG)
@ -1632,7 +1633,7 @@ tables:
GROW();
outbuf = (char*)&ptr[dpos];
outbytesleft = (bsize - old) * sizeof(unichar);
outbytesleft += (bsize - old) * sizeof(unichar);
}
else
{
@ -1640,7 +1641,6 @@ tables:
break;
}
}
dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar);
}
// close the converter
iconv_close(cd);
@ -2141,9 +2141,10 @@ tables:
GROW();
outbuf = (char*)&ptr[dpos];
outbytesleft = (bsize - old);
outbytesleft += (bsize - old);
}
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
dpos = bsize - outbytesleft;
if (rval == (size_t)-1)
{
if (errno == E2BIG)
@ -2152,7 +2153,7 @@ tables:
GROW();
outbuf = (char*)&ptr[dpos];
outbytesleft = (bsize - old);
outbytesleft += (bsize - old);
}
else if (errno == EILSEQ)
{
@ -2179,7 +2180,6 @@ tables:
break;
}
}
dpos = bsize - outbytesleft;
}
// close the converter
iconv_close(cd);

View file

@ -11,6 +11,7 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSProcessInfo.h>
#include <Foundation/NSException.h>
#include <Foundation/NSUserDefaults.h>
#include <assert.h>
#include "server.h"

View file

@ -95,6 +95,9 @@ int main()
printf("%x,%x\n", [base characterAtIndex: i], [want characterAtIndex: i]);
printf("%u\n", [want isEqual: base]);
for (i = 0; i < 1000; i++)
[base appendString: want];
print_string(base);
}
[arp release];
exit(0);