summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18n/unix/utf8_ucs2.c11
-rw-r--r--include/apr_hash.h6
-rw-r--r--include/apr_strings.h8
-rw-r--r--lib/apr_pools.c8
-rw-r--r--memory/unix/apr_pools.c8
-rw-r--r--misc/unix/getopt.c2
-rw-r--r--strings/apr_snprintf.c8
-rw-r--r--tables/apr_hash.c12
-rw-r--r--tables/apr_tables.c3
9 files changed, 36 insertions, 30 deletions
diff --git a/i18n/unix/utf8_ucs2.c b/i18n/unix/utf8_ucs2.c
index 68336c654..15cb411a5 100644
--- a/i18n/unix/utf8_ucs2.c
+++ b/i18n/unix/utf8_ucs2.c
@@ -102,7 +102,8 @@ apr_status_t conv_utf8_to_ucs2(const char *in, apr_size_t *inbytes,
apr_wchar_t *out, apr_size_t *outwords)
{
apr_int64_t newch, mask;
- int ch, expect, eating;
+ apr_size_t expect, eating;
+ int ch;
while (*inbytes && *outwords)
{
@@ -167,7 +168,10 @@ apr_status_t conv_utf8_to_ucs2(const char *in, apr_size_t *inbytes,
return APR_EINVAL;
}
}
- if (*outwords < (expect > 2) + 1)
+ /* Where the boolean (expect > 2) is true, we will need
+ * an extra word for the output.
+ */
+ if (*outwords < (apr_size_t)(expect > 2) + 1)
break; /* buffer full */
while (expect--)
{
@@ -207,8 +211,9 @@ apr_status_t conv_ucs2_to_utf8(const apr_wchar_t *in, apr_size_t *inwords,
char *out, apr_size_t *outbytes)
{
apr_int64_t newch, require;
+ apr_size_t need;
char *invout;
- int ch, need;
+ int ch;
while (*inwords && *outbytes)
{
diff --git a/include/apr_hash.h b/include/apr_hash.h
index c17a20851..4548905eb 100644
--- a/include/apr_hash.h
+++ b/include/apr_hash.h
@@ -119,7 +119,7 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key,
* @param key Pointer to the key
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
* @return Returns NULL if the key is not present.
- * @deffunc void *apr_hash_get(apr_hash_t *ht, const void *key, apr_size_t klen)
+ * @deffunc void *apr_hash_get(apr_hash_t *ht, const void *key, apr_ssize_t klen)
*/
APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key,
apr_ssize_t klen);
@@ -168,10 +168,10 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi);
* @param val Return pointer for the associated value.
* @tip The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
- * @deffunc void apr_hash_this(apr_hash_index_t *hi, const void **key, apr_size_t *klen, void **val);
+ * @deffunc void apr_hash_this(apr_hash_index_t *hi, const void **key, apr_ssize_t *klen, void **val);
*/
APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key,
- apr_size_t *klen, void **val);
+ apr_ssize_t *klen, void **val);
/**
* Get the number of key/value pairs in the hash table.
diff --git a/include/apr_strings.h b/include/apr_strings.h
index 85d070273..a381855eb 100644
--- a/include/apr_strings.h
+++ b/include/apr_strings.h
@@ -244,9 +244,9 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
* @param len The size of the buffer
* @param format The format string
* @param ... The arguments to use to fill out the format string.
- * @deffunc int apr_snprintf(char *buf, size_t len, const char *format, ...)
+ * @deffunc int apr_snprintf(char *buf, apr_size_t len, const char *format, ...)
*/
-APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, size_t len,
+APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
const char *format, ...)
__attribute__((format(printf,3,4)));
@@ -257,9 +257,9 @@ APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, size_t len,
* @param len The size of the buffer
* @param format The format string
* @param ap The arguments to use to fill out the format string.
- * @deffunc int apr_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
+ * @deffunc int apr_vsnprintf(char *buf, apr_size_t len, const char *format, va_list ap)
*/
-APR_DECLARE(int) apr_vsnprintf(char *buf, size_t len, const char *format,
+APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
va_list ap);
#ifdef __cplusplus
diff --git a/lib/apr_pools.c b/lib/apr_pools.c
index 7d34df7ff..4a87c987c 100644
--- a/lib/apr_pools.c
+++ b/lib/apr_pools.c
@@ -347,7 +347,7 @@ static void *mprotect_realloc(void *addr, apr_size_t size)
* Get a completely new block from the system pool. Note that we rely on
* malloc() to provide aligned memory.
*/
-static union block_hdr *malloc_block(int size, apr_abortfunc_t abortfunc)
+static union block_hdr *malloc_block(apr_size_t size, apr_abortfunc_t abortfunc)
{
union block_hdr *blok;
@@ -506,7 +506,7 @@ static void free_blocks(union block_hdr *blok)
* Get a new block, from our own free list if possible, from the system
* if necessary. Must be called with alarms blocked.
*/
-static union block_hdr *new_block(int min_size, apr_abortfunc_t abortfunc)
+static union block_hdr *new_block(apr_size_t min_size, apr_abortfunc_t abortfunc)
{
union block_hdr **lastptr = &block_freelist;
union block_hdr *blok = block_freelist;
@@ -516,7 +516,7 @@ static union block_hdr *new_block(int min_size, apr_abortfunc_t abortfunc)
*/
while (blok != NULL) {
- if (min_size + BLOCK_MINFREE <= blok->h.endp - blok->h.first_avail) {
+ if ((apr_ssize_t)min_size + BLOCK_MINFREE <= blok->h.endp - blok->h.first_avail) {
*lastptr = blok->h.next;
blok->h.next = NULL;
debug_verify_filled(blok->h.first_avail, blok->h.endp,
@@ -1169,7 +1169,7 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data, const char *ke
apr_status_t (*cleanup) (void *),
apr_pool_t *cont)
{
- int keylen = strlen(key);
+ apr_size_t keylen = strlen(key);
if (cont->prog_data == NULL)
cont->prog_data = apr_hash_make(cont);
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 7d34df7ff..4a87c987c 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -347,7 +347,7 @@ static void *mprotect_realloc(void *addr, apr_size_t size)
* Get a completely new block from the system pool. Note that we rely on
* malloc() to provide aligned memory.
*/
-static union block_hdr *malloc_block(int size, apr_abortfunc_t abortfunc)
+static union block_hdr *malloc_block(apr_size_t size, apr_abortfunc_t abortfunc)
{
union block_hdr *blok;
@@ -506,7 +506,7 @@ static void free_blocks(union block_hdr *blok)
* Get a new block, from our own free list if possible, from the system
* if necessary. Must be called with alarms blocked.
*/
-static union block_hdr *new_block(int min_size, apr_abortfunc_t abortfunc)
+static union block_hdr *new_block(apr_size_t min_size, apr_abortfunc_t abortfunc)
{
union block_hdr **lastptr = &block_freelist;
union block_hdr *blok = block_freelist;
@@ -516,7 +516,7 @@ static union block_hdr *new_block(int min_size, apr_abortfunc_t abortfunc)
*/
while (blok != NULL) {
- if (min_size + BLOCK_MINFREE <= blok->h.endp - blok->h.first_avail) {
+ if ((apr_ssize_t)min_size + BLOCK_MINFREE <= blok->h.endp - blok->h.first_avail) {
*lastptr = blok->h.next;
blok->h.next = NULL;
debug_verify_filled(blok->h.first_avail, blok->h.endp,
@@ -1169,7 +1169,7 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data, const char *ke
apr_status_t (*cleanup) (void *),
apr_pool_t *cont)
{
- int keylen = strlen(key);
+ apr_size_t keylen = strlen(key);
if (cont->prog_data == NULL)
cont->prog_data = apr_hash_make(cont);
diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c
index 40378d20d..b14b8c9fe 100644
--- a/misc/unix/getopt.c
+++ b/misc/unix/getopt.c
@@ -239,7 +239,7 @@ APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
p = os->argv[os->ind++] + 1;
if (*p == '-' && p[1] != '\0') { /* Long option */
/* Search for the long option name in the caller's table. */
- int len = 0;
+ apr_size_t len = 0;
p++;
for (i = 0; ; i++) {
diff --git a/strings/apr_snprintf.c b/strings/apr_snprintf.c
index 5bccc15b5..2973191bf 100644
--- a/strings/apr_snprintf.c
+++ b/strings/apr_snprintf.c
@@ -1199,7 +1199,7 @@ static int snprintf_flush(apr_vformatter_buff_t *vbuff)
}
-APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, size_t len,
+APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
const char *format, ...)
{
int cc;
@@ -1216,11 +1216,11 @@ APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, size_t len,
cc = apr_vformatter(snprintf_flush, &vbuff, format, ap);
va_end(ap);
*vbuff.curpos = '\0';
- return (cc == -1) ? len : cc;
+ return (cc == -1) ? (int)len : cc;
}
-APR_DECLARE(int) apr_vsnprintf(char *buf, size_t len, const char *format,
+APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
va_list ap)
{
int cc;
@@ -1234,5 +1234,5 @@ APR_DECLARE(int) apr_vsnprintf(char *buf, size_t len, const char *format,
vbuff.endpos = buf + len - 1;
cc = apr_vformatter(snprintf_flush, &vbuff, format, ap);
*vbuff.curpos = '\0';
- return (cc == -1) ? len : cc;
+ return (cc == -1) ? (int)len : cc;
}
diff --git a/tables/apr_hash.c b/tables/apr_hash.c
index 4da402016..36409e354 100644
--- a/tables/apr_hash.c
+++ b/tables/apr_hash.c
@@ -86,7 +86,7 @@ struct apr_hash_entry_t {
apr_hash_entry_t *next;
int hash;
const void *key;
- apr_size_t klen;
+ apr_ssize_t klen;
const void *val;
};
@@ -168,7 +168,7 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_hash_t *ht)
APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi,
const void **key,
- apr_size_t *klen,
+ apr_ssize_t *klen,
void **val)
{
if (key) *key = hi->this->key;
@@ -209,14 +209,14 @@ static void expand_array(apr_hash_t *ht)
*/
static apr_hash_entry_t **find_entry(apr_hash_t *ht,
- const void *key,
- apr_ssize_t klen,
- const void *val)
+ const void *key,
+ apr_ssize_t klen,
+ const void *val)
{
apr_hash_entry_t **hep, *he;
const unsigned char *p;
int hash;
- int i;
+ apr_ssize_t i;
if (klen == APR_HASH_KEY_STRING)
klen = strlen(key);
diff --git a/tables/apr_tables.c b/tables/apr_tables.c
index ef6bc17e2..b2cf518db 100644
--- a/tables/apr_tables.c
+++ b/tables/apr_tables.c
@@ -221,7 +221,8 @@ APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
const char sep)
{
char *cp, *res, **strpp;
- int i, len;
+ apr_size_t len;
+ int i;
if (arr->nelts <= 0 || arr->elts == NULL) { /* Empty table? */
return (char *) apr_pcalloc(p, 1);