C++/MSVC compatibility, indenting, for #4
authorSteven G. Johnson <stevenj@mit.edu>
Fri, 18 Jul 2014 15:47:24 +0000 (11:47 -0400)
committerSteven G. Johnson <stevenj@mit.edu>
Fri, 18 Jul 2014 15:47:24 +0000 (11:47 -0400)
utf8proc.c
utf8proc.h

index ef2d433bc2937f7d29d1b9c7ece17168c5a438db..e6c51f795fbd09bab3ceb28498cbe4ce8a648dc5 100644 (file)
@@ -536,7 +536,7 @@ ssize_t utf8proc_map(
   *dstptr = NULL;
   result = utf8proc_decompose(str, strlen, NULL, 0, options);
   if (result < 0) return result;
-  buffer = malloc(result * sizeof(int32_t) + 1);
+  buffer = (int32_t *) malloc(result * sizeof(int32_t) + 1);
   if (!buffer) return UTF8PROC_ERROR_NOMEM;
   result = utf8proc_decompose(str, strlen, buffer, result, options);
   if (result < 0) {
@@ -550,7 +550,7 @@ ssize_t utf8proc_map(
   }
   {
     int32_t *newptr;
-    newptr = realloc(buffer, (size_t)result+1);
+    newptr = (int32_t *) realloc(buffer, (size_t)result+1);
     if (newptr) buffer = newptr;
   }
   *dstptr = (uint8_t *)buffer;
index 24a891b6c6713e38a1eff36b60a8942dff6d1342..3dac24d65e15dd35d573178cb401fdf4af568e05 100644 (file)
@@ -60,16 +60,18 @@ typedef unsigned char uint8_t;
 typedef short int16_t;
 typedef unsigned short uint16_t;
 typedef int int32_t;
-#ifdef _WIN64
-#define ssize_t __int64
-#else
-#define ssize_t int
-#endif
+#  ifdef _WIN64
+#    define ssize_t __int64
+#  else
+#    define ssize_t int
+#  endif
+#  ifndef __cplusplus
 typedef unsigned char bool;
 enum {false, true};
+#  endif
 #else
-#include <stdbool.h>
-#include <inttypes.h>
+#  include <stdbool.h>
+#  include <inttypes.h>
 #endif
 #include <limits.h>