From: Petri Lehtinen Date: Tue, 1 Nov 2011 17:52:20 +0000 (+0200) Subject: Fix test file comparisons on MinGW X-Git-Tag: v2.4-moonshot~1^2~55 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=92d9b89d59e627ba46fbb175b1d8f9aebbd1aac7;hp=bc98ab6a6973d5f7d59cf896fb27e4beb559252e;p=jansson.git Fix test file comparisons on MinGW Don't output any DOS line terminators from json_process. Issue GH-39. --- diff --git a/test/bin/json_process.c b/test/bin/json_process.c index 66c34d1..4ec22e6 100644 --- a/test/bin/json_process.c +++ b/test/bin/json_process.c @@ -19,6 +19,11 @@ #include #endif +#if _WIN32 +#include /* for _setmode() */ +#include /* for _O_BINARY */ +#endif + static int getenv_int(const char *name) { char *value, *end; @@ -72,6 +77,13 @@ int main(int argc, char *argv[]) return 2; } +#ifdef _WIN32 + /* On Windows, set stdout and stderr to binary mode to avoid + outputting DOS line terminators */ + _setmode(_fileno(stdout), _O_BINARY); + _setmode(_fileno(stderr), _O_BINARY); +#endif + indent = getenv_int("JSON_INDENT"); if(indent < 0 || indent > 255) { fprintf(stderr, "invalid value for JSON_INDENT: %d\n", indent);