mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 17:10:48 +00:00
Merge branch 'master' of github.com:gnustep/libs-base
This commit is contained in:
commit
23b5d08d18
2 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2021-07-02 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Source/Additions/Unicode.m:
|
||||
Fix possible heap corruption when converting to
|
||||
NSNonLossyASCIIStringEncoding.
|
||||
|
||||
2021-06-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/Port.h:
|
||||
|
|
|
@ -2242,12 +2242,22 @@ GSFromUnicode(unsigned char **dst, unsigned int *size, const unichar *src,
|
|||
}
|
||||
else
|
||||
{
|
||||
dpos += sprintf((char*)&ptr[dpos], "\\%03o", u);
|
||||
char octchars[] = "01234567";
|
||||
ptr[dpos++] = '\\';
|
||||
ptr[dpos++] = octchars[(u >> 6) & 7];
|
||||
ptr[dpos++] = octchars[(u >> 3) & 7];
|
||||
ptr[dpos++] = octchars[u & 7];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dpos += sprintf((char*)&ptr[dpos], "\\u%04x", u);
|
||||
char hexchars[] = "0123456789abcdef";
|
||||
ptr[dpos++] = '\\';
|
||||
ptr[dpos++] = 'u';
|
||||
ptr[dpos++] = hexchars[(u >> 12) & 0xF];
|
||||
ptr[dpos++] = hexchars[(u >> 8) & 0xF];
|
||||
ptr[dpos++] = hexchars[(u >> 4) & 0xF];
|
||||
ptr[dpos++] = hexchars[u & 0xF];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue