Skip to content

WinCE Compatibility Fix #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,11 @@ std::string Reader::getLocationLineAndColumn(Location location) const {
getLocationLineAndColumn(location, line, column);
char buffer[18 + 16 + 16 + 1];
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
#if defined(WINCE)
_snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#else
sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#endif
#else
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#endif
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 @@ -63,6 +63,11 @@ std::string valueToString(UInt value) {
#endif // # if defined(JSON_HAS_INT64)

std::string valueToString(double value) {
#if defined(WINCE)
char buffer[32];
_snprintf(buffer, sizeof(buffer), "%.16g", value);
return buffer;
#else
// We need not request the alternative representation
// that always has a decimal point because JSON doesn't distingish the
// concepts of reals and integers.
Expand All @@ -72,6 +77,7 @@ std::string valueToString(double value) {
str.precision(16);
str << value;
return str.str();
#endif
}

std::string valueToString(bool value) { return value ? "true" : "false"; }
Expand Down