summaryrefslogtreecommitdiff
path: root/upb/json
diff options
context:
space:
mode:
authorEsun Kim <veblush@google.com>2019-07-30 15:43:50 -0700
committerEsun Kim <veblush@google.com>2019-07-30 15:43:50 -0700
commit7a1e6aa84ba857d2e3cdc6e5fd50e3bda210c164 (patch)
treeb4bc5af6bb92804bae676dd32c3b21cdd78972aa /upb/json
parentf179e23e5b9f502cce9a2b9fa6a918d1a689758b (diff)
Support MSVC prior to 2015
Diffstat (limited to 'upb/json')
-rw-r--r--upb/json/parser.rl2
-rw-r--r--upb/json/printer.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/upb/json/parser.rl b/upb/json/parser.rl
index fd3704c..f80ed18 100644
--- a/upb/json/parser.rl
+++ b/upb/json/parser.rl
@@ -947,7 +947,7 @@ static bool parse_number_from_buffer(upb_json_parser *p, const char *buf,
upb_fieldtype_t type = upb_fielddef_type(p->top->f);
double val;
double dummy;
- double inf = 1.0 / 0.0; /* C89 does not have an INFINITY macro. */
+ double inf = UPB_INFINITY;
errno = 0;
diff --git a/upb/json/printer.c b/upb/json/printer.c
index 90705a7..38f817d 100644
--- a/upb/json/printer.c
+++ b/upb/json/printer.c
@@ -181,11 +181,11 @@ const char neginf[] = "\"-Infinity\"";
const char inf[] = "\"Infinity\"";
static size_t fmt_double(double val, char* buf, size_t length) {
- if (val == (1.0 / 0.0)) {
+ if (val == UPB_INFINITY) {
CHKLENGTH(length >= strlen(inf));
strcpy(buf, inf);
return strlen(inf);
- } else if (val == (-1.0 / 0.0)) {
+ } else if (val == -UPB_INFINITY) {
CHKLENGTH(length >= strlen(neginf));
strcpy(buf, neginf);
return strlen(neginf);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback