Fix an issue with files since the adding of xpm saving

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1706 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2011-01-30 19:35:29 +00:00
parent 7150a1ebcd
commit 5a8972d0f9
3 changed files with 16 additions and 13 deletions

View File

@@ -139,7 +139,7 @@ void Save_PNG(T_IO_Context *);
void Load_SDL_Image(T_IO_Context *);
// ENUM Name TestFunc LoadFunc SaveFunc PalOnly Comment Layers Ext Exts
T_Format File_formats[NB_KNOWN_FORMATS] = {
T_Format File_formats[] = {
{FORMAT_ALL_IMAGES, "(all)", NULL, NULL, NULL, 0, 0, 0, "", "gif;png;bmp;pcx;pkm;lbm;ilbm;iff;img;sci;scq;scf;scn;sco;pi1;pc1;cel;neo;kcf;pal;c64;koa;tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico"},
{FORMAT_ALL_FILES, "(*.*)", NULL, NULL, NULL, 0, 0, 0, "", "*"},
{FORMAT_GIF, " gif", Test_GIF, Load_GIF, Save_GIF, 0, 1, 1, "gif", "gif"},
@@ -164,6 +164,12 @@ T_Format File_formats[NB_KNOWN_FORMATS] = {
{FORMAT_MISC,"misc.",NULL, NULL, NULL, 0, 0, 0, "", "tga;pnm;xpm;xcf;jpg;jpeg;tif;tiff;ico"},
};
/// Total number of known file formats
unsigned int Nb_known_formats(void)
{
return sizeof(File_formats)/sizeof(File_formats[0]);
}
/// Set the color of a pixel (on load)
void Set_pixel(T_IO_Context *context, short x_pos, short y_pos, byte color)
{
@@ -567,7 +573,7 @@ void Load_image(T_IO_Context *context)
{
// Sinon, on va devoir scanner les différents formats qu'on connait pour
// savoir à quel format est le fichier:
for (index=0; index < NB_KNOWN_FORMATS; index++)
for (index=0; index < Nb_known_formats(); index++)
{
format = Get_fileformat(index);
// Loadable format
@@ -1089,7 +1095,7 @@ T_Format * Get_fileformat(byte format)
unsigned int i;
T_Format * safe_default = File_formats;
for (i=0; i < NB_KNOWN_FORMATS; i++)
for (i=0; i < Nb_known_formats(); i++)
{
if (File_formats[i].Identifier == format)
return &(File_formats[i]);