2003-07-31 Marcus Brinkmann <marcus@g10code.de>

* 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.
This commit is contained in:
Marcus Brinkmann 2003-07-31 15:44:02 +00:00
parent b0e0ab96cb
commit f4c25d034c
10 changed files with 53 additions and 23 deletions

View File

@ -1,3 +1,29 @@
2003-07-31 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de> 2003-07-29 Marcus Brinkmann <marcus@g10code.de>
* decrypt-verify.c (decrypt_verify_status_handler): Expand silly * decrypt-verify.c (decrypt_verify_status_handler): Expand silly

View File

@ -65,7 +65,7 @@ _gpgme_hextobyte (const unsigned char *str)
is desired or not, the caller is expected to make sure that *DESTP is desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */ is large enough if LEN is not zero. */
gpgme_error_t 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; 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 desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */ is large enough if LEN is not zero. */
gpgme_error_t 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; char *dest;
@ -323,7 +323,7 @@ static struct
gpgme_error_t gpgme_error_t
_gpgme_map_gnupg_error (char *err) _gpgme_map_gnupg_error (char *err)
{ {
int i; unsigned int i;
for (i = 0; i < DIM (gnupg_errors); i++) for (i = 0; i < DIM (gnupg_errors); i++)
if (!strcmp (gnupg_errors[i].name, err)) if (!strcmp (gnupg_errors[i].name, err))

View File

@ -119,7 +119,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info)
gpgme_engine_info_t *lastp = &engine_info; gpgme_engine_info_t *lastp = &engine_info;
gpgme_protocol_t proto_list[] = { GPGME_PROTOCOL_OpenPGP, gpgme_protocol_t proto_list[] = { GPGME_PROTOCOL_OpenPGP,
GPGME_PROTOCOL_CMS }; GPGME_PROTOCOL_CMS };
int proto; unsigned int proto;
for (proto = 0; proto < DIM (proto_list); proto++) for (proto = 0; proto < DIM (proto_list); proto++)
{ {

View File

@ -115,7 +115,7 @@ _gpgme_io_close (int fd)
return -1; return -1;
/* First call the notify handler. */ /* First call the notify handler. */
DEBUG1 ("closing fd %d", fd); 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) 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); assert (fd != -1);
if (fd < 0 || fd >= DIM (notify_table)) if (fd < 0 || fd >= (int) DIM (notify_table))
return -1; return -1;
DEBUG1 ("set notification for fd %d", fd); DEBUG1 ("set notification for fd %d", fd);
notify_table[fd].handler = handler; 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 readfds;
fd_set writefds; 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. */ struct timeval timeout = { 1, 0 }; /* Use a 1s timeout. */
void *dbg_help = NULL; void *dbg_help = NULL;

View File

@ -35,7 +35,7 @@
void void
gpgme_signers_clear (gpgme_ctx_t ctx) gpgme_signers_clear (gpgme_ctx_t ctx)
{ {
int i; unsigned int i;
if (!ctx || !ctx->signers) if (!ctx || !ctx->signers)
return; return;
@ -81,12 +81,14 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)
gpgme_key_t gpgme_key_t
gpgme_signers_enum (const gpgme_ctx_t ctx, int seq) gpgme_signers_enum (const gpgme_ctx_t ctx, int seq)
{ {
unsigned int seqno;
if (!ctx || seq < 0) if (!ctx || seq < 0)
return NULL; return NULL;
if (seq >= ctx->signers_len) seqno = (unsigned int) seq;
if (seqno >= ctx->signers_len)
return NULL; return NULL;
gpgme_key_ref (ctx->signers[seqno]);
gpgme_key_ref (ctx->signers[seq]); return ctx->signers[seqno];
return ctx->signers[seq];
} }

View File

@ -72,7 +72,8 @@ int _gpgme_hextobyte (const unsigned char *str);
the result. Currently, LEN is only used to specify if allocation 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 desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */ 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 /* 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 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 desired or not, the caller is expected to make sure that *DESTP
is large enough if LEN is not zero. */ is large enough if LEN is not zero. */
gpgme_error_t _gpgme_decode_percent_string (const char *src, char **destp, 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); gpgme_error_t _gpgme_map_gnupg_error (char *err);

View File

@ -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 /* An error occured. Close all fds in this context, and
send the error in a done event. */ send the error in a done event. */
int idx; unsigned int idx;
for (idx = 0; idx <= ctx->fdt.size; idx++) for (idx = 0; idx <= ctx->fdt.size; idx++)
if (ctx->fdt.fds[idx].fd != -1) if (ctx->fdt.fds[idx].fd != -1)
@ -255,7 +255,7 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang)
{ {
do do
{ {
int i = 0; unsigned int i = 0;
struct ctx_list_item *li; struct ctx_list_item *li;
struct fd_table fdt; struct fd_table fdt;
int nr; 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, /* An error occured. Close all fds in this context,
and signal it. */ and signal it. */
int idx; unsigned int idx;
for (idx = 0; idx < ictx->fdt.size; idx++) for (idx = 0; idx < ictx->fdt.size; idx++)
if (ictx->fdt.fds[idx].fd != -1) if (ictx->fdt.fds[idx].fd != -1)

View File

@ -79,13 +79,13 @@ _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond)
do do
{ {
int nr = _gpgme_io_select (ctx->fdt.fds, ctx->fdt.size, 0); int nr = _gpgme_io_select (ctx->fdt.fds, ctx->fdt.size, 0);
int i; unsigned int i;
if (nr < 0) if (nr < 0)
{ {
/* An error occured. Close all fds in this context, and /* An error occured. Close all fds in this context, and
signal it. */ signal it. */
int idx; unsigned int idx;
err = gpg_error_from_errno (errno); err = gpg_error_from_errno (errno);
for (idx = 0; idx < ctx->fdt.size; idx++) 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, /* An error occured. Close all fds in this context,
and signal it. */ and signal it. */
int idx; unsigned int idx;
for (idx = 0; idx < ctx->fdt.size; idx++) for (idx = 0; idx < ctx->fdt.size; idx++)
if (ctx->fdt.fds[idx].fd != -1) if (ctx->fdt.fds[idx].fd != -1)

View File

@ -52,7 +52,7 @@ _gpgme_user_io_cb_handler (void *data, int fd)
err = (*item->handler) (item->handler_value, fd); err = (*item->handler) (item->handler_value, fd);
if (err) if (err)
{ {
int idx; unsigned int idx;
for (idx = 0; idx < ctx->fdt.size; idx++) for (idx = 0; idx < ctx->fdt.size; idx++)
if (ctx->fdt.fds[idx].fd != -1) if (ctx->fdt.fds[idx].fd != -1)
@ -61,7 +61,7 @@ _gpgme_user_io_cb_handler (void *data, int fd)
} }
else else
{ {
int i; unsigned int i;
for (i = 0; i < ctx->fdt.size; i++) for (i = 0; i < ctx->fdt.size; i++)
if (ctx->fdt.fds[i].fd != -1) if (ctx->fdt.fds[i].fd != -1)

View File

@ -56,7 +56,7 @@ _gpgme_fd_table_deinit (fd_table_t fdt)
static gpgme_error_t static gpgme_error_t
fd_table_put (fd_table_t fdt, int fd, int dir, void *opaque, int *idx) 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; struct io_select_fd_s *new_fds;
for (i = 0; i < fdt->size; i++) for (i = 0; i < fdt->size; i++)