GrafX2: fixed crash in getcwd()
This commit is contained in:
@@ -14,67 +14,6 @@ Index: src/text.c
|
||||
if (!text_surface)
|
||||
{
|
||||
TTF_CloseFont(font);
|
||||
Index: src/mountlist.c
|
||||
===================================================================
|
||||
--- src/mountlist.c (revision 2067)
|
||||
+++ src/mountlist.c (working copy)
|
||||
@@ -41,7 +41,7 @@
|
||||
#define MOUNTED_GETFSSTAT 1
|
||||
#define HAVE_SYS_MOUNT_H 1
|
||||
#include <sys/types.h>
|
||||
-#elif defined(__SKYOS__)
|
||||
+#elif defined(__SKYOS__)||defined(__ANDROID__)
|
||||
#warning "Your platform is missing some specific code here ! please check and fix :)"
|
||||
#else
|
||||
#define MOUNTED_GETMNTENT1
|
||||
Index: src/io.c
|
||||
===================================================================
|
||||
--- src/io.c (revision 2067)
|
||||
+++ src/io.c (working copy)
|
||||
@@ -455,7 +455,7 @@
|
||||
|
||||
byte Create_lock_file(const char *file_directory)
|
||||
{
|
||||
- #if defined (__amigaos__)||(__AROS__)
|
||||
+ #if defined (__amigaos__)||(__AROS__)||(__ANDROID__)
|
||||
#warning "Missing code for your platform, please check and correct!"
|
||||
#else
|
||||
char lock_filename[MAX_PATH_CHARACTERS];
|
||||
Index: src/setup.c
|
||||
===================================================================
|
||||
--- src/setup.c (revision 2067)
|
||||
+++ src/setup.c (working copy)
|
||||
@@ -93,6 +93,8 @@
|
||||
// Append trailing slash
|
||||
strcat(program_dir,PATH_SEPARATOR);
|
||||
// Linux: argv[0] unreliable
|
||||
+ #elif defined(__ANDROID__)
|
||||
+ strcpy(program_dir, "./");
|
||||
#elif defined(__linux__)
|
||||
if (argv0[0]!='/')
|
||||
{
|
||||
@@ -122,7 +124,7 @@
|
||||
#if defined(__macosx__)
|
||||
strcat(data_dir,"Contents/Resources/");
|
||||
// On GP2X, executable is not in bin/
|
||||
- #elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__)
|
||||
+ #elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) || defined(__ANDROID__)
|
||||
strcat(data_dir,"share/grafx2/");
|
||||
//on tos the same directory
|
||||
#elif defined (__MINT__)
|
||||
Index: src/sdlscreen.c
|
||||
===================================================================
|
||||
--- src/sdlscreen.c (revision 2067)
|
||||
+++ src/sdlscreen.c (working copy)
|
||||
@@ -54,6 +54,8 @@
|
||||
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||
#elif defined(__MINT__)
|
||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||
+ #elif defined(__ANDROID__)
|
||||
+ #define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||
#else
|
||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||
#endif
|
||||
Index: src/readline.c
|
||||
===================================================================
|
||||
--- src/readline.c (revision 2067)
|
||||
@@ -109,3 +48,85 @@ Index: src/readline.c
|
||||
// Effacement de la chaîne
|
||||
Block(window_x+(x_pos*Menu_factor_X),window_y+(y_pos*Menu_factor_Y),
|
||||
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3),BACKGROUND_COLOR);
|
||||
Index: src/io.c
|
||||
===================================================================
|
||||
--- src/io.c (revision 2067)
|
||||
+++ src/io.c (working copy)
|
||||
@@ -455,7 +455,7 @@
|
||||
|
||||
byte Create_lock_file(const char *file_directory)
|
||||
{
|
||||
- #if defined (__amigaos__)||(__AROS__)
|
||||
+ #if defined (__amigaos__)||(__AROS__)||(__ANDROID__)
|
||||
#warning "Missing code for your platform, please check and correct!"
|
||||
#else
|
||||
char lock_filename[MAX_PATH_CHARACTERS];
|
||||
Index: src/sdlscreen.c
|
||||
===================================================================
|
||||
--- src/sdlscreen.c (revision 2067)
|
||||
+++ src/sdlscreen.c (working copy)
|
||||
@@ -54,6 +54,8 @@
|
||||
#define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||
#elif defined(__MINT__)
|
||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||
+ #elif defined(__ANDROID__)
|
||||
+ #define UPDATE_METHOD UPDATE_METHOD_FULL_PAGE
|
||||
#else
|
||||
#define UPDATE_METHOD UPDATE_METHOD_CUMULATED
|
||||
#endif
|
||||
Index: src/filesel.c
|
||||
===================================================================
|
||||
--- src/filesel.c (revision 2067)
|
||||
+++ src/filesel.c (working copy)
|
||||
@@ -360,6 +360,7 @@
|
||||
char * filter = "*"; // Extension demandée
|
||||
struct stat Infos_enreg;
|
||||
char * current_path;
|
||||
+ char curdir[PATH_MAX];
|
||||
#if defined (__MINT__)
|
||||
char path[1024]={0};
|
||||
char path2[1024]={0};
|
||||
@@ -389,7 +390,7 @@
|
||||
strcat(path2,PATH_SEPARATOR);
|
||||
current_directory=opendir(path2);
|
||||
#else
|
||||
- current_path=getcwd(NULL,0);
|
||||
+ current_path=getcwd(curdir,sizeof(curdir));
|
||||
current_directory=opendir(current_path);
|
||||
#endif
|
||||
while ((entry=readdir(current_directory)))
|
||||
Index: src/mountlist.c
|
||||
===================================================================
|
||||
--- src/mountlist.c (revision 2067)
|
||||
+++ src/mountlist.c (working copy)
|
||||
@@ -41,7 +41,7 @@
|
||||
#define MOUNTED_GETFSSTAT 1
|
||||
#define HAVE_SYS_MOUNT_H 1
|
||||
#include <sys/types.h>
|
||||
-#elif defined(__SKYOS__)
|
||||
+#elif defined(__SKYOS__)||defined(__ANDROID__)
|
||||
#warning "Your platform is missing some specific code here ! please check and fix :)"
|
||||
#else
|
||||
#define MOUNTED_GETMNTENT1
|
||||
Index: src/setup.c
|
||||
===================================================================
|
||||
--- src/setup.c (revision 2067)
|
||||
+++ src/setup.c (working copy)
|
||||
@@ -93,6 +93,8 @@
|
||||
// Append trailing slash
|
||||
strcat(program_dir,PATH_SEPARATOR);
|
||||
// Linux: argv[0] unreliable
|
||||
+ #elif defined(__ANDROID__)
|
||||
+ strcpy(program_dir, "./");
|
||||
#elif defined(__linux__)
|
||||
if (argv0[0]!='/')
|
||||
{
|
||||
@@ -122,7 +124,7 @@
|
||||
#if defined(__macosx__)
|
||||
strcat(data_dir,"Contents/Resources/");
|
||||
// On GP2X, executable is not in bin/
|
||||
- #elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__)
|
||||
+ #elif defined (__GP2X__) || defined (__gp2x__) || defined (__WIZ__) || defined (__CAANOO__) || defined(__ANDROID__)
|
||||
strcat(data_dir,"share/grafx2/");
|
||||
//on tos the same directory
|
||||
#elif defined (__MINT__)
|
||||
|
||||
Reference in New Issue
Block a user