Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-08-01 Thread Aruna Matheswaran
On Thu, Aug 1, 2019 at 7:13 PM Nomis101   wrote:

> Am 25.07.19 um 23:58 schrieb Nomis101 :
> > Am 25.07.19 um 06:48 schrieb Aruna Matheswaran:
> >>
> >>
> >> On Wed, Jul 24, 2019 at 9:59 PM Nomis101   nomis...@web.de>> wrote:
> >>
> >> Hi Aruna,
> >>
> >> could you specifiy what kind of errors and warnings you see on
> Windows? I don't have Windows, so I can not test or reproduce.
> >>
> >>
> >> Please find the attached error log.
> >>
> >>
> >>
> >>
> >>
> >> Am 24.07.19 um 16:11 schrieb Aruna Matheswaran:
> >> > The patch applies on default and builds successfully in Mac and
> Linux, but gives build warnings and errors in windows. Could you please fix
> them and resend the patch?
> >>
> >> ___
> >> x265-devel mailing list
> >> x265-devel@videolan.org 
> >> https://mailman.videolan.org/listinfo/x265-devel
> >>
> >>
> >>
> >> --
> >> Regards,
> >> Aruna
> >>
> >> ___
> >> x265-devel mailing list
> >> x265-devel@videolan.org
> >> https://mailman.videolan.org/listinfo/x265-devel
> >>
> >
> >
> > Thanks for the error log. Interestingly, most of the lines the log
> mentions is not touched by my patch. The error messages look to me, like a
> compiler was
> > used which did not fully support C++11. The Microsoft Visual Studio 12.0
> (2013) you used for your test is known to have a limied C++11
> implementation.
> > See:
> https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)
> > For MSVC12 Compatibility I found this issue, which is still open:
> https://github.com/dropbox/json11/issues/2
> > I think the only solution for this kind of errors are to use minimum
> Visual Studio 2015. What do you think? I'm pretty sure it will build on
> Windows with a
> > newer MSVC with full C++11 implementation.
>
>
> > Best, Simon
> > ___
> > x265-devel mailing list
> > x265-devel@videolan.org
> > https://mailman.videolan.org/listinfo/x265-devel
> >
>
>
> As an alternative, I could cherry-pick json11 #92, to at least fix Issue
> #373. I don't know if this will help building on Microsoft Visual Studio
> 12.0, but
> it would not introduce so many new lines.
>

Yes,  the patch builds fine with MSVC15, but setting the minimum required
MSVC version to 15 for HDR10+ isn't recommended at this point. So as you
suggest, please provide the fix for Issue #373; We shall push the fix if it
is compatible with MSVC12.

>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


-- 
Regards,
Aruna
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-08-01 Thread Nomis101 
Am 25.07.19 um 23:58 schrieb Nomis101 :
> Am 25.07.19 um 06:48 schrieb Aruna Matheswaran:
>>
>>
>> On Wed, Jul 24, 2019 at 9:59 PM Nomis101  > > wrote:
>>
>> Hi Aruna,
>>
>> could you specifiy what kind of errors and warnings you see on Windows? 
>> I don't have Windows, so I can not test or reproduce.
>>
>>
>> Please find the attached error log. 
>>
>>
>>
>>
>>
>> Am 24.07.19 um 16:11 schrieb Aruna Matheswaran:
>> > The patch applies on default and builds successfully in Mac and Linux, 
>> but gives build warnings and errors in windows. Could you please fix them 
>> and resend the patch?
>>
>> ___
>> x265-devel mailing list
>> x265-devel@videolan.org 
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>>
>>
>> --
>> Regards,
>> Aruna
>>
>> ___
>> x265-devel mailing list
>> x265-devel@videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
> 
> 
> Thanks for the error log. Interestingly, most of the lines the log mentions 
> is not touched by my patch. The error messages look to me, like a compiler was
> used which did not fully support C++11. The Microsoft Visual Studio 12.0 
> (2013) you used for your test is known to have a limied C++11 implementation.
> See: https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)
> For MSVC12 Compatibility I found this issue, which is still open: 
> https://github.com/dropbox/json11/issues/2
> I think the only solution for this kind of errors are to use minimum Visual 
> Studio 2015. What do you think? I'm pretty sure it will build on Windows with 
> a
> newer MSVC with full C++11 implementation.
> 
> Best, Simon
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
> 


As an alternative, I could cherry-pick json11 #92, to at least fix Issue #373. 
I don't know if this will help building on Microsoft Visual Studio 12.0, but
it would not introduce so many new lines.

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-07-25 Thread Nomis101 
Am 25.07.19 um 06:48 schrieb Aruna Matheswaran:
>
>
> On Wed, Jul 24, 2019 at 9:59 PM Nomis101   > wrote:
>
> Hi Aruna,
>
> could you specifiy what kind of errors and warnings you see on Windows? I 
> don't have Windows, so I can not test or reproduce.
>
>
> Please find the attached error log. 
>
>
>
>
>
> Am 24.07.19 um 16:11 schrieb Aruna Matheswaran:
> > The patch applies on default and builds successfully in Mac and Linux, 
> but gives build warnings and errors in windows. Could you please fix them and 
> resend the patch?
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org 
> https://mailman.videolan.org/listinfo/x265-devel
>
>
>
> --
> Regards,
> Aruna
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


Thanks for the error log. Interestingly, most of the lines the log mentions is 
not touched by my patch. The error messages look to me, like a compiler was
used which did not fully support C++11. The Microsoft Visual Studio 12.0 (2013) 
you used for your test is known to have a limied C++11 implementation.
See: https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)
For MSVC12 Compatibility I found this issue, which is still open: 
https://github.com/dropbox/json11/issues/2
I think the only solution for this kind of errors are to use minimum Visual 
Studio 2015. What do you think? I'm pretty sure it will build on Windows with a
newer MSVC with full C++11 implementation.

Best, Simon
___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-07-24 Thread Aruna Matheswaran
On Wed, Jul 24, 2019 at 9:59 PM Nomis101   wrote:

> Hi Aruna,
>
> could you specifiy what kind of errors and warnings you see on Windows? I
> don't have Windows, so I can not test or reproduce.


Please find the attached error log.

>
>
>
>
> Am 24.07.19 um 16:11 schrieb Aruna Matheswaran:
> > The patch applies on default and builds successfully in Mac and Linux,
> but gives build warnings and errors in windows. Could you please fix them
> and resend the patch?
>
> ___
> x265-devel mailing list
> x265-devel@videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>


-- 
Regards,
Aruna
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(110): error C2228: left of 
'.begin' must have class/struct/union 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>  type is 'add_rvalue_reference<_Ty>::type'
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(110): error C2227: left of 
'->first' must point to class/struct/union/generic type 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(111): error C2228: left of 
'.begin' must have class/struct/union 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>  type is 'add_rvalue_reference<_Ty>::type'
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(111): error C2227: left of 
'->second' must point to class/struct/union/generic type 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>C:\Program Files (x86)\Microsoft Visual Studio 
12.0\VC\include\type_traits(620): error C2139: 'json11::Json' : an undefined 
class is not allowed as an argument to compiler intrinsic type trait 
'__is_constructible' (C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>  c:\x265_clone\source\dynamichdr10\json11\json11.h(79) : see 
declaration of 'json11::Json'
3>  c:\x265_clone\source\dynamichdr10\json11\json11.h(111) : see 
reference to class template instantiation 
'std::is_constructible' being compiled
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(112): error C2039: 'type' : 
is not a member of 'std::enable_if' 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(112): error C4430: missing 
type specifier - int assumed. Note: C++ does not support default-int 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(117): error C2228: left of 
'.begin' must have class/struct/union 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>  type is 'add_rvalue_reference<_Ty>::type'
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(118): error C2039: 'type' : 
is not a member of 'std::enable_if' 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(118): error C4430: missing 
type specifier - int assumed. Note: C++ does not support default-int 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>c:\x265_clone\source\dynamichdr10\json11\json11.h(119): error C2535: 
'json11::Json::Json(const M &)' : member function already defined or declared 
(C:\x265_clone\source\dynamicHDR10\json11\json11.cpp)
3>  c:\x265_clone\source\dynamichdr10\json11\json11.h(113) : see 
declaration of 'json11::Json::Json'
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(171): warning C4512: 
'json11::Value' : assignment operator could not be generated
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(173) : see 
reference to class template instantiation 'json11::Value' being 
compiled
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(180): warning C4512: 
'json11::JsonDouble' : assignment operator could not be generated
4>  motion.cpp
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(173) : see 
declaration of 'json11::JsonDouble'
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(171): warning C4512: 
'json11::Value' : assignment operator could not be generated
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(182) : see 
reference to class template instantiation 'json11::Value' being 
compiled
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(189): warning C4512: 
'json11::JsonInt' : assignment operator could not be generated
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(182) : see 
declaration of 'json11::JsonInt'
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(171): warning C4512: 
'json11::Value' : assignment operator could not be generated
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(191) : see 
reference to class template instantiation 'json11::Value' being 
compiled
3>C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(195): warning C4512: 
'json11::JsonBoolean' : assignment operator could not be generated
3>  C:\x265_clone\source\dynamicHDR10\json11\json11.cpp(191) : see 
declaration of 'json11::JsonBoolean'

Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-07-24 Thread Nomis101 
Hi Aruna,

could you specifiy what kind of errors and warnings you see on Windows? I don't 
have Windows, so I can not test or reproduce.





Am 24.07.19 um 16:11 schrieb Aruna Matheswaran:
> The patch applies on default and builds successfully in Mac and Linux, but 
> gives build warnings and errors in windows. Could you please fix them and 
> resend the patch?

___
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel


Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-07-24 Thread Aruna Matheswaran
On Sat, Apr 13, 2019 at 8:05 PM Nomis101   wrote:

> This is the patch to update json11 to v1.0.0 release against latest
> master. I also included the fix for json11 issue #131.
> Find patch attached.


The patch applies on default and builds successfully in Mac and Linux, but
gives build warnings and errors in windows. Could you please fix them and
resend the patch?

>
>
> # HG changeset patch
> # User Nomis101 
> # Date 1555165564 -7200
> #  Sat Apr 13 16:26:04 2019 +0200
> # Node ID c63e02ef363527e1321142403083ad82a33845eb
> # Parent  768ab38fd5fd104a8d58f42b646d6117d63b2c0a
> Update json11 to v1.0.0 (plus #131 fix) and fix Issue #373.
>
> diff -r 768ab38fd5fd -r c63e02ef3635 source/dynamicHDR10/json11/json11.cpp
> --- a/source/dynamicHDR10/json11/json11.cpp Thu Apr 04 13:35:58 2019
> +0530
> +++ b/source/dynamicHDR10/json11/json11.cpp Sat Apr 13 16:26:04 2019
> +0200
> @@ -21,38 +21,41 @@
>
>  #include "json11.h"
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>
> -#if _MSC_VER
> -#pragma warning(disable: 4510) //const member cannot be default
> initialized
> -#pragma warning(disable: 4512) //assignment operator could not be
> generated
> -#pragma warning(disable: 4610) //const member cannot be default
> initialized
> -#endif
> -
>  namespace json11 {
>
>  static const int max_depth = 200;
>
>  using std::string;
>  using std::vector;
>  using std::map;
>  using std::make_shared;
>  using std::initializer_list;
>  using std::move;
>
> +/* Helper for representing null - just a do-nothing struct, plus
> comparison
> + * operators so the helpers in JsonValue work. We can't use nullptr_t
> because
> + * it may not be orderable.
> + */
> +struct NullStruct {
> +bool operator==(NullStruct) const { return true; }
> +bool operator<(NullStruct) const { return false; }
> +};
> +
>  /* * * * * * * * * * * * * * * * * * * *
>   * Serialization
>   */
>
> -static void dump(std::nullptr_t, string ) {
> +static void dump(NullStruct, string ) {
>  out += "null";
>  }
>
>  static void dump(double value, string ) {
>  if (std::isfinite(value)) {
>  char buf[32];
>  snprintf(buf, sizeof buf, "%.17g", value);
>  out += buf;
> @@ -209,19 +212,19 @@ public:
>  class JsonObject final : public Value {
>  const Json::object _items() const override { return m_value; }
>  const Json & operator[](const string ) const override;
>  public:
>  explicit JsonObject(const Json::object ) : Value(value) {}
>  explicit JsonObject(Json::object &)  : Value(move(value)) {}
>  };
>
> -class JsonNull final : public Value {
> +class JsonNull final : public Value {
>  public:
> -JsonNull() : Value(nullptr) {}
> +JsonNull() : Value({}) {}
>  };
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Static globals - static-init-safe
>   */
>  struct Statics {
>  const std::shared_ptr null = make_shared();
>  const std::shared_ptr t = make_shared(true);
> @@ -292,23 +295,27 @@ const Json & JsonArray::operator[] (size
>  else return m_value[i];
>  }
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Comparison
>   */
>
>  bool Json::operator== (const Json ) const {
> +if (m_ptr == other.m_ptr)
> +return true;
>  if (m_ptr->type() != other.m_ptr->type())
>  return false;
>
>  return m_ptr->equals(other.m_ptr.get());
>  }
>
>  bool Json::operator< (const Json ) const {
> +if (m_ptr == other.m_ptr)
> +return false;
>  if (m_ptr->type() != other.m_ptr->type())
>  return m_ptr->type() < other.m_ptr->type();
>
>  return m_ptr->less(other.m_ptr.get());
>  }
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Parsing
> @@ -376,44 +383,37 @@ struct JsonParser final {
>   *
>   * Advance comments (c-style inline and multiline).
>   */
>  bool consume_comment() {
>bool comment_found = false;
>if (str[i] == '/') {
>  i++;
>  if (i == str.size())
> -  return fail("unexpected end of input inside comment", false);
> +  return fail("unexpected end of input after start of comment",
> false);
>  if (str[i] == '/') { // inline comment
>i++;
> -  if (i == str.size())
> -return fail("unexpected end of input inside inline comment",
> false);
> -  // advance until next line
> -  while (str[i] != '\n') {
> +  // advance until next line, or end of input
> +  while (i < str.size() && str[i] != '\n') {
>  i++;
> -if (i == str.size())
> -  return fail("unexpected end of input inside inline
> comment", false);
>}
>comment_found = true;
>  }
>  else if (str[i] == '*') { // multiline comment
>i++;
>if (i > str.size()-2)
>  return fail("unexpected end of input inside multi-line
> comment", false);
>// advance until closing tokens
>while (!(str[i] == 

Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-04-13 Thread Nomis101 
This is the patch to update json11 to v1.0.0 release against latest master. I 
also included the fix for json11 issue #131.
Find patch attached.



# HG changeset patch
# User Nomis101 
# Date 1555165564 -7200
#  Sat Apr 13 16:26:04 2019 +0200
# Node ID c63e02ef363527e1321142403083ad82a33845eb
# Parent  768ab38fd5fd104a8d58f42b646d6117d63b2c0a
Update json11 to v1.0.0 (plus #131 fix) and fix Issue #373.

diff -r 768ab38fd5fd -r c63e02ef3635 source/dynamicHDR10/json11/json11.cpp
--- a/source/dynamicHDR10/json11/json11.cpp Thu Apr 04 13:35:58 2019 +0530
+++ b/source/dynamicHDR10/json11/json11.cpp Sat Apr 13 16:26:04 2019 +0200
@@ -21,38 +21,41 @@

 #include "json11.h"
 #include 
 #include 
 #include 
 #include 
 #include 

-#if _MSC_VER
-#pragma warning(disable: 4510) //const member cannot be default initialized
-#pragma warning(disable: 4512) //assignment operator could not be generated
-#pragma warning(disable: 4610) //const member cannot be default initialized
-#endif
-
 namespace json11 {

 static const int max_depth = 200;

 using std::string;
 using std::vector;
 using std::map;
 using std::make_shared;
 using std::initializer_list;
 using std::move;

+/* Helper for representing null - just a do-nothing struct, plus comparison
+ * operators so the helpers in JsonValue work. We can't use nullptr_t because
+ * it may not be orderable.
+ */
+struct NullStruct {
+bool operator==(NullStruct) const { return true; }
+bool operator<(NullStruct) const { return false; }
+};
+
 /* * * * * * * * * * * * * * * * * * * *
  * Serialization
  */

-static void dump(std::nullptr_t, string ) {
+static void dump(NullStruct, string ) {
 out += "null";
 }

 static void dump(double value, string ) {
 if (std::isfinite(value)) {
 char buf[32];
 snprintf(buf, sizeof buf, "%.17g", value);
 out += buf;
@@ -209,19 +212,19 @@ public:
 class JsonObject final : public Value {
 const Json::object _items() const override { return m_value; }
 const Json & operator[](const string ) const override;
 public:
 explicit JsonObject(const Json::object ) : Value(value) {}
 explicit JsonObject(Json::object &)  : Value(move(value)) {}
 };

-class JsonNull final : public Value {
+class JsonNull final : public Value {
 public:
-JsonNull() : Value(nullptr) {}
+JsonNull() : Value({}) {}
 };

 /* * * * * * * * * * * * * * * * * * * *
  * Static globals - static-init-safe
  */
 struct Statics {
 const std::shared_ptr null = make_shared();
 const std::shared_ptr t = make_shared(true);
@@ -292,23 +295,27 @@ const Json & JsonArray::operator[] (size
 else return m_value[i];
 }

 /* * * * * * * * * * * * * * * * * * * *
  * Comparison
  */

 bool Json::operator== (const Json ) const {
+if (m_ptr == other.m_ptr)
+return true;
 if (m_ptr->type() != other.m_ptr->type())
 return false;

 return m_ptr->equals(other.m_ptr.get());
 }

 bool Json::operator< (const Json ) const {
+if (m_ptr == other.m_ptr)
+return false;
 if (m_ptr->type() != other.m_ptr->type())
 return m_ptr->type() < other.m_ptr->type();

 return m_ptr->less(other.m_ptr.get());
 }

 /* * * * * * * * * * * * * * * * * * * *
  * Parsing
@@ -376,44 +383,37 @@ struct JsonParser final {
  *
  * Advance comments (c-style inline and multiline).
  */
 bool consume_comment() {
   bool comment_found = false;
   if (str[i] == '/') {
 i++;
 if (i == str.size())
-  return fail("unexpected end of input inside comment", false);
+  return fail("unexpected end of input after start of comment", false);
 if (str[i] == '/') { // inline comment
   i++;
-  if (i == str.size())
-return fail("unexpected end of input inside inline comment", 
false);
-  // advance until next line
-  while (str[i] != '\n') {
+  // advance until next line, or end of input
+  while (i < str.size() && str[i] != '\n') {
 i++;
-if (i == str.size())
-  return fail("unexpected end of input inside inline comment", 
false);
   }
   comment_found = true;
 }
 else if (str[i] == '*') { // multiline comment
   i++;
   if (i > str.size()-2)
 return fail("unexpected end of input inside multi-line comment", 
false);
   // advance until closing tokens
   while (!(str[i] == '*' && str[i+1] == '/')) {
 i++;
 if (i > str.size()-2)
   return fail(
 "unexpected end of input inside multi-line comment", false);
   }
   i += 2;
-  if (i == str.size())
-return fail(
-  "unexpected end of input inside multi-line comment", false);
   comment_found = true;
 }
 else
   return fail("malformed comment", false);
   }
   return comment_found;
 }

@@ 

Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-03-28 Thread Nomis101 

Is there something wrong with my patch? If there is still something that
hinders to accept the patch from Feb 15, please tell me.



Am 15.02.19 um 17:21 schrieb Nomis101 :

# HG changeset patch
# User Nomis101 
# Date 1550247153 -3600
#  Fri Feb 15 17:12:33 2019 +0100
# Node ID f5e1822cce4cc43d9cfd1c7fcb4204ce34f0a2cf
# Parent  dcbec33bfb0f1cabdb1ff9eaadba5305ba23e6fa
Update json11 to v1.0.0 release

diff -r dcbec33bfb0f -r f5e1822cce4c source/dynamicHDR10/json11/json11.cpp
--- a/source/dynamicHDR10/json11/json11.cpp Fri Feb 08 16:02:53 2019 +0530
+++ b/source/dynamicHDR10/json11/json11.cpp Fri Feb 15 17:12:33 2019 +0100
@@ -21,38 +21,41 @@

  #include "json11.h"
  #include 
  #include 
  #include 
  #include 
  #include 

-#if _MSC_VER
-#pragma warning(disable: 4510) //const member cannot be default initialized
-#pragma warning(disable: 4512) //assignment operator could not be generated
-#pragma warning(disable: 4610) //const member cannot be default initialized
-#endif
-
  namespace json11 {

  static const int max_depth = 200;

  using std::string;
  using std::vector;
  using std::map;
  using std::make_shared;
  using std::initializer_list;
  using std::move;

+/* Helper for representing null - just a do-nothing struct, plus comparison
+ * operators so the helpers in JsonValue work. We can't use nullptr_t
because
+ * it may not be orderable.
+ */
+struct NullStruct {
+bool operator==(NullStruct) const { return true; }
+bool operator<(NullStruct) const { return false; }
+};
+
  /* * * * * * * * * * * * * * * * * * * *
   * Serialization
   */

-static void dump(std::nullptr_t, string ) {
+static void dump(NullStruct, string ) {
  out += "null";
  }

  static void dump(double value, string ) {
  if (std::isfinite(value)) {
  char buf[32];
  snprintf(buf, sizeof buf, "%.17g", value);
  out += buf;
@@ -209,19 +212,19 @@ public:
  class JsonObject final : public Value {
  const Json::object _items() const override { return m_value; }
  const Json & operator[](const string ) const override;
  public:
  explicit JsonObject(const Json::object ) : Value(value) {}
  explicit JsonObject(Json::object &)  : Value(move(value)) {}
  };

-class JsonNull final : public Value {
+class JsonNull final : public Value {
  public:
-JsonNull() : Value(nullptr) {}
+JsonNull() : Value({}) {}
  };

  /* * * * * * * * * * * * * * * * * * * *
   * Static globals - static-init-safe
   */
  struct Statics {
  const std::shared_ptr null = make_shared();
  const std::shared_ptr t = make_shared(true);
@@ -292,23 +295,27 @@ const Json & JsonArray::operator[] (size
  else return m_value[i];
  }

  /* * * * * * * * * * * * * * * * * * * *
   * Comparison
   */

  bool Json::operator== (const Json ) const {
+if (m_ptr == other.m_ptr)
+return true;
  if (m_ptr->type() != other.m_ptr->type())
  return false;

  return m_ptr->equals(other.m_ptr.get());
  }

  bool Json::operator< (const Json ) const {
+if (m_ptr == other.m_ptr)
+return false;
  if (m_ptr->type() != other.m_ptr->type())
  return m_ptr->type() < other.m_ptr->type();

  return m_ptr->less(other.m_ptr.get());
  }

  /* * * * * * * * * * * * * * * * * * * *
   * Parsing
@@ -376,44 +383,37 @@ struct JsonParser final {
   *
   * Advance comments (c-style inline and multiline).
   */
  bool consume_comment() {
bool comment_found = false;
if (str[i] == '/') {
  i++;
  if (i == str.size())
-  return fail("unexpected end of input inside comment", false);
+  return fail("unexpected end of input after start of comment",
false);
  if (str[i] == '/') { // inline comment
i++;
-  if (i == str.size())
-return fail("unexpected end of input inside inline
comment", false);
-  // advance until next line
-  while (str[i] != '\n') {
+  // advance until next line, or end of input
+  while (i < str.size() && str[i] != '\n') {
  i++;
-if (i == str.size())
-  return fail("unexpected end of input inside inline
comment", false);
}
comment_found = true;
  }
  else if (str[i] == '*') { // multiline comment
i++;
if (i > str.size()-2)
  return fail("unexpected end of input inside multi-line
comment", false);
// advance until closing tokens
while (!(str[i] == '*' && str[i+1] == '/')) {
  i++;
  if (i > str.size()-2)
return fail(
  "unexpected end of input inside multi-line comment",
false);
}
i += 2;
-  if (i == str.size())
-return fail(
-  "unexpected end of input inside multi-line comment", false);
comment_found = true;
  }
  else
return 

Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-02-15 Thread Nomis101 
# HG changeset patch
# User Nomis101 
# Date 1550247153 -3600
#  Fri Feb 15 17:12:33 2019 +0100
# Node ID f5e1822cce4cc43d9cfd1c7fcb4204ce34f0a2cf
# Parent  dcbec33bfb0f1cabdb1ff9eaadba5305ba23e6fa
Update json11 to v1.0.0 release

diff -r dcbec33bfb0f -r f5e1822cce4c source/dynamicHDR10/json11/json11.cpp
--- a/source/dynamicHDR10/json11/json11.cpp Fri Feb 08 16:02:53 2019 +0530
+++ b/source/dynamicHDR10/json11/json11.cpp Fri Feb 15 17:12:33 2019 +0100
@@ -21,38 +21,41 @@

 #include "json11.h"
 #include 
 #include 
 #include 
 #include 
 #include 

-#if _MSC_VER
-#pragma warning(disable: 4510) //const member cannot be default initialized
-#pragma warning(disable: 4512) //assignment operator could not be generated
-#pragma warning(disable: 4610) //const member cannot be default initialized
-#endif
-
 namespace json11 {

 static const int max_depth = 200;

 using std::string;
 using std::vector;
 using std::map;
 using std::make_shared;
 using std::initializer_list;
 using std::move;

+/* Helper for representing null - just a do-nothing struct, plus comparison
+ * operators so the helpers in JsonValue work. We can't use nullptr_t
because
+ * it may not be orderable.
+ */
+struct NullStruct {
+bool operator==(NullStruct) const { return true; }
+bool operator<(NullStruct) const { return false; }
+};
+
 /* * * * * * * * * * * * * * * * * * * *
  * Serialization
  */

-static void dump(std::nullptr_t, string ) {
+static void dump(NullStruct, string ) {
 out += "null";
 }

 static void dump(double value, string ) {
 if (std::isfinite(value)) {
 char buf[32];
 snprintf(buf, sizeof buf, "%.17g", value);
 out += buf;
@@ -209,19 +212,19 @@ public:
 class JsonObject final : public Value {
 const Json::object _items() const override { return m_value; }
 const Json & operator[](const string ) const override;
 public:
 explicit JsonObject(const Json::object ) : Value(value) {}
 explicit JsonObject(Json::object &)  : Value(move(value)) {}
 };

-class JsonNull final : public Value {
+class JsonNull final : public Value {
 public:
-JsonNull() : Value(nullptr) {}
+JsonNull() : Value({}) {}
 };

 /* * * * * * * * * * * * * * * * * * * *
  * Static globals - static-init-safe
  */
 struct Statics {
 const std::shared_ptr null = make_shared();
 const std::shared_ptr t = make_shared(true);
@@ -292,23 +295,27 @@ const Json & JsonArray::operator[] (size
 else return m_value[i];
 }

 /* * * * * * * * * * * * * * * * * * * *
  * Comparison
  */

 bool Json::operator== (const Json ) const {
+if (m_ptr == other.m_ptr)
+return true;
 if (m_ptr->type() != other.m_ptr->type())
 return false;

 return m_ptr->equals(other.m_ptr.get());
 }

 bool Json::operator< (const Json ) const {
+if (m_ptr == other.m_ptr)
+return false;
 if (m_ptr->type() != other.m_ptr->type())
 return m_ptr->type() < other.m_ptr->type();

 return m_ptr->less(other.m_ptr.get());
 }

 /* * * * * * * * * * * * * * * * * * * *
  * Parsing
@@ -376,44 +383,37 @@ struct JsonParser final {
  *
  * Advance comments (c-style inline and multiline).
  */
 bool consume_comment() {
   bool comment_found = false;
   if (str[i] == '/') {
 i++;
 if (i == str.size())
-  return fail("unexpected end of input inside comment", false);
+  return fail("unexpected end of input after start of comment",
false);
 if (str[i] == '/') { // inline comment
   i++;
-  if (i == str.size())
-return fail("unexpected end of input inside inline
comment", false);
-  // advance until next line
-  while (str[i] != '\n') {
+  // advance until next line, or end of input
+  while (i < str.size() && str[i] != '\n') {
 i++;
-if (i == str.size())
-  return fail("unexpected end of input inside inline
comment", false);
   }
   comment_found = true;
 }
 else if (str[i] == '*') { // multiline comment
   i++;
   if (i > str.size()-2)
 return fail("unexpected end of input inside multi-line
comment", false);
   // advance until closing tokens
   while (!(str[i] == '*' && str[i+1] == '/')) {
 i++;
 if (i > str.size()-2)
   return fail(
 "unexpected end of input inside multi-line comment",
false);
   }
   i += 2;
-  if (i == str.size())
-return fail(
-  "unexpected end of input inside multi-line comment", false);
   comment_found = true;
 }
 else
   return fail("malformed comment", false);
   }
   return comment_found;
 }

@@ -422,31 +422,33 @@ struct JsonParser final {
  * Advance until the current character is non-whitespace and
non-comment.
  */
 void consume_garbage() {
   

Re: [x265] [PATCH] Update json11 to v1.0.0 release

2019-02-15 Thread Pradeep Ramachandran
On Sat, Jan 26, 2019 at 6:35 PM Nomis101   wrote:

> # HG changeset patch
> # User Nomis101 
> # Date 1548440484 -3600
> #  Fri Jan 25 19:21:24 2019 +0100
> # Node ID 0ed9b73b07b21ffdd0d5c12ab7c2ac782ce4c3c9
> # Parent  ae085e5cd8a2cdb161eb5bf54ba9019c3d873506
> Update json11 to v1.0.0 release
>
> This will fix Issue #373 (and maybe some other issues too).
>

I am not able to apply this on the latest tip of x265. Can you please make
it  applicable and send the patch inline and as an attachment (mail clients
tends to screw things over at times!)?


> diff --git a/source/dynamicHDR10/json11/json11.cpp
> b/source/dynamicHDR10/json11/json11.cpp
> --- a/source/dynamicHDR10/json11/json11.cpp
> +++ b/source/dynamicHDR10/json11/json11.cpp
> @@ -21,38 +21,41 @@
>
>  #include "json11.h"
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>
> -#if _MSC_VER
> -#pragma warning(disable: 4510) //const member cannot be default
> initialized
> -#pragma warning(disable: 4512) //assignment operator could not be
> generated
> -#pragma warning(disable: 4610) //const member cannot be default
> initialized
> -#endif
> -
>  namespace json11 {
>
>  static const int max_depth = 200;
>
>  using std::string;
>  using std::vector;
>  using std::map;
>  using std::make_shared;
>  using std::initializer_list;
>  using std::move;
>
> +/* Helper for representing null - just a do-nothing struct, plus
> comparison
> + * operators so the helpers in JsonValue work. We can't use nullptr_t
> because
> + * it may not be orderable.
> + */
> +struct NullStruct {
> +bool operator==(NullStruct) const { return true; }
> +bool operator<(NullStruct) const { return false; }
> +};
> +
>  /* * * * * * * * * * * * * * * * * * * *
>   * Serialization
>   */
>
> -static void dump(std::nullptr_t, string ) {
> +static void dump(NullStruct, string ) {
>  out += "null";
>  }
>
>  static void dump(double value, string ) {
>  if (std::isfinite(value)) {
>  char buf[32];
>  snprintf(buf, sizeof buf, "%.17g", value);
>  out += buf;
> @@ -209,19 +212,19 @@ public:
>  class JsonObject final : public Value {
>  const Json::object _items() const override { return m_value; }
>  const Json & operator[](const string ) const override;
>  public:
>  explicit JsonObject(const Json::object ) : Value(value) {}
>  explicit JsonObject(Json::object &)  : Value(move(value)) {}
>  };
>
> -class JsonNull final : public Value {
> +class JsonNull final : public Value {
>  public:
> -JsonNull() : Value(nullptr) {}
> +JsonNull() : Value({}) {}
>  };
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Static globals - static-init-safe
>   */
>  struct Statics {
>  const std::shared_ptr null = make_shared();
>  const std::shared_ptr t = make_shared(true);
> @@ -292,23 +295,27 @@ const Json & JsonArray::operator[] (size
>  else return m_value[i];
>  }
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Comparison
>   */
>
>  bool Json::operator== (const Json ) const {
> +if (m_ptr == other.m_ptr)
> +return true;
>  if (m_ptr->type() != other.m_ptr->type())
>  return false;
>
>  return m_ptr->equals(other.m_ptr.get());
>  }
>
>  bool Json::operator< (const Json ) const {
> +if (m_ptr == other.m_ptr)
> +return false;
>  if (m_ptr->type() != other.m_ptr->type())
>  return m_ptr->type() < other.m_ptr->type();
>
>  return m_ptr->less(other.m_ptr.get());
>  }
>
>  /* * * * * * * * * * * * * * * * * * * *
>   * Parsing
> @@ -376,44 +383,37 @@ struct JsonParser final {
>   *
>   * Advance comments (c-style inline and multiline).
>   */
>  bool consume_comment() {
>bool comment_found = false;
>if (str[i] == '/') {
>  i++;
>  if (i == str.size())
> -  return fail("unexpected end of input inside comment", false);
> +  return fail("unexpected end of input after start of comment",
> false);
>  if (str[i] == '/') { // inline comment
>i++;
> -  if (i == str.size())
> -return fail("unexpected end of input inside inline
> comment", false);
> -  // advance until next line
> -  while (str[i] != '\n') {
> +  // advance until next line, or end of input
> +  while (i < str.size() && str[i] != '\n') {
>  i++;
> -if (i == str.size())
> -  return fail("unexpected end of input inside inline
> comment", false);
>}
>comment_found = true;
>  }
>  else if (str[i] == '*') { // multiline comment
>i++;
>if (i > str.size()-2)
>  return fail("unexpected end of input inside multi-line
> comment", false);
>// advance until closing tokens
>while (!(str[i] == '*' && str[i+1] == '/')) {
>  i++;
>  if (i > str.size()-2)
>return fail(
>  "unexpected end of