[x265] [PATCH] Fix for Issue #373

Nomis101 🐝 Nomis101 at web.de
Thu Aug 1 23:19:21 CEST 2019


This is cherry-picked from "Update json11 to v1.0.0 release" and just fixes Issue #373. I checked that it builds on macOS Mojave with hdr10plus enabled.
Find patch attached.






# HG changeset patch
# User Nomis101 <Nomis101 at web.de>
# Date 1564692921 -7200
#      Do Aug 01 22:55:21 2019 +0200
# Node ID 28e4787b2a438200da0ff38d4d171d14fb6b82fc
# Parent  459d3822c608948d9c15322b770f7f9b7e2a233e
fix Issue #373

diff -r 459d3822c608 -r 28e4787b2a43 source/dynamicHDR10/json11/json11.cpp
--- a/source/dynamicHDR10/json11/json11.cpp	Fr Jul 26 10:53:09 2019 +0530
+++ b/source/dynamicHDR10/json11/json11.cpp	Do Aug 01 22:55:21 2019 +0200
@@ -38,21 +38,30 @@ 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 &out) {
+static void dump(NullStruct, string &out) {
     out += "null";
 }

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

-class JsonNull final : public Value<Json::NUL, std::nullptr_t> {
+class JsonNull final : public Value<Json::NUL, NullStruct> {
 public:
-    JsonNull() : Value(nullptr) {}
+    JsonNull() : Value({}) {}
 };

 /* * * * * * * * * * * * * * * * * * * *
  * Static globals - static-init-safe
  */
 struct Statics {
     const std::shared_ptr<JsonValue> null = make_shared<JsonNull>();
     const std::shared_ptr<JsonValue> t = make_shared<JsonBoolean>(true);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.bin
Type: application/macbinary
Size: 2224 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20190801/7787e6f2/attachment-0001.bin>


More information about the x265-devel mailing list