Fix Android compiler warnings ("%zd" and ssize_t)

Also squash some unconditional DEBUG statements
This commit is contained in:
Andrew Bettison 2013-11-21 17:32:58 +10:30
parent 702d22de99
commit 67a724b29d
3 changed files with 14 additions and 13 deletions

@ -1117,7 +1117,7 @@ int app_trace(const struct cli_parsed *parsed, struct cli_context *context)
int ret=overlay_mdp_send(mdp_sockfd, &mdp, MDP_AWAITREPLY, 5000);
ob_free(b);
if (ret)
DEBUGF("overlay_mdp_send returned %d", ret);
WHYF("overlay_mdp_send returned %d", ret);
else{
int offset=0;
{
@ -2319,7 +2319,6 @@ int app_id_list(const struct cli_parsed *parsed, struct cli_context *context)
struct mdp_header rev_header;
unsigned char response_payload[1600];
ssize_t len = mdp_poll_recv(mdp_sock, timeout, &rev_header, response_payload, sizeof(response_payload));
DEBUGF("mdp_poll_recv = %zd", len);
if (len==-1)
break;
if (len==-2){
@ -2838,11 +2837,10 @@ int app_network_scan(const struct cli_parsed *parsed, struct cli_context *contex
return -1;
if (address){
DEBUGF("Parsing arg %s", address);
if (!inet_aton(address, &scan->addr))
return WHY("Unable to parse the address");
}else
DEBUGF("Scanning local networks");
INFO("Scanning local networks");
if ((mdp_sockfd = overlay_mdp_client_socket()) < 0)
return WHY("Cannot create MDP socket");

@ -274,8 +274,12 @@ static int ply_read_next(struct ply_read *ply)
return 1;
}
ply->read.offset -= sizeof footer;
if (rhizome_read_buffered(&ply->read, &ply->buff, footer, sizeof footer) != sizeof footer)
return -1;
ssize_t read;
read = rhizome_read_buffered(&ply->read, &ply->buff, footer, sizeof footer);
if (read == -1)
return WHYF("rhizome_read_buffered() failed");
if ((size_t) read != sizeof footer)
return WHYF("Expected %zu bytes read, got %zu", (size_t) sizeof footer, (size_t) read);
// (rhizome_read automatically advances the offset by the number of bytes read)
ply->record_length=read_uint16(footer);
ply->type = ply->record_length & 0xF;
@ -302,9 +306,11 @@ static int ply_read_next(struct ply_read *ply)
ply->buffer = b;
}
ssize_t read = rhizome_read_buffered(&ply->read, &ply->buff, ply->buffer, ply->record_length);
if (read != ply->record_length)
return WHYF("Expected %u bytes read, got %zd", ply->record_length, read);
read = rhizome_read_buffered(&ply->read, &ply->buff, ply->buffer, ply->record_length);
if (read == -1)
return WHYF("rhizome_read_buffered() failed");
if ((size_t) read != ply->record_length)
return WHYF("Expected %u bytes read, got %zu", ply->record_length, (size_t) read);
ply->read.offset = record_start;
return 0;

@ -838,7 +838,7 @@ ssize_t rhizome_read_buffered(struct rhizome_read *read, struct rhizome_read_buf
size_t bytes_copied=0;
while (len>0){
DEBUGF("len=%zu read->length=%"PRIu64" read->offset=%"PRIu64" buffer->offset=%"PRIu64"", len, read->length, read->offset, buffer->offset);
//DEBUGF("len=%zu read->length=%"PRIu64" read->offset=%"PRIu64" buffer->offset=%"PRIu64"", len, read->length, read->offset, buffer->offset);
// make sure we only attempt to read data that actually exists
if (read->length != RHIZOME_SIZE_UNSET && read->offset + len > read->length)
len = read->length - read->offset;
@ -858,7 +858,6 @@ ssize_t rhizome_read_buffered(struct rhizome_read *read, struct rhizome_read_buf
len-=size;
read->offset+=size;
bytes_copied+=size;
DEBUGF("read->offset=%"PRIu64, read->offset);
continue;
}
}
@ -876,7 +875,6 @@ ssize_t rhizome_read_buffered(struct rhizome_read *read, struct rhizome_read_buf
bcopy(buffer->data + ofs - size, data + len - size, size);
len-=size;
bytes_copied+=size;
DEBUGF("read->offset=%"PRIu64, read->offset);
continue;
}
}
@ -892,7 +890,6 @@ ssize_t rhizome_read_buffered(struct rhizome_read *read, struct rhizome_read_buf
if (r == -1)
return -1;
buffer->len = (size_t) r;
DEBUGF("read->offset=%"PRIu64, read->offset);
}
return bytes_copied;
}