[gdl] Fixup string usage

Orion Poplawski orion at fedoraproject.org
Thu Aug 18 19:24:38 UTC 2011


commit 0b059af847ad8378aaf2c8732c9245c07775f0a4
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Thu Aug 18 13:24:26 2011 -0600

    Fixup string usage

 gdl-includes.patch |   10 ----------
 gdl-string.patch   |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdl.spec           |    8 ++++----
 3 files changed, 55 insertions(+), 14 deletions(-)
---
diff --git a/gdl-string.patch b/gdl-string.patch
new file mode 100644
index 0000000..0525a6e
--- /dev/null
+++ b/gdl-string.patch
@@ -0,0 +1,51 @@
+diff -up gdl-0.9.1/src/gdlgstream.cpp.includes gdl-0.9.1/src/gdlgstream.cpp
+--- gdl-0.9.1/src/gdlgstream.cpp.includes	2010-11-17 00:24:55.000000000 -0700
++++ gdl-0.9.1/src/gdlgstream.cpp	2011-08-18 13:17:08.547167104 -0600
+@@ -201,7 +201,7 @@ const char * GDLGStream::TranslateFormat
+   // skip conversion if the string is empty
+   if (len == 0) return in;
+ 
+-  const string fonts[] = {
++  const std::string fonts[] = {
+     "#fn",      // !0  : unused
+     "#fn",      // !1  : unused
+     "#fn",      // !2  : unused
+@@ -240,7 +240,7 @@ const char * GDLGStream::TranslateFormat
+   int curr_lev = 0; // (incremented with #u, decremented with #d)
+   int curr_pos = 0; // (current position in string)
+   int save_pos = 0; // (position in string used in !S/!R save/restore)
+-  string out = string("");
++  std::string out = std::string("");
+ 
+   for (size_t i = 0; i < len; i++) {
+     if (in[i] == '!' && in[i + 1] != '!')
+diff -up gdl-0.9.1/src/gdlgstream.hpp.includes gdl-0.9.1/src/gdlgstream.hpp
+--- gdl-0.9.1/src/gdlgstream.hpp.includes	2010-06-11 09:09:51.000000000 -0600
++++ gdl-0.9.1/src/gdlgstream.hpp	2011-08-18 13:10:41.285235153 -0600
+@@ -50,7 +50,7 @@ public:
+   {
+ //   std::cerr << "GDLGStream()" << std::endl;
+     if (!checkPlplotDriver(driver))
+-      ThrowGDLException(string("PLplot installation lacks the requested driver: ") + driver);
++      ThrowGDLException(std::string("PLplot installation lacks the requested driver: ") + driver);
+   }
+ 
+   virtual ~GDLGStream()
+@@ -103,7 +103,7 @@ if( devNames.empty())// == NULL)
+ 
+ //     devNames = new std::vector<std::string>( numdevs_plus_one - 1);
+     for( int i = 0; i < numdevs_plus_one - 1; ++i)
+-		devNames.push_back(string(devnames[ i]));
++		devNames.push_back(std::string(devnames[ i]));
+     
+     free(devnames);
+ }
+@@ -111,7 +111,7 @@ if( devNames.empty())// == NULL)
+ // for debug
+ std::vector<std::string> devnamesDbg = devNames;
+ 
+-return std::find( devNames.begin(), devNames.end(), string( driver)) != devNames.end();
++return std::find( devNames.begin(), devNames.end(), std::string( driver)) != devNames.end();
+ 
+ //     checking if a given driver is in the list
+ //     bool supported = false;
diff --git a/gdl.spec b/gdl.spec
index b4a6fdc..3d0d812 100644
--- a/gdl.spec
+++ b/gdl.spec
@@ -18,8 +18,8 @@ Patch0:         gdl-0.9rc3-antlr.patch
 Patch1:         gdl-0.9rc4-antlr-auto.patch
 # Upstream patch to fix strsplit
 Patch2:         gdl-strsplit.patch
-# Add missing includes
-Patch3:         gdl-includes.patch
+# Use std::string and add a missing #include <string>
+Patch3:         gdl-string.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 #RHEL doesn't have the needed antlr version/headers, has old plplot
@@ -87,7 +87,7 @@ Provides:       %{name}-runtime = %{version}-%{release}
 %patch1 -p1 -b .antlr-auto
 %endif
 %patch2 -p1 -b .strsplit
-%patch3 -p1 -b .includes
+%patch3 -p1 -b .string
 %if !0%{?rhel}
 rm -rf src/antlr
 %endif
@@ -175,7 +175,7 @@ rm -rf $RPM_BUILD_ROOT
 * Thu Aug 18 2011 Orion Poplawski <orion at cora.nwra.com> - 0.9.1-4
 - Rebuild for plplot 5.9.8
 - Add upstream patch to fix strsplit and str_sep
-- Add patch to add missing includes
+- Add patch to fix compile issues with string
 
 * Tue May 17 2011 Orion Poplawski <orion at cora.nwra.com> - 0.9.1-3
 - Rebuild for hdf5 1.8.7


More information about the scm-commits mailing list