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:
@@ -137,9 +137,8 @@ bool IFCImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
|
||||
// note: this is the common identification for STEP-encoded files, so
|
||||
// it is only unambiguous as long as we don't support any further
|
||||
// file formats with STEP as their encoding.
|
||||
const char *tokens[] = { "ISO-10303-21" };
|
||||
const bool found(SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1));
|
||||
return found;
|
||||
static const char * const tokens[] = { "ISO-10303-21" };
|
||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user