[Pkg-wmaker-commits] [wmcdplay] 51/79: wmcdplay: Fix -Wunused-result compiler warnings.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 11:04:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmcdplay.

commit 653d3d4a6c3c65ef357f51519304a1373cce4ce6
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Thu Dec 18 12:30:50 2014 -0600

    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.
---
 wmcdplay.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/wmcdplay.cc b/wmcdplay.cc
index 0108b89..ab18f4a 100644
--- a/wmcdplay.cc
+++ b/wmcdplay.cc
@@ -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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmcdplay.git



More information about the Pkg-wmaker-commits mailing list