diff --git a/option.h b/option.h index 95772119..aeed4a75 100644 --- a/option.h +++ b/option.h @@ -33,10 +33,10 @@ typedef unsigned char coap_opt_t; #define COAP_OPT_SETDELTA(opt,val) \ (*PCHAR(opt) = (*PCHAR(opt) & 0x0f) | ((val) << 4)) -#define COAP_OPT_LENGTH(opt) \ - ( COAP_OPT_ISEXTENDED(opt) \ - ? (*(PCHAR(opt) + 1) + 15) \ - : (*PCHAR(opt) & 0x0f)) +#define COAP_OPT_LENGTH(opt) \ + ((unsigned int)(COAP_OPT_ISEXTENDED(opt) \ + ? (*(PCHAR(opt) + 1) + 15) \ + : (*PCHAR(opt) & 0x0f))) #define COAP_OPT_SETLENGTH(opt,val) \ if ( ((val) & 0xff) < 15 ) \