mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-01-08 12:24:39 +00:00
warnings cleanup: Wformat: sign-correct PRIu32 specifiers as appropriate
Looks like these are not accepted with splint checker. Also fix some other minor type -- print format specifier discrepancies. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
parent
4a7ac32fb0
commit
ef5b1cf4cb
@ -128,7 +128,7 @@ s1_msg_process_fn(qb_ipcs_connection_t * c, void *data, size_t size)
|
||||
response.id = 13;
|
||||
response.error = 0;
|
||||
|
||||
sl = snprintf(resp, 100, "ACK %zd bytes", size) + 1;
|
||||
sl = snprintf(resp, 100, "ACK %zu bytes", size) + 1;
|
||||
iov[0].iov_len = sizeof(response);
|
||||
iov[0].iov_base = &response;
|
||||
iov[1].iov_len = sl;
|
||||
|
||||
@ -40,7 +40,7 @@ notify_fn(uint32_t event, char *key, void *old_value, void *value,
|
||||
fprintf(stderr, "Notify[REPLACED] %s [%d] -> [%d]\n",
|
||||
key, *(int *)old_value, *(int *)value);
|
||||
} else {
|
||||
fprintf(stderr, "Notify[%d] %s \n", event, key);
|
||||
fprintf(stderr, "Notify[%" PRIu32 "] %s \n", event, key);
|
||||
if (value != NULL) {
|
||||
fprintf(stderr, " value = [%d]\n", *(int *)value);
|
||||
}
|
||||
|
||||
12
lib/log.c
12
lib/log.c
@ -415,13 +415,15 @@ static void
|
||||
qb_log_callsites_dump_sect(struct callsite_section *sect)
|
||||
{
|
||||
struct qb_log_callsite *cs;
|
||||
|
||||
printf(" start %p - stop %p\n", sect->start, sect->stop);
|
||||
printf("filename lineno targets tags\n");
|
||||
for (cs = sect->start; cs < sect->stop; cs++) {
|
||||
if (cs->lineno > 0) {
|
||||
printf("%12s %6d %16d %16d\n", cs->filename, cs->lineno,
|
||||
cs->targets, cs->tags);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("%12s %6" PRIu32 " %16" PRIu32 " %16u\n",
|
||||
cs->filename, cs->lineno, cs->targets,
|
||||
cs->tags);
|
||||
#endif /* S_SPLINT_S */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1060,7 +1062,9 @@ qb_log_custom_open(qb_log_logger_fn log_fn,
|
||||
}
|
||||
|
||||
t->instance = user_data;
|
||||
snprintf(t->filename, PATH_MAX, "custom-%d", t->pos);
|
||||
#ifndef S_SPLINT_S
|
||||
snprintf(t->filename, PATH_MAX, "custom-%" PRIu32, t->pos);
|
||||
#endif /* S_SPLINT_S */
|
||||
|
||||
t->logger = log_fn;
|
||||
t->vlogger = NULL;
|
||||
|
||||
@ -243,11 +243,15 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
|
||||
/* function size & name */
|
||||
memcpy(&fn_size, ptr, sizeof(uint32_t));
|
||||
if ((fn_size + BB_MIN_ENTRY_SIZE) > bytes_read) {
|
||||
printf("ERROR Corrupt file: fn_size way too big %d\n", fn_size);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("ERROR Corrupt file: fn_size way too big %" PRIu32 "\n", fn_size);
|
||||
#endif /* S_SPLINT_S */
|
||||
goto cleanup;
|
||||
}
|
||||
if (fn_size <= 0) {
|
||||
printf("ERROR Corrupt file: fn_size negative %d\n", fn_size);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("ERROR Corrupt file: fn_size negative %" PRIu32 "\n", fn_size);
|
||||
#endif /* S_SPLINT_S */
|
||||
goto cleanup;
|
||||
}
|
||||
ptr += sizeof(uint32_t);
|
||||
@ -270,7 +274,9 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
|
||||
/* message length */
|
||||
memcpy(&msg_len, ptr, sizeof(uint32_t));
|
||||
if (msg_len > QB_LOG_MAX_LEN || msg_len <= 0) {
|
||||
printf("ERROR Corrupt file: msg_len out of bounds %d\n", msg_len);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("ERROR Corrupt file: msg_len out of bounds %" PRIu32 "\n", msg_len);
|
||||
#endif /* S_SPLINT_S */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@ -385,7 +385,9 @@ qb_log_target_format(int32_t target,
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
snprintf(tmp_buf, 30, "%d", cs->lineno);
|
||||
#ifndef S_SPLINT_S
|
||||
snprintf(tmp_buf, 30, "%" PRIu32, cs->lineno);
|
||||
#endif /* S_SPLINT_S */
|
||||
p = tmp_buf;
|
||||
break;
|
||||
|
||||
|
||||
@ -698,12 +698,12 @@ print_header(struct qb_ringbuffer_s * rb)
|
||||
} else {
|
||||
printf(" ->NORMAL\n");
|
||||
}
|
||||
printf(" ->write_pt [%d]\n", rb->shared_hdr->write_pt);
|
||||
printf(" ->read_pt [%d]\n", rb->shared_hdr->read_pt);
|
||||
printf(" ->size [%d words]\n", rb->shared_hdr->word_size);
|
||||
#ifndef S_SPLINT_S
|
||||
printf(" =>free [%zu bytes]\n", qb_rb_space_free(rb));
|
||||
printf(" =>used [%zu bytes]\n", qb_rb_space_used(rb));
|
||||
printf(" ->write_pt [%" PRIu32 "]\n", rb->shared_hdr->write_pt);
|
||||
printf(" ->read_pt [%" PRIu32 "]\n", rb->shared_hdr->read_pt);
|
||||
printf(" ->size [%" PRIu32 " words]\n", rb->shared_hdr->word_size);
|
||||
printf(" =>free [%zd bytes]\n", qb_rb_space_free(rb));
|
||||
printf(" =>used [%zd bytes]\n", qb_rb_space_used(rb));
|
||||
#endif /* S_SPLINT_S */
|
||||
}
|
||||
|
||||
|
||||
10
lib/trie.c
10
lib/trie.c
@ -408,12 +408,14 @@ trie_print_node(struct trie_node *n, struct trie_node *r, const char *suffix)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("[%c", TRIE_INDEX2CHAR(n->idx));
|
||||
printf("[%c", (char) TRIE_INDEX2CHAR(n->idx));
|
||||
for (i = 0; i < n->num_segments; i++) {
|
||||
printf("%c", n->segment[i]);
|
||||
}
|
||||
if (n == r) {
|
||||
printf("] (%d) %s\n", n->refcount, suffix);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("] (%" PRIu32 ") %s\n", n->refcount, suffix);
|
||||
#endif /* S_SPLINT_S */
|
||||
} else {
|
||||
printf("] ");
|
||||
}
|
||||
@ -502,7 +504,9 @@ qb_trie_dump(qb_map_t* m)
|
||||
return;
|
||||
}
|
||||
|
||||
printf("nodes: %d, bytes: %d\n", t->num_nodes, t->mem_used);
|
||||
#ifndef S_SPLINT_S
|
||||
printf("nodes: %" PRIu32 ", bytes: %" PRIu32 "\n", t->num_nodes, t->mem_used);
|
||||
#endif /* S_SPLINT_S */
|
||||
|
||||
n = t->header;
|
||||
do {
|
||||
|
||||
@ -141,7 +141,7 @@ set_ipc_name(const char *prefix)
|
||||
}
|
||||
|
||||
snprintf(ipc_name, sizeof(ipc_name), "%s%s%lX%.4x", prefix, t_sec,
|
||||
(long)getpid(), (int) ((long) time(NULL) % (0x10000)));
|
||||
(unsigned long)getpid(), (unsigned) ((long) time(NULL) % (0x10000)));
|
||||
}
|
||||
|
||||
static int32_t
|
||||
|
||||
@ -820,7 +820,7 @@ END_TEST
|
||||
static const char *tagtest_stringify_tag(uint32_t tag)
|
||||
{
|
||||
static char buf[32];
|
||||
sprintf(buf, "%5d", tag);
|
||||
sprintf(buf, "%5" PRIu32, tag);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@ -65,20 +65,20 @@ store_this_snprintf(const char *fmt, ...)
|
||||
static void
|
||||
test_this_one(const char *name, snprintf_like_func func)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
qb_util_stopwatch_t *sw = qb_util_stopwatch_create();
|
||||
float elapsed = 452.245252343;
|
||||
float ops_per_sec = 0.345624523;
|
||||
|
||||
qb_util_stopwatch_start(sw);
|
||||
for (i = 0; i < ITERATIONS; i++) {
|
||||
func("%d %s %llu %9.3f", i, "hello", 3425ULL, elapsed);
|
||||
func("[%10s] %.32x -> %p", "hello", i, func);
|
||||
func("%u %s %llu %9.3f", i, "hello", 3425ULL, elapsed);
|
||||
func("[%10s] %.32xd -> %p", "hello", i, func);
|
||||
func("Client %s.%.9s wants to fence (%s) '%s' with device '%3.5f'",
|
||||
"bla", "foooooooooooooooooo",
|
||||
name, "target", ops_per_sec);
|
||||
func("Node %s now has process list: %.32x (was %.32x)",
|
||||
"18builder", 2, 0);
|
||||
"18builder", 2U, 0U);
|
||||
}
|
||||
qb_util_stopwatch_stop(sw);
|
||||
elapsed = qb_util_stopwatch_sec_elapsed_get(sw);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user