Skip to content

Commit 2a5b635

Browse files
committed
Resync
1 parent 77f39ab commit 2a5b635

15 files changed

Lines changed: 103 additions & 387 deletions

File tree

dynamic/dylib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ dylib_t dylib_load(const char *path)
135135
{
136136
char fw_path[PATH_MAX_LENGTH];
137137
const char *fw_name = path_basename(path);
138-
size_t sz = strlcpy(fw_path, path, sizeof(fw_path));
139-
sz += strlcpy(fw_path + sz, "/", sizeof(fw_path) - sz);
138+
size_t _len = strlcpy(fw_path, path, sizeof(fw_path));
139+
_len += strlcpy(fw_path + _len, "/", sizeof(fw_path) - _len);
140140
/* Assume every framework binary is named for the framework. Not always
141141
* a great assumption but correct enough for our uses. */
142-
strlcpy(fw_path + sz, fw_name, strlen(fw_name) - STRLEN_CONST(fw_suffix) + 1);
142+
strlcpy(fw_path + _len, fw_name, strlen(fw_name) - STRLEN_CONST(fw_suffix) + 1);
143143
lib = dlopen(fw_path, RTLD_LAZY | RTLD_LOCAL);
144144
}
145145
else

features/features_cpu.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -758,20 +758,6 @@ uint64_t cpu_features_get(void)
758758
#endif
759759
#endif
760760
}
761-
762-
#if 0
763-
check_arm_cpu_feature("swp");
764-
check_arm_cpu_feature("half");
765-
check_arm_cpu_feature("thumb");
766-
check_arm_cpu_feature("fastmult");
767-
check_arm_cpu_feature("vfp");
768-
check_arm_cpu_feature("edsp");
769-
check_arm_cpu_feature("thumbee");
770-
check_arm_cpu_feature("tls");
771-
check_arm_cpu_feature("idiva");
772-
check_arm_cpu_feature("idivt");
773-
#endif
774-
775761
#elif defined(__ARM_NEON__)
776762
cpu |= RETRO_SIMD_NEON;
777763
#if defined(__arm__)

file/archive_file.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,40 @@ bool file_archive_perform_mode(const char *path, const char *valid_exts,
479479
return true;
480480
}
481481

482+
/**
483+
* string_list_append_n:
484+
* @list : pointer to string list
485+
* @elem : element to add to the string list
486+
* @length : read at most this many bytes from elem
487+
* @attr : attributes of new element.
488+
*
489+
* Appends a new element to the string list.
490+
*
491+
* @return true if successful, otherwise false.
492+
**/
493+
static bool string_list_append_n(struct string_list *list,
494+
const char *elem, unsigned length,
495+
union string_list_elem_attr attr)
496+
{
497+
char *data_dup = NULL;
498+
499+
if (list->size >= list->cap &&
500+
!string_list_capacity(list, list->cap * 2))
501+
return false;
502+
503+
if (!(data_dup = (char*)malloc(length + 1)))
504+
return false;
505+
506+
strlcpy(data_dup, elem, length + 1);
507+
508+
list->elems[list->size].data = data_dup;
509+
list->elems[list->size].attr = attr;
510+
511+
list->size++;
512+
return true;
513+
}
514+
515+
482516
/**
483517
* file_archive_filename_split:
484518
* @str : filename to turn into a string list

file/file_path.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,18 @@ char *find_last_slash(const char *str)
384384
**/
385385
size_t fill_pathname_slash(char *s, size_t len)
386386
{
387-
char *last_slash = find_last_slash(s);
387+
char *last_slash = find_last_slash(s);
388+
len = strlen(s);
388389
if (!last_slash)
389-
return strlcat(s, PATH_DEFAULT_SLASH(), len);
390-
len = strlen(s);
391-
/* Try to preserve slash type. */
392-
if (last_slash != (s + len - 1))
393390
{
394-
s[ len] = last_slash[0];
395-
s[++len] = '\0';
391+
s[ len] = PATH_DEFAULT_SLASH_C();
392+
s[++len] = '\0';
393+
}
394+
else if (last_slash != (s + len - 1))
395+
{
396+
/* Try to preserve slash type. */
397+
s[ len] = last_slash[0];
398+
s[++len] = '\0';
396399
}
397400
return len;
398401
}
@@ -992,20 +995,17 @@ size_t fill_pathname_join_special(char *s,
992995

993996
if (*s)
994997
{
995-
char *last_slash = find_last_slash(s);
996-
if (last_slash)
998+
char *last_slash = find_last_slash(s);
999+
if (!last_slash)
9971000
{
998-
/* Try to preserve slash type. */
999-
if (last_slash != (s + _len - 1))
1000-
{
1001-
s[ _len] = last_slash[0];
1002-
s[++_len] = '\0';
1003-
}
1001+
s[ _len] = PATH_DEFAULT_SLASH_C();
1002+
s[++_len] = '\0';
10041003
}
1005-
else
1004+
else if (last_slash != (s + _len - 1))
10061005
{
1007-
s[ _len] = PATH_DEFAULT_SLASH_C();
1008-
s[++_len] = '\0';
1006+
/* Try to preserve slash type. */
1007+
s[ _len] = last_slash[0];
1008+
s[++_len] = '\0';
10091009
}
10101010
}
10111011

@@ -1327,14 +1327,14 @@ void path_basedir_wrapper(char *s)
13271327
*last_slash = '\0';
13281328
#endif
13291329
last_slash = find_last_slash(s);
1330-
if (last_slash)
1331-
last_slash[1] = '\0';
1332-
else
1330+
if (!last_slash)
13331331
{
13341332
s[0] = '.';
13351333
s[1] = PATH_DEFAULT_SLASH_C();
13361334
s[2] = '\0';
13371335
}
1336+
else
1337+
last_slash[1] = '\0';
13381338
}
13391339

13401340
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)

formats/bmp/rbmp.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -346,21 +346,6 @@ static unsigned char *rbmp_bmp_load(rbmp_context *s, unsigned *x, unsigned *y,
346346
switch (compress)
347347
{
348348
case 0:
349-
#if 0
350-
if (bpp == 32)
351-
{
352-
mr = 0xffu << 16;
353-
mg = 0xffu << 8;
354-
mb = 0xffu << 0;
355-
ma = 0xffu << 24;
356-
}
357-
else
358-
{
359-
mr = 31u << 10;
360-
mg = 31u << 5;
361-
mb = 31u << 0;
362-
}
363-
#endif
364349
break;
365350
case 3:
366351
mr = (uint32_t)RBMP_GET32LE(s);
@@ -373,9 +358,6 @@ static unsigned char *rbmp_bmp_load(rbmp_context *s, unsigned *x, unsigned *y,
373358
return 0;
374359
break;
375360
default:
376-
#if 0
377-
mr = mg = mb = 0;
378-
#endif
379361
break;
380362
}
381363

formats/m3u/m3u_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ bool m3u_file_save(
474474
{
475475
size_t i;
476476
char base_dir[DIR_MAX_LENGTH];
477-
char *last_slash = NULL;
478477
RFILE *file = NULL;
479478

480479
if (!m3u_file || !m3u_file->entries)
@@ -485,7 +484,7 @@ bool m3u_file_save(
485484
return false;
486485

487486
/* Get M3U file base directory */
488-
if ((last_slash = find_last_slash(m3u_file->path)))
487+
if (find_last_slash(m3u_file->path))
489488
fill_pathname_basedir(base_dir, m3u_file->path, sizeof(base_dir));
490489
else
491490
base_dir[0] = '\0';

formats/tga/rtga.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,16 @@ static uint8_t *rtga_tga_load(rtga_context *s,
337337
/* read in the data raw */
338338
/* manually unroll, probably GCC bug 92955 */
339339
j = 0;
340-
switch (tga_bits_per_pixel) {
341-
case 32: raw_data[j++] = rtga_get8(s); /* fallthrough */
342-
case 24: raw_data[j++] = rtga_get8(s); /* fallthrough */
343-
case 16: raw_data[j++] = rtga_get8(s); /* fallthrough */
344-
case 8: raw_data[j++] = rtga_get8(s);
340+
switch (tga_bits_per_pixel)
341+
{
342+
case 32:
343+
raw_data[j++] = rtga_get8(s); /* fallthrough */
344+
case 24:
345+
raw_data[j++] = rtga_get8(s); /* fallthrough */
346+
case 16:
347+
raw_data[j++] = rtga_get8(s); /* fallthrough */
348+
case 8:
349+
raw_data[j++] = rtga_get8(s);
345350
}
346351
}
347352

formats/xml/rxml.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ rxml_document_t *rxml_load_document_string(const char *str)
142142
doc = (rxml_document_t*)malloc(sizeof(*doc));
143143
if (!doc)
144144
goto error;
145+
doc->root_node = NULL;
145146

146147
yxml_init(&x, buf->xml, BUFSIZE);
147148

include/defines/d3d_defines.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,64 +29,19 @@
2929

3030
#if defined(HAVE_D3D9)
3131
/* Direct3D 9 */
32-
#if 0
33-
#include <d3d9.h>
34-
#endif
35-
36-
#if 0
37-
#define LPDIRECT3D LPDIRECT3D9
38-
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
39-
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
40-
#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE9
41-
#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER9
42-
#define LPDIRECT3DVERTEXSHADER LPDIRECT3DVERTEXSHADER9
43-
#define LPDIRECT3DPIXELSHADER LPDIRECT3DPIXELSHADER9
44-
#define LPDIRECT3DSURFACE LPDIRECT3DSURFACE9
45-
#define LPDIRECT3DVERTEXDECLARATION LPDIRECT3DVERTEXDECLARATION9
46-
#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE9
47-
#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE9
48-
#define D3DVERTEXELEMENT D3DVERTEXELEMENT9
49-
#define D3DVIEWPORT D3DVIEWPORT9
50-
#endif
5132

5233
#ifndef D3DCREATE_SOFTWARE_VERTEXPROCESSING
5334
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0
5435
#endif
5536

5637
#elif defined(HAVE_D3D8)
57-
#if 0
58-
#ifdef _XBOX
59-
#include <xtl.h>
60-
#else
61-
#include "../gfx/include/d3d8/d3d8.h"
62-
#endif
63-
#endif
6438

6539
/* Direct3D 8 */
66-
#if 0
67-
#define LPDIRECT3D LPDIRECT3D8
68-
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE8
69-
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE8
70-
#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE8
71-
#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE8
72-
#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER8
73-
#define LPDIRECT3DVERTEXDECLARATION (void*)
74-
#define LPDIRECT3DSURFACE LPDIRECT3DSURFACE8
75-
#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE8
76-
#define D3DVERTEXELEMENT D3DVERTEXELEMENT8
77-
#define D3DVIEWPORT D3DVIEWPORT8
78-
#endif
7940

8041
#if !defined(D3DLOCK_NOSYSLOCK) && defined(_XBOX)
8142
#define D3DLOCK_NOSYSLOCK (0)
8243
#endif
8344

84-
#if 0
85-
#define D3DSAMP_ADDRESSU D3DTSS_ADDRESSU
86-
#define D3DSAMP_ADDRESSV D3DTSS_ADDRESSV
87-
#define D3DSAMP_MAGFILTER D3DTSS_MAGFILTER
88-
#define D3DSAMP_MINFILTER D3DTSS_MINFILTER
89-
#endif
9045
#endif
9146

9247
#endif

include/lists/string_list.h

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ struct string_list *string_split(const char *str, const char *delim);
9191
bool string_split_noalloc(struct string_list *list,
9292
const char *str, const char *delim);
9393

94-
/**
95-
* string_separate:
96-
* @str : string to turn into a string list
97-
* @delim : delimiter character to use for separating the string.
98-
*
99-
* Creates a new string list based on string @str, delimited by @delim.
100-
* Includes empty strings - i.e. two adjacent delimiters will resolve
101-
* to a string list element of "".
102-
*
103-
* @return New string list if successful, otherwise NULL.
104-
**/
105-
struct string_list *string_separate(char *str, const char *delim);
106-
107-
bool string_separate_noalloc(struct string_list *list,
108-
char *str, const char *delim);
109-
11094
bool string_list_deinitialize(struct string_list *list);
11195

11296
bool string_list_initialize(struct string_list *list);
@@ -137,25 +121,6 @@ struct string_list *string_list_new(void);
137121
bool string_list_append(struct string_list *list, const char *elem,
138122
union string_list_elem_attr attr);
139123

140-
/**
141-
* string_list_append_n:
142-
* @list : pointer to string list
143-
* @elem : element to add to the string list
144-
* @length : read at most this many bytes from elem
145-
* @attr : attributes of new element.
146-
*
147-
* Appends a new element to the string list.
148-
*
149-
* Hidden non-leaf function cost:
150-
* - Calls string_list_capacity()
151-
* - Calls malloc
152-
* - Calls strlcpy
153-
*
154-
* @return true if successful, otherwise false.
155-
**/
156-
bool string_list_append_n(struct string_list *list, const char *elem,
157-
unsigned length, union string_list_elem_attr attr);
158-
159124
/**
160125
* string_list_free
161126
* @list : pointer to string list object
@@ -200,19 +165,15 @@ void string_list_join_concat_special(char *s, size_t len,
200165
const struct string_list *list, const char *delim);
201166

202167
/**
203-
* string_list_set:
168+
* string_list_capacity:
204169
* @list : pointer to string list
205-
* @idx : index of element in string list
206-
* @str : value for the element.
170+
* @cap : new capacity for string list.
207171
*
208-
* Set value of element inside string list.
172+
* Change maximum capacity of string list's size.
209173
*
210-
* Hidden non-leaf function cost:
211-
* - Calls free
212-
* - Calls strdup
174+
* @return true if successful, otherwise false.
213175
**/
214-
void string_list_set(struct string_list *list, unsigned idx,
215-
const char *str);
176+
bool string_list_capacity(struct string_list *list, size_t cap);
216177

217178
struct string_list *string_list_clone(const struct string_list *src);
218179

0 commit comments

Comments
 (0)