From 0d788fb946f2588bbe1ea93257b402eb94a1403f Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 12 Feb 2024 16:41:51 +0000 Subject: [PATCH] get rid of gcc compiler warning --- scan/scan_utf8_sem.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scan/scan_utf8_sem.c b/scan/scan_utf8_sem.c index 08d3fea..1a216d3 100644 --- a/scan/scan_utf8_sem.c +++ b/scan/scan_utf8_sem.c @@ -1,14 +1,13 @@ #include "scan.h" size_t scan_utf8_sem(const char* in,size_t len,uint32_t* num) { - size_t r=scan_utf8(in,len,num); + uint32_t tmp=0; + size_t r=scan_utf8(in,len,&tmp); if (r>0) { - // gcc -fanalyze warns here that we are reading undefined values - // from *num which is declared as write only. That is a false - // positive because we just called scan_utf8 which writes there. - if (*num>=0xd800 && *num<=0xdfff) return 0; - if ((*num&0xfffe)==0xfffe) return 0; - if (*num>=0xfdd0 && *num<=0xfdef) return 0; + if (tmp>=0xd800 && tmp<=0xdfff) return 0; + if ((tmp&0xfffe)==0xfffe) return 0; + if (tmp>=0xfdd0 && tmp<=0xfdef) return 0; + *num=tmp; } return r; }