Leon Scroggins III | f59fb0e | 2014-05-28 15:19:42 -0400 | [diff] [blame] | 1 | New in SVN |
| 2 | ---------- |
| 3 | |
| 4 | * Updated the type system's behavior, in order to better support backwards |
| 5 | compatibility with code that was written before 64-bit integer support was |
| 6 | introduced. Here's how it works now: |
| 7 | |
| 8 | * isInt, isInt64, isUInt, and isUInt64 return true if and only if the |
| 9 | value can be exactly represented as that type. In particular, a value |
| 10 | constructed with a double like 17.0 will now return true for all of |
| 11 | these methods. |
| 12 | |
| 13 | * isDouble and isFloat now return true for all numeric values, since all |
| 14 | numeric values can be converted to a double or float without |
| 15 | truncation. Note however that the conversion may not be exact -- for |
| 16 | example, doubles cannot exactly represent all integers above 2^53 + 1. |
| 17 | |
| 18 | * isBool, isNull, isString, isArray, and isObject now return true if and |
| 19 | only if the value is of that type. |
| 20 | |
| 21 | * isConvertibleTo(fooValue) indicates that it is safe to call asFoo. |
| 22 | (For each type foo, isFoo always implies isConvertibleTo(fooValue).) |
| 23 | asFoo returns an approximate or exact representation as appropriate. |
| 24 | For example, a double value may be truncated when asInt is called. |
| 25 | |
| 26 | * For backwards compatibility with old code, isConvertibleTo(intValue) |
| 27 | may return false even if type() == intValue. This is because the value |
| 28 | may have been constructed with a 64-bit integer larger than maxInt, |
| 29 | and calling asInt() would cause an exception. If you're writing new |
| 30 | code, use isInt64 to find out whether the value is exactly |
| 31 | representable using an Int64, or asDouble() combined with minInt64 and |
| 32 | maxInt64 to figure out whether it is approximately representable. |
| 33 | |
| 34 | |
| 35 | New in JsonCpp 0.6.0: |
| 36 | --------------------- |
| 37 | |
| 38 | * Compilation |
| 39 | |
| 40 | - LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now |
| 41 | propagated to the build environment as this is required for some |
| 42 | compiler installation. |
| 43 | |
| 44 | - Added support for Microsoft Visual Studio 2008 (bug #2930462): |
| 45 | The platform "msvc90" has been added. |
| 46 | |
| 47 | Notes: you need to setup the environment by running vcvars32.bat |
| 48 | (e.g. MSVC 2008 command prompt in start menu) before running scons. |
| 49 | |
| 50 | - Added support for amalgamated source and header generation (a la sqlite). |
| 51 | Refer to README.txt section "Generating amalgamated source and header" |
| 52 | for detail. |
| 53 | |
| 54 | * Value |
| 55 | |
| 56 | - Removed experimental ValueAllocator, it caused static |
| 57 | initialization/destruction order issues (bug #2934500). |
| 58 | The DefaultValueAllocator has been inlined in code. |
| 59 | |
| 60 | - Added support for 64 bits integer: |
| 61 | |
| 62 | Types Json::Int64 and Json::UInt64 have been added. They are aliased |
| 63 | to 64 bits integers on system that support them (based on __int64 on |
| 64 | Microsoft Visual Studio platform, and long long on other platforms). |
| 65 | |
| 66 | Types Json::LargestInt and Json::LargestUInt have been added. They are |
| 67 | aliased to the largest integer type supported: |
| 68 | either Json::Int/Json::UInt or Json::Int64/Json::UInt64 respectively. |
| 69 | |
| 70 | Json::Value::asInt() and Json::Value::asUInt() still returns plain |
| 71 | "int" based types, but asserts if an attempt is made to retrieve |
| 72 | a 64 bits value that can not represented as the return type. |
| 73 | |
| 74 | Json::Value::asInt64() and Json::Value::asUInt64() have been added |
| 75 | to obtain the 64 bits integer value. |
| 76 | |
| 77 | Json::Value::asLargestInt() and Json::Value::asLargestUInt() returns |
| 78 | the integer as a LargestInt/LargestUInt respectively. Those functions |
| 79 | functions are typically used when implementing writer. |
| 80 | |
| 81 | The reader attempts to read number as 64 bits integer, and fall back |
| 82 | to reading a double if the number is not in the range of 64 bits |
| 83 | integer. |
| 84 | |
| 85 | Warning: Json::Value::asInt() and Json::Value::asUInt() now returns |
| 86 | long long. This changes break code that was passing the return value |
| 87 | to *printf() function. |
| 88 | |
| 89 | Support for 64 bits integer can be disabled by defining the macro |
| 90 | JSON_NO_INT64 (uncomment it in json/config.h for example), though |
| 91 | it should have no impact on existing usage. |
| 92 | |
| 93 | - The type Json::ArrayIndex is used for indexes of a JSON value array. It |
| 94 | is an unsigned int (typically 32 bits). |
| 95 | |
| 96 | - Array index can be passed as int to operator[], allowing use of literal: |
| 97 | Json::Value array; |
| 98 | array.append( 1234 ); |
| 99 | int value = array[0].asInt(); // did not compile previously |
| 100 | |
| 101 | - Added float Json::Value::asFloat() to obtain a floating point value as a |
| 102 | float (avoid lost of precision warning caused by used of asDouble() |
| 103 | to initialize a float). |
| 104 | |
| 105 | * Reader |
| 106 | |
| 107 | - Renamed Reader::getFormatedErrorMessages() to getFormattedErrorMessages. |
| 108 | Bug #3023708 (Formatted has 2 't'). The old member function is deprecated |
| 109 | but still present for backward compatibility. |
| 110 | |
| 111 | * Tests |
| 112 | |
| 113 | - Added test to ensure that the escape sequence "\/" is corrected handled |
| 114 | by the parser. |
| 115 | |
| 116 | * Bug fixes |
| 117 | |
| 118 | - Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now |
| 119 | correctly detected. |
| 120 | |
| 121 | - Bug #3139678: stack buffer overflow when parsing a double with a |
| 122 | length of 32 characters. |
| 123 | |
| 124 | - Fixed Value::operator <= implementation (had the semantic of operator >=). |
| 125 | Found when adding unit tests for comparison operators. |
| 126 | |
| 127 | - Value::compare() is now const and has an actual implementation with |
| 128 | unit tests. |
| 129 | |
| 130 | - Bug #2407932: strpbrk() can fail for NULL pointer. |
| 131 | |
| 132 | - Bug #3306345: Fixed minor typo in Path::resolve(). |
| 133 | |
| 134 | - Bug #3314841/#3306896: errors in amalgamate.py |
| 135 | |
| 136 | - Fixed some Coverity warnings and line-endings. |
| 137 | |
| 138 | * License |
| 139 | |
| 140 | - See file LICENSE for details. Basically JsonCpp is now licensed under |
| 141 | MIT license, or public domain if desired and recognized in your jurisdiction. |
| 142 | Thanks to Stephan G. Beal [http://wanderinghorse.net/home/stephan/]) who |
| 143 | helped figuring out the solution to the public domain issue. |