aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-10-19 08:07:11 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-10-19 08:33:48 +0200
commit18fe86e8245878f3b7a2813bd59b8cfcf636e15c (patch)
tree16ecfe8a8665aec212abdd3f2fcd1e122635358b /android
parent6b512811e01d7c81348bfa9c29c21f788ccc0a8e (diff)
downloadexternal_qemu-18fe86e8245878f3b7a2813bd59b8cfcf636e15c.zip
external_qemu-18fe86e8245878f3b7a2813bd59b8cfcf636e15c.tar.gz
external_qemu-18fe86e8245878f3b7a2813bd59b8cfcf636e15c.tar.bz2
emulator-ui: Remove dependencies from qemu sources.
This change removes some QEMU-specifics that crept into the UI code. Change-Id: Ib1974dc64e54a35dc0cd01aec1eb547a9263a0c8
Diffstat (limited to 'android')
-rw-r--r--android/charmap.c27
-rw-r--r--android/display.c3
-rw-r--r--android/main.c12
-rw-r--r--android/skin/window.c12
-rw-r--r--android/utils/dirscanner.c7
-rw-r--r--android/utils/system.c2
-rw-r--r--android/utils/timezone.c4
7 files changed, 33 insertions, 34 deletions
diff --git a/android/charmap.c b/android/charmap.c
index 1d200e6..81c866a 100644
--- a/android/charmap.c
+++ b/android/charmap.c
@@ -9,11 +9,13 @@
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
*/
-#include "qemu-common.h"
#include "android/utils/path.h"
#include "android/utils/misc.h"
#include "android/utils/debug.h"
+#include "android/utils/system.h"
#include "android/charmap.h"
+#include <stdio.h>
+#include <errno.h>
/* Parses .kcm file producing key characters map.
* .kcm file parsed by this module is expected to contain 4 types of
@@ -636,7 +638,7 @@ parse_kcm_file(const char* kcm_file_path, AKeyCharmap* char_map) {
// Preallocate map.
char_map->num_entries = 0;
- char_map->entries = qemu_malloc(sizeof(AKeyEntry) * map_size);
+ AARRAY_NEW0(char_map->entries, map_size);
// Line by line parse the file.
for (; 0 != fgets(line, sizeof(line), kcm_file); cur_line++) {
@@ -651,13 +653,10 @@ parse_kcm_file(const char* kcm_file_path, AKeyCharmap* char_map) {
// Key information has been extracted. Add it to the map.
// Lets see if we need to reallocate map.
if (map_size == char_map->num_entries) {
- void* new_map;
+ AKeyEntry* entries = (AKeyEntry*)char_map->entries;
map_size += 10;
- new_map = qemu_malloc(sizeof(AKeyEntry) * map_size);
- memcpy(new_map, char_map->entries,
- char_map->num_entries * sizeof(AKeyEntry));
- qemu_free((void*)char_map->entries);
- char_map->entries = new_map;
+ AARRAY_RENEW(entries, map_size);
+ char_map->entries = (const AKeyEntry*)entries;
}
entries = (AKeyEntry*)char_map->entries;
entries[char_map->num_entries] = key_entry;
@@ -682,7 +681,7 @@ parse_kcm_file(const char* kcm_file_path, AKeyCharmap* char_map) {
if (err) {
// Cleanup on failure.
if (0 != char_map->entries) {
- qemu_free((void*)char_map->entries);
+ AFREE((void*)char_map->entries);
char_map->entries = 0;
}
char_map->num_entries = 0;
@@ -704,8 +703,7 @@ android_charmap_setup(const char* kcm_file_path) {
if (!parse_kcm_file(kcm_file_path, &android_custom_charmap)) {
// Here we have two default charmaps and the custom one.
android_charmap_count = 3;
- android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
- android_charmap_count);
+ AARRAY_NEW(android_charmaps, android_charmap_count);
android_charmaps[0] = &android_custom_charmap;
android_charmaps[1] = &_qwerty_charmap;
android_charmaps[2] = &_qwerty2_charmap;
@@ -716,8 +714,7 @@ android_charmap_setup(const char* kcm_file_path) {
} else {
// Here we have only two default charmaps.
android_charmap_count = 2;
- android_charmaps = qemu_malloc(sizeof(AKeyCharmap*) *
- android_charmap_count);
+ AARRAY_NEW(android_charmaps, android_charmap_count);
android_charmaps[0] = &_qwerty_charmap;
android_charmaps[1] = &_qwerty2_charmap;
}
@@ -734,10 +731,10 @@ android_charmap_done(void) {
// static entries defined in charmap.c
if ((_qwerty_charmap.entries != android_charmaps[n]->entries) &&
(_qwerty2_charmap.entries != android_charmaps[n]->entries)) {
- qemu_free((void*)android_charmaps[n]->entries);
+ AFREE((void*)android_charmaps[n]->entries);
}
}
- qemu_free(android_charmaps);
+ AFREE(android_charmaps);
}
}
diff --git a/android/display.c b/android/display.c
index 0cfd98d..d7c261a 100644
--- a/android/display.c
+++ b/android/display.c
@@ -15,6 +15,7 @@
* is supposed to do.
*/
#include "android/display.h"
+#include "android/utils/system.h"
/*
@@ -92,7 +93,7 @@ void android_display_init(DisplayState* ds, QFrameBuffer* qf)
qf->pixels);
/* Register a change listener for it */
- dcl = (DisplayChangeListener *) qemu_mallocz(sizeof(DisplayChangeListener));
+ ANEW0(dcl);
dcl->dpy_update = android_display_update;
dcl->dpy_resize = android_display_resize;
dcl->dpy_refresh = android_display_refresh;
diff --git a/android/main.c b/android/main.c
index c5dc899..b88fb5e 100644
--- a/android/main.c
+++ b/android/main.c
@@ -657,7 +657,7 @@ _getSdkImagePath( const char* fileName )
FOUND_IT:
//D("image auto-detection: %s/%s", temp, fileName);
- return qemu_strdup(temp);
+ return android_strdup(temp);
}
static char*
@@ -670,7 +670,7 @@ _getSdkImage( const char* path, const char* file )
if (p >= end || !path_exists(temp))
return NULL;
- return qemu_strdup(temp);
+ return android_strdup(temp);
}
static char*
@@ -968,7 +968,7 @@ int main(int argc, char **argv)
/* if no data directory is specified, use the system directory */
if (!opts->datadir) {
- opts->datadir = qemu_strdup(opts->sysdir);
+ opts->datadir = android_strdup(opts->sysdir);
dataDirIsSystem = 1;
D("autoconfig: -datadir %s", opts->sysdir);
}
@@ -987,14 +987,14 @@ int main(int argc, char **argv)
exit(2);
}
- opts->data = qemu_strdup(tmp);
+ opts->data = android_strdup(tmp);
D("autoconfig: -data %s", opts->data);
}
if (!opts->sdcard && opts->datadir) {
bufprint(tmp, tmpend, "%s/sdcard.img", opts->datadir);
if (path_exists(tmp)) {
- opts->sdcard = qemu_strdup(tmp);
+ opts->sdcard = android_strdup(tmp);
D("autoconfig: -sdcard %s", opts->sdcard);
}
}
@@ -1466,7 +1466,7 @@ int main(int argc, char **argv)
}
if (!opts->memory) {
bufprint(tmp, tmpend, "%d", hw->hw_ramSize);
- opts->memory = qemu_strdup(tmp);
+ opts->memory = android_strdup(tmp);
}
if (opts->trace) {
diff --git a/android/skin/window.c b/android/skin/window.c
index 9aa7ec9..b1d98af 100644
--- a/android/skin/window.c
+++ b/android/skin/window.c
@@ -722,13 +722,13 @@ layout_done( Layout* layout )
for (nn = 0; nn < layout->num_displays; nn++)
display_done( &layout->displays[nn] );
- qemu_free( layout->buttons );
+ AFREE( layout->buttons );
layout->buttons = NULL;
- qemu_free( layout->backgrounds );
+ AFREE( layout->backgrounds );
layout->backgrounds = NULL;
- qemu_free( layout->displays );
+ AFREE( layout->displays );
layout->displays = NULL;
layout->num_buttons = 0;
@@ -1100,7 +1100,7 @@ skin_window_resize( SkinWindow* window )
}
if (window->shrink_pixels) {
- qemu_free(window->shrink_pixels);
+ AFREE(window->shrink_pixels);
window->shrink_pixels = NULL;
}
@@ -1267,7 +1267,7 @@ skin_window_free ( SkinWindow* window )
window->shrink_surface = NULL;
}
if (window->shrink_pixels) {
- qemu_free(window->shrink_pixels);
+ AFREE(window->shrink_pixels);
window->shrink_pixels = NULL;
}
if (window->onion) {
@@ -1279,7 +1279,7 @@ skin_window_free ( SkinWindow* window )
window->scaler = NULL;
}
layout_done( &window->layout );
- qemu_free(window);
+ AFREE(window);
}
}
diff --git a/android/utils/dirscanner.c b/android/utils/dirscanner.c
index fc63ef0..9c6a39c 100644
--- a/android/utils/dirscanner.c
+++ b/android/utils/dirscanner.c
@@ -11,7 +11,8 @@
*/
#include "android/utils/dirscanner.h"
#include "android/utils/bufprint.h"
-#include "qemu-common.h"
+#include "android/utils/system.h"
+#include "android/utils/path.h"
#include <stddef.h>
#define DIRSCANNER_BASE \
@@ -149,7 +150,7 @@ dirScanner_next( DirScanner* s )
DirScanner*
dirScanner_new ( const char* rootPath )
{
- DirScanner* s = qemu_mallocz(sizeof *s);
+ DirScanner* s = android_alloc0(sizeof *s);
char* p = s->root;
char* end = p + sizeof s->root;
@@ -177,7 +178,7 @@ dirScanner_free( DirScanner* s )
return;
_dirScanner_done(s);
- qemu_free(s);
+ AFREE(s);
}
diff --git a/android/utils/system.c b/android/utils/system.c
index e09fd6b..8443877 100644
--- a/android/utils/system.c
+++ b/android/utils/system.c
@@ -122,7 +122,7 @@ win32_strsep(char** pline, const char* delim)
q++;
}
}
-Exit:
+Exit:
*pline = p;
return line;
}
diff --git a/android/utils/timezone.c b/android/utils/timezone.c
index f4b78db..2707e2e 100644
--- a/android/utils/timezone.c
+++ b/android/utils/timezone.c
@@ -131,7 +131,7 @@ get_zoneinfo_timezone( void )
return NULL;
}
}
- pstrcpy( android_timezone0, sizeof(android_timezone0), tz );
+ snprintf(android_timezone0, sizeof(android_timezone0), "%s", tz );
android_timezone = android_timezone0;
}
D( "found timezone %s", android_timezone );
@@ -402,7 +402,7 @@ get_zoneinfo_timezone( void )
if (tz == NULL)
return NULL;
- pstrcpy( android_timezone0, sizeof(android_timezone0), tz );
+ snprintf(android_timezone0, sizeof(android_timezone0), "%s", tz);
android_timezone = android_timezone0;
}
D( "found timezone %s\n", android_timezone );