Skip to content

Commit

Permalink
Revert "Updated to current libretro-common (#269)" (#271)
Browse files Browse the repository at this point in the history
This reverts commit 9481e11.
  • Loading branch information
LibretroAdmin authored Jun 29, 2024
1 parent fe131fb commit 5d47507
Show file tree
Hide file tree
Showing 19 changed files with 1,194 additions and 2,234 deletions.
7 changes: 7 additions & 0 deletions libgambatte/libretro-common/compat/compat_strl.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ 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: 15 additions & 16 deletions libgambatte/libretro-common/compat/fopen_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,27 @@
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 * 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);
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);
return ret;
}
if (mode_w)
free(mode_w);
return ret;
#endif
return NULL;
}
#endif
Loading

0 comments on commit 5d47507

Please sign in to comment.