<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 16, 2018 at 1:51 PM,  <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1518761459 -19800<br>
#      Fri Feb 16 11:40:59 2018 +0530<br>
# Node ID d50bb9bf0ab29a5f15df83db1527b5<wbr>337f2da9c1<br>
# Parent  a92fd62210b87f112f5fe087ede1a0<wbr>e8f0eb8027<br>
dhdr: Skip comments in the json file while parsing it.<br>
<br>
Comments of the type /* */ OR // are ignored.<br>
<br>
diff -r a92fd62210b8 -r d50bb9bf0ab2 source/dynamicHDR10/<wbr>JsonHelper.cpp<br>
--- a/source/dynamicHDR10/<wbr>JsonHelper.cpp        Fri Feb 16 11:37:45 2018 +0530<br>
+++ b/source/dynamicHDR10/<wbr>JsonHelper.cpp        Fri Feb 16 11:40:59 2018 +0530<br>
@@ -139,21 +139,13 @@<br>
         return JsonObject();<br>
     }<br>
<br>
-    ifstream tfile;<br>
-    string json_str;<br>
-    string json_str2;<br>
+    std::ifstream ifs(path);<br>
+    const std::string json_str2((std::istreambuf_<wbr>iterator<char>(ifs)),<br>
+                                (std::istreambuf_iterator<<wbr>char>()));<br>
+<br>
     string err = "";<br>
-    tfile.open(path);<br>
-    while(tfile)<br>
-    {<br>
-        std::getline(tfile, json_str);<br>
-        json_str2.append(json_str);<br>
-    }<br>
<br>
-    tfile.close();<br>
-    size_t beginning = json_str2.find_first_of("{");<br>
-    int fixchar = json_str2[json_str2.size() - 2] == '}' ? 1 : 0;<br>
-    return Json::parse(json_str2.substr(<wbr>beginning,json_str2.size() - fixchar),err).object_items();<br>
+    return Json::parse(json_str2,err, JsonParse::COMMENTS).object_<wbr>items();<br>
 }<br>
<br>
 JsonArray JsonHelper::readJsonArray(<wbr>const string &path)<br>
@@ -174,28 +166,13 @@<br>
         return JsonArray();<br>
     }<br>
<br>
-    ifstream tfile;<br>
-    string json_str;<br>
-    string json_str2;<br>
+    std::ifstream ifs(path);<br>
+    const std::string json_str2((std::istreambuf_<wbr>iterator<char>(ifs)),<br>
+                                (std::istreambuf_iterator<<wbr>char>()));<br>
+<br>
     string err = "";<br>
-    tfile.open(path);<br>
-    while(tfile)<br>
-    {<br>
-        std::getline(tfile, json_str);<br>
-        json_str2.append(json_str);<br>
-    }<br>
<br>
-    tfile.close();<br>
-<br>
-    vector<Json> data;<br>
-    if (json_str2.size() != 0)<br>
-    {<br>
-        size_t beginning = json_str2.find_first_of("[");<br>
-        int fixchar = json_str2[json_str2.size() - 2] == ']' ? 1 : 0;<br>
-        return Json::parse(json_str2.substr(<wbr>beginning, json_str2.size() - fixchar), err).array_items();<br>
-    }<br>
-    else<br>
-        return data;<br>
+    return Json::parse(json_str2,err, JsonParse::COMMENTS).array_<wbr>items();<br>
 }<br>
<br>
 bool JsonHelper::<wbr>validatePathExtension(string &path)<br>
<br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Pushed.</div></div>