From 8c6c2e80714ac4d14541d0bbdcb3e8ae53eddcce Mon Sep 17 00:00:00 2001 From: matthias gatto Date: Thu, 11 Oct 2018 23:22:21 +0200 Subject: [PATCH 1/4] threads: fix implicit declaration of memset --- desmume/src/libretro-common/rthreads/rthreads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/desmume/src/libretro-common/rthreads/rthreads.c b/desmume/src/libretro-common/rthreads/rthreads.c index e94208ed1..c3f03ca09 100644 --- a/desmume/src/libretro-common/rthreads/rthreads.c +++ b/desmume/src/libretro-common/rthreads/rthreads.c @@ -25,6 +25,7 @@ #endif #include +#include #include #include From 50755c6a458f3e888417360f0c9d7b4a192bfb63 Mon Sep 17 00:00:00 2001 From: matthias gatto Date: Thu, 11 Oct 2018 23:56:27 +0200 Subject: [PATCH 2/4] ROMReader: fix specified bound depends on the length of the source argument It seems gcc have a (new ?) warning that doesn't allow *ncpy functions to have any source length related value as len argument. I've use strdunp to fix this, but I guess there is some other solutions that doesn't require free. use c++ strings ? use strcpy(...); tmp1[strlen(filename) - 4] = 0; ... ? remove the warning in the Makefile ? but as the strdump solution is simple enouth I've keep this. --- desmume/src/ROMReader.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/desmume/src/ROMReader.cpp b/desmume/src/ROMReader.cpp index 4e7a6a806..57e181fb9 100644 --- a/desmume/src/ROMReader.cpp +++ b/desmume/src/ROMReader.cpp @@ -238,12 +238,13 @@ void * ZIPROMReaderInit(const char * filename) ZZIP_DIRENT * dirent = zzip_readdir(dir); if (dir != NULL) { - char tmp1[1024]; + char *tmp1; char tmp2[1024]; - memset(tmp1,0,sizeof(tmp1)); + memset(tmp2,0,sizeof(tmp2)); - strncpy(tmp1, filename, strlen(filename) - 4); + tmp1 = strndup(filename, strlen(filename) - 4); sprintf(tmp2, "%s/%s", tmp1, dirent->d_name); + free(tmp1); return zzip_fopen(tmp2, "rb"); } return NULL; From bf3e1b1cf338e2e276a91840757e9bc194417504 Mon Sep 17 00:00:00 2001 From: matthias gatto Date: Thu, 11 Oct 2018 23:57:30 +0200 Subject: [PATCH 3/4] posix: fix deprecated warning about g_thread_init problems with the old if, is that the code still compiled(but optimised out) as g_thread_supported is a macro, #if work well enouth and doesn't generate warning --- desmume/src/frontend/posix/cli/main.cpp | 4 ++-- desmume/src/frontend/posix/gtk-glade/main.cpp | 5 +++-- desmume/src/frontend/posix/gtk/main.cpp | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/desmume/src/frontend/posix/cli/main.cpp b/desmume/src/frontend/posix/cli/main.cpp index fee0b4253..a8edd3a1f 100644 --- a/desmume/src/frontend/posix/cli/main.cpp +++ b/desmume/src/frontend/posix/cli/main.cpp @@ -574,9 +574,9 @@ int main(int argc, char ** argv) { slot2_Init(); slot2_Change((NDS_SLOT2_TYPE)slot2_device_type); - if ( !g_thread_supported()) { +#if !g_thread_supported() g_thread_init( NULL); - } +#endif driver = new BaseDriver(); diff --git a/desmume/src/frontend/posix/gtk-glade/main.cpp b/desmume/src/frontend/posix/gtk-glade/main.cpp index 623b1a246..aa5667644 100755 --- a/desmume/src/frontend/posix/gtk-glade/main.cpp +++ b/desmume/src/frontend/posix/gtk-glade/main.cpp @@ -539,8 +539,9 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Warning: X11 not thread-safe\n"); } - if (!g_thread_supported()) - g_thread_init( NULL); +#if !g_thread_supported() + g_thread_init( NULL); +#endif gtk_init(&argc, &argv); diff --git a/desmume/src/frontend/posix/gtk/main.cpp b/desmume/src/frontend/posix/gtk/main.cpp index 0b8ba7d0f..9dcbd494a 100644 --- a/desmume/src/frontend/posix/gtk/main.cpp +++ b/desmume/src/frontend/posix/gtk/main.cpp @@ -3511,8 +3511,9 @@ int main (int argc, char *argv[]) fprintf(stderr, "Warning: X11 not thread-safe\n"); } - if (!g_thread_supported()) +#if !g_thread_supported() g_thread_init( NULL); +#endif gtk_init(&argc, &argv); From 2dfc7866d06f5c2bd426103d5d3889f6cf855baa Mon Sep 17 00:00:00 2001 From: matthias gatto Date: Sun, 14 Oct 2018 17:50:53 +0200 Subject: [PATCH 4/4] dlditool: fix redefinition of VERSION --- desmume/src/utils/dlditool.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desmume/src/utils/dlditool.cpp b/desmume/src/utils/dlditool.cpp index c3570b767..9d4b48686 100644 --- a/desmume/src/utils/dlditool.cpp +++ b/desmume/src/utils/dlditool.cpp @@ -51,7 +51,9 @@ * v1.00 - 2006-12-25 - Chishm * Original release */ +#ifndef VERSION #define VERSION "v1.24" +#endif #include #include