fix wchar_t related warnings on Visual Studio 2008
This commit is contained in:
parent
78e9b0fca8
commit
2f9c426487
@ -87,7 +87,9 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen,
|
|||||||
case 1: out[x++] = (unsigned char)in[y]; break;
|
case 1: out[x++] = (unsigned char)in[y]; break;
|
||||||
case 2: out[x++] = 0xC0 | ((in[y] >> 6) & 0x1F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
case 2: out[x++] = 0xC0 | ((in[y] >> 6) & 0x1F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||||
case 3: out[x++] = 0xE0 | ((in[y] >> 12) & 0x0F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
case 3: out[x++] = 0xE0 | ((in[y] >> 12) & 0x0F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||||
|
#if !defined(__WCHAR_MAX__) && !defined(WCHAR_MAX) || __WCHAR_MAX__ > 0xFFFF || WCHAR_MAX > 0xFFFF
|
||||||
case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ unsigned long der_utf8_charsize(const wchar_t c)
|
|||||||
return 1;
|
return 1;
|
||||||
} else if (c <= 0x7FF) {
|
} else if (c <= 0x7FF) {
|
||||||
return 2;
|
return 2;
|
||||||
#if __WCHAR_MAX__ == 0xFFFF
|
#if __WCHAR_MAX__ == 0xFFFF || WCHAR_MAX == 0xFFFF
|
||||||
} else {
|
} else {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
@ -48,10 +48,10 @@ unsigned long der_utf8_charsize(const wchar_t c)
|
|||||||
int der_utf8_valid_char(const wchar_t c)
|
int der_utf8_valid_char(const wchar_t c)
|
||||||
{
|
{
|
||||||
LTC_UNUSED_PARAM(c);
|
LTC_UNUSED_PARAM(c);
|
||||||
#if !defined(__WCHAR_MAX__) || __WCHAR_MAX__ > 0xFFFF
|
#if !defined(__WCHAR_MAX__) && !defined(WCHAR_MAX) || __WCHAR_MAX__ > 0xFFFF || WCHAR_MAX > 0xFFFF
|
||||||
if (c > 0x10FFFF) return 0;
|
if (c > 0x10FFFF) return 0;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__WCHAR_MAX__) || __WCHAR_MAX__ != 0xFFFF && __WCHAR_MAX__ != 0xFFFFFFFF
|
#if !defined(__WCHAR_MAX__) && !defined(WCHAR_MAX) || __WCHAR_MAX__ != 0xFFFF && __WCHAR_MAX__ != 0xFFFFFFFF && WCHAR_MAX != 0xFFFF && WCHAR_MAX != 0xFFFFFFFF
|
||||||
if (c < 0) return 0;
|
if (c < 0) return 0;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user