]> git.tue.mpg.de Git - paraslash.git/commitdiff
wma_afh: Add some assert() statements.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 6 Aug 2017 13:13:04 +0000 (15:13 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 12 Aug 2017 17:22:02 +0000 (19:22 +0200)
The clang static analyzer seems to have a hard time proving that if
convert_utf8_to_utf16() returns non-negative, the destination pointer
is non-null. This patch should help it.

wma_afh.c

index ebb2f9c34c97dbb445b312dd1e8ab2004b0d5bc6..01674f1a1dc1edfa500046f031b436cd83348635 100644 (file)
--- a/wma_afh.c
+++ b/wma_afh.c
@@ -377,14 +377,17 @@ static int make_cdo(struct taginfo *tags, const struct asf_object *cdo,
        ret = convert_utf8_to_utf16(tags->artist, &artist);
        if (ret < 0)
                return ret;
+       assert(artist);
        artist_bytes = ret;
        ret = convert_utf8_to_utf16(tags->title, &title);
        if (ret < 0)
                goto out;
+       assert(title);
        title_bytes = ret;
        ret = convert_utf8_to_utf16(tags->comment, &comment);
        if (ret < 0)
                goto out;
+       assert(comment);
        comment_bytes = ret;
 
        if (cdo) {
@@ -458,10 +461,12 @@ static int make_ecdo(struct taginfo *tags, struct asf_object *result)
        ret = convert_utf8_to_utf16(tags->album, &album);
        if (ret < 0)
                return ret;
+       assert(album);
        album_bytes = ret;
        ret = convert_utf8_to_utf16(tags->year, &year);
        if (ret < 0)
                goto out;
+       assert(year);
        year_bytes = ret;
        result->size = 16 + 8 + 2; /* GUID, size, count */
        /* name_length + name + null + data type + val length + val */