-Save pixel ratio in infile

-Fix a bug if a wrong grid xor value was set (was mostly harmless)
-Some cleanup.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1257 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues
2010-01-16 16:31:03 +00:00
parent 70a61a07ef
commit 655116bd37
4 changed files with 25 additions and 5 deletions

View File

@@ -394,13 +394,16 @@ int Load_INI_get_values(FILE * file,char * buffer,char * option_name,int nb_expe
if ( ((++nb_values) == nb_expected_values) &&
(upper_buffer[buffer_index]!='\0') )
{
// Too many values !
free(upper_buffer);
free(option_upper);
return ERROR_INI_CORRUPTED;
}
}
if (nb_values<nb_expected_values)
{
// Not enough values !
free(upper_buffer);
free(option_upper);
return ERROR_INI_CORRUPTED;
@@ -416,7 +419,6 @@ int Load_INI_get_values(FILE * file,char * buffer,char * option_name,int nb_expe
}
int Load_INI(T_Config * conf)
{
FILE * file;
@@ -836,10 +838,16 @@ int Load_INI(T_Config * conf)
// Optional, XOR color for grid overlay (>2.0)
if (!Load_INI_get_values (file,buffer,"Grid_XOR_color",1,values))
{
if ((values[0]>0) || (values[0]<=255))
if ((values[0]>0) && (values[0]<=255))
conf->Grid_XOR_color=values[0];
}
// Optional, "fake hardware zoom" factor (>2.1)
if (!Load_INI_get_values (file, buffer,"Pixel_ratio",1,values))
{
Pixel_ratio = values[0];
}
fclose(file);
free(filename);