Skip to content

Commit

Permalink
Clean up a couple return value checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaggard10 committed Apr 7, 2014
1 parent 27eae53 commit bc43d45
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tagutils/tagutils-aac.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ _aac_check_extended_descriptor(FILE *infile)
short int i;
unsigned char buf[3];

if( !fread((void *)&buf, 3, 1, infile) )
if( fread((void *)&buf, 1, 3, infile) < 3 )
return -1;
for( i=0; i<3; i++ )
{
Expand Down Expand Up @@ -286,8 +286,8 @@ _get_aacfileinfo(char *file, struct song_metadata *psong)
if(atom_offset != -1)
{
fseek(infile, 12, SEEK_CUR);
if(!fread((void*)&sample_size, 1, sizeof(int), infile) ||
!fread((void*)&samples, 1, sizeof(int), infile))
if(fread((void*)&sample_size, 1, sizeof(int), infile) != sizeof(int) ||
fread((void*)&samples, 1, sizeof(int), infile) != sizeof(int))
{
fclose(infile);
return -1;
Expand Down
6 changes: 3 additions & 3 deletions tagutils/tagutils-asf.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fget_byte(FILE *fp)
{
uint8_t d;

if (!fread(&d, sizeof(d), 1, fp))
if (fread(&d, sizeof(d), 1, fp) != 1)
return 0;
return d;
}
Expand All @@ -102,7 +102,7 @@ fget_le16(FILE *fp)
{
uint16_t d;

if (!fread(&d, sizeof(d), 1, fp))
if (fread(&d, sizeof(d), 1, fp) != 1)
return 0;
d = le16_to_cpu(d);
return d;
Expand All @@ -113,7 +113,7 @@ fget_le32(FILE *fp)
{
uint32_t d;

if (!fread(&d, sizeof(d), 1, fp))
if (fread(&d, sizeof(d), 1, fp) != 1)
return 0;
d = le32_to_cpu(d);
return d;
Expand Down
2 changes: 1 addition & 1 deletion tagutils/tagutils-wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ _get_wavtags(char *filename, struct song_metadata *psong)
{
//DEBUG DPRINTF(E_DEBUG,L_SCANNER,"Found 'fmt ' header\n");
len = 16;
if(!read(fd, fmt, len) || (len != 16))
if(read(fd, fmt, len) != len)
{
close(fd);
DPRINTF(E_WARN, L_SCANNER, "Bad .wav file: can't read fmt: %s\n",
Expand Down
2 changes: 1 addition & 1 deletion tivo_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ is_tivo_file(const char *path)
fd = open(path, O_RDONLY);
if( !fd )
return 0;
if( read(fd, buf, 5) < 0 )
if( read(fd, buf, 5) < 5 )
buf[0] = 'X';
close(fd);

Expand Down

0 comments on commit bc43d45

Please sign in to comment.