Fix printf formats

This commit is contained in:
Jeremy Lakeman 2013-12-16 15:19:15 +10:30
parent 4cf97b7d41
commit 8d80cf55f2
8 changed files with 15 additions and 15 deletions

View File

@ -355,7 +355,7 @@ void transfer_bytes(struct radio_state *radios)
if (bytes>0){
log_time();
fprintf(stderr, "Transferring %d byte packet from %s to %s\n", bytes, t->name, r->name);
fprintf(stderr, "Transferring %zd byte packet from %s to %s\n", bytes, t->name, r->name);
}
unsigned i, j;

View File

@ -246,7 +246,7 @@ void _ob_append_byte(struct __sourceloc __whence, struct overlay_buffer *b, unsi
if (ob_makespace(b, bytes)) {
b->bytes[b->position] = byte;
if (config.debug.overlaybuffer)
DEBUGF("ob_append_byte(b=%p, byte=0x%02x) %p[%d]=%02x position=%zu", b, byte, b->bytes, b->position, byte, b->position + bytes);
DEBUGF("ob_append_byte(b=%p, byte=0x%02x) %p[%zd]=%02x position=%zu", b, byte, b->bytes, b->position, byte, b->position + bytes);
} else {
if (config.debug.overlaybuffer)
DEBUGF("ob_append_byte(b=%p, byte=0x%02x) OVERRUN position=%zu", b, byte, b->position + bytes);
@ -293,7 +293,7 @@ void _ob_append_ui16(struct __sourceloc __whence, struct overlay_buffer *b, uint
b->bytes[b->position] = (v >> 8) & 0xFF;
b->bytes[b->position+1] = v & 0xFF;
if (config.debug.overlaybuffer)
DEBUGF("ob_append_ui16(b=%p, v=%u) %p[%d]=%s position=%zu", b, v, b->bytes, b->position, alloca_tohex(&b->bytes[b->position], bytes), b->position + bytes);
DEBUGF("ob_append_ui16(b=%p, v=%u) %p[%zd]=%s position=%zu", b, v, b->bytes, b->position, alloca_tohex(&b->bytes[b->position], bytes), b->position + bytes);
} else {
if (config.debug.overlaybuffer)
DEBUGF("ob_append_ui16(b=%p, v=%u) OVERRUN position=%zu", b, v, b->position + bytes);
@ -310,7 +310,7 @@ void _ob_append_ui32(struct __sourceloc __whence, struct overlay_buffer *b, uint
b->bytes[b->position+2] = (v >> 8) & 0xFF;
b->bytes[b->position+3] = v & 0xFF;
if (config.debug.overlaybuffer)
DEBUGF("ob_append_ui32(b=%p, v=%"PRIu32") %p[%d]=%s position=%zu",
DEBUGF("ob_append_ui32(b=%p, v=%"PRIu32") %p[%zd]=%s position=%zu",
b, v, b->bytes, b->position, alloca_tohex(&b->bytes[b->position], bytes), b->position + bytes);
} else {
if (config.debug.overlaybuffer)
@ -332,7 +332,7 @@ void _ob_append_ui64(struct __sourceloc __whence, struct overlay_buffer *b, uint
b->bytes[b->position+6] = (v >> 8) & 0xFF;
b->bytes[b->position+7] = v & 0xFF;
if (config.debug.overlaybuffer)
DEBUGF("ob_append_ui64(b=%p, v=%"PRIu64") %p[%d]=%s position=%zu",
DEBUGF("ob_append_ui64(b=%p, v=%"PRIu64") %p[%zd]=%s position=%zu",
b, v, b->bytes, b->position, alloca_tohex(&b->bytes[b->position], bytes), b->position + bytes);
} else {
if (config.debug.overlaybuffer)
@ -530,7 +530,7 @@ void _ob_set_ui16(struct __sourceloc __whence, struct overlay_buffer *b, size_t
b->bytes[offset] = (v >> 8) & 0xFF;
b->bytes[offset+1] = v & 0xFF;
if (config.debug.overlaybuffer)
DEBUGF("ob_set_ui16(b=%p, offset=%d, v=%u) %p[%d]=%s", b, offset, v, b->bytes, offset, alloca_tohex(&b->bytes[offset], bytes));
DEBUGF("ob_set_ui16(b=%p, offset=%zd, v=%u) %p[%zd]=%s", b, offset, v, b->bytes, offset, alloca_tohex(&b->bytes[offset], bytes));
}
void _ob_set(struct __sourceloc __whence, struct overlay_buffer *b, size_t offset, unsigned char byte)
@ -541,7 +541,7 @@ void _ob_set(struct __sourceloc __whence, struct overlay_buffer *b, size_t offse
assert(offset + bytes <= b->allocSize);
b->bytes[offset] = byte;
if (config.debug.overlaybuffer)
DEBUGF("ob_set(b=%p, offset=%d, byte=0x%02x) %p[%d]=%s", b, offset, byte, b->bytes, offset, alloca_tohex(&b->bytes[offset], bytes));
DEBUGF("ob_set(b=%p, offset=%zd, byte=0x%02x) %p[%zd]=%s", b, offset, byte, b->bytes, offset, alloca_tohex(&b->bytes[offset], bytes));
}
void _ob_patch_rfs(struct __sourceloc __whence, struct overlay_buffer *b)

View File

@ -773,7 +773,7 @@ static int overlay_send_frame(
return -1;
}
if (config.debug.mdprequests) {
DEBUGF("Send frame %u bytes", ob_position(plaintext));
DEBUGF("Send frame %zu bytes", ob_position(plaintext));
dump("Frame plaintext", ob_ptr(plaintext), ob_position(plaintext));
}

View File

@ -439,7 +439,7 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
if (config.debug.overlayframes)
dump("Payload Header", header_start, current - header_start);
ret = WHYF("Invalid payload length (%d)", payload_len);
ret = WHYF("Invalid payload length (%zd)", payload_len);
goto end;
}
break;
@ -448,7 +448,7 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
int next_payload = ob_position(b) + payload_len;
if (config.debug.overlayframes){
DEBUGF("Received payload type %x, len %d", f.type, payload_len);
DEBUGF("Received payload type %x, len %zd", f.type, payload_len);
DEBUGF("Payload from %s", f.source?alloca_tohex_sid_t(f.source->sid):"NULL");
DEBUGF("Payload to %s", (f.destination?alloca_tohex_sid_t(f.destination->sid):"broadcast"));
if (!is_all_matching(f.broadcast_id.id, BROADCAST_LEN, 0))

View File

@ -471,7 +471,7 @@ overlay_stuff_packet(struct outgoing_packet *packet, overlay_txqueue *queue, tim
frame->transmit_count++;
if (config.debug.overlayframes){
DEBUGF("Appended payload %p, %d type %x len %d for %s via %s",
DEBUGF("Appended payload %p, %d type %x len %zd for %s via %s",
frame, frame->mdp_sequence,
frame->type, ob_position(frame->payload),
frame->destination?alloca_tohex_sid_t(frame->destination->sid):"All",

View File

@ -431,7 +431,7 @@ static int radio_link_parse(struct overlay_interface *interface, struct radio_li
if (payload[4]&0x80) {
if (config.debug.radio_link)
DEBUGF("PDU Complete (length=%d)",state->packet_length);
DEBUGF("PDU Complete (length=%zd)",state->packet_length);
packetOkOverlay(interface, state->dst, state->packet_length, NULL);
state->packet_length=sizeof(state->dst)+1;

View File

@ -423,7 +423,7 @@ static int receive_http_response(int sock, char *buffer, size_t buffer_len, stru
ssize_t count;
do {
if ((count = read(sock, &buffer[len], buffer_len - len)) == -1)
return WHYF_perror("read(%d, %p, %d)", sock, &buffer[len], (int)buffer_len - len);
return WHYF_perror("read(%d, %p, %d)", sock, &buffer[len], (int)(buffer_len - len));
len += (size_t)count;
} while (len < buffer_len && count != 0 && !is_http_header_complete(buffer, len, len));
if (config.debug.rhizome_rx)

View File

@ -315,7 +315,7 @@ int overlay_rhizome_saw_advertisements(struct decode_context *context, struct ov
unsigned char *data = ob_get_bytes_ptr(f->payload, manifest_length);
if (!data) {
WHYF("Illegal manifest length field in rhizome advertisement frame %zu vs %d",
WHYF("Illegal manifest length field in rhizome advertisement frame %zu vs %zd",
manifest_length, ob_remaining(f->payload));
break;
}
@ -408,7 +408,7 @@ next:
unsigned char *bar;
bars[bar_count]=bar=ob_get_bytes_ptr(f->payload, RHIZOME_BAR_BYTES);
if (!bar){
WARNF("Expected whole BAR @%x (only %d bytes remain)", ob_position(f->payload), ob_remaining(f->payload));
WARNF("Expected whole BAR @%zx (only %zd bytes remain)", ob_position(f->payload), ob_remaining(f->payload));
break;
}