summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@solidstatenetworks.com>2020-05-09 23:51:50 -0400
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-05-30 21:25:18 +0200
commit7d0b252ea919f9363d3097296250e57b3a768394 (patch)
treef464ed8a7be52ddec6ecc088a7a5b28303bbcf6e /test
parentb2ab507832ab63ac729fd382ab8146be6c54e228 (diff)
downloadProject-Tick-7d0b252ea919f9363d3097296250e57b3a768394.tar.gz
Project-Tick-7d0b252ea919f9363d3097296250e57b3a768394.zip
Fixed casting warnings and non-standard initializer warning in example project.
Diffstat (limited to 'test')
-rw-r--r--test/example.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/example.c b/test/example.c
index a6f737ebb4..d5229c984b 100644
--- a/test/example.c
+++ b/test/example.c
@@ -196,19 +196,19 @@ void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen) {
/* Read first hello, hello! string with gzfread */
strcpy((char*)uncompr, "garbages");
read = PREFIX(gzfread)(uncompr, uncomprLen, 1, file);
- if (strcmp(uncompr, hello) != 0) {
+ if (strcmp((const char *)uncompr, hello) != 0) {
fprintf(stderr, "bad gzgets\n");
exit(1);
} else {
printf("gzgets(): %s\n", (char*)uncompr);
}
pos = PREFIX(gzoffset)(file);
- if (pos != comprLen + 10) {
+ if (pos < 0 || (size_t)pos != (comprLen + 10)) {
fprintf(stderr, "gzoffset err: wrong offset at end\n");
exit(1);
}
/* Trigger an error and clear it with gzclearerr */
- PREFIX(gzfread)(uncompr, -1, -1, file);
+ PREFIX(gzfread)(uncompr, (size_t)-1, (size_t)-1, file);
PREFIX(gzerror)(file, &err);
if (err == 0) {
fprintf(stderr, "gzerror err: no error returned\n");
@@ -319,10 +319,15 @@ void test_large_deflate(unsigned char *compr, size_t comprLen, unsigned char *un
#ifndef ZLIB_COMPAT
int level = -1;
int strategy = -1;
- zng_deflate_param_value params[] = {
- { .param = Z_DEFLATE_LEVEL, .buf = &level, .size = sizeof(level) },
- { .param = Z_DEFLATE_STRATEGY, .buf = &strategy, .size = sizeof(strategy) },
- };
+ zng_deflate_param_value params[2];
+
+ params[0].param = Z_DEFLATE_LEVEL;
+ params[0].buf = &level;
+ params[0].size = sizeof(level);
+
+ params[1].param = Z_DEFLATE_STRATEGY;
+ params[1].buf = &strategy;
+ params[1].size = sizeof(strategy);
#endif
c_stream.zalloc = zalloc;