Skip to content

Commit

Permalink
Merge pull request open-source-parsers#46 from chuckatkins/fix-for-ol…
Browse files Browse the repository at this point in the history
…d-msvc

Workaround for missing C99 functions in older versions of Visual Studio
  • Loading branch information
cdunn2001 committed Sep 20, 2014
2 parents 4002f8a + 9dc9026 commit 8aec8d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include <cstring>
#include <istream>

#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
#define snprintf _snprintf
#endif

#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
// Disable warning about strdup being deprecated.
#pragma warning(disable : 4996)
Expand Down
6 changes: 6 additions & 0 deletions src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
#include <iomanip>
#include <math.h>

#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
#include <float.h>
#define isfinite _finite
#define snprintf _snprintf
#endif

#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
// Disable warning about strdup being deprecated.
#pragma warning(disable : 4996)
Expand Down

0 comments on commit 8aec8d8

Please sign in to comment.