GrafX2: fixed crash in getcwd()

This commit is contained in:
Sergii Pylypenko
2014-03-28 18:02:04 +02:00
parent 7aa34454a8
commit a8f168ecea
3 changed files with 86 additions and 65 deletions

View File

@@ -7,10 +7,10 @@ AppName="grafx2"
AppFullName=com.grafx2
# Application version code (integer)
AppVersionCode=24206704
AppVersionCode=24206705
# Application user-visible version name (string)
AppVersionName="2.4.2067.04"
AppVersionName="2.4.2067.05"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu

View File

@@ -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__)

View File

@@ -25,8 +25,8 @@ rm -f Signed.apk
#DEBUGINFODIR=`aapt dump badging App.apk | grep "package:" | sed "s/.*name=[']\([^']*\)['].*versionCode=[']\([^']*\)['].*/\1-\2/" | tr " '/" '---'`
DEBUGINFODIR=$APPNAME-$APPVER
echo Copying debug info to project/debuginfo/$DEBUGINFODIR
mkdir -p ../debuginfo/$DEBUGINFODIR/armeabi ../debuginfo/$DEBUGINFODIR/armeabi-v7a
cp -f ../obj/local/armeabi/*.so ../debuginfo/$DEBUGINFODIR/armeabi
mkdir -p ../debuginfo/$DEBUGINFODIR/x86 ../debuginfo/$DEBUGINFODIR/armeabi-v7a
cp -f ../obj/local/x86/*.so ../debuginfo/$DEBUGINFODIR/x86
cp -f ../obj/local/armeabi-v7a/*.so ../debuginfo/$DEBUGINFODIR/armeabi-v7a
cp -f MainActivity-debug.apk ../debuginfo/$DEBUGINFODIR/$APPNAME-$APPVER.apk
cp -f MainActivity-debug.apk ../../$APPNAME-$APPVER.apk