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 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 \ 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