Skip to content

Commit fc87717

Browse files
committed
build: fix format errors
mostly trivial: for s?size_t -> use z modifier for long/int/time_t/pid_t: add explicit cast, or use different specifier for char*/void*: use explicit cast for too many/too few arguments, use git log and context to either add format specifier or drop argument, resp. drop format specifier or add suitable argument. ipc.c:497: error: format '%d' expects type 'int', but argument 10 has type 'ssize_t' ipc.c:500: error: format '%d' expects type 'int', but argument 10 has type 'ssize_t' ipc.c:500: error: format '%.120s' expects type 'char *', but argument 11 has type 'void *' ipc.c:512: error: format '%d' expects type 'int', but argument 12 has type 'ssize_t' ipc.c:661: error: format '%d' expects type 'int', but argument 8 has type 'ssize_t' ipc.c:831: error: too few arguments for format utils.c:2075: error: format '%lu' expects type 'long unsigned int', but argument 10 has type 'unsigned int' utils.c:2075: error: format '%lu' expects type 'long unsigned int', but argument 11 has type 'unsigned int' utils.c:2075: error: format '%lu' expects type 'long unsigned int', but argument 12 has type 'unsigned int' utils.c:2075: error: format '%lu' expects type 'long unsigned int', but argument 13 has type 'unsigned int' xml.c:910: error: too many arguments for format xml.c:2429: error: '0' flag ignored with precision and '%x' gnu_printf format xml.c:4163: error: '0' flag ignored with precision and '%x' gnu_printf format iso8601.c:982: error: too few arguments for format remote.c:237: error: format '%d' expects type 'int', but argument 7 has type 'size_t' remote.c:250: error: format '%d' expects type 'int', but argument 8 has type 'size_t' remote.c:276: error: format '%d' expects type 'int', but argument 8 has type 'size_t' remote.c:291: error: format '%d' expects type 'int', but argument 8 has type 'size_t' remote.c:521: error: format '%u' expects type 'unsigned int', but argument 7 has type 'size_t' remote.c:562: error: format '%u' expects type 'unsigned int', but argument 8 has type 'size_t' remote.c:568: error: format '%u' expects type 'unsigned int', but argument 7 has type 'size_t' remote.c:572: error: format '%u' expects type 'unsigned int', but argument 7 has type 'size_t' remote.c:580: error: format '%u' expects type 'unsigned int', but argument 7 has type 'size_t' remote.c:583: error: format '%u' expects type 'unsigned int', but argument 7 has type 'size_t' remote.c:693: error: too few arguments for format mainloop.c:659: error: format '%d' expects type 'int', but argument 9 has type 'long int' mainloop.c:659: error: too many arguments for format unpack.c:2884: error: too many arguments for format utils.c:234: error: too many arguments for format services_linux.c:92: error: too many arguments for format dbus.c:521: error: format '%ld' expects type 'long int', but argument 8 has type 'int' lrmd_client.c:1771: error: format '%d' expects type 'int', but argument 7 has type 'size_t' lrmd_client.c:1913: error: format '%d' expects type 'int', but argument 7 has type 'size_t' cpg.c:169: error: format '%d' expects type 'int', but argument 7 has type 'size_t' cpg.c:181: error: format '%d' expects type 'int', but argument 11 has type 'ssize_t' cpg.c:203: error: format '%d' expects type 'int', but argument 8 has type 'size_t' cpg.c:626: error: format '%d' expects type 'int', but argument 9 has type 'size_t' cpg.c:629: error: format '%d' expects type 'int', but argument 9 has type 'size_t'
1 parent 3394eaa commit fc87717

File tree

22 files changed

+50
-49
lines changed

22 files changed

+50
-49
lines changed

cib/callbacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ cib_process_request(xmlNode * request, gboolean force_synchronous, gboolean priv
10881088

10891089
finished = time(NULL);
10901090
if (finished - now > 3) {
1091-
crm_trace("%s operation took %ds to complete", op, finished - now);
1091+
crm_trace("%s operation took %lds to complete", op, (long)(finished - now));
10921092
crm_write_blackbox(0, NULL);
10931093
}
10941094

cib/io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ static int cib_archive_sort(const struct dirent ** a, const struct dirent **b)
183183
rc = -1;
184184
}
185185

186-
crm_trace("%s (%u) vs. %s (%u) : %d", a[0]->d_name, a_age, b[0]->d_name, b_age, rc);
186+
crm_trace("%s (%lu) vs. %s (%lu) : %d",
187+
a[0]->d_name, (unsigned long)a_age,
188+
b[0]->d_name, (unsigned long)b_age, rc);
187189
return rc;
188190
}
189191

cib/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ cib_handle_remote_msg(crm_client_t * client, xmlNode * command)
436436
value = crm_element_value(command, F_CIB_CALLBACK_TOKEN);
437437
if (value != NULL) {
438438
client->userdata = strdup(value);
439-
crm_trace("Callback channel for %s is %s", client->id, client->userdata);
439+
crm_trace("Callback channel for %s is %s", client->id, (char*)client->userdata);
440440

441441
} else {
442442
client->userdata = strdup(client->id);

crmd/lrm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ build_parameter_list(lrmd_event_data_t *op, xmlNode *metadata, xmlNode *result,
601601
if(result && accept) {
602602
value = g_hash_table_lookup(op->params, name);
603603
if(value != NULL) {
604-
crm_trace("Adding attr to the xml result", name, target?"":"not ", criteria);
604+
crm_trace("Adding attr %s=%s to the xml result", name, value);
605605
crm_xml_add(result, name, value);
606606
}
607607
}
@@ -1928,7 +1928,7 @@ stop_recurring_action_by_rsc(gpointer key, gpointer value, gpointer user_data)
19281928
struct recurring_op_s *op = (struct recurring_op_s *)value;
19291929

19301930
if (op->interval != 0 && crm_str_eq(op->rsc_id, event->rsc->id, TRUE)) {
1931-
crm_debug("Cancelling op %d for %s (%s)", op->call_id, op->rsc_id, key);
1931+
crm_debug("Cancelling op %d for %s (%s)", op->call_id, op->rsc_id, (char*)key);
19321932
remove = !cancel_op(event->lrm_state, event->rsc->id, key, op->call_id, FALSE);
19331933
}
19341934

crmd/lrm_state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fail_pending_op(gpointer key, gpointer value, gpointer user_data)
7575

7676
crm_trace("Pre-emptively failing %s_%s_%d on %s (call=%s, %s)",
7777
op->rsc_id, op->op_type, op->interval,
78-
lrm_state->node_name, key, op->user_data);
78+
lrm_state->node_name, (char*)key, op->user_data);
7979

8080
event.type = lrmd_event_exec_complete;
8181
event.rsc_id = op->rsc_id;

crmd/throttle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ static bool throttle_cib_load(float *load)
215215
*load = (delta_utime + delta_stime); /* Cast to a float before division */
216216
*load /= ticks_per_s;
217217
*load /= elapsed;
218-
crm_debug("cib load: %f (%lu ticks in %ds)", *load, delta_utime + delta_stime, elapsed);
218+
crm_debug("cib load: %f (%lu ticks in %lds)", *load, delta_utime + delta_stime, (long)elapsed);
219219

220220
} else {
221-
crm_debug("Init %lu + %lu ticks at %d (%lu tps)", utime, stime, now, ticks_per_s);
221+
crm_debug("Init %lu + %lu ticks at %ld (%lu tps)", utime, stime, (long)now, ticks_per_s);
222222
}
223223

224224
last_call = now;

lib/cluster/cpg.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ crm_cs_flush(gpointer data)
166166

167167
sent++;
168168
last_sent++;
169-
crm_trace("CPG message sent, size=%d", iov->iov_len);
169+
crm_trace("CPG message sent, size=%zd", iov->iov_len);
170170

171171
cs_message_queue = g_list_remove(cs_message_queue, iov);
172172
free(iov->iov_base);
@@ -178,7 +178,7 @@ crm_cs_flush(gpointer data)
178178
crm_info("Sent %d CPG messages (%d remaining, last=%u): %s (%d)",
179179
sent, queue_len, last_sent, ais_error2text(rc), rc);
180180
} else {
181-
crm_trace("Sent %d CPG messages (%d remaining, last=%u): %s (%d)",
181+
crm_trace("Sent %d CPG messages (%d remaining, last=%u): %s (%zd)",
182182
sent, queue_len, last_sent, ais_error2text(rc), rc);
183183
}
184184

@@ -200,7 +200,7 @@ send_cpg_iov(struct iovec * iov)
200200
static unsigned int queued = 0;
201201

202202
queued++;
203-
crm_trace("Queueing CPG message %u (%d bytes)", queued, iov->iov_len);
203+
crm_trace("Queueing CPG message %u (%zd bytes)", queued, iov->iov_len);
204204
cs_message_queue = g_list_append(cs_message_queue, iov);
205205
crm_cs_flush(&pcmk_cpg_handle);
206206
return TRUE;
@@ -623,10 +623,10 @@ send_cluster_text(int class, const char *data,
623623
iov->iov_len = msg->header.size;
624624

625625
if (msg->compressed_size) {
626-
crm_trace("Queueing CPG message %u to %s (%d bytes, %d bytes compressed payload): %.200s",
626+
crm_trace("Queueing CPG message %u to %s (%zd bytes, %d bytes compressed payload): %.200s",
627627
msg->id, target, iov->iov_len, msg->compressed_size, data);
628628
} else {
629-
crm_trace("Queueing CPG message %u to %s (%d bytes, %d bytes payload): %.200s",
629+
crm_trace("Queueing CPG message %u to %s (%zd bytes, %d bytes payload): %.200s",
630630
msg->id, target, iov->iov_len, msg->size, data);
631631
}
632632
free(target);

lib/common/ipc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,11 @@ crm_ipcs_flush_events(crm_client_t * c)
494494
sent++;
495495
header = event[0].iov_base;
496496
if (header->size_compressed) {
497-
crm_trace("Event %d to %p[%d] (%d compressed bytes) sent",
497+
crm_trace("Event %d to %p[%d] (%zu compressed bytes) sent",
498498
header->qb.id, c->ipcs, c->pid, rc);
499499
} else {
500-
crm_trace("Event %d to %p[%d] (%d bytes) sent: %.120s",
501-
header->qb.id, c->ipcs, c->pid, rc, event[1].iov_base);
500+
crm_trace("Event %d to %p[%d] (%zu bytes) sent: %.120s",
501+
header->qb.id, c->ipcs, c->pid, rc, (char *)(event[1].iov_base));
502502
}
503503

504504
c->event_queue = g_list_remove(c->event_queue, event);
@@ -509,7 +509,7 @@ crm_ipcs_flush_events(crm_client_t * c)
509509

510510
queue_len -= sent;
511511
if (sent > 0 || c->event_queue) {
512-
crm_trace("Sent %d events (%d remaining) for %p[%d]: %s (%d)",
512+
crm_trace("Sent %d events (%d remaining) for %p[%d]: %s (%zd)",
513513
sent, queue_len, c->ipcs, c->pid, pcmk_strerror(rc < 0 ? rc : 0), rc);
514514
}
515515

@@ -658,7 +658,7 @@ crm_ipcs_sendv(crm_client_t * c, struct iovec * iov, enum crm_ipc_flags flags)
658658
header->qb.id, c->ipcs, c->pid, header->qb.size, pcmk_strerror(rc), rc);
659659

660660
} else {
661-
crm_trace("Response %d sent, %d bytes to %p[%d]", header->qb.id, rc, c->ipcs, c->pid);
661+
crm_trace("Response %d sent, %zd bytes to %p[%d]", header->qb.id, rc, c->ipcs, c->pid);
662662
}
663663

664664
if (flags & crm_ipc_server_free) {
@@ -828,7 +828,7 @@ void
828828
crm_ipc_close(crm_ipc_t * client)
829829
{
830830
if (client) {
831-
crm_trace("Disconnecting %s IPC connection %p (%p.%p)", client->name, client, client->ipc);
831+
crm_trace("Disconnecting %s IPC connection %p (%p)", client->name, client, client->ipc);
832832

833833
if (client->ipc) {
834834
qb_ipcc_connection_t *ipc = client->ipc;

lib/common/iso8601.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ crm_time_parse_period(const char *period_str)
979979
void
980980
crm_time_set(crm_time_t * target, crm_time_t * source)
981981
{
982-
crm_trace("target=%p, source=%p, offset=%d", target, source);
982+
crm_trace("target=%p, source=%p", target, source);
983983

984984
CRM_CHECK(target != NULL && source != NULL, return);
985985

lib/common/mainloop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ mainloop_gio_callback(GIOChannel * gio, GIOCondition condition, gpointer data)
656656
} else if (client->dispatch_fn_ipc) {
657657
const char *buffer = crm_ipc_buffer(client->ipc);
658658

659-
crm_trace("New message from %s[%p] = %d", client->name, client, rc, condition);
659+
crm_trace("New message from %s[%p] = %ld (I/O condition=%d)", client->name, client, rc, condition);
660660
if (client->dispatch_fn_ipc(buffer, rc, client->userdata) < 0) {
661661
crm_trace("Connection to %s no longer required", client->name);
662662
keep = FALSE;

0 commit comments

Comments
 (0)