From 3f53af93dce0de32b30af39d2edef84cd2ebe600 Mon Sep 17 00:00:00 2001 From: maya Date: Sat, 17 Dec 2016 16:40:31 +0000 Subject: [PATCH] libaudiofile: attempt to fix Ubuntu build which is failing due to UB in code Switch left shift of negative operand with functionally equivalent and well-defined function. --- audio/libaudiofile/distinfo | 3 ++- .../patch-libaudiofile_modules_SimpleModule.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h diff --git a/audio/libaudiofile/distinfo b/audio/libaudiofile/distinfo index 450eea39e0f7..0b9ae2b9f946 100644 --- a/audio/libaudiofile/distinfo +++ b/audio/libaudiofile/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.26 2015/11/03 01:12:36 agc Exp $ +$NetBSD: distinfo,v 1.27 2016/12/17 16:40:31 maya Exp $ SHA1 (audiofile-0.3.6.tar.gz) = 3aba3ef724b1b5f88cfc20ab9f8ce098e6c35a0e RMD160 (audiofile-0.3.6.tar.gz) = d0666dbf98cb4b41304b01e1b4f8ca15fe9288d8 SHA512 (audiofile-0.3.6.tar.gz) = f9a1182d93e405c21eba79c5cc40962347bff13f1b3b732d9a396e3d1675297515188bd6eb43033aaa00e9bde74ff4628c1614462456529cabba464f03c1d5fa Size (audiofile-0.3.6.tar.gz) = 811733 bytes SHA1 (patch-libaudiofile_CAF.cpp) = ddea79105f9b1e7222f91649815668d3a8ee6e98 +SHA1 (patch-libaudiofile_modules_SimpleModule.h) = 73aeee36ef390502b38353e35bb56776a4ca052d diff --git a/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h b/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h new file mode 100644 index 000000000000..d8dfd2c32022 --- /dev/null +++ b/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h @@ -0,0 +1,16 @@ +$NetBSD: patch-libaudiofile_modules_SimpleModule.h,v 1.1 2016/12/17 16:40:31 maya Exp $ + +Left shift of a negative number is UB and doesn't build (-fpermissive) +Switch with functionally identical but well-defined operation. + +--- libaudiofile/modules/SimpleModule.h.orig 2013-03-06 05:30:03.000000000 +0000 ++++ libaudiofile/modules/SimpleModule.h +@@ -123,7 +123,7 @@ struct signConverter + typedef typename IntTypes::UnsignedType UnsignedType; + + static const int kScaleBits = (Format + 1) * CHAR_BIT - 1; +- static const int kMinSignedValue = -1 << kScaleBits; ++ static const int kMinSignedValue = ~((1 << kScaleBits) - 1); + + struct signedToUnsigned : public std::unary_function + {