Merge pull request #3926 from OlegHahm/some-scan-build-warnings

clean up: Some scan build warnings
dev/timer
Oleg Hahm 8 years ago
commit a0957b11d6

@ -108,10 +108,6 @@ int base64_encode(unsigned char *data_in, size_t data_in_size, \
/* The last character is not finished yet */
njump++;
if (njump == 4) {
nNum = (tmpval >> (2 * njump));
}
nNum = nLst << (8 - 2 * njump);
base64_out[iterate_base64_buffer++] = getsymbol(nNum);

@ -35,7 +35,7 @@ bloom_t *bloom_new(size_t size, size_t num_hashes, ...)
}
/* Allocate Bloom array */
if (!(bloom->a = calloc(ROUND(size), sizeof(char)))) {
if (!(bloom->a = calloc(ROUND(size), sizeof(uint8_t)))) {
free(bloom);
return NULL;
}

@ -40,7 +40,7 @@ int ccm_compute_cbc_mac(cipher_t* cipher, uint8_t iv[16],
uint8_t offset, block_size, mac_enc[16] = {0};
block_size = cipher_get_block_size(cipher);
memcpy(mac, iv, 16);
memmove(mac, iv, 16);
offset = 0;
do {
uint8_t block_size_input = (length - offset > block_size) ?

@ -103,17 +103,18 @@ int stdimpl_strcmp(const char *s1, const char *s2)
if (s1 == s2) {
return 0;
}
else if (s1 && !s2) {
else if (s1 == NULL) {
return -1;
}
else if (s2 == NULL) {
return +1;
}
else if (!s1 && s2) {
return -1;
} else {
char c1,c2;
else {
char c1, c2;
do {
c1 = *s1++;
c2 = *s2++;
} while (c1 && c2 && (c1==c2));
} while ((c1 == c2) && (c1 != '\0'));
return c1 - c2;
}
}

@ -104,6 +104,8 @@ ssize_t ubjson_get_i32(ubjson_cookie_t *restrict cookie, ssize_t content, int32_
case UBJSON_INT32_INT32:
*dest = (int32_t) byteorder_ntohl(value.i32);
break;
default:
return -1;
}
}
return result;
@ -134,7 +136,9 @@ static ubjson_read_callback_result_t _ubjson_read_length(ubjson_cookie_t *restri
if (type == UBJSON_TYPE_INT32) {
int32_t len32;
read = ubjson_get_i32(cookie, content, &len32);
len64 = len32;
if (read > 0) {
len64 = len32;
}
}
else if (type == UBJSON_TYPE_INT64) {
read = ubjson_get_i64(cookie, content, &len64);

@ -351,6 +351,7 @@ static void test_array(void)
TEST_ASSERT_EQUAL_INT(1, i);
offset += cbor_deserialize_int(&stream, offset, &i);
TEST_ASSERT_EQUAL_INT(2, i);
TEST_ASSERT_EQUAL_INT(sizeof(data), offset);
}
cbor_clear(&stream);
@ -374,6 +375,7 @@ static void test_array(void)
char buffer[1024];
offset += cbor_deserialize_byte_string(&stream, offset, buffer, sizeof(buffer));
TEST_ASSERT_EQUAL_STRING("a", &(buffer[0]));
TEST_ASSERT_EQUAL_INT(sizeof(data), offset);
}
}
@ -442,6 +444,7 @@ static void test_map(void)
TEST_ASSERT_EQUAL_INT(2, key);
offset += cbor_deserialize_byte_string(&stream, offset, value, sizeof(value));
TEST_ASSERT_EQUAL_STRING("2", &(value[0]));
TEST_ASSERT_EQUAL_INT(sizeof(data), offset);
}
}

Loading…
Cancel
Save