From dc043338207d002c7ba347b7fbecaef40216317d Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 4 Jul 2012 15:56:01 +0200 Subject: [PATCH] bugfix: support option length > 255 --- option.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/option.h b/option.h index aeed4a75..55de98ff 100644 --- a/option.h +++ b/option.h @@ -39,11 +39,11 @@ typedef unsigned char coap_opt_t; : (*PCHAR(opt) & 0x0f))) #define COAP_OPT_SETLENGTH(opt,val) \ - if ( ((val) & 0xff) < 15 ) \ + if ((val) < 15) \ *PCHAR(opt) = ((*PCHAR(opt) & 0xf0) | ((val) & 0x0f)); \ else { \ *PCHAR(opt) |= 0x0f; \ - *(PCHAR(opt) + 1) = ((val) & 0xff) - 15; \ + *(PCHAR(opt) + 1) = ((val) - 15) & 0xff; \ } #define COAP_OPT_VALUE(opt) \