diff --git a/src/broker/log.c b/src/broker/log.c index e456cef82a92..1046bd8b8747 100644 --- a/src/broker/log.c +++ b/src/broker/log.c @@ -481,7 +481,7 @@ static void append_request_cb (flux_t *h, flux_msg_handler_t *mh, logbuf_t *logbuf = arg; uint32_t matchtag; const char *buf; - int len; + size_t len; if (flux_msg_get_matchtag (msg, &matchtag) < 0) { log_msg ("%s: malformed log request", __FUNCTION__); diff --git a/src/broker/trace.c b/src/broker/trace.c index b15f7f892ec8..aabca09655b1 100644 --- a/src/broker/trace.c +++ b/src/broker/trace.c @@ -54,7 +54,7 @@ static void trace_msg (flux_t *h, int type = 0; char buf[64]; const char *topic = NULL; - int payload_size = 0; + size_t payload_size = 0; json_t *payload_json = NULL; int errnum = 0; const char *errstr = NULL; diff --git a/src/cmd/builtin/content.c b/src/cmd/builtin/content.c index ce54c0751526..237e1e8f1fcc 100644 --- a/src/cmd/builtin/content.c +++ b/src/cmd/builtin/content.c @@ -23,7 +23,7 @@ static void load_to_fd (flux_t *h, int fd, const char *blobref, int flags) { flux_future_t *f; const uint8_t *data; - int size; + size_t size; if (!(f = content_load_byblobref (h, blobref, flags)) || content_load_get (f, (const void **)&data, &size) < 0) diff --git a/src/cmd/builtin/dump.c b/src/cmd/builtin/dump.c index 00d569533bc3..9266abe0b7f5 100644 --- a/src/cmd/builtin/dump.c +++ b/src/cmd/builtin/dump.c @@ -154,7 +154,7 @@ static void dump_valref (struct archive *ar, int total_size = 0; struct archive_entry *entry; const void *data; - int len; + size_t len; /* We need the total size before we start writing archive data, * so make a first pass, saving the data for writing later. @@ -220,7 +220,7 @@ static void dump_val (struct archive *ar, { struct archive_entry *entry; void *data; - int len; + size_t len; if (treeobj_decode_val (treeobj, &data, &len) < 0) log_err_exit ("%s: invalid value object", path); @@ -296,7 +296,7 @@ static void dump_dirref (struct archive *ar, { flux_future_t *f; const void *buf; - int buflen; + size_t buflen; json_t *treeobj_deref = NULL; if (treeobj_get_count (treeobj) != 1) @@ -356,7 +356,7 @@ static void dump_blobref (struct archive *ar, { flux_future_t *f; const void *buf; - int buflen; + size_t buflen; json_t *treeobj; json_t *dict; const char *key; diff --git a/src/cmd/flux-event.c b/src/cmd/flux-event.c index b6184b632efa..7fa924635716 100644 --- a/src/cmd/flux-event.c +++ b/src/cmd/flux-event.c @@ -256,7 +256,7 @@ static int event_pub (optparse_t *p, int argc, char **argv) log_err_exit ("flux_recv error"); if (optparse_hasopt (p, "raw")) { const void *data; - int len; + size_t len; if ((flux_event_decode_raw (msg, NULL, &data, &len) == 0 && match_payload_raw (payload, payloadsz, data, len))) received = true; @@ -350,7 +350,7 @@ static void event_cb (flux_t *h, int max_count = optparse_get_int (p, "count", 0); static int recv_count = 0; const char *payload; - int payloadsz; + size_t payloadsz; const char *topic; if (flux_event_decode (msg, &topic, &payload) == 0) diff --git a/src/cmd/flux-kvs.c b/src/cmd/flux-kvs.c index b887cf47c9b4..1235ded9abab 100644 --- a/src/cmd/flux-kvs.c +++ b/src/cmd/flux-kvs.c @@ -712,7 +712,7 @@ void lookup_continuation (flux_future_t *f, void *arg) } else if (optparse_hasopt (ctx->p, "raw")) { const void *data; - int len; + size_t len; if (flux_kvs_lookup_get_raw (f, &data, &len) < 0) log_err_exit ("%s", key); if (optparse_hasopt (ctx->p, "label")) @@ -1291,7 +1291,7 @@ static void dump_kvs_dir (const flux_kvsdir_t *dir, int maxcol, if (!dopt) { const char *value; const void *buf; - int len; + size_t len; if (rootref) { if (!(f = flux_kvs_lookupat (h, 0, key, rootref))) log_err_exit ("%s", key); @@ -1303,7 +1303,7 @@ static void dump_kvs_dir (const flux_kvsdir_t *dir, int maxcol, if (flux_kvs_lookup_get (f, &value) == 0) // null terminated dump_kvs_val (key, maxcol, value); else if (flux_kvs_lookup_get_raw (f, &buf, &len) == 0) - kv_printf (key, maxcol, "%.*s", len, (char *)buf); + kv_printf (key, maxcol, "%.*s", (int)len, (char *)buf); else log_err_exit ("%s", key); flux_future_destroy (f); diff --git a/src/common/libcontent/content.c b/src/common/libcontent/content.c index 865aaff57e3c..196ac67f2c42 100644 --- a/src/common/libcontent/content.c +++ b/src/common/libcontent/content.c @@ -23,7 +23,7 @@ flux_future_t *content_load_byhash (flux_t *h, const void *hash, - int hash_size, + size_t hash_size, int flags) { const char *topic = "content.load"; @@ -47,19 +47,19 @@ flux_future_t *content_load_byblobref (flux_t *h, int flags) { uint32_t hash[BLOBREF_MAX_DIGEST_SIZE]; - int hash_size; + ssize_t hash_size; if ((hash_size = blobref_strtohash (blobref, hash, sizeof (hash))) < 0) return NULL; return content_load_byhash (h, hash, hash_size, flags); } -int content_load_get (flux_future_t *f, const void **buf, int *len) +int content_load_get (flux_future_t *f, const void **buf, size_t *len) { return flux_rpc_get_raw (f, buf, len); } -flux_future_t *content_store (flux_t *h, const void *buf, int len, int flags) +flux_future_t *content_store (flux_t *h, const void *buf, size_t len, int flags) { const char *topic = "content.store"; uint32_t rank = FLUX_NODEID_ANY; @@ -73,10 +73,12 @@ flux_future_t *content_store (flux_t *h, const void *buf, int len, int flags) return flux_rpc_raw (h, topic, buf, len, rank, 0); } -int content_store_get_hash (flux_future_t *f, const void **hash, int *hash_size) +int content_store_get_hash (flux_future_t *f, + const void **hash, + size_t *hash_size) { const void *buf; - int buf_size; + size_t buf_size; if (flux_rpc_get_raw (f, &buf, &buf_size) < 0) return -1; @@ -96,7 +98,7 @@ int content_store_get_blobref (flux_future_t *f, if (!(result = flux_future_aux_get (f, auxkey))) { const void *hash; - int hash_len; + size_t hash_len; char buf[BLOBREF_MAX_STRING_SIZE]; char *cpy = NULL; diff --git a/src/common/libcontent/content.h b/src/common/libcontent/content.h index d97d697b4b97..6d31ff04f98f 100644 --- a/src/common/libcontent/content.h +++ b/src/common/libcontent/content.h @@ -21,7 +21,7 @@ enum { */ flux_future_t *content_load_byhash (flux_t *h, const void *hash, - int hash_len, + size_t hash_len, int flags); flux_future_t *content_load_byblobref (flux_t *h, const char *blobref, @@ -32,17 +32,22 @@ flux_future_t *content_load_byblobref (flux_t *h, * Storage for 'buf' belongs to 'f' and is valid until 'f' is destroyed. * Returns 0 on success, -1 on failure with errno set. */ -int content_load_get (flux_future_t *f, const void **buf, int *len); +int content_load_get (flux_future_t *f, const void **buf, size_t *len); /* Send request to store blob. */ -flux_future_t *content_store (flux_t *h, const void *buf, int len, int flags); +flux_future_t *content_store (flux_t *h, + const void *buf, + size_t len, + int flags); /* Get result of store request (hash or blobref). * Storage belongs to 'f' and is valid until 'f' is destroyed. * Returns 0 on success, -1 on failure with errno set. */ -int content_store_get_hash (flux_future_t *f, const void **hash, int *hash_len); +int content_store_get_hash (flux_future_t *f, + const void **hash, + size_t *hash_len); int content_store_get_blobref (flux_future_t *f, const char *hash_name, const char **blobref); diff --git a/src/common/libfilemap/filemap.c b/src/common/libfilemap/filemap.c index cba352f99f59..a7395143336f 100644 --- a/src/common/libfilemap/filemap.c +++ b/src/common/libfilemap/filemap.c @@ -82,7 +82,7 @@ static int extract_blob (flux_t *h, } entry; flux_future_t *f; const void *buf; - int size; + size_t size; if (json_unpack (o, "[I,I,s]", diff --git a/src/common/libflux/event.c b/src/common/libflux/event.c index 2d2df9146769..f56d187da1ed 100644 --- a/src/common/libflux/event.c +++ b/src/common/libflux/event.c @@ -130,11 +130,11 @@ int flux_event_decode (const flux_msg_t *msg, int flux_event_decode_raw (const flux_msg_t *msg, const char **topicp, const void **datap, - int *lenp) + size_t *lenp) { const char *topic; const void *data = NULL; - int len = 0; + size_t len = 0; int rc = -1; if (!datap || !lenp) { @@ -224,7 +224,7 @@ flux_msg_t *flux_event_encode (const char *topic, const char *s) flux_msg_t *flux_event_encode_raw (const char *topic, const void *data, - int len) + size_t len) { flux_msg_t *msg = flux_event_create (topic); if (!msg) @@ -267,7 +267,7 @@ static flux_future_t *wrap_event_rpc (flux_t *h, const char *topic, int flags, const void *src, - int srclen) + size_t srclen) { flux_future_t *f; @@ -371,7 +371,7 @@ flux_future_t *flux_event_publish_raw (flux_t *h, const char *topic, int flags, const void *data, - int len) + size_t len) { if (!h || !topic || (flags & ~(FLUX_MSGFLAG_PRIVATE)) != 0) { errno = EINVAL; diff --git a/src/common/libflux/event.h b/src/common/libflux/event.h index 5cc8b5e4724a..1848a811de19 100644 --- a/src/common/libflux/event.h +++ b/src/common/libflux/event.h @@ -63,7 +63,7 @@ flux_msg_t *flux_event_pack (const char *topic, const char *fmt, ...); */ flux_msg_t *flux_event_encode_raw (const char *topic, const void *data, - int len); + size_t len); /* Decode an event message, with optional raw payload. * If topic is non-NULL, assign the event topic string. @@ -74,7 +74,7 @@ flux_msg_t *flux_event_encode_raw (const char *topic, int flux_event_decode_raw (const flux_msg_t *msg, const char **topic, const void **data, - int *len); + size_t *len); /* Publish an event with optional string payload. * The future is fulfilled once the event has been assigned a sequence number, @@ -99,7 +99,7 @@ flux_future_t *flux_event_publish_raw (flux_t *h, const char *topic, int flags, const void *data, - int len); + size_t len); /* Obtain the event sequence number from the fulfilled * flux_event_publish() future. diff --git a/src/common/libflux/message.c b/src/common/libflux/message.c index cdf1d9af01bd..e34870527d4f 100644 --- a/src/common/libflux/message.c +++ b/src/common/libflux/message.c @@ -842,7 +842,7 @@ static bool payload_overlap (flux_msg_t *msg, const void *b) && (char *)b < (char *)msg->payload + msg->payload_size); } -int flux_msg_set_payload (flux_msg_t *msg, const void *buf, int size) +int flux_msg_set_payload (flux_msg_t *msg, const void *buf, size_t size) { if (msg_validate (msg) < 0) return -1; @@ -968,7 +968,7 @@ int flux_msg_pack (flux_msg_t *msg, const char *fmt, ...) return rc; } -int flux_msg_get_payload (const flux_msg_t *msg, const void **buf, int *size) +int flux_msg_get_payload (const flux_msg_t *msg, const void **buf, size_t *size) { if (msg_validate (msg) < 0) return -1; @@ -1003,7 +1003,7 @@ int flux_msg_get_string (const flux_msg_t *msg, const char **s) { const char *buf; const char *result; - int size; + size_t size; if (msg_validate (msg) < 0) return -1; @@ -1366,7 +1366,7 @@ void flux_msg_fprint_ts (FILE *f, const flux_msg_t *msg, double timestamp) if (flux_msg_has_payload (msg)) { const char *s; const void *buf; - int size; + size_t size; if (flux_msg_get_string (msg, &s) == 0) fprintf (f, "%s %s\n", prefix, s); else if (flux_msg_get_payload (msg, &buf, &size) == 0) { diff --git a/src/common/libflux/message.h b/src/common/libflux/message.h index 57f0a7ff2b76..94fab74a6bb9 100644 --- a/src/common/libflux/message.h +++ b/src/common/libflux/message.h @@ -166,8 +166,10 @@ int flux_msg_get_topic (const flux_msg_t *msg, const char **topic); * Any old payload is deleted. * flux_msg_get_payload returns pointer to msg-owned buf. */ -int flux_msg_get_payload (const flux_msg_t *msg, const void **buf, int *size); -int flux_msg_set_payload (flux_msg_t *msg, const void *buf, int size); +int flux_msg_get_payload (const flux_msg_t *msg, + const void **buf, + size_t *size); +int flux_msg_set_payload (flux_msg_t *msg, const void *buf, size_t size); bool flux_msg_has_payload (const flux_msg_t *msg); /* Test/set/clear message flags diff --git a/src/common/libflux/request.c b/src/common/libflux/request.c index a20c640498e2..d42f09d8e562 100644 --- a/src/common/libflux/request.c +++ b/src/common/libflux/request.c @@ -63,11 +63,11 @@ int flux_request_decode (const flux_msg_t *msg, int flux_request_decode_raw (const flux_msg_t *msg, const char **topic, const void **data, - int *len) + size_t *len) { const char *ts; const void *d = NULL; - int l = 0; + size_t l = 0; int rc = -1; if (!data || !len) { @@ -162,7 +162,7 @@ flux_msg_t *flux_request_encode (const char *topic, const char *s) flux_msg_t *flux_request_encode_raw (const char *topic, const void *data, - int len) + size_t len) { flux_msg_t *msg = request_encode (topic); diff --git a/src/common/libflux/request.h b/src/common/libflux/request.h index cabfee85dfa3..b460fdee9d17 100644 --- a/src/common/libflux/request.h +++ b/src/common/libflux/request.h @@ -42,7 +42,7 @@ int flux_request_unpack (const flux_msg_t *msg, int flux_request_decode_raw (const flux_msg_t *msg, const char **topic, const void **data, - int *len); + size_t *len); /* Encode a request message with optional string payload. * If s is non-NULL, assign the string payload. @@ -55,7 +55,7 @@ flux_msg_t *flux_request_encode (const char *topic, const char *s); */ flux_msg_t *flux_request_encode_raw (const char *topic, const void *data, - int len); + size_t len); #ifdef __cplusplus } diff --git a/src/common/libflux/response.c b/src/common/libflux/response.c index 2404a9433c08..cef0718eadf1 100644 --- a/src/common/libflux/response.c +++ b/src/common/libflux/response.c @@ -71,11 +71,11 @@ int flux_response_decode (const flux_msg_t *msg, int flux_response_decode_raw (const flux_msg_t *msg, const char **topic, const void **data, - int *len) + size_t *len) { const char *ts; const void *d = NULL; - int l = 0; + size_t l = 0; int rc = -1; if (!data || !len) { @@ -167,7 +167,7 @@ flux_msg_t *flux_response_encode (const char *topic, const char *s) flux_msg_t *flux_response_encode_raw (const char *topic, const void *data, - int len) + size_t len) { flux_msg_t *msg; diff --git a/src/common/libflux/response.h b/src/common/libflux/response.h index 5ad456f079ce..d06839d8d8a9 100644 --- a/src/common/libflux/response.h +++ b/src/common/libflux/response.h @@ -38,7 +38,7 @@ int flux_response_decode (const flux_msg_t *msg, int flux_response_decode_raw (const flux_msg_t *msg, const char **topic, const void **data, - int *len); + size_t *len); /* If failed response includes an error string payload, assign to 'errstr', * otherwise fail. @@ -55,7 +55,7 @@ flux_msg_t *flux_response_encode (const char *topic, const char *s); */ flux_msg_t *flux_response_encode_raw (const char *topic, const void *data, - int len); + size_t len); /* Encode an error response with 'errnum' (must be nonzero) and * if non-NULL, an error string payload. diff --git a/src/common/libflux/rpc.c b/src/common/libflux/rpc.c index 657ed524e22e..74917c371723 100644 --- a/src/common/libflux/rpc.c +++ b/src/common/libflux/rpc.c @@ -123,7 +123,7 @@ int flux_rpc_get (flux_future_t *f, const char **s) return rc; } -int flux_rpc_get_raw (flux_future_t *f, const void **data, int *len) +int flux_rpc_get_raw (flux_future_t *f, const void **data, size_t *len) { const flux_msg_t *msg; int rc = -1; @@ -331,7 +331,7 @@ flux_future_t *flux_rpc (flux_t *h, flux_future_t *flux_rpc_raw (flux_t *h, const char *topic, const void *data, - int len, + size_t len, uint32_t nodeid, int flags) { diff --git a/src/common/libflux/rpc.h b/src/common/libflux/rpc.h index 78ff2d855359..667f56d13972 100644 --- a/src/common/libflux/rpc.h +++ b/src/common/libflux/rpc.h @@ -43,7 +43,7 @@ flux_future_t *flux_rpc_vpack (flux_t *h, flux_future_t *flux_rpc_raw (flux_t *h, const char *topic, const void *data, - int len, + size_t len, uint32_t nodeid, int flags); @@ -56,7 +56,7 @@ int flux_rpc_get (flux_future_t *f, const char **s); int flux_rpc_get_unpack (flux_future_t *f, const char *fmt, ...); -int flux_rpc_get_raw (flux_future_t *f, const void **data, int *len); +int flux_rpc_get_raw (flux_future_t *f, const void **data, size_t *len); /* Accessor for RPC matchtag (see RFC 6). */ diff --git a/src/common/libflux/test/event.c b/src/common/libflux/test/event.c index 192800b165e2..6aa6fea5d541 100644 --- a/src/common/libflux/test/event.c +++ b/src/common/libflux/test/event.c @@ -25,8 +25,8 @@ void test_codec (void) const char data[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; int len = strlen (data); const void *d; - int l; - int i; + size_t l; + size_t i; /* no topic is an error */ errno = 0; diff --git a/src/common/libflux/test/message.c b/src/common/libflux/test/message.c index 9abf9f864666..0ec8d18bc975 100644 --- a/src/common/libflux/test/message.c +++ b/src/common/libflux/test/message.c @@ -39,7 +39,7 @@ void check_cornercase (void) uint32_t tag; const char *topic; const void *payload; - int payload_size; + size_t payload_size; errno = 0; ok (flux_msg_create (0xFFFF) == NULL && errno == EINVAL, @@ -634,7 +634,8 @@ void check_payload (void) flux_msg_t *msg; const void *buf; void *pay[1024]; - int plen = sizeof (pay), len; + size_t plen = sizeof (pay); + size_t len; ok ((msg = flux_msg_create (FLUX_MSGTYPE_REQUEST)) != NULL, "flux_msg_create works"); @@ -995,7 +996,7 @@ void check_copy (void) flux_msg_t *msg, *cpy; int type; const char *topic; - int cpylen; + size_t cpylen; const char buf[] = "xxxxxxxxxxxxxxxxxx"; const void *cpybuf; const char *s; diff --git a/src/common/libflux/test/request.c b/src/common/libflux/test/request.c index a3ffc6642a07..35452f81c9c7 100644 --- a/src/common/libflux/test/request.c +++ b/src/common/libflux/test/request.c @@ -25,7 +25,9 @@ int main (int argc, char *argv[]) const char *json_str = "{\"a\":42}"; const void *d; const char data[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - int i, l, len = strlen (data); + size_t i; + size_t l; + size_t len = strlen (data); plan (NO_PLAN); diff --git a/src/common/libflux/test/response.c b/src/common/libflux/test/response.c index 2aaf5e436ff8..6128c270cfff 100644 --- a/src/common/libflux/test/response.c +++ b/src/common/libflux/test/response.c @@ -27,7 +27,8 @@ int main (int argc, char *argv[]) const char *json_str = "{\"a\":42}"; const void *d; const char data[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; - int l, len = strlen (data); + size_t l; + size_t len = strlen (data); int errnum; plan (NO_PLAN); diff --git a/src/common/libflux/test/rpc.c b/src/common/libflux/test/rpc.c index 4dbc2a82a6c4..4b6c783cb404 100644 --- a/src/common/libflux/test/rpc.c +++ b/src/common/libflux/test/rpc.c @@ -124,7 +124,7 @@ void rpctest_rawecho_cb (flux_t *h, void *arg) { const void *d = NULL; - int l = 0; + size_t l = 0; if (flux_request_decode_raw (msg, NULL, &d, &l) < 0) goto error; @@ -494,7 +494,7 @@ void test_encoding (flux_t *h) /* working with-payload RPC (raw) */ const void *d; const char data[] = "aaaaaaaaaaaaaaaaaaaa"; - int l, len = strlen (data); + size_t l, len = strlen (data); ok ((r = flux_rpc_raw (h, "rpctest.rawecho", data, diff --git a/src/common/libflux/test/rpcscale.c b/src/common/libflux/test/rpcscale.c index 8814e44cb7fa..7048dc4e5ac3 100644 --- a/src/common/libflux/test/rpcscale.c +++ b/src/common/libflux/test/rpcscale.c @@ -29,7 +29,7 @@ void ping_cb (flux_t *h, void *arg) { const void *payload; - int payload_len; + size_t payload_len; if (flux_request_decode_raw (msg, NULL, &payload, &payload_len) < 0) goto error; diff --git a/src/common/libkvs/kvs_lookup.c b/src/common/libkvs/kvs_lookup.c index e2783c80f970..716fb6f7dc4c 100644 --- a/src/common/libkvs/kvs_lookup.c +++ b/src/common/libkvs/kvs_lookup.c @@ -31,7 +31,7 @@ struct lookup_ctx { json_t *treeobj; char *treeobj_str; // json_dumps of tree object returned from lookup void *val_data; // result of base64 decode of val object data - int val_len; + size_t val_len; bool val_valid; json_t *val_obj; flux_kvsdir_t *dir; @@ -333,7 +333,7 @@ int flux_kvs_lookup_get_unpack (flux_future_t *f, const char *fmt, ...) return rc; } -int flux_kvs_lookup_get_raw (flux_future_t *f, const void **data, int *len) +int flux_kvs_lookup_get_raw (flux_future_t *f, const void **data, size_t *len) { struct lookup_ctx *ctx; diff --git a/src/common/libkvs/kvs_lookup.h b/src/common/libkvs/kvs_lookup.h index e2f3b2d5bba0..d3a7717ec89a 100644 --- a/src/common/libkvs/kvs_lookup.h +++ b/src/common/libkvs/kvs_lookup.h @@ -26,7 +26,7 @@ flux_future_t *flux_kvs_lookupat (flux_t *h, int flux_kvs_lookup_get (flux_future_t *f, const char **value); int flux_kvs_lookup_get_unpack (flux_future_t *f, const char *fmt, ...); -int flux_kvs_lookup_get_raw (flux_future_t *f, const void **data, int *len); +int flux_kvs_lookup_get_raw (flux_future_t *f, const void **data, size_t *len); int flux_kvs_lookup_get_treeobj (flux_future_t *f, const char **treeobj); int flux_kvs_lookup_get_dir (flux_future_t *f, const flux_kvsdir_t **dir); int flux_kvs_lookup_get_symlink (flux_future_t *f, diff --git a/src/common/libkvs/kvs_txn.c b/src/common/libkvs/kvs_txn.c index f362588709f5..ca4e08dfced3 100644 --- a/src/common/libkvs/kvs_txn.c +++ b/src/common/libkvs/kvs_txn.c @@ -101,7 +101,7 @@ int flux_kvs_txn_put_raw (flux_kvs_txn_t *txn, int flags, const char *key, const void *data, - int len) + size_t len) { json_t *dirent = NULL; int saved_errno; diff --git a/src/common/libkvs/kvs_txn.h b/src/common/libkvs/kvs_txn.h index 4ebd89b052b4..d884afb16754 100644 --- a/src/common/libkvs/kvs_txn.h +++ b/src/common/libkvs/kvs_txn.h @@ -43,7 +43,7 @@ int flux_kvs_txn_put_raw (flux_kvs_txn_t *txn, int flags, const char *key, const void *data, - int len); + size_t len); int flux_kvs_txn_put_treeobj (flux_kvs_txn_t *txn, int flags, diff --git a/src/common/libkvs/kvs_txn_compact.c b/src/common/libkvs/kvs_txn_compact.c index 751935558469..827e67a88bf4 100644 --- a/src/common/libkvs/kvs_txn_compact.c +++ b/src/common/libkvs/kvs_txn_compact.c @@ -51,7 +51,7 @@ struct append_data { void *data; - int len; + size_t len; }; struct compact_key { diff --git a/src/common/libkvs/test/kvs_txn.c b/src/common/libkvs/test/kvs_txn.c index 175b5b23aec1..d582ce1f0335 100644 --- a/src/common/libkvs/test/kvs_txn.c +++ b/src/common/libkvs/test/kvs_txn.c @@ -37,7 +37,7 @@ void jdiag (json_t *o) int check_null_value (json_t *dirent) { char *data = ""; - int len = -1; + size_t len = 42; if (treeobj_decode_val (dirent, (void **)&data, &len) < 0) { diag ("%s: initial base64 decode failed", __FUNCTION__); @@ -56,7 +56,8 @@ int check_null_value (json_t *dirent) int check_int_value (json_t *dirent, int expected) { char *data; - int rc, len, i; + int rc, i; + size_t len; json_t *val; if (treeobj_decode_val (dirent, (void **)&data, &len) < 0) { @@ -89,7 +90,8 @@ int check_int_value (json_t *dirent, int expected) int check_string_value (json_t *dirent, const char *expected) { char *data; - int rc, len; + int rc; + size_t len; const char *s; json_t *val; @@ -121,7 +123,7 @@ int check_string_value (json_t *dirent, const char *expected) int check_raw_value (json_t *dirent, const char *expected, int expected_len) { char *data; - int len; + size_t len; if (treeobj_decode_val (dirent, (void **)&data, &len) < 0) { diag ("%s: initial base64 decode failed", __FUNCTION__); @@ -304,7 +306,8 @@ void test_raw_values (void) char buf[13], *nbuf; json_t *entry, *dirent; const char *key; - int flags, nlen; + int flags; + size_t nlen; memset (buf, 'c', sizeof (buf)); diff --git a/src/common/libkvs/test/kvs_txn_compact.c b/src/common/libkvs/test/kvs_txn_compact.c index b61bfebe49eb..377bcd3e1aee 100644 --- a/src/common/libkvs/test/kvs_txn_compact.c +++ b/src/common/libkvs/test/kvs_txn_compact.c @@ -29,7 +29,7 @@ int check_null_value (json_t *dirent) { char *data = ""; - int len = -1; + size_t len = 42; if (treeobj_decode_val (dirent, (void **)&data, &len) < 0) { diag ("%s: initial base64 decode failed", __FUNCTION__); @@ -45,7 +45,7 @@ int check_null_value (json_t *dirent) int check_raw_value (json_t *dirent, const char *expected, int expected_len) { char *data = NULL; - int len; + size_t len; int rc = -1; if (treeobj_decode_val (dirent, (void **)&data, &len) < 0) { diff --git a/src/common/libkvs/test/treeobj.c b/src/common/libkvs/test/treeobj.c index d94a45aad55c..8413c6a6ad42 100644 --- a/src/common/libkvs/test/treeobj.c +++ b/src/common/libkvs/test/treeobj.c @@ -191,7 +191,7 @@ void test_val (void) json_t *val, *val2; char buf[32]; char *outbuf; - int outlen; + size_t outlen; memset (buf, 'x', sizeof (buf)); @@ -720,7 +720,7 @@ void test_corner_cases (void) json_t *val, *valref, *dir, *symlink; json_t *array, *object; char *outbuf; - int outlen; + size_t outlen; val = treeobj_create_val ("a", 1); if (!val) diff --git a/src/common/libkvs/treeobj.c b/src/common/libkvs/treeobj.c index e9e167b70979..e45efd453782 100644 --- a/src/common/libkvs/treeobj.c +++ b/src/common/libkvs/treeobj.c @@ -218,7 +218,7 @@ int treeobj_get_symlink (const json_t *obj, return 0; } -int treeobj_decode_val (const json_t *obj, void **dp, int *lp) +int treeobj_decode_val (const json_t *obj, void **dp, size_t *lp) { const char *type, *xdatastr; const json_t *xdata; @@ -517,9 +517,9 @@ json_t *treeobj_create_symlink (const char *ns, const char *target) return obj; } -json_t *treeobj_create_val (const void *data, int len) +json_t *treeobj_create_val (const void *data, size_t len) { - int xlen; + ssize_t xlen; char *xdata; json_t *obj = NULL; diff --git a/src/common/libkvs/treeobj.h b/src/common/libkvs/treeobj.h index 867aaf00302b..f0ec1c01ee0a 100644 --- a/src/common/libkvs/treeobj.h +++ b/src/common/libkvs/treeobj.h @@ -24,7 +24,7 @@ * Return JSON object on success, NULL on failure with errno set. */ json_t *treeobj_create_symlink (const char *ns, const char *target); -json_t *treeobj_create_val (const void *data, int len); +json_t *treeobj_create_val (const void *data, size_t len); json_t *treeobj_create_valref (const char *blobref); json_t *treeobj_create_dir (void); json_t *treeobj_create_dirref (const char *blobref); @@ -67,7 +67,7 @@ int treeobj_get_symlink (const json_t *obj, * If len > 0, data will be followed by an extra NULL byte in memory. * Caller must free returned data. */ -int treeobj_decode_val (const json_t *obj, void **data, int *len); +int treeobj_decode_val (const json_t *obj, void **data, size_t *len); /* get type-specific count. * For dirref/valref, this is the number of blobrefs. diff --git a/src/common/librouter/test/sendfd.c b/src/common/librouter/test/sendfd.c index d74e53822781..4d0d3f67139d 100644 --- a/src/common/librouter/test/sendfd.c +++ b/src/common/librouter/test/sendfd.c @@ -68,7 +68,7 @@ void test_large (void) char buf[8192]; const char *topic; const void *buf2; - int buf2len; + size_t buf2len; #if defined(F_GETPIPE_SZ) int min_size = 16384; int size; @@ -280,7 +280,7 @@ void test_nonblock (int size, int count) while ((msg = zlist_pop (ior->queue))) { const char *topic; const void *buf2; - int buf2len; + size_t buf2len; if (flux_request_decode_raw (msg, &topic, &buf2, &buf2len) < 0) { diag ("flux_request_decode_raw: %s", flux_strerror (errno)); diff --git a/src/common/librouter/test/usock_echo.c b/src/common/librouter/test/usock_echo.c index 08ebffcf92bb..f36252b400f2 100644 --- a/src/common/librouter/test/usock_echo.c +++ b/src/common/librouter/test/usock_echo.c @@ -139,7 +139,7 @@ static bool equal_message (const flux_msg_t *m1, const flux_msg_t *m2) int type1, type2; const char *topic1, *topic2; const void *buf1, *buf2; - int len1, len2; + size_t len1, len2; if (flux_msg_get_type (m1, &type1) < 0) return false; diff --git a/src/modules/content-files/content-files.c b/src/modules/content-files/content-files.c index 2b10b6fce833..b5c3fad8db6e 100644 --- a/src/modules/content-files/content-files.c +++ b/src/modules/content-files/content-files.c @@ -122,7 +122,7 @@ static void load_cb (flux_t *h, { struct content_files *ctx = arg; const void *hash; - int hash_size; + size_t hash_size; char blobref[BLOBREF_MAX_STRING_SIZE]; void *data = NULL; size_t size; @@ -164,7 +164,7 @@ void store_cb (flux_t *h, { struct content_files *ctx = arg; const void *data; - int size; + size_t size; char blobref[BLOBREF_MAX_STRING_SIZE]; char hash[BLOBREF_MAX_DIGEST_SIZE]; int hash_size; diff --git a/src/modules/content-s3/content-s3.c b/src/modules/content-s3/content-s3.c index c5e84c0b3162..4f39e140851f 100644 --- a/src/modules/content-s3/content-s3.c +++ b/src/modules/content-s3/content-s3.c @@ -256,7 +256,7 @@ static void load_cb (flux_t *h, flux_msg_handler_t *mh, const flux_msg_t *msg, v { struct content_s3 *ctx = arg; const void *hash; - int hash_size; + size_t hash_size; char blobref[BLOBREF_MAX_STRING_SIZE]; void *data = NULL; size_t size; @@ -300,7 +300,7 @@ void store_cb (flux_t *h, { struct content_s3 *ctx = arg; const void *data; - int size; + size_t size; char blobref[BLOBREF_MAX_STRING_SIZE]; uint8_t hash[BLOBREF_MAX_DIGEST_SIZE]; int hash_size; diff --git a/src/modules/content-sqlite/content-sqlite.c b/src/modules/content-sqlite/content-sqlite.c index 5778333c86db..312d8060e1dc 100644 --- a/src/modules/content-sqlite/content-sqlite.c +++ b/src/modules/content-sqlite/content-sqlite.c @@ -305,7 +305,7 @@ static void load_cb (flux_t *h, { struct content_sqlite *ctx = arg; const void *hash; - int hash_size; + size_t hash_size; const void *data; int size; struct timespec t0; @@ -339,7 +339,7 @@ void store_cb (flux_t *h, { struct content_sqlite *ctx = arg; const void *data; - int size; + size_t size; uint8_t hash[BLOBREF_MAX_DIGEST_SIZE]; int hash_size; struct timespec t0; diff --git a/src/modules/content/cache.c b/src/modules/content/cache.c index 6d4da698e9ce..b543f397fa7a 100644 --- a/src/modules/content/cache.c +++ b/src/modules/content/cache.c @@ -62,7 +62,7 @@ struct msgstack { struct cache_entry { const void *data; - int len; + size_t len; void *data_container; void *hash; // key storage is contiguous with struct uint8_t valid:1; // entry contains valid data @@ -417,7 +417,7 @@ static void content_load_request (flux_t *h, { struct content_cache *cache = arg; const void *hash; - int hash_size; + size_t hash_size; struct cache_entry *e; const char *errmsg = NULL; @@ -535,7 +535,7 @@ static void cache_store_continuation (flux_future_t *f, void *arg) struct content_cache *cache = arg; struct cache_entry *e = flux_future_aux_get (f, "entry"); const void *hash; - int hash_size; + size_t hash_size; e->store_pending = 0; assert (cache->flush_batch_count > 0); @@ -630,7 +630,7 @@ static void content_store_request (flux_t *h, { struct content_cache *cache = arg; const void *data; - int len; + size_t len; struct cache_entry *e = NULL; uint8_t hash[BLOBREF_MAX_DIGEST_SIZE]; int hash_size; diff --git a/src/modules/kvs-watch/kvs-watch.c b/src/modules/kvs-watch/kvs-watch.c index 9de18ccacde2..5f3e0609d576 100644 --- a/src/modules/kvs-watch/kvs-watch.c +++ b/src/modules/kvs-watch/kvs-watch.c @@ -255,7 +255,7 @@ static void handle_load_response (flux_future_t *f, struct watcher *w) { flux_t *h = flux_future_get_flux (f); const void *data; - int size; + size_t size; flux_error_t err; if (content_load_get (f, &data, &size) < 0) { diff --git a/src/modules/kvs/kvs.c b/src/modules/kvs/kvs.c index 9259c56d1274..d36229b24fe2 100644 --- a/src/modules/kvs/kvs.c +++ b/src/modules/kvs/kvs.c @@ -501,7 +501,7 @@ static void content_load_completion (flux_future_t *f, void *arg) { struct kvs_ctx *ctx = arg; const void *data; - int size; + size_t size; const char *blobref; struct cache_entry *entry; diff --git a/t/request/req.c b/t/request/req.c index c384b9723433..ec86c342f019 100644 --- a/t/request/req.c +++ b/t/request/req.c @@ -305,7 +305,8 @@ void null_request_cb (flux_t *h, { t_req_ctx_t *ctx = arg; const char *topic; - int type, size; + int type; + size_t size; const void *buf; uint32_t nodeid; @@ -349,7 +350,7 @@ void null_request_cb (flux_t *h, if (flux_msg_get_payload (msg, &buf, &size) == 0) { flux_log (h, LOG_ERR, - "%s: unexpected payload size %d", + "%s: unexpected payload size %zu", __FUNCTION__, size); goto error; diff --git a/t/request/rpc.c b/t/request/rpc.c index fd0e262865ff..c834e6da385b 100644 --- a/t/request/rpc.c +++ b/t/request/rpc.c @@ -41,7 +41,7 @@ int main (int argc, char *argv[]) ssize_t inlen; void *inbuf; const char *outbuf; - int outlen; + size_t outlen; int expected_errno = -1; int ch; bool raw_request = false;