wrowe 01/05/15 22:30:53
Modified: i18n/unix utf8_ucs2.c
include apr_hash.h apr_strings.h
lib apr_pools.c
misc/unix getopt.c
strings apr_snprintf.c
tables apr_hash.c apr_tables.c
Log:
Sing, "we are apr"... and make all hash functions accept apr_ssize_t
if we are going to bury -1 flags (I'd prefer the flag cast to apr_size_t
and use that value throughout the hash api, however.)
Revision Changes Path
1.5 +8 -3 apr/i18n/unix/utf8_ucs2.c
Index: utf8_ucs2.c
===================================================================
RCS file: /home/cvs/apr/i18n/unix/utf8_ucs2.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- utf8_ucs2.c 2001/02/16 04:15:41 1.4
+++ utf8_ucs2.c 2001/05/16 05:30:51 1.5
@@ -102,7 +102,8 @@
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 @@
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 @@
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)
{
1.25 +3 -3 apr/include/apr_hash.h
Index: apr_hash.h
===================================================================
RCS file: /home/cvs/apr/include/apr_hash.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- apr_hash.h 2001/03/07 17:57:15 1.24
+++ apr_hash.h 2001/05/16 05:30:51 1.25
@@ -119,7 +119,7 @@
* @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 @@
* @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.
1.15 +4 -4 apr/include/apr_strings.h
Index: apr_strings.h
===================================================================
RCS file: /home/cvs/apr/include/apr_strings.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- apr_strings.h 2001/02/22 04:05:58 1.14
+++ apr_strings.h 2001/05/16 05:30:52 1.15
@@ -244,9 +244,9 @@
* @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 @@
* @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
1.97 +4 -4 apr/lib/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/lib/apr_pools.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- apr_pools.c 2001/04/27 03:46:15 1.96
+++ apr_pools.c 2001/05/16 05:30:52 1.97
@@ -347,7 +347,7 @@
* 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 @@
* 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 @@
*/
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_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);
1.33 +1 -1 apr/misc/unix/getopt.c
Index: getopt.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/getopt.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- getopt.c 2001/02/08 07:44:52 1.32
+++ getopt.c 2001/05/16 05:30:52 1.33
@@ -239,7 +239,7 @@
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++) {
1.16 +4 -4 apr/strings/apr_snprintf.c
Index: apr_snprintf.c
===================================================================
RCS file: /home/cvs/apr/strings/apr_snprintf.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- apr_snprintf.c 2001/05/03 16:51:05 1.15
+++ apr_snprintf.c 2001/05/16 05:30:52 1.16
@@ -1199,7 +1199,7 @@
}
-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 @@
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 @@
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;
}
1.19 +6 -6 apr/tables/apr_hash.c
Index: apr_hash.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_hash.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- apr_hash.c 2001/03/22 17:35:08 1.18
+++ apr_hash.c 2001/05/16 05:30:52 1.19
@@ -86,7 +86,7 @@
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(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 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);
1.14 +2 -1 apr/tables/apr_tables.c
Index: apr_tables.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_tables.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- apr_tables.c 2001/02/25 20:39:38 1.13
+++ apr_tables.c 2001/05/16 05:30:52 1.14
@@ -221,7 +221,8 @@
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);