Skip to content

Commit f980556

Browse files
committed
Resync
1 parent 2f2a8ea commit f980556

19 files changed

Lines changed: 121 additions & 169 deletions

cdrom/cdrom.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,12 +1000,11 @@ int cdrom_set_read_speed(libretro_vfs_implementation_file *stream, unsigned spee
10001000

10011001
int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, size_t *out_len, char cdrom_drive, unsigned char *num_tracks, cdrom_toc_t *toc)
10021002
{
1003+
int i;
10031004
unsigned char buf[2352] = {0};
10041005
unsigned short data_len = 0;
1005-
size_t len = 0;
1006-
size_t pos = 0;
1006+
size_t _len = 0, pos = 0;
10071007
int rv = 0;
1008-
int i;
10091008

10101009
if (!out_buf || !out_len || !num_tracks || !toc)
10111010
{
@@ -1052,10 +1051,10 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
10521051
return 1;
10531052
}
10541053

1055-
len = CDROM_CUE_TRACK_BYTES * (*num_tracks);
1054+
_len = CDROM_CUE_TRACK_BYTES * (*num_tracks);
10561055
toc->num_tracks = *num_tracks;
1057-
*out_buf = (char*)calloc(1, len);
1058-
*out_len = len;
1056+
*out_buf = (char*)calloc(1, _len);
1057+
*out_len = _len;
10591058

10601059
for (i = 0; i < (data_len - 2) / 11; i++)
10611060
{
@@ -1104,11 +1103,11 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
11041103
track_type = "MODE2/2352";
11051104

11061105
#if defined(_WIN32) && !defined(_XBOX)
1107-
pos += snprintf(*out_buf + pos, len - pos, "FILE \"cdrom://%c:/drive-track%02d.bin\" BINARY\n", cdrom_drive, point);
1106+
pos += snprintf(*out_buf + pos, _len - pos, "FILE \"cdrom://%c:/drive-track%02d.bin\" BINARY\n", cdrom_drive, point);
11081107
#else
1109-
pos += snprintf(*out_buf + pos, len - pos, "FILE \"cdrom://drive%c-track%02d.bin\" BINARY\n", cdrom_drive, point);
1108+
pos += snprintf(*out_buf + pos, _len - pos, "FILE \"cdrom://drive%c-track%02d.bin\" BINARY\n", cdrom_drive, point);
11101109
#endif
1111-
pos += snprintf(*out_buf + pos, len - pos, " TRACK %02d %s\n", point, track_type);
1110+
pos += snprintf(*out_buf + pos, _len - pos, " TRACK %02d %s\n", point, track_type);
11121111

11131112
{
11141113
unsigned pregap_lba_len = toc->track[point - 1].lba - toc->track[point - 1].lba_start;
@@ -1121,11 +1120,11 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
11211120

11221121
cdrom_lba_to_msf(pregap_lba_len, &min, &sec, &frame);
11231122

1124-
pos += snprintf(*out_buf + pos, len - pos, " INDEX 00 00:00:00\n");
1125-
pos += snprintf(*out_buf + pos, len - pos, " INDEX 01 %02u:%02u:%02u\n", (unsigned)min, (unsigned)sec, (unsigned)frame);
1123+
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 00 00:00:00\n");
1124+
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 01 %02u:%02u:%02u\n", (unsigned)min, (unsigned)sec, (unsigned)frame);
11261125
}
11271126
else
1128-
pos += snprintf(*out_buf + pos, len - pos, " INDEX 01 00:00:00\n");
1127+
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 01 00:00:00\n");
11291128
}
11301129
}
11311130
}

compat/compat_posix_string.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ int retro_strcasecmp__(const char *a, const char *b)
5656

5757
char *retro_strdup__(const char *orig)
5858
{
59-
size_t len = strlen(orig) + 1;
60-
char *ret = (char*)malloc(len);
59+
size_t _len = strlen(orig) + 1;
60+
char *ret = (char*)malloc(_len);
6161
if (!ret)
6262
return NULL;
63-
64-
strlcpy(ret, orig, len);
63+
strlcpy(ret, orig, _len);
6564
return ret;
6665
}
6766

compat/compat_strl.c

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,28 @@
2828
/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
2929

3030
#ifndef __MACH__
31-
32-
size_t strlcpy(char *dest, const char *source, size_t size)
31+
size_t strlcpy(char *s, const char *source, size_t len)
3332
{
34-
size_t src_size = 0;
35-
size_t n = size;
36-
37-
if (n)
38-
while (--n && (*dest++ = *source++)) src_size++;
39-
40-
if (!n)
33+
size_t _len = len;
34+
size_t __len = 0;
35+
if (_len)
36+
while (--_len && (*s++ = *source++)) __len++;
37+
if (!_len)
4138
{
42-
if (size) *dest = '\0';
43-
while (*source++) src_size++;
39+
if (len) *s = '\0';
40+
while (*source++) __len++;
4441
}
45-
46-
return src_size;
42+
return __len;
4743
}
4844

49-
size_t strlcat(char *dest, const char *source, size_t size)
45+
size_t strlcat(char *s, const char *source, size_t len)
5046
{
51-
size_t len = strlen(dest);
52-
53-
dest += len;
54-
55-
if (len > size)
56-
size = 0;
47+
size_t _len = strlen(s);
48+
s += _len;
49+
if (_len > len)
50+
len = 0;
5751
else
58-
size -= len;
59-
60-
return len + strlcpy(dest, source, size);
52+
len -= _len;
53+
return _len + strlcpy(s, source, len);
6154
}
6255
#endif

file/archive_file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static struct string_list *file_archive_filename_split(const char *path)
526526
*/
527527
int file_archive_compressed_read(
528528
const char * path, void **buf,
529-
const char* optional_filename, int64_t *length)
529+
const char* optional_filename, int64_t *len)
530530
{
531531
const struct
532532
file_archive_file_backend *backend = NULL;
@@ -540,7 +540,7 @@ int file_archive_compressed_read(
540540
*/
541541
if (optional_filename && path_is_valid(optional_filename))
542542
{
543-
*length = 0;
543+
*len = 0;
544544
return 1;
545545
}
546546

@@ -555,17 +555,17 @@ int file_archive_compressed_read(
555555
{
556556
/* could not extract string and substring. */
557557
string_list_free(str_list);
558-
*length = 0;
558+
*len = 0;
559559
return 0;
560560
}
561561

562562
backend = file_archive_get_file_backend(str_list->elems[0].data);
563-
*length = backend->compressed_file_read(str_list->elems[0].data,
563+
*len = backend->compressed_file_read(str_list->elems[0].data,
564564
str_list->elems[1].data, buf, optional_filename);
565565

566566
string_list_free(str_list);
567567

568-
if (*length != -1)
568+
if (*len != -1)
569569
return 1;
570570

571571
return 0;

file/archive_file_7z.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,9 @@ static int sevenzip_parse_file_iterate_step(void *context,
515515
}
516516

517517
static uint32_t sevenzip_stream_crc32_calculate(uint32_t crc,
518-
const uint8_t *data, size_t length)
518+
const uint8_t *data, size_t len)
519519
{
520-
return encoding_crc32(crc, data, length);
520+
return encoding_crc32(crc, data, len);
521521
}
522522

523523
const struct file_archive_file_backend sevenzip_backend = {

file/archive_file_zlib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ static int zlib_stream_decompress_data_to_file_iterate(
256256
}
257257

258258
static uint32_t zlib_stream_crc32_calculate(uint32_t crc,
259-
const uint8_t *data, size_t length)
259+
const uint8_t *data, size_t len)
260260
{
261-
return encoding_crc32(crc, data, length);
261+
return encoding_crc32(crc, data, len);
262262
}
263263

264264
static bool zip_file_decompressed_handle(

file/file_path.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,11 +1414,11 @@ size_t fill_pathname_application_path(char *s, size_t len)
14141414
}
14151415
#elif defined(__QNX__)
14161416
char *buff = malloc(len);
1417-
size_t rv = 0;
1417+
size_t _len = 0;
14181418
if (_cmdname(buff))
1419-
rv = strlcpy(s, buff, len);
1419+
_len = strlcpy(s, buff, len);
14201420
free(buff);
1421-
return rv;
1421+
return _len;
14221422
#else
14231423
size_t i;
14241424
static const char *exts[] = { "exe", "file", "path/a.out" };

file/nbio/nbio_unixmmap.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ static void *nbio_mmap_unix_open(const char * filename, unsigned mode)
6666
static const int o_flags[] = { O_RDONLY, O_RDWR|O_CREAT|O_TRUNC, O_RDWR, O_RDONLY, O_RDWR|O_CREAT|O_TRUNC };
6767
static const int map_flags[] = { PROT_READ, PROT_WRITE|PROT_READ, PROT_WRITE|PROT_READ, PROT_READ, PROT_WRITE|PROT_READ };
6868

69-
size_t len;
69+
size_t _len;
7070
void* ptr = NULL;
7171
struct nbio_mmap_unix_t* handle = NULL;
7272
int fd = open(filename, o_flags[mode]|O_CLOEXEC, 0644);
7373
if (fd < 0)
7474
return NULL;
7575

76-
len = lseek(fd, 0, SEEK_END);
77-
if (len != 0)
78-
ptr = mmap(NULL, len, map_flags[mode], MAP_SHARED, fd, 0);
76+
_len = lseek(fd, 0, SEEK_END);
77+
if (_len != 0)
78+
ptr = mmap(NULL, _len, map_flags[mode], MAP_SHARED, fd, 0);
7979

8080
if (ptr == MAP_FAILED)
8181
{
@@ -86,7 +86,7 @@ static void *nbio_mmap_unix_open(const char * filename, unsigned mode)
8686
handle = malloc(sizeof(struct nbio_mmap_unix_t));
8787
handle->fd = fd;
8888
handle->map_flags = map_flags[mode];
89-
handle->len = len;
89+
handle->len = _len;
9090
handle->ptr = ptr;
9191
return handle;
9292
}
@@ -132,7 +132,7 @@ static void nbio_mmap_unix_resize(void *data, size_t len)
132132
abort();
133133
}
134134

135-
static void *nbio_mmap_unix_get_ptr(void *data, size_t* len)
135+
static void *nbio_mmap_unix_get_ptr(void *data, size_t *len)
136136
{
137137
struct nbio_mmap_unix_t* handle = (struct nbio_mmap_unix_t*)data;
138138
if (!handle)

formats/json/rjson.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,14 +930,14 @@ static int _rjson_buffer_io(void* buf, int len, void *user)
930930
return len;
931931
}
932932

933-
rjson_t *rjson_open_buffer(const void *buffer, size_t size)
933+
rjson_t *rjson_open_buffer(const void *buffer, size_t len)
934934
{
935935
rjson_t *json = (rjson_t *)malloc(sizeof(rjson_t) + sizeof(const char *)*2);
936936
const char **ud = (const char **)(json + 1);
937937
if (!json)
938938
return NULL;
939939
ud[0] = (const char *)buffer;
940-
ud[1] = ud[0] + size;
940+
ud[1] = ud[0] + len;
941941
_rjson_setup(json, _rjson_buffer_io, (void*)ud, sizeof(json->input_buf));
942942
return json;
943943
}
@@ -987,12 +987,12 @@ void rjson_set_max_depth(rjson_t *json, unsigned int max_depth)
987987
json->stack_max = max_depth;
988988
}
989989

990-
const char *rjson_get_string(rjson_t *json, size_t *length)
990+
const char *rjson_get_string(rjson_t *json, size_t *len)
991991
{
992992
char* str = (json->string_pass_through
993993
? json->string_pass_through : json->string);
994-
if (length)
995-
*length = json->string_len;
994+
if (len)
995+
*len = json->string_len;
996996
str[json->string_len] = '\0';
997997
return str;
998998
}
@@ -1112,7 +1112,7 @@ void rjson_free(rjson_t *json)
11121112
}
11131113

11141114
static bool _rjson_nop_default(void *context) { return true; }
1115-
static bool _rjson_nop_string(void *context, const char *value, size_t length) { return true; }
1115+
static bool _rjson_nop_string(void *context, const char *value, size_t len) { return true; }
11161116
static bool _rjson_nop_bool(void *context, bool value) { return true; }
11171117

11181118
enum rjson_type rjson_parse(rjson_t *json, void* context,

formats/m3u/m3u_file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ static bool m3u_file_load(m3u_file_t *m3u_file)
182182

183183
if (token_ptr)
184184
{
185-
size_t len = (size_t)(1 + token_ptr - line);
185+
size_t _len = (size_t)(1 + token_ptr - line);
186186

187187
/* Get entry_path segment */
188-
if (len > 0)
188+
if (_len > 0)
189189
{
190190
memset(entry_path, 0, sizeof(entry_path));
191191
strlcpy(
192192
entry_path, line,
193-
((len < PATH_MAX_LENGTH ?
194-
len : PATH_MAX_LENGTH) * sizeof(char)));
193+
((_len < PATH_MAX_LENGTH ?
194+
_len : PATH_MAX_LENGTH) * sizeof(char)));
195195
string_trim_whitespace_right(entry_path);
196196
string_trim_whitespace_left(entry_path);
197197
}

0 commit comments

Comments
 (0)