more const in format detection
BaseImporter::SearchFileHeaderForToken() expected a pointer to a non-const token list. This was probably an oversight, as nobody would realistically expect the function to change the list. Furthermore, it prevented token lists from being compiled to read-only memory, in some cases even causing the compiler to generate thread-safe initialization. The list is now const and all callers declare their token lists static const, thus compiling them to read-only memory.
This commit is contained in:
@@ -92,7 +92,7 @@ bool Q3DImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
|
||||
else if (!extension.length() || checkSig) {
|
||||
if (!pIOHandler)
|
||||
return true;
|
||||
const char *tokens[] = { "quick3Do", "quick3Ds" };
|
||||
static const char * const tokens[] = { "quick3Do", "quick3Ds" };
|
||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 2);
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user