Use int32_t instead of plain int with Unicode code points
[jansson.git] / src / utf.c
index 0adf01b..2efcb68 100644 (file)
--- a/src/utf.c
+++ b/src/utf.c
@@ -1,6 +1,14 @@
+/*
+ * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
 #include <string.h>
+#include <stdint.h>
 
-int utf8_encode(int codepoint, char *buffer, int *size)
+int utf8_encode(int32_t codepoint, char *buffer, int *size)
 {
     if(codepoint < 0)
         return -1;
@@ -74,7 +82,8 @@ int utf8_check_first(char byte)
 
 int utf8_check_full(const char *buffer, int size)
 {
-    int i, value = 0;
+    int i;
+    int32_t value = 0;
     unsigned char u = (unsigned char)buffer[0];
 
     if(size == 2)