Skip to content

Commit

Permalink
libretro, update common
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Dec 11, 2024
1 parent b0be121 commit bc48697
Show file tree
Hide file tree
Showing 29 changed files with 8,196 additions and 3,200 deletions.
7 changes: 0 additions & 7 deletions platform/libretro/libretro-common/compat/compat_strl.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,3 @@ size_t strlcat(char *dest, const char *source, size_t size)
return len + strlcpy(dest, source, size);
}
#endif

char *strldup(const char *s, size_t n)
{
char *dst = (char*)malloc(sizeof(char) * (n + 1));
strlcpy(dst, s, n);
return dst;
}
31 changes: 16 additions & 15 deletions platform/libretro/libretro-common/compat/fopen_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@
void *fopen_utf8(const char * filename, const char * mode)
{
#if defined(LEGACY_WIN32)
FILE *ret = NULL;
char * filename_local = utf8_to_local_string_alloc(filename);

if (!filename_local)
return NULL;
ret = fopen(filename_local, mode);
if (filename_local)
{
FILE *ret = fopen(filename_local, mode);
free(filename_local);
return ret;
return ret;
}
#else
wchar_t * filename_w = utf8_to_utf16_string_alloc(filename);
wchar_t * mode_w = utf8_to_utf16_string_alloc(mode);
FILE* ret = NULL;

if (filename_w && mode_w)
ret = _wfopen(filename_w, mode_w);
wchar_t * filename_w = utf8_to_utf16_string_alloc(filename);
if (filename_w)
{
FILE *ret = NULL;
wchar_t *mode_w = utf8_to_utf16_string_alloc(mode);
if (mode_w)
{
ret = _wfopen(filename_w, mode_w);
free(mode_w);
}
free(filename_w);
if (mode_w)
free(mode_w);
return ret;
return ret;
}
#endif
return NULL;
}
#endif
Loading

0 comments on commit bc48697

Please sign in to comment.