summaryrefslogtreecommitdiffstats
path: root/system/kyotocabinet/kyotocabinet-1.2.76-gcc6.patch
blob: d565cff0f3a374a7d495402ac32a1707704e8e8c (plain)
Patch from Andreas Stührk <andy@hammerhartes.de> to work around build
failures with GCC >= 6 like:

In file included from kcdbext.cc:16:0:
kcdbext.h: In member function 'char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)':
kcdbext.h:1281:14: error: cannot convert 'bool' to 'char*' in return
       return false;
              ^~~~~
In file included from kclangc.cc:17:0:
kcdbext.h: In member function 'char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)':
kcdbext.h:1281:14: error: cannot convert 'bool' to 'char*' in return
       return false;
              ^~~~~

Note that using '\0' rather nullptr (like the patch from openSUSE is
doing) just leads to new build failures with GCC >= 7 like:

In file included from kcdbext.cc:16:0:
kcdbext.h: In member function 'char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)':
kcdbext.h:1281:14: error: invalid conversion from 'char' to 'char*' [-fpermissive]
       return '\0';
              ^~~~
In file included from kclangc.cc:17:0:
kcdbext.h: In member function 'char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)':
kcdbext.h:1281:14: error: invalid conversion from 'char' to 'char*' [-fpermissive]
       return '\0';
              ^~~~

See also:

 - https://bugzilla.redhat.com/show_bug.cgi?id=1307706
 - https://build.opensuse.org/package/view_file/devel:libraries:c_c++/kyotocabinet/gcc6-fix-errors.patch?expand=1
 - https://bugs.debian.org/811627

--- kyotocabinet-1.2.76/kcdbext.h	2016-05-25 11:32:53.591866016 +0200
+++ kyotocabinet-1.2.76/kcdbext.h	2012-05-24 18:27:59.000000000 +0200
@@ -1278,7 +1278,7 @@
     if (omode_ == 0) {
       set_error(_KCCODELINE_, BasicDB::Error::INVALID, "not opened");
       *sp = 0;
-      return false;
+      return nullptr;
     }
     if (!cache_) return db_.get(kbuf, ksiz, sp);
     size_t dvsiz = 0;