mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-13 17:40:54 +00:00
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:
parent
c3167184cb
commit
663bef37e7
4 changed files with 12 additions and 8 deletions
|
@ -1264,8 +1264,8 @@ lossyCString_u(ivars self)
|
||||||
unsigned l = 0;
|
unsigned l = 0;
|
||||||
unsigned char *r = 0;
|
unsigned char *r = 0;
|
||||||
|
|
||||||
GSFromUnicode(&r, &l, self->_contents.u, self->_count, defEnc, 0,
|
GSFromUnicode(&r, &l, self->_contents.u, self->_count, defEnc,
|
||||||
GSUniTemporary|GSUniTerminate);
|
NSDefaultMallocZone(), GSUniTemporary|GSUniTerminate);
|
||||||
return (const char*)r;
|
return (const char*)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1621,9 +1621,10 @@ tables:
|
||||||
|
|
||||||
GROW();
|
GROW();
|
||||||
outbuf = (char*)&ptr[dpos];
|
outbuf = (char*)&ptr[dpos];
|
||||||
outbytesleft = (bsize - old) * sizeof(unichar);
|
outbytesleft += (bsize - old) * sizeof(unichar);
|
||||||
}
|
}
|
||||||
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
|
dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar);
|
||||||
if (rval == (size_t)-1)
|
if (rval == (size_t)-1)
|
||||||
{
|
{
|
||||||
if (errno == E2BIG)
|
if (errno == E2BIG)
|
||||||
|
@ -1632,7 +1633,7 @@ tables:
|
||||||
|
|
||||||
GROW();
|
GROW();
|
||||||
outbuf = (char*)&ptr[dpos];
|
outbuf = (char*)&ptr[dpos];
|
||||||
outbytesleft = (bsize - old) * sizeof(unichar);
|
outbytesleft += (bsize - old) * sizeof(unichar);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1640,7 +1641,6 @@ tables:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dpos = (bsize * sizeof(unichar) - outbytesleft) / sizeof(unichar);
|
|
||||||
}
|
}
|
||||||
// close the converter
|
// close the converter
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
|
@ -2141,9 +2141,10 @@ tables:
|
||||||
|
|
||||||
GROW();
|
GROW();
|
||||||
outbuf = (char*)&ptr[dpos];
|
outbuf = (char*)&ptr[dpos];
|
||||||
outbytesleft = (bsize - old);
|
outbytesleft += (bsize - old);
|
||||||
}
|
}
|
||||||
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
rval = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
|
dpos = bsize - outbytesleft;
|
||||||
if (rval == (size_t)-1)
|
if (rval == (size_t)-1)
|
||||||
{
|
{
|
||||||
if (errno == E2BIG)
|
if (errno == E2BIG)
|
||||||
|
@ -2152,7 +2153,7 @@ tables:
|
||||||
|
|
||||||
GROW();
|
GROW();
|
||||||
outbuf = (char*)&ptr[dpos];
|
outbuf = (char*)&ptr[dpos];
|
||||||
outbytesleft = (bsize - old);
|
outbytesleft += (bsize - old);
|
||||||
}
|
}
|
||||||
else if (errno == EILSEQ)
|
else if (errno == EILSEQ)
|
||||||
{
|
{
|
||||||
|
@ -2179,7 +2180,6 @@ tables:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dpos = bsize - outbytesleft;
|
|
||||||
}
|
}
|
||||||
// close the converter
|
// close the converter
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <Foundation/NSProcessInfo.h>
|
#include <Foundation/NSProcessInfo.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
|
#include <Foundation/NSUserDefaults.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,9 @@ int main()
|
||||||
printf("%x,%x\n", [base characterAtIndex: i], [want characterAtIndex: i]);
|
printf("%x,%x\n", [base characterAtIndex: i], [want characterAtIndex: i]);
|
||||||
|
|
||||||
printf("%u\n", [want isEqual: base]);
|
printf("%u\n", [want isEqual: base]);
|
||||||
|
for (i = 0; i < 1000; i++)
|
||||||
|
[base appendString: want];
|
||||||
|
print_string(base);
|
||||||
}
|
}
|
||||||
[arp release];
|
[arp release];
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
Loading…
Reference in a new issue