diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 6e53a723..4d6ff1b6 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,29 @@ +2003-07-31 Marcus Brinkmann + + * util.h (_gpgme_decode_c_string): Change type of LEN argument to + size_t. + (_gpgme_decode_percent_string): Likewise. + * conversion.c (_gpgme_decode_c_string): Likewise. + (_gpgme_decode_percent_string): Likewise. + (_gpgme_map_gnupg_error): Change type of I to unsigned int. + * signers.c (gpgme_signers_clear): Likewise. + (gpgme_signers_enum): New unsigned variable SEQNO, set to SEQ. + Use SEQNO instead SEQ. + * wait.c (fd_table_put): Change type of I and J to unsigned int. + * wait-global.c (_gpgme_wait_global_event_cb): Change type of IDX + to unsigned int. + (gpgme_wait): Change type of I and IDX to unsigned int. + * wait-private.c (_gpgme_wait_on_condition): Change type of IDX + and I to unsigned int. + * posix-io.c (_gpgme_io_close): Cast return value of macro DIM to + int to suppress gcc warning. + (_gpgme_io_set_close_notify): Likewise. + (_gpgme_io_select): Change type of I to unsigned int. + * engine.c (gpgme_get_engine_info): Change type of PROTO to + unsigned int. + * wait-user.c (_gpgme_user_io_cb_handler): Change type of IDX and + I to unsigned int. + 2003-07-29 Marcus Brinkmann * decrypt-verify.c (decrypt_verify_status_handler): Expand silly diff --git a/gpgme/conversion.c b/gpgme/conversion.c index c98f3776..d889aeb9 100644 --- a/gpgme/conversion.c +++ b/gpgme/conversion.c @@ -65,7 +65,7 @@ _gpgme_hextobyte (const unsigned char *str) is desired or not, the caller is expected to make sure that *DESTP is large enough if LEN is not zero. */ gpgme_error_t -_gpgme_decode_c_string (const char *src, char **destp, int len) +_gpgme_decode_c_string (const char *src, char **destp, size_t len) { char *dest; @@ -168,7 +168,7 @@ _gpgme_decode_c_string (const char *src, char **destp, int len) is desired or not, the caller is expected to make sure that *DESTP is large enough if LEN is not zero. */ gpgme_error_t -_gpgme_decode_percent_string (const char *src, char **destp, int len) +_gpgme_decode_percent_string (const char *src, char **destp, size_t len) { char *dest; @@ -323,7 +323,7 @@ static struct gpgme_error_t _gpgme_map_gnupg_error (char *err) { - int i; + unsigned int i; for (i = 0; i < DIM (gnupg_errors); i++) if (!strcmp (gnupg_errors[i].name, err)) diff --git a/gpgme/engine.c b/gpgme/engine.c index 034edc15..d974db5a 100644 --- a/gpgme/engine.c +++ b/gpgme/engine.c @@ -119,7 +119,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info) gpgme_engine_info_t *lastp = &engine_info; gpgme_protocol_t proto_list[] = { GPGME_PROTOCOL_OpenPGP, GPGME_PROTOCOL_CMS }; - int proto; + unsigned int proto; for (proto = 0; proto < DIM (proto_list); proto++) { diff --git a/gpgme/posix-io.c b/gpgme/posix-io.c index 2969eb95..5034468d 100644 --- a/gpgme/posix-io.c +++ b/gpgme/posix-io.c @@ -115,7 +115,7 @@ _gpgme_io_close (int fd) return -1; /* First call the notify handler. */ DEBUG1 ("closing fd %d", fd); - if (fd >= 0 && fd < DIM (notify_table)) + if (fd >= 0 && fd < (int) DIM (notify_table)) { if (notify_table[fd].handler) { @@ -134,7 +134,7 @@ _gpgme_io_set_close_notify (int fd, void (*handler)(int, void*), void *value) { assert (fd != -1); - if (fd < 0 || fd >= DIM (notify_table)) + if (fd < 0 || fd >= (int) DIM (notify_table)) return -1; DEBUG1 ("set notification for fd %d", fd); notify_table[fd].handler = handler; @@ -315,7 +315,8 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { fd_set readfds; fd_set writefds; - int any, i, max_fd, n, count; + unsigned int i; + int any, max_fd, n, count; struct timeval timeout = { 1, 0 }; /* Use a 1s timeout. */ void *dbg_help = NULL; diff --git a/gpgme/signers.c b/gpgme/signers.c index 203c6727..a5662a27 100644 --- a/gpgme/signers.c +++ b/gpgme/signers.c @@ -35,7 +35,7 @@ void gpgme_signers_clear (gpgme_ctx_t ctx) { - int i; + unsigned int i; if (!ctx || !ctx->signers) return; @@ -81,12 +81,14 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq) { + unsigned int seqno; + if (!ctx || seq < 0) return NULL; - if (seq >= ctx->signers_len) + seqno = (unsigned int) seq; + if (seqno >= ctx->signers_len) return NULL; - - gpgme_key_ref (ctx->signers[seq]); - return ctx->signers[seq]; + gpgme_key_ref (ctx->signers[seqno]); + return ctx->signers[seqno]; } diff --git a/gpgme/util.h b/gpgme/util.h index 21164f07..fcb48259 100644 --- a/gpgme/util.h +++ b/gpgme/util.h @@ -72,7 +72,8 @@ int _gpgme_hextobyte (const unsigned char *str); the result. Currently, LEN is only used to specify if allocation is desired or not, the caller is expected to make sure that *DESTP is large enough if LEN is not zero. */ -gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp, int len); +gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp, + size_t len); /* Decode the percent escaped string SRC and store the result in the buffer *DESTP which is LEN bytes long. If LEN is zero, then a @@ -81,7 +82,7 @@ gpgme_error_t _gpgme_decode_c_string (const char *src, char **destp, int len); is desired or not, the caller is expected to make sure that *DESTP is large enough if LEN is not zero. */ gpgme_error_t _gpgme_decode_percent_string (const char *src, char **destp, - int len); + size_t len); gpgme_error_t _gpgme_map_gnupg_error (char *err); diff --git a/gpgme/wait-global.c b/gpgme/wait-global.c index 992446e6..e6422510 100644 --- a/gpgme/wait-global.c +++ b/gpgme/wait-global.c @@ -202,7 +202,7 @@ _gpgme_wait_global_event_cb (void *data, gpgme_event_io_t type, { /* An error occured. Close all fds in this context, and send the error in a done event. */ - int idx; + unsigned int idx; for (idx = 0; idx <= ctx->fdt.size; idx++) if (ctx->fdt.fds[idx].fd != -1) @@ -255,7 +255,7 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang) { do { - int i = 0; + unsigned int i = 0; struct ctx_list_item *li; struct fd_table fdt; int nr; @@ -314,7 +314,7 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang) { /* An error occured. Close all fds in this context, and signal it. */ - int idx; + unsigned int idx; for (idx = 0; idx < ictx->fdt.size; idx++) if (ictx->fdt.fds[idx].fd != -1) diff --git a/gpgme/wait-private.c b/gpgme/wait-private.c index b5a049bf..c9c5ce55 100644 --- a/gpgme/wait-private.c +++ b/gpgme/wait-private.c @@ -79,13 +79,13 @@ _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond) do { int nr = _gpgme_io_select (ctx->fdt.fds, ctx->fdt.size, 0); - int i; + unsigned int i; if (nr < 0) { /* An error occured. Close all fds in this context, and signal it. */ - int idx; + unsigned int idx; err = gpg_error_from_errno (errno); for (idx = 0; idx < ctx->fdt.size; idx++) @@ -113,7 +113,7 @@ _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond) { /* An error occured. Close all fds in this context, and signal it. */ - int idx; + unsigned int idx; for (idx = 0; idx < ctx->fdt.size; idx++) if (ctx->fdt.fds[idx].fd != -1) diff --git a/gpgme/wait-user.c b/gpgme/wait-user.c index 1ea3db03..1fbe9cb2 100644 --- a/gpgme/wait-user.c +++ b/gpgme/wait-user.c @@ -52,7 +52,7 @@ _gpgme_user_io_cb_handler (void *data, int fd) err = (*item->handler) (item->handler_value, fd); if (err) { - int idx; + unsigned int idx; for (idx = 0; idx < ctx->fdt.size; idx++) if (ctx->fdt.fds[idx].fd != -1) @@ -61,7 +61,7 @@ _gpgme_user_io_cb_handler (void *data, int fd) } else { - int i; + unsigned int i; for (i = 0; i < ctx->fdt.size; i++) if (ctx->fdt.fds[i].fd != -1) diff --git a/gpgme/wait.c b/gpgme/wait.c index 53d89901..b874c570 100644 --- a/gpgme/wait.c +++ b/gpgme/wait.c @@ -56,7 +56,7 @@ _gpgme_fd_table_deinit (fd_table_t fdt) static gpgme_error_t fd_table_put (fd_table_t fdt, int fd, int dir, void *opaque, int *idx) { - int i, j; + unsigned int i, j; struct io_select_fd_s *new_fds; for (i = 0; i < fdt->size; i++)