forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utf8proc_msvc.patch
40 lines (40 loc) · 1.1 KB
/
utf8proc_msvc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
diff --git a/utf8proc.c b/utf8proc.c
index ef2d433..e6c51f7 100644
--- a/utf8proc.c
+++ b/utf8proc.c
@@ -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;
diff --git a/utf8proc.h b/utf8proc.h
index 24a891b..304e227 100644
--- a/utf8proc.h
+++ b/utf8proc.h
@@ -65,8 +65,13 @@ typedef int int32_t;
#else
#define ssize_t int
#endif
+#ifdef __cplusplus
+typedef unsigned char _bool;
+enum {_false, _true};
+#else
typedef unsigned char bool;
enum {false, true};
+#endif
#else
#include <stdbool.h>
#include <inttypes.h>