mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
address signedness issue
This commit is contained in:
parent
0caea881a5
commit
8776630509
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user