From 744a4f3ec1b3c123e4628c7ec45be2fe430d7e9c Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 19 Jun 2019 21:20:04 -0400 Subject: [PATCH] Remove Json:Reader `Json::Reader` has been deprecated for some time, so we replace it with `Json::CharReader` generated by a `Json::CharReaderBuilder`, or (in the one instance where we have a stream as input) `Json::parseFromStream();` --- src/CacheDisk.cpp | 16 ++++++++++++---- src/CacheMemory.cpp | 17 +++++++++++++---- src/ChunkReader.cpp | 14 ++++++++++---- src/Clip.cpp | 8 ++++++-- src/Color.cpp | 8 ++++++-- src/Coordinate.cpp | 8 ++++++-- src/DecklinkReader.cpp | 8 ++++++-- src/DummyReader.cpp | 8 ++++++-- src/EffectBase.cpp | 8 ++++++-- src/FFmpegReader.cpp | 8 ++++++-- src/FrameMapper.cpp | 8 ++++++-- src/ImageReader.cpp | 10 +++++++--- src/KeyFrame.cpp | 8 ++++++-- src/Point.cpp | 8 ++++++-- src/Profiles.cpp | 8 ++++++-- src/QtImageReader.cpp | 8 ++++++-- src/TextReader.cpp | 8 ++++++-- src/Timeline.cpp | 16 ++++++++++++---- src/WriterBase.cpp | 8 ++++++-- src/effects/Bars.cpp | 8 ++++++-- src/effects/Blur.cpp | 8 ++++++-- src/effects/Brightness.cpp | 8 ++++++-- src/effects/ChromaKey.cpp | 8 ++++++-- src/effects/ColorShift.cpp | 8 ++++++-- src/effects/Crop.cpp | 9 ++++++--- src/effects/Deinterlace.cpp | 8 ++++++-- src/effects/Hue.cpp | 8 ++++++-- src/effects/Mask.cpp | 8 ++++++-- src/effects/Negate.cpp | 8 ++++++-- src/effects/Pixelate.cpp | 8 ++++++-- src/effects/Saturation.cpp | 8 ++++++-- src/effects/Shift.cpp | 8 ++++++-- src/effects/Wave.cpp | 8 ++++++-- tests/Clip_Tests.cpp | 16 +++++++++++----- 34 files changed, 233 insertions(+), 81 deletions(-) diff --git a/src/CacheDisk.cpp b/src/CacheDisk.cpp index 23854f3a..148dc1db 100644 --- a/src/CacheDisk.cpp +++ b/src/CacheDisk.cpp @@ -486,8 +486,12 @@ Json::Value CacheDisk::JsonValue() { // Parse and append range data (if any) Json::Value ranges; - Json::Reader reader; - bool success = reader.parse( json_ranges, ranges ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( json_ranges.c_str(), + json_ranges.c_str() + json_ranges.size(), &ranges, &errors ); if (success) root["ranges"] = ranges; @@ -500,8 +504,12 @@ void CacheDisk::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/CacheMemory.cpp b/src/CacheMemory.cpp index f830d74e..2cc79e7b 100644 --- a/src/CacheMemory.cpp +++ b/src/CacheMemory.cpp @@ -340,8 +340,13 @@ Json::Value CacheMemory::JsonValue() { // Parse and append range data (if any) Json::Value ranges; - Json::Reader reader; - bool success = reader.parse( json_ranges, ranges ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( json_ranges.c_str(), + json_ranges.c_str() + json_ranges.size(), &ranges, &errors ); + if (success) root["ranges"] = ranges; @@ -354,8 +359,12 @@ void CacheMemory::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/ChunkReader.cpp b/src/ChunkReader.cpp index fe552243..44f887b7 100644 --- a/src/ChunkReader.cpp +++ b/src/ChunkReader.cpp @@ -76,8 +76,10 @@ void ChunkReader::load_json() // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( json_string.str(), root ); + Json::CharReaderBuilder rbuilder; + + string errors; + bool success = Json::parseFromStream(rbuilder, json_string, &root, &errors); if (!success) // Raise exception throw InvalidJSON("Chunk folder could not be opened.", path); @@ -278,8 +280,12 @@ void ChunkReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Clip.cpp b/src/Clip.cpp index 2099705d..0cb88cfe 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -786,8 +786,12 @@ void Clip::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Color.cpp b/src/Color.cpp index df2cf097..e9bf438a 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -107,8 +107,12 @@ void Color::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Coordinate.cpp b/src/Coordinate.cpp index 60ea90b2..835cbbf0 100644 --- a/src/Coordinate.cpp +++ b/src/Coordinate.cpp @@ -70,8 +70,12 @@ void Coordinate::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/DecklinkReader.cpp b/src/DecklinkReader.cpp index 1d9b70b9..7e491424 100644 --- a/src/DecklinkReader.cpp +++ b/src/DecklinkReader.cpp @@ -265,8 +265,12 @@ void DecklinkReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/DummyReader.cpp b/src/DummyReader.cpp index dc77db5b..bb079abb 100644 --- a/src/DummyReader.cpp +++ b/src/DummyReader.cpp @@ -143,8 +143,12 @@ void DummyReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/EffectBase.cpp b/src/EffectBase.cpp index c0afded8..48dd266f 100644 --- a/src/EffectBase.cpp +++ b/src/EffectBase.cpp @@ -99,8 +99,12 @@ void EffectBase::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 6aa0938e..0e28971d 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -2422,8 +2422,12 @@ void FFmpegReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse(value, root); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse(value.c_str(), value.c_str() + value.size(), + &root, &errors); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index 113171a2..22cf4a97 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -694,8 +694,12 @@ void FrameMapper::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/ImageReader.cpp b/src/ImageReader.cpp index f535666a..3c1d334a 100644 --- a/src/ImageReader.cpp +++ b/src/ImageReader.cpp @@ -106,7 +106,7 @@ void ImageReader::Close() { // Mark as "closed" is_open = false; - + // Delete the image image.reset(); } @@ -153,8 +153,12 @@ void ImageReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 2b0389de..f585333d 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -366,8 +366,12 @@ void Keyframe::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Point.cpp b/src/Point.cpp index e55e6453..e41883bf 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -133,8 +133,12 @@ void Point::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Profiles.cpp b/src/Profiles.cpp index 390e5765..53a3424b 100644 --- a/src/Profiles.cpp +++ b/src/Profiles.cpp @@ -164,8 +164,12 @@ void Profile::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/QtImageReader.cpp b/src/QtImageReader.cpp index 502ddb9a..7630a693 100644 --- a/src/QtImageReader.cpp +++ b/src/QtImageReader.cpp @@ -286,8 +286,12 @@ void QtImageReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/TextReader.cpp b/src/TextReader.cpp index 8234aa5d..a24f26e4 100644 --- a/src/TextReader.cpp +++ b/src/TextReader.cpp @@ -201,8 +201,12 @@ void TextReader::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 37d3f71c..1758479b 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -990,8 +990,12 @@ void Timeline::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); @@ -1083,8 +1087,12 @@ void Timeline::ApplyJsonDiff(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success || !root.isArray()) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid).", ""); diff --git a/src/WriterBase.cpp b/src/WriterBase.cpp index 3697c52a..3aedec67 100644 --- a/src/WriterBase.cpp +++ b/src/WriterBase.cpp @@ -196,8 +196,12 @@ void WriterBase::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Bars.cpp b/src/effects/Bars.cpp index a4a72c19..f7219215 100644 --- a/src/effects/Bars.cpp +++ b/src/effects/Bars.cpp @@ -138,8 +138,12 @@ void Bars::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Blur.cpp b/src/effects/Blur.cpp index 6eafc2a1..dbbfbdbf 100644 --- a/src/effects/Blur.cpp +++ b/src/effects/Blur.cpp @@ -275,8 +275,12 @@ void Blur::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Brightness.cpp b/src/effects/Brightness.cpp index 591bce6a..e817a062 100644 --- a/src/effects/Brightness.cpp +++ b/src/effects/Brightness.cpp @@ -129,8 +129,12 @@ void Brightness::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/ChromaKey.cpp b/src/effects/ChromaKey.cpp index 2c3008f2..fe6a2687 100644 --- a/src/effects/ChromaKey.cpp +++ b/src/effects/ChromaKey.cpp @@ -122,8 +122,12 @@ void ChromaKey::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/ColorShift.cpp b/src/effects/ColorShift.cpp index 00300561..e2a72d7e 100644 --- a/src/effects/ColorShift.cpp +++ b/src/effects/ColorShift.cpp @@ -221,8 +221,12 @@ void ColorShift::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Crop.cpp b/src/effects/Crop.cpp index 53953ec2..245307ef 100644 --- a/src/effects/Crop.cpp +++ b/src/effects/Crop.cpp @@ -137,8 +137,12 @@ void Crop::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); @@ -193,4 +197,3 @@ string Crop::PropertiesJSON(int64_t requested_frame) { // Return formatted string return root.toStyledString(); } - diff --git a/src/effects/Deinterlace.cpp b/src/effects/Deinterlace.cpp index bf34d13f..dc35cd9a 100644 --- a/src/effects/Deinterlace.cpp +++ b/src/effects/Deinterlace.cpp @@ -116,8 +116,12 @@ void Deinterlace::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Hue.cpp b/src/effects/Hue.cpp index ae401a8b..4ea3bcd5 100644 --- a/src/effects/Hue.cpp +++ b/src/effects/Hue.cpp @@ -123,8 +123,12 @@ void Hue::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Mask.cpp b/src/effects/Mask.cpp index f8f34ac6..95dd3489 100644 --- a/src/effects/Mask.cpp +++ b/src/effects/Mask.cpp @@ -176,8 +176,12 @@ void Mask::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Negate.cpp b/src/effects/Negate.cpp index 8ff6e0d6..98b79213 100644 --- a/src/effects/Negate.cpp +++ b/src/effects/Negate.cpp @@ -77,8 +77,12 @@ void Negate::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Pixelate.cpp b/src/effects/Pixelate.cpp index 78030283..bad0fa15 100644 --- a/src/effects/Pixelate.cpp +++ b/src/effects/Pixelate.cpp @@ -134,8 +134,12 @@ void Pixelate::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Saturation.cpp b/src/effects/Saturation.cpp index ecb3165f..0393ed0b 100644 --- a/src/effects/Saturation.cpp +++ b/src/effects/Saturation.cpp @@ -134,8 +134,12 @@ void Saturation::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Shift.cpp b/src/effects/Shift.cpp index 80a7b2d7..89ad36d1 100644 --- a/src/effects/Shift.cpp +++ b/src/effects/Shift.cpp @@ -154,8 +154,12 @@ void Shift::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/src/effects/Wave.cpp b/src/effects/Wave.cpp index 0a1c5273..2325213f 100644 --- a/src/effects/Wave.cpp +++ b/src/effects/Wave.cpp @@ -137,8 +137,12 @@ void Wave::SetJson(string value) { // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( value, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + + string errors; + bool success = reader->parse( value.c_str(), + value.c_str() + value.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); diff --git a/tests/Clip_Tests.cpp b/tests/Clip_Tests.cpp index 1134e8ab..0ae00d65 100644 --- a/tests/Clip_Tests.cpp +++ b/tests/Clip_Tests.cpp @@ -110,8 +110,11 @@ TEST(Clip_Properties) // Parse JSON string into JSON objects Json::Value root; - Json::Reader reader; - bool success = reader.parse( properties, root ); + Json::CharReaderBuilder rbuilder; + Json::CharReader* reader(rbuilder.newCharReader()); + string errors; + bool success = reader->parse( properties.c_str(), + properties.c_str() + properties.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); @@ -135,7 +138,8 @@ TEST(Clip_Properties) // Parse JSON string into JSON objects root.clear(); - success = reader.parse( properties, root ); + success = reader->parse( properties.c_str(), + properties.c_str() + properties.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); @@ -159,7 +163,8 @@ TEST(Clip_Properties) // Parse JSON string into JSON objects root.clear(); - success = reader.parse( properties, root ); + success = reader->parse( properties.c_str(), + properties.c_str() + properties.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", ""); @@ -182,7 +187,8 @@ TEST(Clip_Properties) // Parse JSON string into JSON objects root.clear(); - success = reader.parse( properties, root ); + success = reader->parse( properties.c_str(), + properties.c_str() + properties.size(), &root, &errors ); if (!success) // Raise exception throw InvalidJSON("JSON could not be parsed (or is invalid)", "");