wma_afh: Remove some dead stores.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 21 Apr 2017 18:13:14 +0000 (20:13 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 26 Apr 2017 12:06:45 +0000 (14:06 +0200)
scan-build complains with

Value stored to 'orig_title_bytes' is never read

and similar for orig_artist_bytes and orig_comment_bytes. Indeed,
these variables are only referenced in the if clause but not in the
else clause.

This commit makes them local to the if clause and removes the dead
stores in the else clause..

wma_afh.c

index 7394bf91768276b92884e1548f61ed791946540d..ebb2f9c34c97dbb445b312dd1e8ab2004b0d5bc6 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -365,8 +365,7 @@ static int make_cdo(struct taginfo *tags, const struct asf_object *cdo,
                struct asf_object *result)
 {
        const char *cr, *rating; /* orig data */
                struct asf_object *result)
 {
        const char *cr, *rating; /* orig data */
-       uint16_t orig_title_bytes, orig_artist_bytes, orig_cr_bytes,
-               orig_comment_bytes, orig_rating_bytes;
+       uint16_t orig_cr_bytes, orig_rating_bytes;
        /* pointers to new UTF-16 tags */
        char *artist = NULL, *title = NULL, *comment = NULL;
        /* number of bytes in UTF-16 for the new tags */
        /* pointers to new UTF-16 tags */
        char *artist = NULL, *title = NULL, *comment = NULL;
        /* number of bytes in UTF-16 for the new tags */
@@ -389,6 +388,7 @@ static int make_cdo(struct taginfo *tags, const struct asf_object *cdo,
        comment_bytes = ret;
 
        if (cdo) {
        comment_bytes = ret;
 
        if (cdo) {
+               uint16_t orig_title_bytes, orig_artist_bytes, orig_comment_bytes;
                /*
                 * Sizes of the five fields (stored as 16-bit numbers) are
                 * located after the header (16 bytes) and the cdo size (8
                /*
                 * Sizes of the five fields (stored as 16-bit numbers) are
                 * located after the header (16 bytes) and the cdo size (8
@@ -402,10 +402,7 @@ static int make_cdo(struct taginfo *tags, const struct asf_object *cdo,
                cr = cdo->ptr + 34 + orig_title_bytes + orig_artist_bytes;
                rating = cr + orig_cr_bytes + orig_comment_bytes;
        } else {
                cr = cdo->ptr + 34 + orig_title_bytes + orig_artist_bytes;
                rating = cr + orig_cr_bytes + orig_comment_bytes;
        } else {
-               orig_title_bytes = 2;
-               orig_artist_bytes = 2;
                orig_cr_bytes = 2;
                orig_cr_bytes = 2;
-               orig_comment_bytes = 2;
                orig_rating_bytes = 2;
                cr = null;
                rating = null;
                orig_rating_bytes = 2;
                cr = null;
                rating = null;