Fix unchecked retval warnings

pull/2/head
Stelios Bounanos 2008-02-02 23:16:13 +00:00
rodzic c3d55a6ce1
commit ead061ffd9
2 zmienionych plików z 15 dodań i 3 usunięć

Wyświetl plik

@ -226,8 +226,13 @@ void QRZ::OpenQRZFiles( const char *fname )
}
memset( index, 0, idxsize );
fread( &idxhdr.dataname, 1, 48, idxfile );
fread( index, 1, idxsize, idxfile ) ;
if (fread( &idxhdr.dataname, 1, 48, idxfile ) != 1 ||
fread( index, 1, idxsize, idxfile ) != 1) {
fclose( idxfile );
free( index );
QRZvalid = 0;
return;
}
fflush( stdout );

Wyświetl plik

@ -62,7 +62,14 @@ void loadPalette()
if (!p) return;
if ((clrfile = fopen(p, "r")) != NULL) {
for (int i = 0; i < 9; i++) {
fscanf(clrfile, "%d;%d;%d\n", &r, &g, &b);
if (fscanf(clrfile, "%d;%d;%d\n", &r, &g, &b) == EOF) {
if (ferror(clrfile))
perror("fscanf");
else
cerr << p << ": unexpected EOF\n";
fclose(clrfile);
return;
}
palette[i].R = r;
palette[i].G = g;
palette[i].B = b;