-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6230 from tkelman/msvc
Steps towards MSVC compatibility
- Loading branch information
Showing
69 changed files
with
670 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
For future reference: this flag is an odd mix of GCC style (
-Wl
) and MSVC style. In normal MSVC use, you would get a dll usingcl /LD foo.c
. Alternately,cl foo.c /o libfoo.dll /link /dll
works as well (with a warning). I use-
instead of/
to specify option flags because MSYS automatically translates any argument beginning with a forward slash into a file path.I am relying on the
compile
wrapper script from automake to translate-L
and-l
library linking flags from GCC style to MSVC style, so unfortunately I can't use-LD
or-link
here. Thecompile
script translatescompile cl -Wl,-dll foo.c -o libfoo.dll
intocl foo.c -o libfoo.dll -link -dll
and things work.