version 1.56, 2013/02/20 18:09:13 |
version 1.57, 2013/02/20 18:40:49 |
Line 105 static wchar_t *do_svis(wchar_t *, wint_ |
|
Line 105 static wchar_t *do_svis(wchar_t *, wint_ |
|
|
|
#define MAXEXTRAS 10 |
#define MAXEXTRAS 10 |
|
|
|
#ifdef notyet |
|
/* |
|
* On NetBSD MB_LEN_MAX is currently 32 which does not fit on any integer |
|
* integral type and it is probably wrong, since currently the maximum |
|
* number of bytes and character needs is 6. Until this is fixed, the |
|
* loops below are using sizeof(uint64_t) - 1 instead of MB_LEN_MAX, and |
|
* the assertion is commented out. |
|
*/ |
|
__CTASSERT(MB_LEN_MAX <= sizeof(uint64_t)) |
|
#endif |
|
|
/* |
/* |
* This is do_hvis, for HTTP style (RFC 1808) |
* This is do_hvis, for HTTP style (RFC 1808) |
*/ |
*/ |
Line 238 static wchar_t * |
|
Line 249 static wchar_t * |
|
do_svis(wchar_t *dst, wint_t c, int flags, wint_t nextc, const wchar_t *extra) |
do_svis(wchar_t *dst, wint_t c, int flags, wint_t nextc, const wchar_t *extra) |
{ |
{ |
int iswextra, i, shft; |
int iswextra, i, shft; |
wint_t bmsk, wmsk; |
uint64_t bmsk, wmsk; |
|
|
iswextra = wcschr(extra, c) != NULL; |
iswextra = wcschr(extra, c) != NULL; |
if (!iswextra && (iswgraph(c) || iswwhite(c) || |
if (!iswextra && (iswgraph(c) || iswwhite(c) || |
Line 249 do_svis(wchar_t *dst, wint_t c, int flag |
|
Line 260 do_svis(wchar_t *dst, wint_t c, int flag |
|
|
|
/* See comment in istrsenvisx() output loop, below. */ |
/* See comment in istrsenvisx() output loop, below. */ |
wmsk = 0; |
wmsk = 0; |
for (i = sizeof(wint_t) - 1; i >= 0; i--) { |
for (i = sizeof(uint64_t) - 1; i >= 0; i--) { |
shft = i * NBBY; |
shft = i * NBBY; |
bmsk = (wint_t)(0xffL << shft); |
bmsk = (uint64_t)(0xffL << shft); |
wmsk |= bmsk; |
wmsk |= bmsk; |
if ((c & wmsk) || i == 0) |
if ((c & wmsk) || i == 0) |
dst = do_mbyte(dst, (wint_t)( |
dst = do_mbyte(dst, (wint_t)( |
Line 324 istrsenvisx(char *mbdst, size_t *dlen, c |
|
Line 335 istrsenvisx(char *mbdst, size_t *dlen, c |
|
{ |
{ |
wchar_t *dst, *src, *pdst, *psrc, *start, *extra; |
wchar_t *dst, *src, *pdst, *psrc, *start, *extra; |
size_t len, olen; |
size_t len, olen; |
wint_t c, bmsk, wmsk; |
uint64_t bmsk, wmsk; |
|
wint_t c; |
visfun_t f; |
visfun_t f; |
int clen = 0, cerr = 0, error = -1, i, shft; |
int clen = 0, cerr = 0, error = -1, i, shft; |
ssize_t mbslength, maxolen; |
ssize_t mbslength, maxolen; |
Line 461 istrsenvisx(char *mbdst, size_t *dlen, c |
|
Line 473 istrsenvisx(char *mbdst, size_t *dlen, c |
|
*/ |
*/ |
clen = 0; |
clen = 0; |
wmsk = 0; |
wmsk = 0; |
for (i = sizeof(wint_t) - 1; i >= 0; i--) { |
for (i = sizeof(uint64_t) - 1; i >= 0; i--) { |
shft = i * NBBY; |
shft = i * NBBY; |
bmsk = (wint_t)(0xffL << shft); |
bmsk = (uint64_t)(0xffL << shft); |
wmsk |= bmsk; |
wmsk |= bmsk; |
if ((*dst & wmsk) || i == 0) |
if ((*dst & wmsk) || i == 0) |
mbdst[clen++] = (char)((unsigned int) |
mbdst[clen++] = (char)((unsigned int) |