Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aleixalcacer committed May 18, 2020
1 parent 4e391cf commit 2c9907e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions blosc/frame.c
Expand Up @@ -287,7 +287,7 @@ void *new_header_frame(blosc2_schunk *schunk, blosc2_frame *frame) {
assert(hsize2 == current_header_len); // sanity check

// Map size + int16 size
assert((hsize2 - hsize) < (1U << 16U));
assert((uint32_t) (hsize2 - hsize) < (1U << 16U));
uint16_t map_size = (uint16_t) (hsize2 - hsize);
swap_store(h2 + FRAME_IDX_SIZE, &map_size, sizeof(map_size));

Expand Down Expand Up @@ -876,7 +876,7 @@ int frame_get_metalayers(blosc2_frame* frame, blosc2_schunk* schunk) {
header = malloc(header_len);
FILE* fp = fopen(frame->fname, "rb");
size_t rbytes = fread(header, 1, header_len, fp);
if (rbytes != header_len) {
if (rbytes != (size_t) header_len) {
fprintf(stderr, "Cannot access the header out of the fileframe.\n");
fclose(fp);
return -2;
Expand Down
2 changes: 1 addition & 1 deletion blosc/schunk.c
Expand Up @@ -421,7 +421,7 @@ int blosc2_get_metalayer(blosc2_schunk *schunk, const char *name, uint8_t **cont
/* Update the content of the usermeta chunk. */
int blosc2_update_usermeta(blosc2_schunk *schunk, uint8_t *content, int32_t content_len,
blosc2_cparams cparams) {
if (content_len > (1u << 31u)) {
if ((uint32_t) content_len > (1u << 31u)) {
fprintf(stderr, "Error: content_len cannot exceed 2 GB");
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions compat/filegen.c
Expand Up @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {

/* Write data_out to argv[3] */
f = fopen(argv[3], "wb+");
if (fwrite(data_out, 1, (size_t) csize, f) == csize) {
if (fwrite(data_out, 1, (size_t) csize, f) == (uint32_t) csize) {
printf("Wrote %s\n", argv[3]);
} else {
printf("Write failed");
Expand All @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
fseek(f, 0, SEEK_END);
fsize = ftell(f);
fseek(f, 0, SEEK_SET);
if (fread(data_out, 1, (size_t) fsize, f) == fsize) {
if (fread(data_out, 1, (size_t) fsize, f) == (uint32_t) fsize) {
printf("Checking %s\n", argv[2]);
} else {
printf("Read failed");
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bitshuffle_leftovers.c
Expand Up @@ -102,7 +102,7 @@ int main() {
int result;

/* Initialize data */
for (int i = 0; i < size / sizeof(int32_t); i++) {
for (int i = 0; i < (int) (size / sizeof(int32_t)); i++) {
((uint32_t*)data)[i] = i;
}
/* leftovers */
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common.h
Expand Up @@ -164,7 +164,7 @@ static void dummy_threads_callback(void *callback_data, void (*dojob)(void *), i
dojob(((char *) jobdata) + ((unsigned) i)*jobdata_elsize);
}
/* install the callback if environment variable BLOSC_TEST_CALLBACK="yes" */
static void install_blosc_callback_test(void)
inline static void install_blosc_callback_test(void)
{
char *callback_env;
callback_env = getenv("BLOSC_TEST_CALLBACK");
Expand Down
6 changes: 3 additions & 3 deletions tests/test_frame.c
Expand Up @@ -109,7 +109,7 @@ static char* test_frame() {

if (usermeta) {
int content_len_ = blosc2_get_usermeta(schunk, &content_);
mu_assert("ERROR: bad usermeta length in frame", content_len_ == content_len);
mu_assert("ERROR: bad usermeta length in frame", (size_t) content_len_ == content_len);
mu_assert("ERROR: bad usermeta data in frame", strncmp((char*)content_, content, content_len) == 0);
free(content_);
blosc2_update_usermeta(schunk, (uint8_t *) content2, (int32_t) content_len2, BLOSC2_CPARAMS_DEFAULTS);
Expand Down Expand Up @@ -145,7 +145,7 @@ static char* test_frame() {

if (usermeta) {
int content_len_ = blosc2_get_usermeta(schunk, &content_);
mu_assert("ERROR: bad usermeta length in frame", content_len_ == content_len2);
mu_assert("ERROR: bad usermeta length in frame", (size_t) content_len_ == content_len2);
mu_assert("ERROR: bad usermeta data in frame", strncmp((char*)content_, content2, content_len2) == 0);
free(content_);
blosc2_update_usermeta(schunk, (uint8_t *) content3, (int32_t) content_len3, BLOSC2_CPARAMS_DEFAULTS);
Expand Down Expand Up @@ -202,7 +202,7 @@ static char* test_frame() {

if (usermeta) {
int content_len_ = blosc2_get_usermeta(schunk, &content_);
mu_assert("ERROR: bad usermeta length in frame", content_len_ == content_len3);
mu_assert("ERROR: bad usermeta length in frame", (size_t) content_len_ == content_len3);
mu_assert("ERROR: bad usermeta data in frame", strncmp((char*)content_, content3, content_len3) == 0);
free(content_);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_getitem_delta.c
Expand Up @@ -53,7 +53,7 @@ static char* test_getitem() {

/* Now that we see the round-trip passed, check the getitem */
int get_result = blosc_getitem(intermediate, start_item, num_items, items);
mu_assert("ERROR: the number of items in getitem is not correct", get_result == (num_items * type_size));
mu_assert("ERROR: the number of items in getitem is not correct", (uint32_t) get_result == (num_items * type_size));
mu_assert("ERROR: getitem with delta filter fails", memcmp(original, items, get_result) == 0);

/* Free allocated memory. */
Expand Down

0 comments on commit 2c9907e

Please sign in to comment.