]> git.sur5r.net Git - openldap/commitdiff
address signedness issue
authorPierangelo Masarati <ando@openldap.org>
Wed, 19 Aug 2009 12:06:04 +0000 (12:06 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 19 Aug 2009 12:06:04 +0000 (12:06 +0000)
libraries/libldap/utf-8-conv.c

index b21f011999e9709c7a30f855665794a115573fb2..782900ea000fdd6c9a654a88c78ee7b96ae33a5c 100644 (file)
@@ -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 */