summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2019-08-06 09:12:10 +0000
committermaya <maya@pkgsrc.org>2019-08-06 09:12:10 +0000
commite938f9ccfdce1cb8a63d6148b61d1717ebc300a6 (patch)
tree65efa0a41fff93f1b3634fcaa26eb2434e1c5142 /devel
parentea86c641c99655c9355de083428cad1c2e446dcf (diff)
downloadpkgsrc-e938f9ccfdce1cb8a63d6148b61d1717ebc300a6.tar.gz
libusb: avoid unaligned access. Improve code consistency.
XXX does this package also need -O1 -fno-strict-aliasing on clang? Noted by Shingo Nishioka in PR pkg/54441
Diffstat (limited to 'devel')
-rw-r--r--devel/libusb/Makefile4
-rw-r--r--devel/libusb/distinfo3
-rw-r--r--devel/libusb/patches/patch-descriptors.c30
3 files changed, 34 insertions, 3 deletions
diff --git a/devel/libusb/Makefile b/devel/libusb/Makefile
index 62416ac2205..eabb9998ecd 100644
--- a/devel/libusb/Makefile
+++ b/devel/libusb/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.43 2019/05/16 16:17:52 pgoyette Exp $
+# $NetBSD: Makefile,v 1.44 2019/08/06 09:12:10 maya Exp $
DISTNAME= libusb-0.1.12
-PKGREVISION= 5
+PKGREVISION= 6
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=libusb/}
diff --git a/devel/libusb/distinfo b/devel/libusb/distinfo
index bece4433fe4..dc55ace6e9c 100644
--- a/devel/libusb/distinfo
+++ b/devel/libusb/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.27 2018/02/19 17:59:23 mrg Exp $
+$NetBSD: distinfo,v 1.28 2019/08/06 09:12:10 maya Exp $
SHA1 (libusb-0.1.12.tar.gz) = 599a5168590f66bc6f1f9a299579fd8500614807
RMD160 (libusb-0.1.12.tar.gz) = 63848df717e00fff67ab30ba86a85466370d4e8e
@@ -11,3 +11,4 @@ SHA1 (patch-ad) = 8ea70b0501ccd725d19a735699437f67ae76d13d
SHA1 (patch-ae) = 49a01ebe66de4965f3611cf42db09703aa68c415
SHA1 (patch-af) = e46e576a589fb65488011a41df95f744230c0c6c
SHA1 (patch-darwin.c) = 20df5d5970bf86f6f4ada002ca16a3bccf5bb4ff
+SHA1 (patch-descriptors.c) = 14cc1b46f094585fcfbb2ba046b89c3eb5cf49f9
diff --git a/devel/libusb/patches/patch-descriptors.c b/devel/libusb/patches/patch-descriptors.c
new file mode 100644
index 00000000000..4e944d1622e
--- /dev/null
+++ b/devel/libusb/patches/patch-descriptors.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-descriptors.c,v 1.1 2019/08/06 09:12:10 maya Exp $
+
+Avoid unaligned access. This breaks clang.
+Improve consistency.
+
+--- descriptors.c.orig 2006-03-04 02:52:46.000000000 +0000
++++ descriptors.c
+@@ -39,17 +39,17 @@ int usb_parse_descriptor(unsigned char *
+ for (cp = description; *cp; cp++) {
+ switch (*cp) {
+ case 'b': /* 8-bit byte */
+- *dp++ = *sp++;
++ memcpy(dp, sp, 1); sp += 1; dp += 1;
+ break;
+ case 'w': /* 16-bit word, convert from little endian to CPU */
+- w = (sp[1] << 8) | sp[0]; sp += 2;
++ w = (sp[1] << 8) | sp[0];
+ dp += ((unsigned long)dp & 1); /* Align to word boundary */
+- *((uint16_t *)dp) = w; dp += 2;
++ memcpy(dp, &w, 2); sp += 2; dp += 2;
+ break;
+ case 'd': /* 32-bit dword, convert from little endian to CPU */
+- d = (sp[3] << 24) | (sp[2] << 16) | (sp[1] << 8) | sp[0]; sp += 4;
++ d = (sp[3] << 24) | (sp[2] << 16) | (sp[1] << 8) | sp[0];
+ dp += ((unsigned long)dp & 2); /* Align to dword boundary */
+- *((uint32_t *)dp) = d; dp += 4;
++ memcpy(dp, &d, 4); sp += 4; dp += 4;
+ break;
+ /* These two characters are undocumented and just a hack for Linux */
+ case 'W': /* 16-bit word, keep CPU endianess */