Clean up a couple return value checks.

This commit is contained in:
Justin Maggard 2014-04-07 14:20:50 -07:00
parent 27eae53584
commit bc43d45964
4 changed files with 8 additions and 8 deletions

View File

@ -236,7 +236,7 @@ _aac_check_extended_descriptor(FILE *infile)
short int i; short int i;
unsigned char buf[3]; unsigned char buf[3];
if( !fread((void *)&buf, 3, 1, infile) ) if( fread((void *)&buf, 1, 3, infile) < 3 )
return -1; return -1;
for( i=0; i<3; i++ ) for( i=0; i<3; i++ )
{ {
@ -286,8 +286,8 @@ _get_aacfileinfo(char *file, struct song_metadata *psong)
if(atom_offset != -1) if(atom_offset != -1)
{ {
fseek(infile, 12, SEEK_CUR); fseek(infile, 12, SEEK_CUR);
if(!fread((void*)&sample_size, 1, sizeof(int), infile) || if(fread((void*)&sample_size, 1, sizeof(int), infile) != sizeof(int) ||
!fread((void*)&samples, 1, sizeof(int), infile)) fread((void*)&samples, 1, sizeof(int), infile) != sizeof(int))
{ {
fclose(infile); fclose(infile);
return -1; return -1;

View File

@ -92,7 +92,7 @@ fget_byte(FILE *fp)
{ {
uint8_t d; uint8_t d;
if (!fread(&d, sizeof(d), 1, fp)) if (fread(&d, sizeof(d), 1, fp) != 1)
return 0; return 0;
return d; return d;
} }
@ -102,7 +102,7 @@ fget_le16(FILE *fp)
{ {
uint16_t d; uint16_t d;
if (!fread(&d, sizeof(d), 1, fp)) if (fread(&d, sizeof(d), 1, fp) != 1)
return 0; return 0;
d = le16_to_cpu(d); d = le16_to_cpu(d);
return d; return d;
@ -113,7 +113,7 @@ fget_le32(FILE *fp)
{ {
uint32_t d; uint32_t d;
if (!fread(&d, sizeof(d), 1, fp)) if (fread(&d, sizeof(d), 1, fp) != 1)
return 0; return 0;
d = le32_to_cpu(d); d = le32_to_cpu(d);
return d; return d;

View File

@ -111,7 +111,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
{ {
//DEBUG DPRINTF(E_DEBUG,L_SCANNER,"Found 'fmt ' header\n"); //DEBUG DPRINTF(E_DEBUG,L_SCANNER,"Found 'fmt ' header\n");
len = 16; len = 16;
if(!read(fd, fmt, len) || (len != 16)) if(read(fd, fmt, len) != len)
{ {
close(fd); close(fd);
DPRINTF(E_WARN, L_SCANNER, "Bad .wav file: can't read fmt: %s\n", DPRINTF(E_WARN, L_SCANNER, "Bad .wav file: can't read fmt: %s\n",

View File

@ -155,7 +155,7 @@ is_tivo_file(const char *path)
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if( !fd ) if( !fd )
return 0; return 0;
if( read(fd, buf, 5) < 0 ) if( read(fd, buf, 5) < 5 )
buf[0] = 'X'; buf[0] = 'X';
close(fd); close(fd);