From 4d5c7a05d13b8b153db9f22a6e68bbf3d44323fa Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 12 Nov 2014 14:32:08 +0100 Subject: [PATCH] (Android) C90 build fixes --- android/phoenix/jni/Android.mk | 2 +- driver.c | 34 +++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/android/phoenix/jni/Android.mk b/android/phoenix/jni/Android.mk index 73bcd6af39..149d5c2f92 100644 --- a/android/phoenix/jni/Android.mk +++ b/android/phoenix/jni/Android.mk @@ -58,7 +58,7 @@ else endif -LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_LAKKA -DHAVE_GLUI -DHAVE_XMB +LOCAL_CFLAGS += -Wall -pthread -Wno-unused-function -fno-stack-protector -funroll-loops -DNDEBUG -DRARCH_MOBILE -DHAVE_GRIFFIN -DANDROID -DHAVE_DYNAMIC -DHAVE_OPENGL -DHAVE_FBO -DHAVE_OVERLAY -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DGLSL_DEBUG -DHAVE_DYLIB -DHAVE_GLSL -DHAVE_MENU -DHAVE_RGUI -DHAVE_ZLIB -DINLINE=inline -DLSB_FIRST -DHAVE_THREADS -D__LIBRETRO__ -DHAVE_RSOUND -DHAVE_NETPLAY -DRARCH_INTERNAL -DHAVE_FILTERS_BUILTIN -DHAVE_LAKKA -DHAVE_GLUI -DHAVE_XMB -std=gnu99 LOCAL_CFLAGS += -DHAVE_7ZIP LOCAL_CFLAGS += -O2 diff --git a/driver.c b/driver.c index e72aa40092..90b0148641 100644 --- a/driver.c +++ b/driver.c @@ -191,22 +191,30 @@ static const input_driver_t *input_drivers[] = { // JM: This is a very painful function to write, especially because // we'll have to do it to all the drivers. -const char* config_get_input_driver_options(void) { +const char* config_get_input_driver_options(void) +{ + char *input_options; + int i; int input_option_k = 0; int input_options_len = 0; - while (input_drivers[input_option_k]) { - const char *opt = input_drivers[input_option_k]->ident; - input_options_len += strlen(opt) + 1; - input_option_k++; + unsigned offset = 0; + + while (input_drivers[input_option_k]) + { + const char *opt = input_drivers[input_option_k]->ident; + input_options_len += strlen(opt) + 1; + input_option_k++; } - uint offset = 0; - char *input_options = (char*)calloc(input_options_len, sizeof(char)); - for (int i = 0; i < input_option_k; i++) { - const char *opt = input_drivers[i]->ident; - strlcpy(input_options + offset, opt, input_options_len - offset); - offset += strlen(opt); - input_options[offset] = '|'; - offset += 1; + + input_options = (char*)calloc(input_options_len, sizeof(char)); + + for (i = 0; i < input_option_k; i++) + { + const char *opt = input_drivers[i]->ident; + strlcpy(input_options + offset, opt, input_options_len - offset); + offset += strlen(opt); + input_options[offset] = '|'; + offset += 1; } input_options[input_options_len] = '\0';