From 72b59cfc2e2dc0ecd5b28083857264facf19e26d Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Thu, 12 Apr 2018 15:55:50 +0200 Subject: [PATCH] pkg/cn-cbor: Bump version Patches for unaligned memory access are upstreamed and thus removed here --- pkg/cn-cbor/Makefile | 2 +- pkg/cn-cbor/Makefile.cn-cbor | 3 ++ ...ement-alignment-safe-ntoh16p-ntoh32p.patch | 37 ------------------- 3 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 pkg/cn-cbor/patches/0001-implement-alignment-safe-ntoh16p-ntoh32p.patch diff --git a/pkg/cn-cbor/Makefile b/pkg/cn-cbor/Makefile index 094c57bec9..0ff9ac08d6 100644 --- a/pkg/cn-cbor/Makefile +++ b/pkg/cn-cbor/Makefile @@ -1,6 +1,6 @@ PKG_NAME=cn-cbor PKG_URL=https://github.com/cabo/cn-cbor -PKG_VERSION=2f9c3b1931eb012909e74f3b628e6a31fd446ad1 +PKG_VERSION=f1cf9ffdf5cfab935a45900556f9b68af925c256 PKG_LICENSE=MIT .PHONY: all diff --git a/pkg/cn-cbor/Makefile.cn-cbor b/pkg/cn-cbor/Makefile.cn-cbor index e13f6b2105..0466f35c80 100644 --- a/pkg/cn-cbor/Makefile.cn-cbor +++ b/pkg/cn-cbor/Makefile.cn-cbor @@ -1,3 +1,6 @@ MODULE := cn-cbor +# Enable code forcing aligned reads +CFLAGS += -DCBOR_ALIGN_READS + include $(RIOTBASE)/Makefile.base diff --git a/pkg/cn-cbor/patches/0001-implement-alignment-safe-ntoh16p-ntoh32p.patch b/pkg/cn-cbor/patches/0001-implement-alignment-safe-ntoh16p-ntoh32p.patch deleted file mode 100644 index 7cd6a73514..0000000000 --- a/pkg/cn-cbor/patches/0001-implement-alignment-safe-ntoh16p-ntoh32p.patch +++ /dev/null @@ -1,37 +0,0 @@ -From a8ad896613571b16c53d9915f7b413fae7ea2879 Mon Sep 17 00:00:00 2001 -From: Kaspar Schleiser -Date: Fri, 16 Mar 2018 15:33:00 +0100 -Subject: [PATCH] implement alignment-safe ntoh16p() && ntoh32p() - ---- - src/cn-cbor.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - -diff --git a/src/cn-cbor.c b/src/cn-cbor.c -index a7677ae..400de5f 100644 ---- a/src/cn-cbor.c -+++ b/src/cn-cbor.c -@@ -51,8 +51,18 @@ static double decode_half(int half) { - - /* Fix these if you can't do non-aligned reads */ - #define ntoh8p(p) (*(unsigned char*)(p)) --#define ntoh16p(p) (ntohs(*(unsigned short*)(p))) --#define ntoh32p(p) (ntohl(*(unsigned long*)(p))) -+static uint16_t ntoh16p(unsigned char *p) { -+ uint16_t tmp; -+ memcpy(&tmp, p, sizeof(tmp)); -+ return ntohs(tmp); -+} -+ -+static uint32_t ntoh32p(unsigned char *p) { -+ uint32_t tmp; -+ memcpy(&tmp, p, sizeof(tmp)); -+ return ntohl(tmp); -+} -+ - static uint64_t ntoh64p(unsigned char *p) { - uint64_t ret = ntoh32p(p); - ret <<= 32; --- -2.16.2 -