wmcdplay: Fix -Wunused-result compiler warnings.

In particular, fix warnings of the form "warning: ignoring return value of
‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result" by
checking return value of fgets.
This commit is contained in:
Doug Torrance 2014-12-18 12:30:50 -06:00 committed by Carlos R. Mafra
parent 7959aa4cda
commit 0716c46281

View file

@ -644,7 +644,10 @@ bool readArtwork(char *artfilen){
char buf[256];
bool done=false;
while(!done){
fgets(buf, 250, artfile);
if (fgets(buf, 250, artfile) == NULL) {
fprintf(stderr,"%s : Error reading artwork file.\n", NAME);
return false;
}
done=(feof(artfile)!=0);
if(!done){
@ -734,7 +737,10 @@ char *readBlock(FILE *dfile){
long bytes=0;
char *block=NULL;
do{
fgets(buf, 250, dfile);
if (fgets(buf, 250, dfile) == NULL) {
fprintf(stderr,"%s : Error reading artwork file.\n", NAME);
return NULL;
}
int buflen=strlen(buf);
block=(char *)realloc(block, sizeof(char)*(bytes+buflen+1));
strcpy(block+bytes, buf);