coverity: Fix assert model
This commit is contained in:
parent
79578efd19
commit
2af6e52259
|
@ -43,9 +43,15 @@ void _assert_return_code(const LargestIntegralType result,
|
|||
void _assert_string_equal(const char * const a, const char * const b,
|
||||
const char * const file, const int line)
|
||||
{
|
||||
char ch;
|
||||
int cmp;
|
||||
|
||||
cmp = __coverity_strcmp(a, b);
|
||||
__coverity_weak_guard_sink__(a, b);
|
||||
__coverity_weak_guard_sink__(b, a);
|
||||
|
||||
ch = *((char *)a);
|
||||
ch = *((char *)b);
|
||||
|
||||
if (cmp != 0) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
@ -54,9 +60,15 @@ void _assert_string_equal(const char * const a, const char * const b,
|
|||
void _assert_string_not_equal(const char * const a, const char * const b,
|
||||
const char *file, const int line)
|
||||
{
|
||||
char ch;
|
||||
int cmp;
|
||||
|
||||
cmp = __coverity_strcmp(a, b);
|
||||
__coverity_weak_guard_sink__(a, b);
|
||||
__coverity_weak_guard_sink__(b, a);
|
||||
|
||||
ch = *((char *)a);
|
||||
ch = *((char *)b);
|
||||
|
||||
if (cmp == 0) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
@ -66,9 +78,15 @@ void _assert_memory_equal(const void * const a, const void * const b,
|
|||
const size_t size, const char* const file,
|
||||
const int line)
|
||||
{
|
||||
unsigned char ch;
|
||||
int cmp;
|
||||
|
||||
cmp = memcmp(a, b, size);
|
||||
__coverity_weak_guard_sink__(a, b);
|
||||
__coverity_weak_guard_sink__(b, a);
|
||||
|
||||
ch = *((unsigned char *)a);
|
||||
ch = *((unsigned char *)b);
|
||||
|
||||
if (cmp != 0) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
@ -78,9 +96,15 @@ void _assert_memory_not_equal(const void * const a, const void * const b,
|
|||
const size_t size, const char* const file,
|
||||
const int line)
|
||||
{
|
||||
unsigned char ch;
|
||||
int cmp;
|
||||
|
||||
cmp = memcmp(a, b, size);
|
||||
__coverity_weak_guard_sink__(a, b);
|
||||
__coverity_weak_guard_sink__(b, a);
|
||||
|
||||
ch = *((unsigned char *)a);
|
||||
ch = *((unsigned char *)b);
|
||||
|
||||
if (cmp == 0) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
@ -108,9 +132,9 @@ void _assert_in_set(
|
|||
const LargestIntegralType value, const LargestIntegralType values[],
|
||||
const size_t number_of_values, const char* const file, const int line)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if (i = 0; i < number_of_values; i++) {
|
||||
for (i = 0; i < number_of_values; i++) {
|
||||
if (value == values[i]) {
|
||||
return;
|
||||
}
|
||||
|
@ -122,9 +146,9 @@ void _assert_not_in_set(
|
|||
const LargestIntegralType value, const LargestIntegralType values[],
|
||||
const size_t number_of_values, const char* const file, const int line)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if (i = 0; i < number_of_values; i++) {
|
||||
for (i = 0; i < number_of_values; i++) {
|
||||
if (value == values[i]) {
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue