Skip to content

q3map2: fix pk3dir/dpk/dpkdir code

Thomas Debesse requested to merge illwieckz/netradiant:importfixes into master

This is a fix by @TTimo imported from GtkRadiant, see the talk there.

In addition to the warnings, it doesn't seem the logic was correct and it would have skipped any .dpk still.

    q3map2/common/vfs.c:215:65: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
                                            if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) {
                                                                                                       ^                         ~~
    q3map2/common/vfs.c:215:65: note: add parentheses after the '!' to evaluate the comparison first
                                            if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) {
                                                                                                       ^
                                                                                                        (                            )
    q3map2/common/vfs.c:215:65: note: add parentheses around left hand side expression to silence this warning
                                            if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) {
                                                                                                       ^
                                                                                                       (                        )
    q3map2/common/vfs.c:209:7: warning: array index 4096 is past the end of the array (which contains 4096 elements) [-Warray-bounds]
                                                    g_strDirs[g_numDirs][PATH_MAX] = '\0';
                                                    ^                    ~~~~~~~~
    q3map2/common/vfs.c:81:1: note: array 'g_strDirs' declared here
    static char g_strDirs[VFS_MAXDIRS][PATH_MAX];
Edited by Thomas Debesse

Merge request reports