From 4991f728c897a303b9cb0b307e164017fe8b4eca Mon Sep 17 00:00:00 2001 From: Krishty Date: Thu, 29 Jul 2021 14:23:52 +0200 Subject: [PATCH 1/2] =?UTF-8?q?style=20fix=C2=A0=E2=80=93=20initializing?= =?UTF-8?q?=20and=20assigning=20empty=20std::string=20properly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for details, see #3764 --- code/AssetLib/STEPParser/STEPFileReader.cpp | 4 ++-- code/AssetLib/glTF/glTFCommon.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/STEPParser/STEPFileReader.cpp b/code/AssetLib/STEPParser/STEPFileReader.cpp index ac6d83672..360277912 100644 --- a/code/AssetLib/STEPParser/STEPFileReader.cpp +++ b/code/AssetLib/STEPParser/STEPFileReader.cpp @@ -58,13 +58,13 @@ using namespace Assimp; namespace EXPRESS = STEP::EXPRESS; // ------------------------------------------------------------------------------------------------ -std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "") +std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = std::string()) { return line == STEP::SyntaxError::LINE_NOT_SPECIFIED ? prefix+s : static_cast( (Formatter::format(),prefix,"(line ",line,") ",s) ); } // ------------------------------------------------------------------------------------------------ -std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = "") +std::string AddEntityID(const std::string& s,uint64_t entity /*= ENTITY_NOT_SPECIFIED*/, const std::string& prefix = std::string()) { return entity == STEP::TypeError::ENTITY_NOT_SPECIFIED ? prefix+s : static_cast( (Formatter::format(),prefix,"(entity #",entity,") ",s)); } diff --git a/code/AssetLib/glTF/glTFCommon.h b/code/AssetLib/glTF/glTFCommon.h index 0506ad056..6f35e7881 100644 --- a/code/AssetLib/glTF/glTFCommon.h +++ b/code/AssetLib/glTF/glTFCommon.h @@ -196,7 +196,7 @@ inline std::string getCurrentAssetDir(const std::string &pFile) { std::string path = pFile; int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\'))); if (pos == int(std::string::npos)) { - return ""; + return std::string(); } return pFile.substr(0, pos + 1); From 42a7611f8511e5af0e357a56b658b381b14c8454 Mon Sep 17 00:00:00 2001 From: Krishty Date: Thu, 29 Jul 2021 14:39:22 +0200 Subject: [PATCH 2/2] style fix: indentation --- code/AssetLib/3MF/3MFXmlTags.h | 2 +- code/AssetLib/MMD/MMDPmxParser.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/AssetLib/3MF/3MFXmlTags.h b/code/AssetLib/3MF/3MFXmlTags.h index d447556d6..9fa2affd4 100644 --- a/code/AssetLib/3MF/3MFXmlTags.h +++ b/code/AssetLib/3MF/3MFXmlTags.h @@ -103,7 +103,7 @@ namespace XmlTag { const char* const PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture"; const char* const PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; const char* const PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail"; - } +} } // Namespace D3MF } // Namespace Assimp diff --git a/code/AssetLib/MMD/MMDPmxParser.cpp b/code/AssetLib/MMD/MMDPmxParser.cpp index d57dc169a..ba8efa8e9 100644 --- a/code/AssetLib/MMD/MMDPmxParser.cpp +++ b/code/AssetLib/MMD/MMDPmxParser.cpp @@ -516,13 +516,13 @@ namespace pmx stream->read((char*) magic, sizeof(char) * 4); if (magic[0] != 0x50 || magic[1] != 0x4d || magic[2] != 0x58 || magic[3] != 0x20) { - throw DeadlyImportError("MMD: Invalid magic number."); - } + throw DeadlyImportError("MMD: Invalid magic number."); + } stream->read((char*) &version, sizeof(float)); if (version != 2.0f && version != 2.1f) { throw DeadlyImportError("MMD: Unsupported version (must be 2.0 or 2.1): ", ai_to_string(version)); - } + } this->setting.Read(stream); this->model_name = ReadString(stream, setting.encoding);