Closed danielaparker closed 2 weeks ago
Thanks for your insight!
This condition was added along with YYJSON_READ_BIGNUM_AS_RAW
, but it doesn't match the documentation.
This should be considered a bug and not covered by the tests.
My own view is that the documentation accords with intuition - that YYJSON_READ_NUMBER_AS_RAW | YYJSON_READ_BIGNUM_AS_RAW
should return all numbers as raw - and that it's the condition that should be changed.
Fixed
There must have been a reason for using
rather than simply
but I don't see it.
One, it doesn't seem to be in the spirit of yyjson to do two checks where one will do.
Two, the documentation for
YYJSON_READ_BIGNUM_AS_RAW
states "The flag will be overridden byYYJSON_READ_NUMBER_AS_RAW
flag." But with this code, it's the other way around, ifYYJSON_READ_BIGNUM_AS_RAW | YYJSON_READ_NUMBER_AS_RAW
is passed as flags, it'sYYJSON_READ_BIGNUM_AS_RAW
that overridesYYJSON_READ_NUMBER_AS_RAW
.It's a precondition that
pre
is not null before the call toread_number_raw
, but that's already guaranteed if either of the flags are set.All tests still pass with the alternative check.