Make sure that we save only to files with extension pnm (and similar). Patch

from Gerard Klaver <gerard@gkall.hobby.nl>, bug #300239.
merge-requests/2/head
Henning Geinitz 2003-09-30 15:37:12 +00:00
rodzic 7a730d7419
commit 7c21720af4
2 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2003-09-30 Henning Meier-Geinitz <henning@meier-geinitz.de>
* src/xscanimage.c: Make sure that we save only to files with
extension pnm (and similar). Patch from Gerard Klaver
<gerard@gkall.hobby.nl>, bug #300239.
2003-09-24 Henning Meier-Geinitz <henning@meier-geinitz.de>
* README doc/scanadf.man: Changed links to

Wyświetl plik

@ -1206,9 +1206,28 @@ static void
scan_dialog (GtkWidget * widget, gpointer call_data)
{
char buf[256];
char testfilename[256];
if (scan_win.mode == STANDALONE)
{ /* We are running in standalone mode */
/* test for pnm formats*/
strncpy (testfilename, preferences.filename, sizeof (testfilename));
testfilename [sizeof (testfilename)] = 0;
g_strreverse (testfilename);
if (! ((!strncmp(testfilename,"mnp.",4)) ||
(!strncmp(testfilename,"mgp.",4)) ||
(!strncmp(testfilename,"mbp.",4)) ||
(!strncmp(testfilename,"mpp.",4)) ||
(!strncmp(testfilename,"MNP.",4)) ||
(!strncmp(testfilename,"MGP.",4)) ||
(!strncmp(testfilename,"MBP.",4)) ||
(!strncmp(testfilename,"MPP.",4)) ))
{
snprintf (buf, sizeof (buf), "Failed to scan, wrong file extension, use pnm, pgm, pbm or ppm `%s'",
preferences.filename);
gsg_error (buf);
return;
}
scan_win.out = fopen (preferences.filename, "w");
if (!scan_win.out)
{