Library: Change range operator in validation pattern to ':'

This commit is contained in:
Daniel Marjamäki 2014-06-08 18:12:11 +02:00
parent 228d67cf05
commit 42c3b3c89d
6 changed files with 96 additions and 78 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<def> <def>
<function name="usleep"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><valid>0-999999</valid></arg> </function> <function name="usleep"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><valid>0:999999</valid></arg> </function>
<function name="_exit"> <noreturn>true</noreturn> </function> <function name="_exit"> <noreturn>true</noreturn> </function>
<function name="closedir"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><not-uninit/><not-null/></arg> </function> <function name="closedir"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><not-uninit/><not-null/></arg> </function>

View File

@ -32,7 +32,7 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-uninit/><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-null/><not-uninit/></arg> <arg nr="3"><not-null/><not-uninit/></arg>
</function> </function>
<function name="floor"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="floor"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
@ -42,7 +42,7 @@
<function name="fputc"> <function name="fputc">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="1"><not-uninit/><not-bool/><valid>0:</valid></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
</function> </function>
<function name="fputs"> <function name="fputs">
@ -95,7 +95,7 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-uninit/><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-null/><not-uninit/></arg> <arg nr="3"><not-null/><not-uninit/></arg>
</function> </function>
<function name="ftell"> <function name="ftell">
@ -115,18 +115,18 @@
<function name="getenv"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="getenv"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
<function name="gets"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/></arg></function> <function name="gets"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/></arg></function>
<function name="gmtime"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="gmtime"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
<function name="isalnum"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isalnum"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isalpha"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isalpha"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isblank"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isblank"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="iscntrl"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="iscntrl"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isdigit"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isdigit"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isgraph"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isgraph"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="islower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="islower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isprint"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isprint"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="ispunct"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="ispunct"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isspace"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isspace"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="isxdigit"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="isxdigit"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="labs"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="labs"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
<function name="ldexp"> <function name="ldexp">
<noreturn>false</noreturn> <noreturn>false</noreturn>
@ -154,36 +154,36 @@
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg> <arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-uninit/><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="memcmp"> <function name="memcmp">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg> <arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="memcpy"> <function name="memcpy">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="memmove"> <function name="memmove">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="memset"> <function name="memset">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-uninit/></arg> <arg nr="2"><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="mktime"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="mktime"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
<function name="modf"> <function name="modf">
@ -206,18 +206,18 @@
<function name="putc"> <function name="putc">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="1"><not-null/><not-uninit/><not-bool/><valid>0:</valid></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
</function> </function>
<function name="putchar"> <function name="putchar">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="1"><not-uninit/><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="puts"> <function name="puts">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/><not-bool/><valid>0-</valid></arg> <arg nr="1"><not-null/><not-uninit/><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="realloc"><noreturn>false</noreturn><arg nr="2"><not-uninit/></arg></function> <function name="realloc"><noreturn>false</noreturn><arg nr="2"><not-uninit/></arg></function>
<function name="remove"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function> <function name="remove"><noreturn>false</noreturn><leak-ignore/><arg nr="1"><not-null/><not-uninit/></arg></function>
@ -260,25 +260,25 @@
<function name="strcpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function> <function name="strcpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strdup"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function> <function name="strdup"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function>
<function name="strlen"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function> <function name="strlen"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function>
<function name="strncpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function> <function name="strncpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strncat"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function> <function name="strncat"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strncmp"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0-</valid></arg> </function> <function name="strncmp"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strstr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function> <function name="strstr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function> <function name="strspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strerror"> <noreturn>false</noreturn> <leak-ignore/></function> <function name="strerror"> <noreturn>false</noreturn> <leak-ignore/></function>
<function name="strcspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function> <function name="strcspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strcoll"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function> <function name="strcoll"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strtol"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="strtol"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtoll"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="strtoll"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtoul"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="strtoul"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtoull"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="strtoull"> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="tolower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="tolower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="toupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function> <function name="toupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="wcstol"> <leak-ignore/> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="wcstol"> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoll"> <leak-ignore/> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="wcstoll"> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoul"> <leak-ignore/> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="wcstoul"> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoull"> <leak-ignore/> <arg nr="3"><valid>0,2-36</valid></arg> </function> <function name="wcstoull"> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wprintf"> <noreturn>false</noreturn> <formatstr/> <arg nr="1"><formatstr/></arg> </function> <function name="wprintf"> <noreturn>false</noreturn> <formatstr/> <arg nr="1"><formatstr/></arg> </function>

View File

@ -185,41 +185,41 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg> <arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlCopyBytes"> <function name="RtlCopyBytes">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlCopyMemory"> <function name="RtlCopyMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlEqualMemory"> <function name="RtlEqualMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg> <arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlFillBytes"> <function name="RtlFillBytes">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-uninit/></arg> <arg nr="3"><not-uninit/></arg>
</function> </function>
<function name="RtlFillMemory"> <function name="RtlFillMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-uninit/></arg> <arg nr="3"><not-uninit/></arg>
</function> </function>
<function name="RtlMoveMemory"> <function name="RtlMoveMemory">
@ -227,25 +227,25 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlSecureZeroMemory"> <function name="RtlSecureZeroMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlZeroBytes"> <function name="RtlZeroBytes">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="RtlZeroMemory"> <function name="RtlZeroMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="CopyMemory"> <function name="CopyMemory">
@ -253,13 +253,13 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="FillMemory"> <function name="FillMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
<arg nr="3"><not-uninit/></arg> <arg nr="3"><not-uninit/></arg>
</function> </function>
<function name="MoveMemory"> <function name="MoveMemory">
@ -267,19 +267,19 @@
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0-</valid></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="SecureZeroMemory"> <function name="SecureZeroMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="ZeroMemory"> <function name="ZeroMemory">
<noreturn>false</noreturn> <noreturn>false</noreturn>
<leak-ignore/> <leak-ignore/>
<arg nr="1"><not-null/></arg> <arg nr="1"><not-null/></arg>
<arg nr="2"><not-bool/><valid>0-</valid></arg> <arg nr="2"><not-bool/><valid>0:</valid></arg>
</function> </function>
<function name="KeBugCheck"> <function name="KeBugCheck">

View File

@ -181,19 +181,24 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
else if (strcmp(argnode->Name(), "valid") == 0) { else if (strcmp(argnode->Name(), "valid") == 0) {
// Validate the validation expression // Validate the validation expression
const char *p = argnode->GetText(); const char *p = argnode->GetText();
if (*p == '-') bool error = false;
++p; bool range = false;
if (!std::isdigit(*p))
return Error(BAD_ATTRIBUTE_VALUE, argnode->GetText());
for (; *p; p++) { for (; *p; p++) {
if (std::isdigit(*p)) if (std::isdigit(*p))
continue; error |= (*(p+1) == '-');
if (*p == '-' && std::isdigit(*(p-1))) else if (*p == ':')
continue; error |= range;
if (*p == ',' && *(p+1) != ',') else if (*p == '-')
continue; error |= (!std::isdigit(*(p+1)));
return Error(BAD_ATTRIBUTE_VALUE, argnode->GetText()); else if (*p == ',')
range = false;
else
error = true;
range |= (*p == ':');
} }
if (error)
return Error(BAD_ATTRIBUTE_VALUE, argnode->GetText());
// Set validation expression // Set validation expression
valid = argnode->GetText(); valid = argnode->GetText();
@ -337,18 +342,20 @@ bool Library::isargvalid(const std::string &functionName, int argnr, const MathL
TokenList tokenList(0); TokenList tokenList(0);
std::istringstream istr(ac->valid + ','); std::istringstream istr(ac->valid + ',');
tokenList.createTokens(istr,""); tokenList.createTokens(istr,"");
if (Token::Match(tokenList.front(), "- %num% -")) { for (Token *tok = tokenList.front(); tok; tok = tok->next()) {
tokenList.front()->str("-" + tokenList.front()->strAt(1)); if (Token::Match(tok,"- %num%")) {
tokenList.front()->deleteNext(); tok->str("-" + tok->strAt(1));
tok->deleteNext();
}
} }
for (const Token *tok = tokenList.front(); tok; tok = tok->next()) { for (const Token *tok = tokenList.front(); tok; tok = tok->next()) {
if (tok->isNumber() && argvalue == MathLib::toLongNumber(tok->str())) if (tok->isNumber() && argvalue == MathLib::toLongNumber(tok->str()))
return true; return true;
if (Token::Match(tok, "%num% - %num%") && argvalue >= MathLib::toLongNumber(tok->str()) && argvalue <= MathLib::toLongNumber(tok->strAt(2))) if (Token::Match(tok, "%num% : %num%") && argvalue >= MathLib::toLongNumber(tok->str()) && argvalue <= MathLib::toLongNumber(tok->strAt(2)))
return true; return true;
if (Token::Match(tok, "%num% - ,") && argvalue >= MathLib::toLongNumber(tok->str())) if (Token::Match(tok, "%num% : ,") && argvalue >= MathLib::toLongNumber(tok->str()))
return true; return true;
if ((!tok->previous() || tok->previous()->str() == ",") && Token::Match(tok,"- %num%") && argvalue <= MathLib::toLongNumber(tok->strAt(1))) if ((!tok->previous() || tok->previous()->str() == ",") && Token::Match(tok,": %num%") && argvalue <= MathLib::toLongNumber(tok->strAt(1)))
return true; return true;
} }
return false; return false;

View File

@ -112,9 +112,11 @@ private:
const char xmldata[] = "<?xml version=\"1.0\"?>\n" const char xmldata[] = "<?xml version=\"1.0\"?>\n"
"<def>\n" "<def>\n"
" <function name=\"foo\">\n" " <function name=\"foo\">\n"
" <arg nr=\"1\"><valid>1-</valid></arg>\n" " <arg nr=\"1\"><valid>1:</valid></arg>\n"
" <arg nr=\"2\"><valid>-7-0</valid></arg>\n" " <arg nr=\"2\"><valid>-7:0</valid></arg>\n"
" <arg nr=\"3\"><valid>1-5,8</valid></arg>\n" " <arg nr=\"3\"><valid>1:5,8</valid></arg>\n"
" <arg nr=\"4\"><valid>-1,5</valid></arg>\n"
" <arg nr=\"5\"><valid>:1,5</valid></arg>\n"
" </function>\n" " </function>\n"
"</def>"; "</def>";
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
@ -145,6 +147,15 @@ private:
ASSERT_EQUALS(false, library.isargvalid("foo", 3, 7)); ASSERT_EQUALS(false, library.isargvalid("foo", 3, 7));
ASSERT_EQUALS(true, library.isargvalid("foo", 3, 8)); ASSERT_EQUALS(true, library.isargvalid("foo", 3, 8));
ASSERT_EQUALS(false, library.isargvalid("foo", 3, 9)); ASSERT_EQUALS(false, library.isargvalid("foo", 3, 9));
// -1,5
ASSERT_EQUALS(false, library.isargvalid("foo", 4, -10));
ASSERT_EQUALS(true, library.isargvalid("foo", 4, -1));
// :1,5
ASSERT_EQUALS(true, library.isargvalid("foo", 5, -10));
ASSERT_EQUALS(true, library.isargvalid("foo", 5, 1));
ASSERT_EQUALS(false, library.isargvalid("foo", 5, 2));
} }
void memory() const { void memory() const {

View File

@ -219,7 +219,7 @@ private:
if (posix) { if (posix) {
const char cfg[] = "<?xml version=\"1.0\"?>\n" const char cfg[] = "<?xml version=\"1.0\"?>\n"
"<def>\n" "<def>\n"
" <function name=\"usleep\"> <arg nr=\"1\"><valid>0-999999</valid></arg> </function>\n" " <function name=\"usleep\"> <arg nr=\"1\"><valid>0:999999</valid></arg> </function>\n"
"</def>"; "</def>";
tinyxml2::XMLDocument xmldoc; tinyxml2::XMLDocument xmldoc;
xmldoc.Parse(cfg, sizeof(cfg)); xmldoc.Parse(cfg, sizeof(cfg));
@ -768,7 +768,7 @@ private:
const char cfg[] = "<?xml version=\"1.0\"?>\n" const char cfg[] = "<?xml version=\"1.0\"?>\n"
"<def>\n" "<def>\n"
" <function name=\"memset\"> <arg nr=\"3\"><not-bool/></arg> </function>\n" " <function name=\"memset\"> <arg nr=\"3\"><not-bool/></arg> </function>\n"
" <function name=\"strtol\"> <arg nr=\"3\"><valid>0,2-36</valid></arg> </function>\n" " <function name=\"strtol\"> <arg nr=\"3\"><valid>0,2:36</valid></arg> </function>\n"
"</def>"; "</def>";
tinyxml2::XMLDocument xmldoc; tinyxml2::XMLDocument xmldoc;
xmldoc.Parse(cfg, sizeof(cfg)); xmldoc.Parse(cfg, sizeof(cfg));
@ -794,10 +794,10 @@ private:
TODO_ASSERT_EQUALS("error", "", errout.str()); TODO_ASSERT_EQUALS("error", "", errout.str());
invalidFunctionUsage("int f() { strtol(a,b,sizeof(a)!=12); }"); invalidFunctionUsage("int f() { strtol(a,b,sizeof(a)!=12); }");
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (comparison result) but the valid values are '0,2-36'.\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 0 or 1 (comparison result) but the valid values are '0,2:36'.\n", errout.str());
invalidFunctionUsage("int f() { strtol(a,b,1); }"); invalidFunctionUsage("int f() { strtol(a,b,1); }");
ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 1 but the valid values are '0,2-36'.\n", errout.str()); ASSERT_EQUALS("[test.cpp:1]: (error) Invalid strtol() argument nr 3. The value is 1 but the valid values are '0,2:36'.\n", errout.str());
invalidFunctionUsage("int f() { strtol(a,b,10); }"); invalidFunctionUsage("int f() { strtol(a,b,10); }");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
@ -7156,12 +7156,12 @@ private:
check("void f(){\n" check("void f(){\n"
"usleep(1000000);\n" "usleep(1000000);\n"
"}",nullptr,false,false,true); "}",nullptr,false,false,true);
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid usleep() argument nr 1. The value is 1000000 but the valid values are '0-999999'.\n", errout.str()); ASSERT_EQUALS("[test.cpp:2]: (error) Invalid usleep() argument nr 1. The value is 1000000 but the valid values are '0:999999'.\n", errout.str());
check("void f(){\n" check("void f(){\n"
"usleep(1000001);\n" "usleep(1000001);\n"
"}",nullptr,false,false,true); "}",nullptr,false,false,true);
ASSERT_EQUALS("[test.cpp:2]: (error) Invalid usleep() argument nr 1. The value is 1000001 but the valid values are '0-999999'.\n", errout.str()); ASSERT_EQUALS("[test.cpp:2]: (error) Invalid usleep() argument nr 1. The value is 1000001 but the valid values are '0:999999'.\n", errout.str());
} }
void checkCommaSeparatedReturn() { void checkCommaSeparatedReturn() {