Menu

#408 utf8/charset.c:59: possible bad expression ?

1.3.0
closed-fixed
Erik
None
5
2014-03-19
2014-01-15
dcb
No

I just ran the static analysis tool "cppcheck" over
the source code of flac-1.3.0

It said many things, including

[utf8/charset.c:59] -> [utf8/charset.c:59]: (style) Same expression on both sides of '||'.

Source code is

if (!*s1 || !*s1)

Maybe

if (!*s1 || !*s2)

might be better code. I also checked your current development
source code and the bug exists there too.

Discussion

  • Erik

    Erik - 2014-03-15

    Fixed in:

    Author: Erik de Castro Lopo <erikd@mega-nerd.com>
    Date:   Mon Feb 3 18:48:24 2014 +1100
    
    src/share/utf8/charset.c : Fix typo in conditional.
    
    Typo in the conditional to check the exit condition in ascii_strcasecmp.
    It checks for (!*s1 || !*s1) instead of (!*s1 || !*s2). The typo did
    not affect the result of the function as the loop  is exited before
    changing s1 or s2 anyway.
    
    The problem was found by cppcheck which is run automatically on the
    Debian sources. Results here:
    http://cppcheck.sourceforge.net/devinfo/daca2-cppcheck1.63/daca2.html
    
    Patch-from: Robert Kausch <robert.kausch@freac.org>
    
     
  • Erik

    Erik - 2014-03-19
    • status: open --> closed-fixed
    • assigned_to: Erik
     

Log in to post a comment.