Merge pull request #3878 from krishty/less-string-bloat

Less string bloat
pull/3896/head^2
Kim Kulling 2021-05-26 13:09:18 +02:00 committed by GitHub
commit d4fb6847d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 19 deletions

View File

@ -63,11 +63,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp;
// AutoCAD Binary DXF<CR><LF><SUB><NULL>
const std::string AI_DXF_BINARY_IDENT = std::string("AutoCAD Binary DXF\r\n\x1a\0");
const size_t AI_DXF_BINARY_IDENT_LEN = 24u;
static constexpr char AI_DXF_BINARY_IDENT[] = "AutoCAD Binary DXF\r\n\x1a";
static constexpr size_t AI_DXF_BINARY_IDENT_LEN = sizeof AI_DXF_BINARY_IDENT;
// 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
// 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 :-(
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);
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");
}

View File

@ -604,15 +604,15 @@ void MeshGeometry::ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out,
}
// ------------------------------------------------------------------------------------------------
static const std::string BinormalIndexToken = "BinormalIndex";
static const std::string BinormalsIndexToken = "BinormalsIndex";
static const char * BinormalIndexToken = "BinormalIndex";
static const char * BinormalsIndexToken = "BinormalsIndex";
void MeshGeometry::ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source,
const std::string& MappingInformationType,
const std::string& ReferenceInformationType)
{
const char * str = source.Elements().count( "Binormals" ) > 0 ? "Binormals" : "Binormal";
const char * strIdx = source.Elements().count( "Binormals" ) > 0 ? BinormalsIndexToken.c_str() : BinormalIndexToken.c_str();
const char * strIdx = source.Elements().count( "Binormals" ) > 0 ? BinormalsIndexToken : BinormalIndexToken;
ResolveVertexDataArray(binormals_out,source,MappingInformationType,ReferenceInformationType,
str,
strIdx,

View File

@ -55,9 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp {
namespace Ogre {
const std::string MESH_VERSION_1_8 = "[MeshSerializer_v1.8]";
const std::string SKELETON_VERSION_1_8 = "[Serializer_v1.80]";
const std::string SKELETON_VERSION_1_1 = "[Serializer_v1.10]";
static constexpr auto MESH_VERSION_1_8 = "[MeshSerializer_v1.8]";
static constexpr auto SKELETON_VERSION_1_8 = "[Serializer_v1.80]";
static constexpr auto SKELETON_VERSION_1_1 = "[Serializer_v1.10]";
const unsigned short HEADER_CHUNK_ID = 0x1000;

View File

@ -749,22 +749,22 @@ enum MeshAttribute {
TexCoord
};
static const std::string PosToken = "position";
static const std::string ColToken = "color";
static const std::string NormalToken = "normal";
static const std::string TexCoordToken = "texcoord";
constexpr auto PosToken = "position";
constexpr auto ColToken = "color";
constexpr auto NormalToken = "normal";
constexpr auto TexCoordToken = "texcoord";
//------------------------------------------------------------------------------------------------
static MeshAttribute getAttributeByName(const char *attribName) {
ai_assert(nullptr != attribName);
if (0 == strncmp(PosToken.c_str(), attribName, PosToken.size())) {
if (0 == strcmp(PosToken, attribName)) {
return Position;
} else if (0 == strncmp(ColToken.c_str(), attribName, ColToken.size())) {
} else if (0 == strcmp(ColToken, attribName)) {
return Color;
} else if (0 == strncmp(NormalToken.c_str(), attribName, NormalToken.size())) {
} else if (0 == strcmp(NormalToken, attribName)) {
return Normal;
} else if (0 == strncmp(TexCoordToken.c_str(), attribName, TexCoordToken.size())) {
} else if (0 == strcmp(TexCoordToken, attribName)) {
return TexCoord;
}