pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/audio/libaudiofile
Module Name: pkgsrc
Committed By: maya
Date: Mon Dec 19 00:14:43 UTC 2016
Modified Files:
pkgsrc/audio/libaudiofile: distinfo
pkgsrc/audio/libaudiofile/patches:
patch-libaudiofile_modules_SimpleModule.h
Log Message:
libaudiofile: fix the second UB in the same line of code, cstatic which
isn't actually a cstatic. switch to just defining it in the accessor.
GCC optimized this UB away leading to an undefined reference in the builds.
Also use a function which is right for int32 too (same as upstream)
Thanks joerg for the help
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 pkgsrc/audio/libaudiofile/distinfo
cvs rdiff -u -r1.2 -r1.3 \
pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/audio/libaudiofile/distinfo
diff -u pkgsrc/audio/libaudiofile/distinfo:1.28 pkgsrc/audio/libaudiofile/distinfo:1.29
--- pkgsrc/audio/libaudiofile/distinfo:1.28 Sun Dec 18 23:40:22 2016
+++ pkgsrc/audio/libaudiofile/distinfo Mon Dec 19 00:14:43 2016
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.28 2016/12/18 23:40:22 maya Exp $
+$NetBSD: distinfo,v 1.29 2016/12/19 00:14:43 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) = f1e3842d3d9ddcea6b547bbeb5991769855ab2fc
+SHA1 (patch-libaudiofile_modules_SimpleModule.h) = 356869de2119e868e84cc9d39f370270678a778c
Index: pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h
diff -u pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h:1.2 pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h:1.3
--- pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h:1.2 Sun Dec 18 23:40:23 2016
+++ pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h Mon Dec 19 00:14:43 2016
@@ -1,16 +1,41 @@
-$NetBSD: patch-libaudiofile_modules_SimpleModule.h,v 1.2 2016/12/18 23:40:23 maya Exp $
+$NetBSD: patch-libaudiofile_modules_SimpleModule.h,v 1.3 2016/12/19 00:14:43 maya Exp $
Left shift of a negative number is UB and doesn't build (-fpermissive)
Switch with functionally identical but well-defined operation.
+(same function used upstream)
+
+Just define it in the accessor rather than a cstatic global (which isn't
+actually cstatic, which is UB and optimized away at least by GCC)
--- libaudiofile/modules/SimpleModule.h.orig 2013-03-06 05:30:03.000000000 +0000
+++ libaudiofile/modules/SimpleModule.h
-@@ -123,7 +123,7 @@ struct signConverter
+@@ -122,17 +122,24 @@ struct signConverter
+ typedef typename IntTypes<Format>::SignedType SignedType;
typedef typename IntTypes<Format>::UnsignedType UnsignedType;
- static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
+- static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
- static const int kMinSignedValue = -1 << kScaleBits;
-+ static const int kMinSignedValue = -(1 << kScaleBits);
-
+-
struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType>
{
+- UnsignedType operator()(SignedType x) { return x - kMinSignedValue; }
++ UnsignedType operator()(SignedType x) {
++ int kScaleBits = (Format + 1) * CHAR_BIT - 1;
++ int kMaxSignedValue = (((1 << (kScaleBits - 1)) - 1) << 1) + 1;
++ int kMinSignedValue = -kMaxSignedValue - 1;
++ return x - kMinSignedValue;
++ }
+ };
+
+ struct unsignedToSigned : public std::unary_function<SignedType, UnsignedType>
+ {
+- SignedType operator()(UnsignedType x) { return x + kMinSignedValue; }
++ SignedType operator()(UnsignedType x) {
++ int kScaleBits = (Format + 1) * CHAR_BIT - 1;
++ int kMaxSignedValue = (((1 << (kScaleBits - 1)) - 1) << 1) + 1;
++ int kMinSignedValue = -kMaxSignedValue - 1;
++ return x + kMinSignedValue;
++ }
+ };
+ };
+
Home |
Main Index |
Thread Index |
Old Index