Merge pull request #3764 from krishty/empty-string-style
style fix - initializing and assigning empty std::string properlypull/3765/head^2
commit
9b36f62cb2
|
@ -212,7 +212,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat,
|
|||
mat.AddProperty(&tex, AI_MATKEY_GLOBAL_BACKGROUND_IMAGE);
|
||||
|
||||
// Be sure this is only done for the first material
|
||||
mBackgroundImage = std::string("");
|
||||
mBackgroundImage = std::string();
|
||||
}
|
||||
|
||||
// At first add the base ambient color of the scene to the material
|
||||
|
|
|
@ -164,7 +164,7 @@ void Discreet3DSImporter::InternReadFile(const std::string &pFile,
|
|||
mRootNode->mHierarchyIndex = -1;
|
||||
mRootNode->mParent = nullptr;
|
||||
mMasterScale = 1.0f;
|
||||
mBackgroundImage = "";
|
||||
mBackgroundImage = std::string();
|
||||
bHasBG = false;
|
||||
bIsPrj = false;
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ bool D3MFOpcPackage::validate() {
|
|||
std::string D3MFOpcPackage::ReadPackageRootRelationship(IOStream *stream) {
|
||||
XmlParser xmlParser;
|
||||
if (!xmlParser.parse(stream)) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
OpcPackageRelationshipReader reader(xmlParser);
|
||||
|
|
|
@ -123,9 +123,9 @@ public:
|
|||
struct Object {
|
||||
Object() :
|
||||
type(World),
|
||||
name(""),
|
||||
name(),
|
||||
children(),
|
||||
texture(""),
|
||||
texture(),
|
||||
texRepeat(1.f, 1.f),
|
||||
texOffset(0.0f, 0.0f),
|
||||
rotation(),
|
||||
|
|
|
@ -685,7 +685,7 @@ void Parser::ParseLV3MapBlock(Texture &map) {
|
|||
// Files with 'None' as map name are produced by
|
||||
// an Maja to ASE exporter which name I forgot ..
|
||||
ASSIMP_LOG_WARN("ASE: Skipping invalid map entry");
|
||||
map.mMapName = "";
|
||||
map.mMapName = std::string();
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -1241,7 +1241,7 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
|
|||
continue;
|
||||
}
|
||||
entry.mTargetId = entry.mTransformId;
|
||||
entry.mTransformId = "";
|
||||
entry.mTransformId = std::string();
|
||||
}
|
||||
|
||||
entry.mChannel = &(*cit);
|
||||
|
|
|
@ -330,7 +330,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
|
|||
}
|
||||
|
||||
const Element* Name = source["Name"];
|
||||
m_uvNames[index] = "";
|
||||
m_uvNames[index] = std::string();
|
||||
if(Name) {
|
||||
m_uvNames[index] = ParseTokenAsString(GetRequiredToken(*Name,0));
|
||||
}
|
||||
|
|
|
@ -462,7 +462,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
|||
|
||||
if (t.Type() != TokenType_DATA) {
|
||||
err_out = "expected TOK_DATA token";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
if(t.IsBinary())
|
||||
|
@ -470,7 +470,7 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
|||
const char* data = t.begin();
|
||||
if (data[0] != 'S') {
|
||||
err_out = "failed to parse S(tring), unexpected data type (binary)";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// read string length
|
||||
|
@ -484,13 +484,13 @@ std::string ParseTokenAsString(const Token& t, const char*& err_out)
|
|||
const size_t length = static_cast<size_t>(t.end() - t.begin());
|
||||
if(length < 2) {
|
||||
err_out = "token is too short to hold a string";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const char* s = t.begin(), *e = t.end() - 1;
|
||||
if (*s != '\"' || *e != '\"') {
|
||||
err_out = "expected double quoted string";
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return std::string(s+1,length-2);
|
||||
|
|
|
@ -155,7 +155,7 @@ std::string PeekPropertyName(const Element& element)
|
|||
ai_assert(element.KeyToken().StringContents() == "P");
|
||||
const TokenList& tok = element.Tokens();
|
||||
if(tok.size() < 4) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return ParseTokenAsString(*tok[0]);
|
||||
|
|
|
@ -567,7 +567,7 @@ typedef std::map<std::string, std::string> Metadata;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcProperty>, 1, 0> &set, ConversionData &conv, Metadata &properties,
|
||||
const std::string &prefix = "",
|
||||
const std::string &prefix = std::string(),
|
||||
unsigned int nest = 0) {
|
||||
for (const Schema_2x3::IfcProperty &property : set) {
|
||||
const std::string &key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
||||
|
@ -618,7 +618,7 @@ void ProcessMetadata(const Schema_2x3::ListOf<Schema_2x3::Lazy<Schema_2x3::IfcPr
|
|||
ProcessMetadata(complexProp->HasProperties, conv, properties, key, nest + 1);
|
||||
}
|
||||
} else {
|
||||
properties[key] = "";
|
||||
properties[key] = std::string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -859,7 +859,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError("Failed to open IRR file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open IRR file " + pFile);
|
||||
}
|
||||
|
||||
// Construct the irrXML parser
|
||||
|
|
|
@ -135,7 +135,7 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
|||
|
||||
// Check whether we can read from the file
|
||||
if (file.get() == NULL)
|
||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile);
|
||||
|
||||
// Construct the irrXML parser
|
||||
XmlParser parser;
|
||||
|
|
|
@ -502,7 +502,7 @@ struct Surface {
|
|||
Surface() :
|
||||
mColor(0.78431f, 0.78431f, 0.78431f), bDoubleSided(false), mDiffuseValue(1.f), mSpecularValue(0.f), mTransparency(0.f), mGlossiness(0.4f), mLuminosity(0.f), mColorHighlights(0.f), mMaximumSmoothAngle(0.f) // 0 == not specified, no smoothing
|
||||
,
|
||||
mVCMap(""),
|
||||
mVCMap(),
|
||||
mVCMapType(AI_LWO_RGBA),
|
||||
mIOR(1.f) // vakuum
|
||||
,
|
||||
|
|
|
@ -88,7 +88,7 @@ struct NodeDesc {
|
|||
id(),
|
||||
number(0),
|
||||
parent(0),
|
||||
name(""),
|
||||
name(),
|
||||
isPivotSet(false),
|
||||
lightColor(1.f, 1.f, 1.f),
|
||||
lightIntensity(1.f),
|
||||
|
|
|
@ -95,7 +95,7 @@ void UniqueNameGenerator::make_unique(std::vector<std::string> &names) {
|
|||
auto generate_unique_name = [&](const std::string &base_name) -> std::string {
|
||||
auto *duplicate_info = &names_to_duplicates[base_name];
|
||||
|
||||
std::string new_name = "";
|
||||
std::string new_name;
|
||||
|
||||
bool found_identical_name;
|
||||
bool tried_with_base_name_only = false;
|
||||
|
|
|
@ -75,7 +75,7 @@ using namespace std;
|
|||
// Default constructor
|
||||
MMDImporter::MMDImporter() :
|
||||
m_Buffer(),
|
||||
m_strAbsPath("") {
|
||||
m_strAbsPath() {
|
||||
DefaultIOSystem io;
|
||||
m_strAbsPath = io.getOsSeparator();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace pmx
|
|||
std::vector<char> buffer;
|
||||
if (size == 0)
|
||||
{
|
||||
return std::string("");
|
||||
return std::string();
|
||||
}
|
||||
buffer.reserve(size);
|
||||
stream->read((char*) buffer.data(), size);
|
||||
|
|
|
@ -206,7 +206,7 @@ USE_ODDLPARSER_NS
|
|||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static void propId2StdString(Property *prop, std::string &name, std::string &key) {
|
||||
name = key = "";
|
||||
name = key = std::string();
|
||||
if (nullptr == prop) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ struct MetricInfo {
|
|||
int m_intValue;
|
||||
|
||||
MetricInfo()
|
||||
: m_stringValue( "" )
|
||||
: m_stringValue( )
|
||||
, m_floatValue( 0.0f )
|
||||
, m_intValue( -1 ) {
|
||||
// empty
|
||||
|
|
|
@ -178,7 +178,7 @@ struct Q3BSPModel {
|
|||
m_Textures(),
|
||||
m_Lightmaps(),
|
||||
m_EntityData(),
|
||||
m_ModelName( "" )
|
||||
m_ModelName()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ static void extractIds(const std::string &key, int &id1, int &id2) {
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Local helper function to normalize filenames.
|
||||
static void normalizePathName(const std::string &rPath, std::string &normalizedPath) {
|
||||
normalizedPath = "";
|
||||
normalizedPath = std::string();
|
||||
if (rPath.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
|
|||
throw DeadlyImportError("Failed to open file ", rFile, ".");
|
||||
}
|
||||
|
||||
std::string archiveName(""), mapName("");
|
||||
std::string archiveName, mapName;
|
||||
separateMapName(rFile, archiveName, mapName);
|
||||
|
||||
if (mapName.empty()) {
|
||||
|
@ -202,8 +202,8 @@ void Q3BSPFileImporter::InternReadFile(const std::string &rFile, aiScene *scene,
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Separates the map name from the import name.
|
||||
void Q3BSPFileImporter::separateMapName(const std::string &importName, std::string &archiveName, std::string &mapName) {
|
||||
archiveName = "";
|
||||
mapName = "";
|
||||
archiveName = std::string();
|
||||
mapName = std::string();
|
||||
if (importName.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ void Q3BSPFileImporter::separateMapName(const std::string &importName, std::stri
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns the first map in the map archive.
|
||||
bool Q3BSPFileImporter::findFirstMapInArchive(ZipArchiveIOSystem &bspArchive, std::string &mapName) {
|
||||
mapName = "";
|
||||
mapName = std::string();
|
||||
std::vector<std::string> fileList;
|
||||
bspArchive.getFileListExtension(fileList, "bsp");
|
||||
if (fileList.empty()) {
|
||||
|
@ -440,7 +440,7 @@ void Q3BSPFileImporter::createMaterials(const Q3BSP::Q3BSPModel *pModel, aiScene
|
|||
if (-1 != textureId) {
|
||||
sQ3BSPTexture *pTexture = pModel->m_Textures[textureId];
|
||||
if (nullptr != pTexture) {
|
||||
std::string tmp("*"), texName("");
|
||||
std::string tmp("*"), texName;
|
||||
tmp += pTexture->strName;
|
||||
tmp += ".jpg";
|
||||
normalizePathName(tmp, texName);
|
||||
|
@ -512,7 +512,7 @@ size_t Q3BSPFileImporter::countTriangles(const std::vector<Q3BSP::sQ3BSPFace *>
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Creates the faces-to-material map.
|
||||
void Q3BSPFileImporter::createMaterialMap(const Q3BSP::Q3BSPModel *pModel) {
|
||||
std::string key("");
|
||||
std::string key;
|
||||
std::vector<sQ3BSPFace *> *pCurFaceArray = nullptr;
|
||||
for (size_t idx = 0; idx < pModel->m_Faces.size(); idx++) {
|
||||
Q3BSP::sQ3BSPFace *pQ3BSPFace = pModel->m_Faces[idx];
|
||||
|
@ -660,7 +660,7 @@ bool Q3BSPFileImporter::expandFile(ZipArchiveIOSystem *pArchive, const std::stri
|
|||
|
||||
if (rExtList.empty()) {
|
||||
rFile = rFilename;
|
||||
rExt = "";
|
||||
rExt = std::string();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ struct Mesh {
|
|||
|
||||
std::vector<Bone> mBones;
|
||||
|
||||
explicit Mesh(const std::string &pName = "") AI_NO_EXCEPT
|
||||
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
|
||||
: mName( pName )
|
||||
, mPositions()
|
||||
, mPosFaces()
|
||||
|
|
|
@ -142,7 +142,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
|
||||
// check whether we can read from the file
|
||||
if (stream.get() == NULL) {
|
||||
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile + "");
|
||||
throw DeadlyImportError("Failed to open XGL/ZGL file " + pFile);
|
||||
}
|
||||
|
||||
// see if its compressed, if so uncompress it
|
||||
|
|
|
@ -1033,7 +1033,7 @@ namespace glTF
|
|||
|
||||
AssetMetadata()
|
||||
: premultipliedAlpha(false)
|
||||
, version("")
|
||||
, version()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1071,7 +1071,7 @@ struct AssetMetadata {
|
|||
void Read(Document &doc);
|
||||
|
||||
AssetMetadata() :
|
||||
version("") {}
|
||||
version() {}
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -271,7 +271,7 @@ std::string BaseImporter::GetExtension(const std::string &file) {
|
|||
|
||||
// no file extension at all
|
||||
if (pos == std::string::npos) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// thanks to Andy Maloney for the hint
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
if (std::string::npos != (ss2 = mBase.find_last_of("\\/"))) {
|
||||
mBase.erase(ss2,mBase.length()-ss2);
|
||||
} else {
|
||||
mBase = "";
|
||||
mBase = std::string();
|
||||
}
|
||||
|
||||
// make sure the directory is terminated properly
|
||||
|
|
|
@ -149,7 +149,7 @@ void AllocateFromAssimpHeap::operator delete[] ( void* data) {
|
|||
Importer::Importer()
|
||||
: pimpl( new ImporterPimpl ) {
|
||||
pimpl->mScene = nullptr;
|
||||
pimpl->mErrorString = "";
|
||||
pimpl->mErrorString = std::string();
|
||||
|
||||
// Allocate a default IO handler
|
||||
pimpl->mIOHandler = new DefaultIOSystem;
|
||||
|
@ -387,7 +387,7 @@ void Importer::FreeScene( ) {
|
|||
delete pimpl->mScene;
|
||||
pimpl->mScene = nullptr;
|
||||
|
||||
pimpl->mErrorString = "";
|
||||
pimpl->mErrorString = std::string();
|
||||
pimpl->mException = std::exception_ptr();
|
||||
ASSIMP_END_EXCEPTION_REGION(void);
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ aiScene* Importer::GetOrphanedScene() {
|
|||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||
pimpl->mScene = nullptr;
|
||||
|
||||
pimpl->mErrorString = ""; // reset error string
|
||||
pimpl->mErrorString = std::string();
|
||||
pimpl->mException = std::exception_ptr();
|
||||
ASSIMP_END_EXCEPTION_REGION(aiScene*);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/scene.h>
|
||||
|
||||
aiNode::aiNode()
|
||||
: mName("")
|
||||
: mName()
|
||||
, mParent(nullptr)
|
||||
, mNumChildren(0)
|
||||
, mChildren(nullptr)
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
/** @brief Set list of fixed (inmutable) materials
|
||||
* @param fixed See #AI_CONFIG_PP_RRM_EXCLUDE_LIST
|
||||
*/
|
||||
void SetFixedMaterialsString(const std::string& fixed = "") {
|
||||
void SetFixedMaterialsString(const std::string& fixed = std::string()) {
|
||||
mConfigFixedMaterials = fixed;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ private:
|
|||
AI_FORCE_INLINE
|
||||
DefaultIOStream::DefaultIOStream() AI_NO_EXCEPT
|
||||
: mFile(nullptr)
|
||||
, mFilename("")
|
||||
, mFilename()
|
||||
, mCachedSize(SIZE_MAX) {
|
||||
// empty
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ bool IOSystem::PushDirectory( const std::string &path ) {
|
|||
AI_FORCE_INLINE
|
||||
const std::string &IOSystem::CurrentDirectory() const {
|
||||
if ( m_pathStack.empty() ) {
|
||||
static const std::string Dummy("");
|
||||
static const std::string Dummy;
|
||||
return Dummy;
|
||||
}
|
||||
return m_pathStack[ m_pathStack.size()-1 ];
|
||||
|
|
|
@ -286,7 +286,7 @@ public:
|
|||
* @see GetPropertyInteger()
|
||||
*/
|
||||
std::string GetPropertyString(const char *szName,
|
||||
const std::string &sErrorReturn = "") const;
|
||||
const std::string &sErrorReturn = std::string()) const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Get a matrix configuration property
|
||||
|
|
|
@ -239,7 +239,7 @@ public:
|
|||
}
|
||||
|
||||
static inline bool getValueAsString( XmlNode &node, std::string &text ) {
|
||||
text = "";
|
||||
text = std::string();
|
||||
if (node.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue