aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-06-23 18:40:11 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-27 13:41:23 +0200
commitf816a75ca5b357563a4ecf996e95b24ffabd0b54 (patch)
tree65d9a5630c9186c1802850c7f99d70a5dcfd778e
parent4863f82a20559827c131363e193aefcc4964cc23 (diff)
downloadexternal_qemu-f816a75ca5b357563a4ecf996e95b24ffabd0b54.zip
external_qemu-f816a75ca5b357563a4ecf996e95b24ffabd0b54.tar.gz
external_qemu-f816a75ca5b357563a4ecf996e95b24ffabd0b54.tar.bz2
Fix -audio <name> and -no-audio processing.
Turns out that the string passed to putenv() must not be modified :-/ We provide our own win32 implementation for emulator-ui that doesn't embed the os-win32.c QEMU-specific file. Change-Id: I7260fbc37d23a5340dab589dfde577ef5eb10005
-rw-r--r--Makefile.android1
-rw-r--r--android/main-common.c2
-rw-r--r--android/skin/window.c6
-rw-r--r--android/utils/setenv.c18
-rw-r--r--vl-android.c4
5 files changed, 21 insertions, 10 deletions
diff --git a/Makefile.android b/Makefile.android
index 735697c..3b1619b 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -242,6 +242,7 @@ LOCAL_SRC_FILES := \
android/snapshot.c \
android/main-common.c \
android/main.c \
+ android/utils/setenv.c \
vl-android-ui.c \
android/protocol/core-connection.c \
android/protocol/attach-ui-impl.c \
diff --git a/android/main-common.c b/android/main-common.c
index 94accf7..a0e5f56 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -524,7 +524,7 @@ init_sdl_ui(AConfig* skinConfig,
#endif
/* we're not a game, so allow the screensaver to run */
- putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1");
+ setenv("SDL_VIDEO_ALLOW_SCREENSAVER","1",1);
flags = SDL_INIT_NOPARACHUTE;
if (!opts->no_window)
diff --git a/android/skin/window.c b/android/skin/window.c
index c1bf23f..9e29a3f 100644
--- a/android/skin/window.c
+++ b/android/skin/window.c
@@ -1301,15 +1301,9 @@ skin_window_resize( SkinWindow* window )
{
char temp[32];
-#ifdef HAVE_SETENV
sprintf(temp, "%d,%d", window_x, window_y);
setenv("SDL_VIDEO_WINDOW_POS", temp, 1);
setenv("SDL_VIDEO_WINDOW_FORCE_VISIBLE", "1", 1);
-#else
- sprintf(temp,"SDL_VIDEO_WINDOW_POS=%d,%d",window_x,window_y);
- putenv(temp);
- putenv("SDL_VIDEO_WINDOW_FORCE_VISIBLE=1");
-#endif
}
flags = SDL_SWSURFACE;
diff --git a/android/utils/setenv.c b/android/utils/setenv.c
new file mode 100644
index 0000000..916c5f3
--- /dev/null
+++ b/android/utils/setenv.c
@@ -0,0 +1,18 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef _WIN32
+int setenv(const char *name, const char *value, int overwrite)
+{
+ int result = 0;
+ if (overwrite || !getenv(name)) {
+ size_t length = strlen(name) + strlen(value) + 2;
+ char *string = malloc(length);
+ snprintf(string, length, "%s=%s", name, value);
+ result = putenv(string);
+ }
+ return result;
+}
+
+#endif
diff --git a/vl-android.c b/vl-android.c
index 8436d68..32b5eac 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -3721,13 +3721,11 @@ int main(int argc, char **argv, char **envp)
/* Initialize audio. */
if (android_op_audio) {
- char temp[128];
if ( !audio_check_backend_name( 0, android_op_audio ) ) {
PANIC("'%s' is not a valid audio output backend. see -help-audio-out",
android_op_audio);
}
- snprintf(temp, sizeof temp, "QEMU_AUDIO_DRV=%s", android_op_audio);
- putenv(temp);
+ setenv("QEMU_AUDIO_DRV", android_op_audio, 1);
}
/* Initialize OpenGLES emulation */