|
From: Aaron J. <ja...@go...> - 2011-05-23 09:00:16
|
Hi all,
I'm working on updating Google's internal version of jsoncpp from an ancient
commit to the most recent version (SVN rev 192), but having some trouble. I
think I've run into a backwards incompatible change that makes it nearly
impossible for us to upgrade.
In particular, there's jsoncpp-using code that looks something like this:
Json::Value value = ...
unsigned int value =
value.isUInt() ? value.asUInt() :
(value.isDouble() ? value.asDouble() : kError);
That is, the code uses the isFoo methods to decide which asFoo method to call.
The problem is that at SVN rev 192, values parsed as integers greater than
2^32 will return true for isUInt(), but have an assertion failure for
asUInt():
value_.uint_ <= maxUInt
"unsigned integer out of UInt range"
You can see this by parsing the string "31121983701778432", for example.
As far as I can tell, there's no way for me to update to the latest version of
jsoncpp without either changing the code above or breaking it (introducing
incorrectness or a crasher bug into production). Updating the code is not an
option for me since there is too much of it.
Do you have any advice? In particular, am I missing something in the
Json::Value API?
Thanks,
Aaron
|