[lierolibre] 03/04: Update libconfig++ patch with cleaner version

Martin Werner arand-guest at moszumanska.debian.org
Tue Aug 18 21:41:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

arand-guest pushed a commit to branch master
in repository lierolibre.

commit 97628f0664f7df52622f837bff31d72289968e08
Author: Martin Erik Werner <martinerikwerner at gmail.com>
Date:   Tue Aug 18 22:07:35 2015 +0200

    Update libconfig++ patch with cleaner version
---
 debian/changelog                                   |  7 +-
 ...c-string.patch => adapt-to-new-libconfig.patch} | 89 +++++++++-------------
 debian/patches/series                              |  2 +-
 3 files changed, 39 insertions(+), 59 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8000fc3..928ca20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,10 +4,11 @@ lierolibre (0.5-2) UNRELEASED; urgency=low
   * Handle hurd/kfreebsd as linux. Fixes build there
 
   [ Martin Erik Werner ]
-  * Add upstream patch to fix string conversion with new libstdc++6 cxx11 and
-    libconfig++9v5
-    - debian/patches/fix-conversion-of-basic-string-to-c-string.patch
+  * Add patch to adapt to libconfig++9v5 (Closes: #795437)
+    - debian/patches/adapt-to-new-libconfig.patch
+    - Thanks to Simon McVittie for large parts of this patch
   * Add upstream patches for building on other archs than x86 and x86_64
+    (Closes: #790363)
     - debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch
     - debian/patches/0002-At-least-try-building-for-other-archs-than-x86.patch
     - debian/patches/0003-Remove-unknown-arch-warning.patch
diff --git a/debian/patches/fix-conversion-of-basic-string-to-c-string.patch b/debian/patches/adapt-to-new-libconfig.patch
similarity index 71%
rename from debian/patches/fix-conversion-of-basic-string-to-c-string.patch
rename to debian/patches/adapt-to-new-libconfig.patch
index 21cc5b8..83913b4 100644
--- a/debian/patches/fix-conversion-of-basic-string-to-c-string.patch
+++ b/debian/patches/adapt-to-new-libconfig.patch
@@ -1,22 +1,20 @@
-From b9cc6f96a13e24bc219b9f493792f6de44fd206b Mon Sep 17 00:00:00 2001
+From b27e3604aa6bfbfcc50db1000b394d06c87ae2f2 Mon Sep 17 00:00:00 2001
 From: Martin Erik Werner <martinerikwerner at gmail.com>
 Date: Mon, 17 Aug 2015 15:54:53 +0200
-Subject: [PATCH] Fix conversion of basic string to c string
+Subject: [PATCH] Adapt to new libconfig++
 
-An ABI bump in libstdc++6 presumably made it so that
-operator[](const char*) does not accept std::__cxx11::basic_string<char>
-as an argument, so solve this by explicitly converting the result via
-c_str() everywhere.
+The new libconfig++ have removed operator[](const std::string &), so use
+const char* instead via c_str().
 
-This also required some odd messing with templates in order to
-specialise them for the conversion.
+Thanks to Simon McVittie for preparing a patch, which intially went
+unnoticed, but eventually helped in creating the final result here.
 ---
  src/common.cpp       | 12 ++++++------
  src/configCompat.cpp |  6 +++---
- src/configHelper.cpp | 36 ++++++++++++++++++++++++++++--------
- src/configHelper.hpp |  2 ++
+ src/configHelper.cpp | 14 +++++---------
  src/constants.cpp    |  6 +++---
- 5 files changed, 42 insertions(+), 20 deletions(-)
+ src/gfx/palette.cpp  |  6 +++---
+ 5 files changed, 20 insertions(+), 24 deletions(-)
 
 diff --git a/src/common.cpp b/src/common.cpp
 index 2d6ada5..4942b05 100644
@@ -95,10 +93,10 @@ index 1aeb262..a72c40f 100644
  }
  
 diff --git a/src/configHelper.cpp b/src/configHelper.cpp
-index fcd1f3f..fd74f0c 100644
+index fcd1f3f..a63bddc 100644
 --- a/src/configHelper.cpp
 +++ b/src/configHelper.cpp
-@@ -54,15 +54,35 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &
+@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &
  
  template Uint8 ConfigHelper::getValue<Uint8, const Setting, char const*>(const Setting &node, char const* index);
  
@@ -110,34 +108,11 @@ index fcd1f3f..fd74f0c 100644
  template Uint8 ConfigHelper::getValue<Uint8, Setting, char const*>(Setting &node, char const* index);
  
 -template Uint8 ConfigHelper::getValue<Uint8, Setting, string>(Setting &node, string index);
-+// This needs to be specific since string must be manually cast to const char*
-+template<>
-+Uint8 ConfigHelper::getValue(const Setting &node, string index)
-+{
-+	int value = node[index.c_str()];
-+	if(value <= numeric_limits<Uint8>::max() && value >= numeric_limits<Uint8>::min())
-+	{
-+		return static_cast<Uint8>(value);
-+	} else {
-+		throw overflow_error("Config value is too big");
-+	}
-+}
- 
-+template<>
-+Uint8 ConfigHelper::getValue(Setting &node, string index)
-+{
-+	int value = node[index.c_str()];
-+	if(value <= numeric_limits<Uint8>::max() && value >= numeric_limits<Uint8>::min())
-+	{
-+		return static_cast<Uint8>(value);
-+	} else {
-+		throw overflow_error("Config value is too big");
-+	}
-+}
+-
  
  // Since we still need specialisation per value type (Setting::Type),
  // no need to templateify these
-@@ -72,7 +92,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
+@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
  	{
  		node.add(variable, Setting::TypeString) = value;
  	} else {
@@ -146,7 +121,7 @@ index fcd1f3f..fd74f0c 100644
  		var = value;
  	}
  }
-@@ -83,7 +103,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
+@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
  	{
  		node.add(variable, Setting::TypeInt) = value;
  	} else {
@@ -155,7 +130,7 @@ index fcd1f3f..fd74f0c 100644
  		var = value;
  	}
  }
-@@ -94,7 +114,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
+@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
  	{
  		node.add(variable, Setting::TypeInt) = value;
  	} else {
@@ -164,7 +139,7 @@ index fcd1f3f..fd74f0c 100644
  		var = value;
  	}
  }
-@@ -105,7 +125,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
+@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
  	{
  		node.add(variable, Setting::TypeBoolean) = value;
  	} else {
@@ -173,7 +148,7 @@ index fcd1f3f..fd74f0c 100644
  		var = value;
  	}
  }
-@@ -135,6 +155,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
+@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
  	{
  		node.add(groupName, Setting::TypeGroup);
  	}
@@ -181,19 +156,6 @@ index fcd1f3f..fd74f0c 100644
 +	return node[groupName.c_str()];
  }
  
-diff --git a/src/configHelper.hpp b/src/configHelper.hpp
-index 6c4ba33..b7bd343 100644
---- a/src/configHelper.hpp
-+++ b/src/configHelper.hpp
-@@ -37,6 +37,8 @@ class ConfigHelper
- public:
- 	void putVersion(libconfig::Setting &node, int version);
- 
-+	unsigned char getValue(const libconfig::Setting &node, std::string index);
-+	unsigned char getValue(libconfig::Setting &node, std::string index);
- 	template<typename Dest, typename Node, typename Idx>
- 	Dest getValue(Node &node, Idx index);
- 
 diff --git a/src/constants.cpp b/src/constants.cpp
 index 7fced6a..cf7bbfc 100644
 --- a/src/constants.cpp
@@ -221,6 +183,23 @@ index 7fced6a..cf7bbfc 100644
  	}
  }
  
+diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp
+index 3fd08c4..3d3bf22 100644
+--- a/src/gfx/palette.cpp
++++ b/src/gfx/palette.cpp
+@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath)
+ 
+ 	for(int i = 0; i < 256; ++i)
+ 	{
+-		entries[i].r = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "r");
+-		entries[i].g = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "g");
+-		entries[i].b = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "b");
++		entries[i].r = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "r").c_str());
++		entries[i].g = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "g").c_str());
++		entries[i].b = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "b").c_str());
+ 	}
+ }
+ 
 -- 
 2.4.6
 
diff --git a/debian/patches/series b/debian/patches/series
index 66ec740..1d0869c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,5 @@
 kfreebsd.patch
-fix-conversion-of-basic-string-to-c-string.patch
+adapt-to-new-libconfig.patch
 0001-Use-unaligned-access-define-over-checking-arch.patch
 0002-At-least-try-building-for-other-archs-than-x86.patch
 0003-Remove-unknown-arch-warning.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/lierolibre.git



More information about the Pkg-games-commits mailing list