mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
cmInstrumentation: Use cmJSONState to read snippet files
This approach will be more portable.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include <cm/string_view>
|
||||
#include <cmext/algorithm>
|
||||
|
||||
#include <cm3p/json/reader.h>
|
||||
#include <cm3p/json/version.h>
|
||||
#include <cm3p/json/writer.h>
|
||||
#include <cm3p/uv.h>
|
||||
@@ -537,22 +536,16 @@ void cmInstrumentation::InsertTimingData(
|
||||
|
||||
Json::Value cmInstrumentation::ReadJsonSnippet(std::string const& file_name)
|
||||
{
|
||||
Json::CharReaderBuilder builder;
|
||||
builder["collectComments"] = false;
|
||||
cmsys::ifstream ftmp(
|
||||
cmStrCat(this->timingDirv1, "/data/", file_name).c_str());
|
||||
Json::Value snippetData;
|
||||
builder["collectComments"] = false;
|
||||
|
||||
if (!Json::parseFromStream(builder, ftmp, &snippetData, nullptr)) {
|
||||
std::string snippetPath = cmStrCat(this->timingDirv1, "/data/", file_name);
|
||||
cmJSONState parseState(snippetPath, &snippetData);
|
||||
if (!parseState.errors.empty()) {
|
||||
#if JSONCPP_VERSION_HEXA < 0x01070300
|
||||
snippetData = Json::Value::null;
|
||||
#else
|
||||
snippetData = Json::Value::nullSingleton();
|
||||
#endif
|
||||
}
|
||||
|
||||
ftmp.close();
|
||||
return snippetData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user