• Ralph Giles's avatar
    Use strcmp instead of pointer comparison against string literals. · 56ad6cba
    Ralph Giles authored
    The oggenc option parsing set some filter strings to a default,
    then checked later settings from the command line against that
    default to decide whether to warn about multiple settings of
    the same value. This works fine when the default is 'NULL' but
    unforutnately in the case where the default is a string literal
    the results of the pointer comparison is undefined: the compiler
    will generally collapse the two instances of the same #define'd
    literal, but it is not required to do so. And if fact, the clang
    compiler warns about this.
    
    Instead, we use strcmp() to compare the values of the two different
    pointers, which will be identical if they both point to the literal.
    
    This works in the case of DEFAULT_NAMEFMT_REMOVE, but generated a
    new warning on DEFAULT_NAMEFMT_REPLACE which was NULL. Clang also
    warns (incorrectly) on  the code:
    
    #define bar NULL
    if (foo && bar && strcmp(foo, bar));
    
    so instead, we use the empty string for an empty default. This lets
    us preserve the identical code paths for the two options, and have
    things still work if the defaults are changed later.
    
    The logic is still a little odd as it won't warn about successive
    identical settings, but perhaps that's a feature.
    
    svn path=/trunk/vorbis-tools/; revision=17071
    56ad6cba