Added preliminary Symbian support.
[silc.git] / lib / silcutil / silcutf8.c
index af6cac3e502d33fe9cbc9e69411a873612f70d38..29f74dc34dbc04795d19d542c18af30f83e8daf5 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-#include "silcincludes.h"
+#include "silc.h"
 #include "silcutf8.h"
 
 /* Encodes the string `bin' of which encoding is `bin_encoding' to the
@@ -491,7 +491,7 @@ SilcUInt32 silc_utf8_decode(const unsigned char *utf8, SilcUInt32 utf8_len,
              if (enclen + 3 > bin_size)
                return 0;
              bin[enclen] = '\\';
-             snprintf(bin + enclen + 1, 3, "%02X", cv);
+             silc_silc_snprintf(bin + enclen + 1, 3, "%02X", cv);
            }
            enclen += 3;
            continue;
@@ -536,14 +536,14 @@ SilcUInt32 silc_utf8_decoded_len(const unsigned char *bin, SilcUInt32 bin_len,
 /* Returns TRUE if the `utf8' string of length of `utf8_len' is valid
    UTF-8 encoded string, FALSE if it is not UTF-8 encoded string. */
 
-bool silc_utf8_valid(const unsigned char *utf8, SilcUInt32 utf8_len)
+SilcBool silc_utf8_valid(const unsigned char *utf8, SilcUInt32 utf8_len)
 {
   return silc_utf8_decode(utf8, utf8_len, 0, NULL, 0) != 0;
 }
 
 /* Pretty close strcasecmp */
 
-bool silc_utf8_strcasecmp(const char *s1, const char *s2)
+SilcBool silc_utf8_strcasecmp(const char *s1, const char *s2)
 {
   if (s1 == s2)
     return TRUE;
@@ -555,25 +555,25 @@ bool silc_utf8_strcasecmp(const char *s1, const char *s2)
 
 /* Pretty close strcasecmp */
 
-bool silc_utf8_strncasecmp(const char *s1, const char *s2, SilcUInt32 n)
+SilcBool silc_utf8_strncasecmp(const char *s1, const char *s2, SilcUInt32 n)
 {
   unsigned char *s1u, *s2u;
   SilcUInt32 s1u_len, s2u_len;
   SilcStringprepStatus status;
-  bool ret;
+  SilcBool ret;
 
   if (s1 == s2)
     return TRUE;
 
   /* Casefold and normalize */
-  status = silc_stringprep(s1, strlen(s1), SILC_STRING_UTF8,
+  status = silc_stringprep(s1, n, SILC_STRING_UTF8,
                           SILC_IDENTIFIERC_PREP, 0, &s1u,
                           &s1u_len, SILC_STRING_UTF8);
   if (status != SILC_STRINGPREP_OK)
     return FALSE;
 
   /* Casefold and normalize */
-  status = silc_stringprep(s2, strlen(s2), SILC_STRING_UTF8,
+  status = silc_stringprep(s2, n, SILC_STRING_UTF8,
                           SILC_IDENTIFIERC_PREP, 0, &s2u,
                           &s2u_len, SILC_STRING_UTF8);
   if (status != SILC_STRINGPREP_OK)