From: Pierangelo Masarati Date: Wed, 19 Aug 2009 12:06:04 +0000 (+0000) Subject: address signedness issue X-Git-Tag: ACLCHECK_0~280 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8776630509ab1f60ab32ddd0d46b8fc9ee94f74f;p=openldap address signedness issue --- diff --git a/libraries/libldap/utf-8-conv.c b/libraries/libldap/utf-8-conv.c index b21f011999..782900ea00 100644 --- a/libraries/libldap/utf-8-conv.c +++ b/libraries/libldap/utf-8-conv.c @@ -191,7 +191,9 @@ ldap_x_wc_to_utf8 ( char *utf8char, wchar_t wchar, size_t count ) return 4; if( wchar < 0x4000000 ) return 5; - if( wchar < 0x80000000 ) +#if SIZEOF_WCHAR_T > 4 + if( wchar < 0x80000000LL ) +#endif /* SIZEOF_WCHAR_T > 4 */ return 6; return -1; } @@ -235,7 +237,11 @@ ldap_x_wc_to_utf8 ( char *utf8char, wchar_t wchar, size_t count ) utf8char[len++] = 0x80 | ( wchar & 0x3f ); } - } else if( wchar < 0x80000000 ) { + } else +#if SIZEOF_WCHAR_T > 4 + if( wchar < 0x80000000LL ) +#endif /* SIZEOF_WCHAR_T > 4 */ + { if (count >= 6) { utf8char[len++] = 0xfc | ( wchar >> 30 ); utf8char[len++] = 0x80 | ( (wchar >> 24) & 0x3f ); @@ -245,8 +251,11 @@ ldap_x_wc_to_utf8 ( char *utf8char, wchar_t wchar, size_t count ) utf8char[len++] = 0x80 | ( wchar & 0x3f ); } - } else +#if SIZEOF_WCHAR_T > 4 + } else { len = -1; +#endif /* SIZEOF_WCHAR_T > 4 */ + } return len; @@ -467,4 +476,4 @@ ldap_x_mbs_to_utf8s ( char *utf8str, const char *mbstr, size_t count, return n; } -#endif +#endif /* SIZEOF_WCHAR_T >= 4 */