Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix a bug when serializing numbers. Somehow the % got dropped from th…

…e .17g floating point format specifier.
  • Loading branch information...
commit 607e7d6b0cac6b2c925960fa6b3b444fa64caefc 1 parent 83c6e4f
@johnezang authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  JSONKit.m
View
2  JSONKit.m
@@ -2884,7 +2884,7 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object
double dv;
if(JK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberDoubleType, &dv))) {
if(JK_EXPECT_F(!isfinite(dv))) { jk_encode_error(encodeState, @"Floating point values must be finite. JSON does not support NaN or Infinity."); return(1); }
- return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, ((encodeState->serializeOptionFlags & JKSerializeOptionExtendedFloatingPoint) == 0) ? ".17g" : "%a", dv));
+ return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, ((encodeState->serializeOptionFlags & JKSerializeOptionExtendedFloatingPoint) == 0) ? "%.17g" : "%a", dv));
} else { jk_encode_error(encodeState, @"Unable to get floating point value from number object."); return(1); }
}
break;
Please sign in to comment.
Something went wrong with that request. Please try again.