From 1609abd091e350266685e73ed9c9c58e46ff8e5b Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Sat, 24 Sep 2016 21:53:08 +0200 Subject: [PATCH 1/3] Add note about USE_MINGW_ANSI_STDIO to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 78581ee..75711ec 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ I'm very happy to accept pull-requests and collaborators. doesn't matter. But for ARM chips it can segfault. * `modp_numtoa.c` functions may produce different rounding than whatever `printf` is on your system. +* On mingw (windows) compiling with `-D__USE_MINGW_ANSI_STDIO` gives the + standard `prinf` behavior. ## Alpine Linux / musl-libc From 6c674aca429d32c15acfd836b7b17c623fb29c48 Mon Sep 17 00:00:00 2001 From: Xianjin YE Date: Tue, 7 Nov 2017 20:48:57 +0800 Subject: [PATCH 2/3] Include extern_c_begin.h and extern_c_end.h in output --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.am b/src/Makefile.am index 2243659..add0026 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,6 @@ include_HEADERS = \ + extern_c_begin.h extern_c_end.h \ modp_b16.h modp_b64.h modp_b64w.h modp_b64r.h \ modp_b85.h modp_burl.h modp_bjavascript.h \ modp_numtoa.h modp_ascii.h modp_b2.h \ From 90941f9912db81a1b6157cd5b8224e1fea055473 Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 3 Jan 2018 11:41:27 +0800 Subject: [PATCH 3/3] fix compiling with GCC 7 Fix two issues below: error: this statement may fall through [-Werror=implicit-fallthrough=] error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp] --- src/modp_ascii.c | 9 +++++++++ test/speedtest_numtoa.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modp_ascii.c b/src/modp_ascii.c index 81a6f8e..6b59855 100644 --- a/src/modp_ascii.c +++ b/src/modp_ascii.c @@ -40,10 +40,13 @@ void modp_toupper_copy(char* dest, const char* str, size_t len) switch (leftover) { case 3: *dest++ = (char)gsToUpperMap[ustr[i++]]; + /* fall through */ case 2: *dest++ = (char)gsToUpperMap[ustr[i++]]; + /* fall through */ case 1: *dest++ = (char)gsToUpperMap[ustr[i]]; + /* fall through */ case 0: *dest = '\0'; } @@ -75,10 +78,13 @@ void modp_tolower_copy(char* dest, const char* str, size_t len) switch (leftover) { case 3: *dest++ = (char)gsToLowerMap[ustr[i++]]; + /* fall through */ case 2: *dest++ = (char)gsToLowerMap[ustr[i++]]; + /* fall through */ case 1: *dest++ = (char)gsToLowerMap[ustr[i]]; + /* fall through */ case 0: *dest = '\0'; } @@ -121,10 +127,13 @@ void modp_toprint_copy(char* dest, const char* str, size_t len) switch (leftover) { case 3: *dest++ = (char)gsToPrintMap[s[i++]]; + /* fall through */ case 2: *dest++ = (char)gsToPrintMap[s[i++]]; + /* fall through */ case 1: *dest++ = (char)gsToPrintMap[s[i]]; + /* fall through */ case 0: *dest = '\0'; } diff --git a/test/speedtest_numtoa.c b/test/speedtest_numtoa.c index e9239c8..65356b8 100644 --- a/test/speedtest_numtoa.c +++ b/test/speedtest_numtoa.c @@ -2,7 +2,7 @@ * trick gcc to accepting snprintf which is a C99-ism */ #define _ISOC99_SOURCE -#define _BSD_SOURCE +#define _DEFAULT_SOURCE #define _XOPEN_SOURCE 500 #define _POSIX_C_SOURCE 200112L #include