Use std::stoll to convert JSON values

This commit is contained in:
FeRD (Frank Dana)
2019-08-10 11:31:08 -04:00
parent e95d18476c
commit 141e6ba61e
6 changed files with 9 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ void ChunkReader::load_json()
info.has_video = root["has_video"].asBool();
info.has_audio = root["has_audio"].asBool();
info.duration = root["duration"].asDouble();
info.file_size = atoll(root["file_size"].asString().c_str());
info.file_size = std::stoll(root["file_size"].asString());
info.height = root["height"].asInt();
info.width = root["width"].asInt();
info.pixel_format = root["pixel_format"].asInt();
@@ -106,7 +106,7 @@ void ChunkReader::load_json()
info.display_ratio.num = root["display_ratio"]["num"].asInt();
info.display_ratio.den = root["display_ratio"]["den"].asInt();
info.vcodec = root["vcodec"].asString();
info.video_length = atoll(root["video_length"].asString().c_str());
info.video_length = std::stoll(root["video_length"].asString());
info.video_stream_index = root["video_stream_index"].asInt();
info.video_timebase.num = root["video_timebase"]["num"].asInt();
info.video_timebase.den = root["video_timebase"]["den"].asInt();
@@ -316,7 +316,7 @@ void ChunkReader::SetJsonValue(Json::Value root) {
if (!root["path"].isNull())
path = root["path"].asString();
if (!root["chunk_size"].isNull())
chunk_size = atoll(root["chunk_size"].asString().c_str());
chunk_size = std::stoll(root["chunk_size"].asString());
if (!root["chunk_version"].isNull())
version = (ChunkVersion) root["chunk_version"].asInt();