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;
}
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 );
utf8char[len++] = 0x80 | ( wchar & 0x3f );
}
- } else
+#if SIZEOF_WCHAR_T > 4
+ } else {
len = -1;
+#endif /* SIZEOF_WCHAR_T > 4 */
+ }
return len;
return n;
}
-#endif
+#endif /* SIZEOF_WCHAR_T >= 4 */