mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-04-27 10:25:57 +02:00
Replace reintroduced legacy u_* type usage in strnvis() and strnunvis()
This fixes a regression caused by 2d7de18. These types are not available on all systems. Fixes: commit 2d7de186e9cb19a756c0630ee85cb3f2d29b3484 Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
parent
5e0998fa4f
commit
81c3c3e405
@ -68,7 +68,8 @@ __weak_alias(strnunvisx,_strnunvisx)
|
|||||||
#define S_NUMBER 14 /* collecting number */
|
#define S_NUMBER 14 /* collecting number */
|
||||||
#define S_STRING 15 /* collecting string */
|
#define S_STRING 15 /* collecting string */
|
||||||
|
|
||||||
#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
|
#define isoctal(c) \
|
||||||
|
(((unsigned char)(c)) >= '0' && ((unsigned char)(c)) <= '7')
|
||||||
#define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
|
#define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
|
||||||
#define XTOD(c) (isdigit(c) ? (c - '0') : ((c - 'A') + 10))
|
#define XTOD(c) (isdigit(c) ? (c - '0') : ((c - 'A') + 10))
|
||||||
|
|
||||||
|
13
src/vis.c
13
src/vis.c
@ -117,7 +117,8 @@ iscgraph(int c) {
|
|||||||
#define ISGRAPH(flags, c) \
|
#define ISGRAPH(flags, c) \
|
||||||
(((flags) & VIS_NOLOCALE) ? iscgraph(c) : iswgraph(c))
|
(((flags) & VIS_NOLOCALE) ? iscgraph(c) : iswgraph(c))
|
||||||
|
|
||||||
#define iswoctal(c) (((u_char)(c)) >= L'0' && ((u_char)(c)) <= L'7')
|
#define iswoctal(c) \
|
||||||
|
(((unsigned char)(c)) >= L'0' && ((unsigned char)(c)) <= L'7')
|
||||||
#define iswwhite(c) (c == L' ' || c == L'\t' || c == L'\n')
|
#define iswwhite(c) (c == L' ' || c == L'\t' || c == L'\n')
|
||||||
#define iswsafe(c) (c == L'\b' || c == BELL || c == L'\r')
|
#define iswsafe(c) (c == L'\b' || c == BELL || c == L'\r')
|
||||||
#define xtoa(c) L"0123456789abcdef"[c]
|
#define xtoa(c) L"0123456789abcdef"[c]
|
||||||
@ -253,8 +254,10 @@ do_mbyte(wchar_t *dst, wint_t c, int flags, wint_t nextc, int iswextra)
|
|||||||
}
|
}
|
||||||
if (iswextra || ((c & 0177) == L' ') || (flags & VIS_OCTAL)) {
|
if (iswextra || ((c & 0177) == L' ') || (flags & VIS_OCTAL)) {
|
||||||
*dst++ = L'\\';
|
*dst++ = L'\\';
|
||||||
*dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + L'0';
|
*dst++ =
|
||||||
*dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + L'0';
|
(unsigned char)(((uint32_t)(unsigned char)c >> 6) & 03) + L'0';
|
||||||
|
*dst++ =
|
||||||
|
(unsigned char)(((uint32_t)(unsigned char)c >> 3) & 07) + L'0';
|
||||||
*dst++ = (c & 07) + L'0';
|
*dst++ = (c & 07) + L'0';
|
||||||
} else {
|
} else {
|
||||||
if ((flags & VIS_NOSLASH) == 0)
|
if ((flags & VIS_NOSLASH) == 0)
|
||||||
@ -349,7 +352,7 @@ makeextralist(int flags, const char *src)
|
|||||||
if ((flags & VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) {
|
if ((flags & VIS_NOLOCALE) || mbstowcs(dst, src, len) == (size_t)-1) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
dst[i] = (wchar_t)(u_char)src[i];
|
dst[i] = (wchar_t)(unsigned char)src[i];
|
||||||
d = dst + len;
|
d = dst + len;
|
||||||
} else
|
} else
|
||||||
d = dst + wcslen(dst);
|
d = dst + wcslen(dst);
|
||||||
@ -452,7 +455,7 @@ istrsenvisx(char **mbdstp, size_t *dlen, const char *mbsrc, size_t mblength,
|
|||||||
clen = mbtowc(src, mbsrc, MB_LEN_MAX);
|
clen = mbtowc(src, mbsrc, MB_LEN_MAX);
|
||||||
if (cerr || clen < 0) {
|
if (cerr || clen < 0) {
|
||||||
/* Conversion error, process as a byte instead. */
|
/* Conversion error, process as a byte instead. */
|
||||||
*src = (wint_t)(u_char)*mbsrc;
|
*src = (wint_t)(unsigned char)*mbsrc;
|
||||||
clen = 1;
|
clen = 1;
|
||||||
cerr = 1;
|
cerr = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user