This commit is contained in:
iceman1001 2019-04-04 23:45:58 +02:00
parent 287a9dd204
commit 444c12717c

View file

@ -284,8 +284,7 @@ static CborError add_value_metadata(FILE *out, CborType type, const ConversionSt
type = flags & FinalTypeMask; type = flags & FinalTypeMask;
flags &= ~(FinalTypeMask | TypeWasTagged); flags &= ~(FinalTypeMask | TypeWasTagged);
if (fprintf(out, "\"tag\":\"%" PRIu64 "\"%s", status->lastTag, if (fprintf(out, "\"tag\":\"%" PRIu64 "\"%s", status->lastTag, (flags & ~TypeWasTagged) ? "," : "") < 0)
flags & ~TypeWasTagged ? "," : "") < 0)
return CborErrorIO; return CborErrorIO;
} }
@ -300,11 +299,10 @@ static CborError add_value_metadata(FILE *out, CborType type, const ConversionSt
if (fprintf(out, ",\"v\":\"nan\"") < 0) if (fprintf(out, ",\"v\":\"nan\"") < 0)
return CborErrorIO; return CborErrorIO;
if (flags & NumberWasInfinite) if (flags & NumberWasInfinite)
if (fprintf(out, ",\"v\":\"%sinf\"", flags & NumberWasNegative ? "-" : "") < 0) if (fprintf(out, ",\"v\":\"%sinf\"", (flags & NumberWasNegative) ? "-" : "") < 0)
return CborErrorIO; return CborErrorIO;
if (flags & NumberPrecisionWasLost) if (flags & NumberPrecisionWasLost)
if (fprintf(out, ",\"v\":\"%c%" PRIx64 "\"", flags & NumberWasNegative ? '-' : '+', if (fprintf(out, ",\"v\":\"%c%" PRIx64 "\"", (flags & NumberWasNegative) ? '-' : '+', status->originalNumber) < 0)
status->originalNumber) < 0)
return CborErrorIO; return CborErrorIO;
if (type == CborSimpleType) if (type == CborSimpleType)
if (fprintf(out, ",\"v\":%d", (int)status->originalNumber) < 0) if (fprintf(out, ",\"v\":%d", (int)status->originalNumber) < 0)