reduced DXF string bloat
The DXF importer defined a global std::string constant, only to convert it back to a C string on use. This commit defines the constant as a C string right away, thus saving 340 B of code and data.pull/3878/head
parent
2a126f9f62
commit
7b6dab5e20
|
@ -63,11 +63,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
// AutoCAD Binary DXF<CR><LF><SUB><NULL>
|
// AutoCAD Binary DXF<CR><LF><SUB><NULL>
|
||||||
const std::string AI_DXF_BINARY_IDENT = std::string("AutoCAD Binary DXF\r\n\x1a\0");
|
static constexpr char AI_DXF_BINARY_IDENT[] = "AutoCAD Binary DXF\r\n\x1a";
|
||||||
const size_t AI_DXF_BINARY_IDENT_LEN = 24u;
|
static constexpr size_t AI_DXF_BINARY_IDENT_LEN = sizeof AI_DXF_BINARY_IDENT;
|
||||||
|
|
||||||
// default vertex color that all uncolored vertices will receive
|
// default vertex color that all uncolored vertices will receive
|
||||||
const aiColor4D AI_DXF_DEFAULT_COLOR(aiColor4D(0.6f, 0.6f, 0.6f, 0.6f));
|
static const aiColor4D AI_DXF_DEFAULT_COLOR(aiColor4D(0.6f, 0.6f, 0.6f, 0.6f));
|
||||||
|
|
||||||
// color indices for DXF - 16 are supported, the table is
|
// color indices for DXF - 16 are supported, the table is
|
||||||
// taken directly from the DXF spec.
|
// taken directly from the DXF spec.
|
||||||
|
@ -156,10 +156,10 @@ void DXFImporter::InternReadFile( const std::string& filename, aiScene* pScene,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this is a binary DXF file - we can't read binary DXF files :-(
|
// Check whether this is a binary DXF file - we can't read binary DXF files :-(
|
||||||
char buff[AI_DXF_BINARY_IDENT_LEN+1] = {0};
|
char buff[AI_DXF_BINARY_IDENT_LEN] = {0};
|
||||||
file->Read(buff,AI_DXF_BINARY_IDENT_LEN,1);
|
file->Read(buff,AI_DXF_BINARY_IDENT_LEN,1);
|
||||||
|
|
||||||
if (0 == strncmp(AI_DXF_BINARY_IDENT.c_str(),buff,AI_DXF_BINARY_IDENT_LEN)) {
|
if (0 == memcmp(AI_DXF_BINARY_IDENT,buff,AI_DXF_BINARY_IDENT_LEN)) {
|
||||||
throw DeadlyImportError("DXF: Binary files are not supported at the moment");
|
throw DeadlyImportError("DXF: Binary files are not supported at the moment");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue