Patch 2185448 by riccardom that checks fopen return
value for gtk(-glade) ports.
This commit is contained in:
parent
40880f8be1
commit
e92f677719
|
@ -66,6 +66,8 @@ int WriteBMP(const char *filename,u16 *bmp){
|
||||||
imageheader.height = 192*2;
|
imageheader.height = 192*2;
|
||||||
|
|
||||||
FILE *fichier = fopen(filename,"wb");
|
FILE *fichier = fopen(filename,"wb");
|
||||||
|
if (!fichier)
|
||||||
|
return 0;
|
||||||
//fwrite(&fileheader, 1, 14, fichier);
|
//fwrite(&fileheader, 1, 14, fichier);
|
||||||
|
|
||||||
//fwrite(&imageheader, 1, 40, fichier);
|
//fwrite(&imageheader, 1, 40, fichier);
|
||||||
|
|
|
@ -23,11 +23,16 @@
|
||||||
gboolean g_file_set_contents(const gchar * filename, const gchar * contents, gssize len, GError ** error) {
|
gboolean g_file_set_contents(const gchar * filename, const gchar * contents, gssize len, GError ** error) {
|
||||||
FILE * file = fopen(filename, "w");
|
FILE * file = fopen(filename, "w");
|
||||||
|
|
||||||
|
if (!file)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
fprintf(file, "%s", contents);
|
fprintf(file, "%s", contents);
|
||||||
else
|
else
|
||||||
fwrite(contents, 1, len, file);
|
fwrite(contents, 1, len, file);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -293,6 +293,7 @@ static int Write_ConfigFile()
|
||||||
int i;
|
int i;
|
||||||
GKeyFile * keyfile;
|
GKeyFile * keyfile;
|
||||||
gchar *contents;
|
gchar *contents;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
keyfile = g_key_file_new();
|
keyfile = g_key_file_new();
|
||||||
|
|
||||||
|
@ -307,7 +308,9 @@ static int Write_ConfigFile()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
contents = g_key_file_to_data(keyfile, 0, 0);
|
contents = g_key_file_to_data(keyfile, 0, 0);
|
||||||
g_file_set_contents(CONFIG_FILE, contents, -1, 0);
|
ret = g_file_set_contents(CONFIG_FILE, contents, -1, NULL);
|
||||||
|
if (!ret)
|
||||||
|
fprintf(stderr, "Failed to write to %s\n", CONFIG_FILE);
|
||||||
g_free (contents);
|
g_free (contents);
|
||||||
|
|
||||||
g_key_file_free(keyfile);
|
g_key_file_free(keyfile);
|
||||||
|
@ -1190,6 +1193,8 @@ static int WriteBMP(const char *filename,u16 *bmp)
|
||||||
imageheader.height = 192*2;
|
imageheader.height = 192*2;
|
||||||
|
|
||||||
FILE *fichier = fopen(filename,"wb");
|
FILE *fichier = fopen(filename,"wb");
|
||||||
|
if (!fichier)
|
||||||
|
return 0;
|
||||||
//fwrite(&fileheader, 1, 14, fichier);
|
//fwrite(&fileheader, 1, 14, fichier);
|
||||||
|
|
||||||
//fwrite(&imageheader, 1, 40, fichier);
|
//fwrite(&imageheader, 1, 40, fichier);
|
||||||
|
|
Loading…
Reference in New Issue