src/init.c: bail out if skin_name or font_name is "".

Fixes a crash on AROS

src/filesel.c: fixed BSTR conversion routine for AROS.
Without this fix "RAM DISK" was printed as "AM DISK" in
the file selector.

src/setup.c: removed slash to avoid that paths like
"PROGDIR:/share" are created on AROS. That fix should be right
for all Amiga like OS but I don't want to change things
which I can't test.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1970 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
mazzearos 2012-08-02 09:19:07 +00:00
parent 7613093df9
commit 113d6423b4
3 changed files with 24 additions and 7 deletions

View File

@ -470,16 +470,21 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max )
{
STRPTR iptr;
dword i;
iptr = BADDR( in );
if( max > iptr[0] ) max = iptr[0];
dword len;
#if defined(__AROS__)
for ( i=0 ; i<max ; i++ ) out[i] = *(AROS_BSTR_ADDR(iptr+i));
iptr = AROS_BSTR_ADDR( in );
len = AROS_BSTR_strlen( in );
#else
for( i=0; i<max; i++ ) out[i] = iptr[i+1];
iptr = BADDR( in );
len = iptr[0];
iptr++;
#endif
if( max > len ) max = len;
for( i=0; i<max; i++ , iptr++ ) out[i] = *iptr;
out[i] = 0;
}
#endif

View File

@ -664,6 +664,12 @@ T_Gui_skin * Load_graphics(const char * skin_file, T_Gradient_array *gradients)
char filename[MAX_PATH_CHARACTERS];
SDL_Surface * gui;
if (skin_file[0] == '\0')
{
sprintf(Gui_loading_error_message, "Wrong skin file name \"\"\n");
return NULL;
}
gfx = (T_Gui_skin *)malloc(sizeof(T_Gui_skin));
if (gfx == NULL)
{
@ -744,6 +750,12 @@ byte * Load_font(const char * font_name)
char filename[MAX_PATH_CHARACTERS];
SDL_Surface * image;
if (font_name[0] == '\0')
{
sprintf(Gui_loading_error_message, "Wrong font name \"\"\n");
return NULL;
}
font = (byte *)malloc(8*8*256);
if (font == NULL)
{

View File

@ -134,7 +134,7 @@ void Set_data_directory(const char * program_dir, char * data_dir)
strcpy(data_dir, program_dir);
// All other targets, program is in a "bin" subdirectory
#elif defined (__AROS__)
strcat(data_dir,"/share/grafx2/");
strcat(data_dir,"share/grafx2/");
#else
strcat(data_dir,"../share/grafx2/");
#endif