pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/42293: databases/palm-db-tools g++ v4 fixes



>Number:         42293
>Category:       pkg
>Synopsis:       databases/palm-db-tools g++ v4 fixes
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 09 04:35:03 +0000 2009
>Originator:     Steven Drake
>Release:        pkgsrc-2009Q3
>Organization:
>Environment:
System: Linux idran 2.6.30 #2 PREEMPT Sun Aug 9 18:32:44 NZST 2009 i686 
pentium4 i386 GNU/Linux
Architecture: pentium4
Machine: i686
C library: GNU C Library stable release version 2.10.1, by Roland McGrath et al.
>Description:
1) <cstring> not <string> needed for memset/memcpy

2) g++ v4 is picky about casts

>Examples:
1)
 g++ -Wno-error -O2 -pipe -march=i586 -mtune=generic -Wno-deprecated -I. -I.. 
-DHAVE_CONFIG_H -c csvfile.cpp  -fPIC -DPIC -o .libs/csvfile.o
csvfile.cpp: In member function 'std::string 
DataFile::CSVFile::field2string(PalmLib::FlatFile::Field, const 
DataFile::CSVConfig&)':
csvfile.cpp:323: error: 'memset' was not declared in this scope
csvfile.cpp:338: error: 'memset' was not declared in this scope
csvfile.cpp:343: error: 'memcpy' was not declared in this scope
csvfile.cpp:359: error: 'memset' was not declared in this scope
make[1]: *** [csvfile.lo] Error 1

2)
 g++ -O2 -pipe -march=i586 -mtune=generic -Wno-deprecated -I. -I.. 
-DHAVE_CONFIG_H -c JFile3.cpp  -fPIC -DPIC -o .libs/JFile3.o
JFile3.cpp: In member function 'void 
PalmLib::FlatFile::JFile3::JFileAppInfoType::unpack(const PalmLib::Block&)':
JFile3.cpp:470: error: reinterpret_cast from type 'const void*' to type 
'PalmLib::pi_char_t*' casts away constness
JFile3.cpp:521: error: reinterpret_cast from type 'const void*' to type 
'PalmLib::pi_char_t*' casts away constness
JFile3.cpp:529: error: reinterpret_cast from type 'const void*' to type 
'PalmLib::pi_char_t*' casts away constness
JFile3.cpp:545: error: reinterpret_cast from type 'const void*' to type 
'PalmLib::pi_char_t*' casts away constness
make[1]: *** [JFile3.lo] Error 1



>Fix:
Index: pkgsrc/databases/palm-db-tools/patches/patch-ac
===================================================================
--- pkgsrc.orig/databases/palm-db-tools/patches/patch-ac        2007-10-21 
16:53:45.000000000 +1300
+++ pkgsrc/databases/palm-db-tools/patches/patch-ac     2009-11-08 
22:56:19.000000000 +1300
@@ -7,14 +7,21 @@ The default C++ precision of 6 digits is
 As with DATE fields, if a TIME field is unset (hour value 24+), output an
 empty string.
 
+<cstring> not <string> needed for memset/memcpy
+
 --- libsupport/csvfile.cpp.orig        2003-06-20 11:37:47.000000000 +1200
 +++ libsupport/csvfile.cpp     2007-02-19 21:19:46.000000000 +1300
-@@ -1,5 +1,3 @@
+@@ -1,9 +1,7 @@
 -#define _XOPEN_SOURCE
 -
  #include <iostream>
  #include <fstream>
  #include <sstream>
+-#include <string>
++#include <cstring>
+ #include <stdexcept>
+ #include <utility>
+ 
 @@ -299,6 +297,7 @@
          break;
  
Index: pkgsrc/databases/palm-db-tools/patches/patch-ae
===================================================================
--- pkgsrc.orig/databases/palm-db-tools/patches/patch-ae        2007-10-21 
16:53:45.000000000 +1300
+++ pkgsrc/databases/palm-db-tools/patches/patch-ae     2009-11-08 
22:41:50.000000000 +1300
@@ -4,6 +4,15 @@ Correctly terminate default string value
 
 --- libflatfile/DB.cpp.orig    2003-06-20 11:37:46.000000000 +1200
 +++ libflatfile/DB.cpp 2007-10-12 17:57:05.000000000 +1300
+@@ -222,7 +222,7 @@
+ 
+         // Determine the length of the name string.
+         pi_char_t* null_ptr = reinterpret_cast<pi_char_t*>
+-            (memchr(chunk.data() + 4, 0, 32));
++            (memchr((pi_char_t*)chunk.data() + 4, 0, 32));
+         if (null_ptr)
+             lv.name = std::string((char *) (chunk.data() + 4),
+                                   null_ptr - (chunk.data() + 4));
 @@ -275,7 +276,8 @@
          switch (type) {
  
Index: pkgsrc/databases/palm-db-tools/patches/patch-af
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ pkgsrc/databases/palm-db-tools/patches/patch-af     2009-11-08 
21:48:18.000000000 +1300
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- libflatfile/JFile3.cpp.orig        2003-06-19 23:37:46.000000000 +0000
++++ libflatfile/JFile3.cpp
+@@ -467,7 +467,7 @@ void PalmLib::FlatFile::JFile3::JFileApp
+     // Extract the field names.
+     for (i = 0; i < 20; ++i) {
+         /* Find the trailing null byte and extract the string. */
+-        null_ptr = reinterpret_cast<pi_char_t*> (memchr(p, 0, 21));
++        null_ptr = reinterpret_cast<pi_char_t*> ((pi_char_t*)memchr(p, 0, 
21));
+         if (null_ptr)
+             fieldNames[i] = std::string((char *) p, null_ptr - p);
+         else
+@@ -518,7 +518,7 @@ void PalmLib::FlatFile::JFile3::JFileApp
+     p += sizeof(pi_uint16_t);
+ 
+     // Extract the string used last by Find.
+-    null_ptr = reinterpret_cast<pi_char_t*> (memchr(p, 0, 16));
++    null_ptr = reinterpret_cast<pi_char_t*> ((pi_char_t*)memchr(p, 0, 16));
+     if (null_ptr)
+         findString = std::string((char *) p, null_ptr - p);
+     else
+@@ -526,7 +526,7 @@ void PalmLib::FlatFile::JFile3::JFileApp
+     p += 16;
+ 
+     // Extract the string used last by Filter.
+-    null_ptr = reinterpret_cast<pi_char_t*> (memchr(p, 0, 16));
++    null_ptr = reinterpret_cast<pi_char_t*> ((pi_char_t*)memchr(p, 0, 16));
+     if (null_ptr)
+         filterString = std::string((char *) p, null_ptr - p);
+     else
+@@ -542,7 +542,7 @@ void PalmLib::FlatFile::JFile3::JFileApp
+     p += sizeof(pi_uint16_t);
+ 
+     // Extract the password (if any).
+-    null_ptr = reinterpret_cast<pi_char_t*> (memchr(p, 0, 12));
++    null_ptr = reinterpret_cast<pi_char_t*> ((pi_char_t*)memchr(p, 0, 12));
+     if (null_ptr)
+         password = std::string((char *) p, null_ptr - p);
+     else
Index: pkgsrc/databases/palm-db-tools/patches/patch-ag
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ pkgsrc/databases/palm-db-tools/patches/patch-ag     2009-11-08 
21:48:18.000000000 +1300
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- libflatfile/MobileDB.cpp.orig      2003-06-19 23:37:46.000000000 +0000
++++ libflatfile/MobileDB.cpp
+@@ -222,7 +222,7 @@ PalmLib::FlatFile::MobileDB::parse_recor
+ 
+         // Now search for the end of the current field.
+         pi_char_t* q = reinterpret_cast<pi_char_t*>
+-            (memchr(p, 0, rec.end() - p));
++            (memchr((pi_char_t*)p, 0, rec.end() - p));
+         if (!q)
+             throw PalmLib::error("field terminiator is missing");
+ 

-- 
Steven



Home | Main Index | Thread Index | Old Index