projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use inline syscalls for powerpc (32-bit)
[musl]
/
src
/
locale
/
iconv.c
diff --git
a/src/locale/iconv.c
b/src/locale/iconv.c
index
3a34395
..
3047c27
100644
(file)
--- a/
src/locale/iconv.c
+++ b/
src/locale/iconv.c
@@
-458,16
+458,24
@@
size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
* range in the hkscs table then hard-coded
* here. Ugly, yes. */
if (c/256 == 0xdc) {
* range in the hkscs table then hard-coded
* here. Ugly, yes. */
if (c/256 == 0xdc) {
- if (totype-0300U > 8) k = 2;
- else k = "\10\4\4\10\4\4\10\2\4"[totype-0300];
- if (k > *outb) goto toobig;
- x += iconv(combine_to_from(to, 0),
+ union {
+ char c[8];
+ wchar_t wc[2];
+ } tmp;
+ char *ptmp = tmp.c;
+ size_t tmpx = iconv(combine_to_from(to, find_charmap("utf8")),
&(char *){"\303\212\314\204"
"\303\212\314\214"
"\303\252\314\204"
"\303\252\314\214"
+c%256}, &(size_t){4},
&(char *){"\303\212\314\204"
"\303\212\314\214"
"\303\252\314\204"
"\303\252\314\214"
+c%256}, &(size_t){4},
- out, outb);
+ &ptmp, &(size_t){sizeof tmp});
+ size_t tmplen = ptmp - tmp.c;
+ if (tmplen > *outb) goto toobig;
+ if (tmpx) x++;
+ memcpy(*out, &tmp, tmplen);
+ *out += tmplen;
+ *outb -= tmplen;
continue;
}
if (!c) goto ilseq;
continue;
}
if (!c) goto ilseq;