Skip to content

Commit 3588b4d

Browse files
committed
Use sufficiently large data type for indexes/position counters
1 parent 543e20b commit 3588b4d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/base64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ unsigned char *base64decode(const char *buf, size_t *size)
7878
if (len <= 0) return NULL;
7979
unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3);
8080
const char *ptr = buf;
81-
int p = 0;
81+
size_t p = 0;
8282
int wv, w1, w2, w3, w4;
8383
int tmpval[4];
8484
int tmpcnt = 0;

src/bplist.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,13 @@ static plist_t parse_string_node(const char **bnode, uint64_t size)
369369
return node_create(NULL, data);
370370
}
371371

372-
static char *plist_utf16be_to_utf8(uint16_t *unistr, long len, long *items_read, long *items_written)
372+
static char *plist_utf16be_to_utf8(uint16_t *unistr, size_t len, size_t *items_read, size_t *items_written)
373373
{
374374
if (!unistr || (len <= 0)) return NULL;
375375
char* outbuf;
376376
char* outbuf_new;
377-
int p = 0;
378-
long i = 0;
377+
size_t p = 0;
378+
size_t i = 0;
379379

380380
uint16_t wc;
381381
uint32_t w;
@@ -443,8 +443,8 @@ static char *plist_utf16be_to_utf8(uint16_t *unistr, long len, long *items_read,
443443
static plist_t parse_unicode_node(const char **bnode, uint64_t size)
444444
{
445445
plist_data_t data = plist_new_plist_data();
446-
long items_read = 0;
447-
long items_written = 0;
446+
size_t items_read = 0;
447+
size_t items_written = 0;
448448

449449
data->type = PLIST_STRING;
450450
data->strval = plist_utf16be_to_utf8((uint16_t*)(*bnode), size, &items_read, &items_written);
@@ -1097,11 +1097,11 @@ static void write_string(bytearray_t * bplist, char *val, uint64_t size)
10971097
write_raw_data(bplist, BPLIST_STRING, (uint8_t *) val, size);
10981098
}
10991099

1100-
static uint16_t *plist_utf8_to_utf16be(char *unistr, long size, long *items_read, long *items_written)
1100+
static uint16_t *plist_utf8_to_utf16be(char *unistr, size_t size, size_t *items_read, size_t *items_written)
11011101
{
11021102
uint16_t *outbuf;
1103-
int p = 0;
1104-
long i = 0;
1103+
size_t p = 0;
1104+
size_t i = 0;
11051105

11061106
unsigned char c0;
11071107
unsigned char c1;
@@ -1156,10 +1156,10 @@ static uint16_t *plist_utf8_to_utf16be(char *unistr, long size, long *items_read
11561156
return outbuf;
11571157
}
11581158

1159-
static void write_unicode(bytearray_t * bplist, char *val, uint64_t size)
1159+
static void write_unicode(bytearray_t * bplist, char *val, size_t size)
11601160
{
1161-
long items_read = 0;
1162-
long items_written = 0;
1161+
size_t items_read = 0;
1162+
size_t items_written = 0;
11631163
uint16_t *unicodestr = NULL;
11641164

11651165
unicodestr = plist_utf8_to_utf16be(val, size, &items_read, &items_written);

0 commit comments

Comments
 (0)