tag 925782 + patch
thanks

Hi,

attached is a patch that fixes the FTBFS with g++-9.

Best regards,
  Joachim
Index: mp3check-0.8.7/texception.h
===================================================================
--- mp3check-0.8.7.orig/texception.h
+++ mp3check-0.8.7/texception.h
@@ -38,10 +38,10 @@ extern "C" {

 #define TExceptionN(n) public: virtual const char *name()  const { return #n; }
 #define TExceptionM(m) public: virtual const char *message() const { return m; }
-#define TExceptionM1(m,a) public: virtual const char *message() const { char *buf; asprintf(&buf, m, a); return buf; }
-#define TExceptionM2(m,a,b) public: virtual const char *message() const { char *buf; asprintf(&buf, m, a,b); return buf; }
-#define TExceptionM3(m,a,b,c) public: virtual const char *message() const { char *buf; asprintf(&buf, m, a,b,c); return buf; }
-#define TExceptionM4(m,a,b,c,d) public: virtual const char *message() const { char *buf; asprintf(&buf, m, a,b,c,d); return buf; }
+#define TExceptionM1(m,a) public: virtual const char *message() const { char *buf; int result = asprintf(&buf, m, a); return result != -1 ? buf : "asprintf failure"; }
+#define TExceptionM2(m,a,b) public: virtual const char *message() const { char *buf; int result = asprintf(&buf, m, a,b); return result != -1 ? buf : "asprintf failure"; }
+#define TExceptionM3(m,a,b,c) public: virtual const char *message() const { char *buf; int result = asprintf(&buf, m, a,b,c); return result != -1 ? buf : "asprintf failure"; }
+#define TExceptionM4(m,a,b,c,d) public: virtual const char *message() const { char *buf; int result = asprintf(&buf, m, a,b,c,d); return result != -1 ? buf : "asprintf failure"; }

 // base class of all exceptions
 class TException {
Index: mp3check-0.8.7/tstring.cc
===================================================================
--- mp3check-0.8.7.orig/tstring.cc
+++ mp3check-0.8.7/tstring.cc
@@ -111,7 +111,7 @@ tstring::Rep *tstring::Rep::clone(size_t
 tstring::Rep *tstring::Rep::create(size_t tmem) {
    size_t m = sizeof(Rep) << 1;
    while((m - 1 - sizeof(Rep)) < tmem) m <<= 1;
-   Rep *p = new (m - 1 - sizeof(Rep)) Rep;
+   Rep *p = new (/*tag*/ true, m - 1 - sizeof(Rep)) Rep;
    p->mem = m - 1 - sizeof(Rep); p->ref = 1; p->vulnerable = false;
    return p;
 }
Index: mp3check-0.8.7/tstring.h
===================================================================
--- mp3check-0.8.7.orig/tstring.h
+++ mp3check-0.8.7/tstring.h
@@ -71,9 +71,12 @@ class tstring {

       // static methods
       // operator new for this class
-      static void * operator new (size_t size, size_t tmem) {
+      // add a tag parameter to ensure that the signature of the delete operator does not collide with the (void*,size_t) overload
+      static void * operator new (size_t size, bool /*tag*/, size_t tmem) {
 	 return ::operator new (size + tmem + 1);}
-      static void operator delete (void *p, size_t) {
+      static void operator delete (void *p, bool /*tag*/, size_t) {
+	 ::operator delete (p); }
+      static void operator delete (void *p) {
 	 ::operator delete (p); }

       // create a new representation

Reply via email to