diff --git a/code/ACLoader.cpp b/code/ACLoader.cpp index b011ebab6..196ec5ac0 100644 --- a/code/ACLoader.cpp +++ b/code/ACLoader.cpp @@ -199,7 +199,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) if (TokenMatch(buffer,"kids",4)) { SkipSpaces(&buffer); - unsigned int num = strtol10(buffer,&buffer); + unsigned int num = strtoul10(buffer,&buffer); GetNextLine(); if (num) { @@ -252,7 +252,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) else if (TokenMatch(buffer,"subdiv",6)) { SkipSpaces(&buffer); - obj.subDiv = strtol10(buffer,&buffer); + obj.subDiv = strtoul10(buffer,&buffer); } else if (TokenMatch(buffer,"crease",6)) { @@ -263,7 +263,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) { SkipSpaces(&buffer); - unsigned int t = strtol10(buffer,&buffer); + unsigned int t = strtoul10(buffer,&buffer); obj.vertices.reserve(t); for (unsigned int i = 0; i < t;++i) { @@ -289,7 +289,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) bool Q3DWorkAround = false; - const unsigned int t = strtol10(buffer,&buffer); + const unsigned int t = strtoul10(buffer,&buffer); obj.surfaces.reserve(t); for (unsigned int i = 0; i < t;++i) { @@ -311,7 +311,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) SkipSpaces(&buffer); obj.surfaces.push_back(Surface()); Surface& surf = obj.surfaces.back(); - surf.flags = strtol_cppstyle(buffer); + surf.flags = strtoul_cppstyle(buffer); while (1) { @@ -323,7 +323,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) if (TokenMatch(buffer,"mat",3)) { SkipSpaces(&buffer); - surf.mat = strtol10(buffer); + surf.mat = strtoul10(buffer); } else if (TokenMatch(buffer,"refs",4)) { @@ -338,7 +338,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) } SkipSpaces(&buffer); - const unsigned int m = strtol10(buffer); + const unsigned int m = strtoul10(buffer); surf.entries.reserve(m); obj.numRefs += m; @@ -353,7 +353,7 @@ void AC3DImporter::LoadObjectSection(std::vector& objects) surf.entries.push_back(Surface::SurfaceEntry()); Surface::SurfaceEntry& entry = surf.entries.back(); - entry.first = strtol10(buffer,&buffer); + entry.first = strtoul10(buffer,&buffer); SkipSpaces(&buffer); AI_AC_CHECKED_LOAD_FLOAT_ARRAY("",0,2,&entry.second); } diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index de8033192..280dfdfc3 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -1563,7 +1563,7 @@ void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh) // parse an index ... if(SkipSpaces(&filePtr)) { - unsigned int iIndex = strtol10(filePtr,&filePtr); + unsigned int iIndex = strtoul10(filePtr,&filePtr); if (iIndex >= iNumBones) { continue; @@ -1593,7 +1593,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh if (TokenMatch(filePtr,"MESH_BONE_VERTEX" ,16)) { // read the vertex index - unsigned int iIndex = strtol10(filePtr,&filePtr); + unsigned int iIndex = strtoul10(filePtr,&filePtr); if (iIndex >= mesh.mPositions.size()) { iIndex = (unsigned int)mesh.mPositions.size()-1; @@ -1610,7 +1610,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh { // first parse the bone index ... if (!SkipSpaces(&filePtr))break; - pairOut.first = strtol10(filePtr,&filePtr); + pairOut.first = strtoul10(filePtr,&filePtr); // then parse the vertex weight if (!SkipSpaces(&filePtr))break; @@ -1951,7 +1951,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out) } // parse the face index - out.iFace = strtol10(filePtr,&filePtr); + out.iFace = strtoul10(filePtr,&filePtr); // next character should be ':' if(!SkipSpaces(&filePtr)) @@ -2012,7 +2012,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out) SkipToNextToken(); return; } - out.mIndices[iIndex] = strtol10(filePtr,&filePtr); + out.mIndices[iIndex] = strtoul10(filePtr,&filePtr); } // now we need to skip the AB, BC, CA blocks. @@ -2044,7 +2044,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out) { if (*filePtr < '9' && *filePtr >= '0') { - out.iSmoothGroup |= (1 << strtol10(filePtr,&filePtr)); + out.iSmoothGroup |= (1 << strtoul10(filePtr,&filePtr)); } SkipSpaces(&filePtr); if (',' != *filePtr) @@ -2076,7 +2076,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out) SkipToNextToken(); return; } - out.iMaterial = strtol10(filePtr,&filePtr); + out.iMaterial = strtoul10(filePtr,&filePtr); } return; } @@ -2146,5 +2146,5 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut) return; } // parse the value - iOut = strtol10(filePtr,&filePtr); + iOut = strtoul10(filePtr,&filePtr); } diff --git a/code/BlenderDNA.cpp b/code/BlenderDNA.cpp index c8c5814e0..eeb093b04 100644 --- a/code/BlenderDNA.cpp +++ b/code/BlenderDNA.cpp @@ -259,13 +259,13 @@ void DNA :: DumpToFile() if (pos++ == std::string::npos) { return; } - array_sizes[0] = strtol10(&out[pos]); + array_sizes[0] = strtoul10(&out[pos]); pos = out.find('[',pos); if (pos++ == std::string::npos) { return; } - array_sizes[1] = strtol10(&out[pos]); + array_sizes[1] = strtoul10(&out[pos]); } // ------------------------------------------------------------------------------------------------ diff --git a/code/COBLoader.cpp b/code/COBLoader.cpp index 3fb7de1dd..d78c4f4b5 100644 --- a/code/COBLoader.cpp +++ b/code/COBLoader.cpp @@ -439,9 +439,9 @@ void COBImporter::ReadChunkInfo_Ascii(ChunkInfo& out, const LineSplitter& splitt splitter.get_tokens(all_tokens); out.version = (all_tokens[1][1]-'0')*100+(all_tokens[1][3]-'0')*10+(all_tokens[1][4]-'0'); - out.id = strtol10(all_tokens[3]); - out.parent_id = strtol10(all_tokens[5]); - out.size = strtol10s(all_tokens[7]); + out.id = strtoul10(all_tokens[3]); + out.parent_id = strtoul10(all_tokens[5]); + out.size = strtol10(all_tokens[7]); } // ------------------------------------------------------------------------------------------------ @@ -562,7 +562,7 @@ void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const Chunk Material& mat = out.materials.back(); mat = nfo; - mat.matnum = strtol10(splitter[1]); + mat.matnum = strtoul10(splitter[1]); ++splitter; if (!splitter.match_start("shader: ")) { @@ -626,7 +626,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk // corresponding chunk already. for_each(boost::shared_ptr< Node >& nd, out.nodes) { if (nd->id == nfo.parent_id) { - const unsigned int t=strtol10(splitter[1]); + const unsigned int t=strtoul10(splitter[1]); nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?( LogWarn_Ascii(splitter,format()<c_str(); for(size_t i = 0; i < face.indices.size(); ++i) { @@ -828,11 +828,11 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk if ('<' != *s++) { ThrowException("Expected < token in Face entry"); } - face.indices[i].pos_idx = strtol10(s,&s); + face.indices[i].pos_idx = strtoul10(s,&s); if (',' != *s++) { ThrowException("Expected , token in Face entry"); } - face.indices[i].uv_idx = strtol10(s,&s); + face.indices[i].uv_idx = strtoul10(s,&s); if ('>' != *s++) { ThrowException("Expected < token in Face entry"); } @@ -843,7 +843,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk } } else if (splitter.match_start("DrawFlags")) { - msh.draw_flags = strtol10(splitter[1]); + msh.draw_flags = strtoul10(splitter[1]); break; } } @@ -863,7 +863,7 @@ void COBImporter::ReadBitM_Ascii(Scene& out, LineSplitter& splitter, const Chunk "\nZippedThumbnail: %02hx 02hx %02hx " */ - const unsigned int head = strtol10((++splitter)[1]); + const unsigned int head = strtoul10((++splitter)[1]); if (head != sizeof(Bitmap::BitmapHeader)) { LogWarn_Ascii(splitter,"Unexpected ThumbNailHdrSize, skipping this chunk"); return; diff --git a/code/CSMLoader.cpp b/code/CSMLoader.cpp index 3ee22202f..3eb3502f4 100644 --- a/code/CSMLoader.cpp +++ b/code/CSMLoader.cpp @@ -125,11 +125,11 @@ void CSMImporter::InternReadFile( const std::string& pFile, ++buffer; if (TokenMatchI(buffer,"firstframe",10)) { SkipSpaces(&buffer); - first = strtol10s(buffer,&buffer); + first = strtol10(buffer,&buffer); } else if (TokenMatchI(buffer,"lastframe",9)) { SkipSpaces(&buffer); - last = strtol10s(buffer,&buffer); + last = strtol10(buffer,&buffer); } else if (TokenMatchI(buffer,"rate",4)) { SkipSpaces(&buffer); @@ -189,7 +189,7 @@ void CSMImporter::InternReadFile( const std::string& pFile, } // read frame - const int frame = ::strtol10(buffer,&buffer); + const int frame = ::strtoul10(buffer,&buffer); last = std::max(frame,last); first = std::min(frame,last); for (unsigned int i = 0; i < anim->mNumChannels;++i) { diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index f22a9295f..7a1ddc169 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -1165,7 +1165,7 @@ void ColladaLoader::AddTexture ( Assimp::MaterialHelper& mat, const ColladaParse map = -1; for (std::string::const_iterator it = sampler.mUVChannel.begin();it != sampler.mUVChannel.end(); ++it){ if (IsNumeric(*it)) { - map = strtol10(&(*it)); + map = strtoul10(&(*it)); break; } } diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 1eaab595e..c47df2fc5 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -638,7 +638,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController) if( *text == 0) ThrowException( "Out of data while reading vcount"); - *it = strtol10( text, &text); + *it = strtoul10( text, &text); numWeights += *it; SkipSpacesAndLineEnd( &text); } @@ -657,11 +657,11 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController) { if( *text == 0) ThrowException( "Out of data while reading vertex_weights"); - it->first = strtol10( text, &text); + it->first = strtoul10( text, &text); SkipSpacesAndLineEnd( &text); if( *text == 0) ThrowException( "Out of data while reading vertex_weights"); - it->second = strtol10( text, &text); + it->second = strtoul10( text, &text); SkipSpacesAndLineEnd( &text); } @@ -1887,7 +1887,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh) if( *content == 0) ThrowException( "Expected more values while reading vcount contents."); // read a number - vcount.push_back( (size_t) strtol10( content, &content)); + vcount.push_back( (size_t) strtoul10( content, &content)); // skip whitespace after it SkipSpacesAndLineEnd( &content); } @@ -2007,7 +2007,7 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector& pPer { // read a value. // Hack: (thom) Some exporters put negative indices sometimes. We just try to carry on anyways. - int value = std::max( 0, strtol10s( content, &content)); + int value = std::max( 0, strtol10( content, &content)); indices.push_back( size_t( value)); // skip whitespace after it SkipSpacesAndLineEnd( &content); diff --git a/code/DXFHelper.h b/code/DXFHelper.h index c0e3f3ed9..9eb0908fc 100644 --- a/code/DXFHelper.h +++ b/code/DXFHelper.h @@ -99,12 +99,12 @@ public: // ----------------------------------------- unsigned int ValueAsUnsignedInt() const { - return strtol10(value.c_str()); + return strtoul10(value.c_str()); } // ----------------------------------------- int ValueAsSignedInt() const { - return strtol10s(value.c_str()); + return strtol10(value.c_str()); } // ----------------------------------------- @@ -125,7 +125,7 @@ public: } try { - groupcode = strtol10s(splitter->c_str()); + groupcode = strtol10(splitter->c_str()); splitter++; value = *splitter; diff --git a/code/IRRLoader.cpp b/code/IRRLoader.cpp index e5e52b240..4889a6c34 100644 --- a/code/IRRLoader.cpp +++ b/code/IRRLoader.cpp @@ -1073,7 +1073,7 @@ void IRRImporter::InternReadFile( const std::string& pFile, // and parse its properties key.mValue = prop.value; - key.mTime = strtol10(&prop.name[5]); + key.mTime = strtoul10(&prop.name[5]); } } else if (curAnim->type == Animator::FLY_CIRCLE) { diff --git a/code/IRRMeshLoader.cpp b/code/IRRMeshLoader.cpp index 0c8f33c64..6966e0259 100644 --- a/code/IRRMeshLoader.cpp +++ b/code/IRRMeshLoader.cpp @@ -320,7 +320,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile, curNormals.push_back(temp); // read the vertex colors - uint32_t clr = strtol16(sz,&sz); + uint32_t clr = strtoul16(sz,&sz); ColorFromARGBPacked(clr,c); if (!curColors.empty() && c != *(curColors.end()-1)) @@ -411,7 +411,7 @@ void IRRMeshImporter::InternReadFile( const std::string& pFile, curFace->mIndices = new unsigned int[3]; } - unsigned int idx = strtol10(sz,&sz); + unsigned int idx = strtoul10(sz,&sz); if (idx >= curVertices.size()) { DefaultLogger::get()->error("IRRMESH: Index out of range"); idx = 0; diff --git a/code/IRRShared.cpp b/code/IRRShared.cpp index 3baf2f433..cf1b82848 100644 --- a/code/IRRShared.cpp +++ b/code/IRRShared.cpp @@ -73,7 +73,7 @@ void IrrlichtBase::ReadHexProperty (HexProperty& out) else if (!ASSIMP_stricmp(reader->getAttributeName(i),"value")) { // parse the hexadecimal value - out.value = strtol16(reader->getAttributeValue(i)); + out.value = strtoul16(reader->getAttributeValue(i)); } } } @@ -91,7 +91,7 @@ void IrrlichtBase::ReadIntProperty (IntProperty& out) else if (!ASSIMP_stricmp(reader->getAttributeName(i),"value")) { // parse the ecimal value - out.value = strtol10s(reader->getAttributeValue(i)); + out.value = strtol10(reader->getAttributeValue(i)); } } } diff --git a/code/LWSLoader.cpp b/code/LWSLoader.cpp index ca75f49dc..f05aa5223 100644 --- a/code/LWSLoader.cpp +++ b/code/LWSLoader.cpp @@ -177,7 +177,7 @@ void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill ) // reserve enough storage std::list< LWS::Element >::const_iterator it = dad.children.begin();; - fill.keys.reserve(strtol10(it->tokens[1].c_str())); + fill.keys.reserve(strtoul10(it->tokens[1].c_str())); for (++it; it != dad.children.end(); ++it) { const char* c = (*it).tokens[1].c_str(); @@ -194,7 +194,7 @@ void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill ) key.time = f; - unsigned int span = strtol10(c,&c), num = 0; + unsigned int span = strtoul10(c,&c), num = 0; switch (span) { case 0: @@ -228,9 +228,9 @@ void LWSImporter::ReadEnvelope(const LWS::Element& dad, LWO::Envelope& fill ) } else if ((*it).tokens[0] == "Behaviors") { SkipSpaces(&c); - fill.pre = (LWO::PrePostBehaviour) strtol10(c,&c); + fill.pre = (LWO::PrePostBehaviour) strtoul10(c,&c); SkipSpaces(&c); - fill.post = (LWO::PrePostBehaviour) strtol10(c,&c); + fill.post = (LWO::PrePostBehaviour) strtoul10(c,&c); } } } @@ -246,7 +246,7 @@ void LWSImporter::ReadEnvelope_Old( unsigned int num,sub_num; if (++it == end)goto unexpected_end; - num = strtol10((*it).tokens[0].c_str()); + num = strtoul10((*it).tokens[0].c_str()); for (unsigned int i = 0; i < num; ++i) { nodes.channels.push_back(LWO::Envelope()); @@ -256,7 +256,7 @@ void LWSImporter::ReadEnvelope_Old( envl.type = (LWO::EnvelopeType)(i+1); if (++it == end)goto unexpected_end; - sub_num = strtol10((*it).tokens[0].c_str()); + sub_num = strtoul10((*it).tokens[0].c_str()); for (unsigned int n = 0; n < sub_num;++n) { @@ -504,7 +504,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, // get file format version and print to log ++it; - unsigned int version = strtol10((*it).tokens[0].c_str()); + unsigned int version = strtoul10((*it).tokens[0].c_str()); DefaultLogger::get()->info("LWS file format version is " + (*it).tokens[0]); first = 0.; last = 60.; @@ -517,25 +517,25 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, // 'FirstFrame': begin of animation slice if ((*it).tokens[0] == "FirstFrame") { if (150392. != first /* see SetupProperties() */) - first = strtol10(c,&c)-1.; /* we're zero-based */ + first = strtoul10(c,&c)-1.; /* we're zero-based */ } // 'LastFrame': end of animation slice else if ((*it).tokens[0] == "LastFrame") { if (150392. != last /* see SetupProperties() */) - last = strtol10(c,&c)-1.; /* we're zero-based */ + last = strtoul10(c,&c)-1.; /* we're zero-based */ } // 'FramesPerSecond': frames per second else if ((*it).tokens[0] == "FramesPerSecond") { - fps = strtol10(c,&c); + fps = strtoul10(c,&c); } // 'LoadObjectLayer': load a layer of a specific LWO file else if ((*it).tokens[0] == "LoadObjectLayer") { // get layer index - const int layer = strtol10(c,&c); + const int layer = strtoul10(c,&c); // setup the layer to be loaded BatchLoader::PropertyMap props; @@ -546,7 +546,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, d.type = LWS::NodeDesc::OBJECT; if (version >= 4) { // handle LWSC 4 explicit ID SkipSpaces(&c); - d.number = strtol16(c,&c) & AI_LWS_MASK; + d.number = strtoul16(c,&c) & AI_LWS_MASK; } else d.number = cur_object++; @@ -567,7 +567,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, d.type = LWS::NodeDesc::OBJECT; if (version >= 4) { // handle LWSC 4 explicit ID - d.number = strtol16(c,&c) & AI_LWS_MASK; + d.number = strtoul16(c,&c) & AI_LWS_MASK; SkipSpaces(&c); } else d.number = cur_object++; @@ -586,7 +586,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, d.type = LWS::NodeDesc::OBJECT; d.name = c; if (version >= 4) { // handle LWSC 4 explicit ID - d.number = strtol16(c,&c) & AI_LWS_MASK; + d.number = strtoul16(c,&c) & AI_LWS_MASK; } else d.number = cur_object++; nodes.push_back(d); @@ -616,7 +616,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, nodes.back().channels.push_back(LWO::Envelope()); LWO::Envelope& env = nodes.back().channels.back(); - env.index = strtol10(c); + env.index = strtoul10(c); // currently we can just interpret the standard channels 0...9 // (hack) assume that index-i yields the binary channel type from LWO @@ -650,8 +650,8 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, for (std::list::iterator it = nodes.back().channels.begin(); it != nodes.back().channels.end(); ++it) { // two ints per envelope LWO::Envelope& env = *it; - env.pre = (LWO::PrePostBehaviour) strtol10(c,&c); SkipSpaces(&c); - env.post = (LWO::PrePostBehaviour) strtol10(c,&c); SkipSpaces(&c); + env.pre = (LWO::PrePostBehaviour) strtoul10(c,&c); SkipSpaces(&c); + env.post = (LWO::PrePostBehaviour) strtoul10(c,&c); SkipSpaces(&c); } } } @@ -660,7 +660,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, if (nodes.empty()) DefaultLogger::get()->error("LWS: Unexpected keyword: \'ParentItem\'"); - else nodes.back().parent = strtol16(c,&c); + else nodes.back().parent = strtoul16(c,&c); } // 'ParentObject': deprecated one for older formats else if (version < 3 && (*it).tokens[0] == "ParentObject") { @@ -668,7 +668,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, DefaultLogger::get()->error("LWS: Unexpected keyword: \'ParentObject\'"); else { - nodes.back().parent = strtol10(c,&c) | (1u << 28u); + nodes.back().parent = strtoul10(c,&c) | (1u << 28u); } } // 'AddCamera': add a camera to the scenegraph @@ -679,7 +679,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, d.type = LWS::NodeDesc::CAMERA; if (version >= 4) { // handle LWSC 4 explicit ID - d.number = strtol16(c,&c) & AI_LWS_MASK; + d.number = strtoul16(c,&c) & AI_LWS_MASK; } else d.number = cur_camera++; nodes.push_back(d); @@ -701,7 +701,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, d.type = LWS::NodeDesc::LIGHT; if (version >= 4) { // handle LWSC 4 explicit ID - d.number = strtol16(c,&c) & AI_LWS_MASK; + d.number = strtoul16(c,&c) & AI_LWS_MASK; } else d.number = cur_light++; nodes.push_back(d); @@ -728,7 +728,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightType\'"); - else nodes.back().lightType = strtol10(c); + else nodes.back().lightType = strtoul10(c); } // 'LightFalloffType': set falloff type of currently active light @@ -736,7 +736,7 @@ void LWSImporter::InternReadFile( const std::string& pFile, aiScene* pScene, if (nodes.empty() || nodes.back().type != LWS::NodeDesc::LIGHT) DefaultLogger::get()->error("LWS: Unexpected keyword: \'LightFalloffType\'"); - else nodes.back().lightFalloffType = strtol10(c); + else nodes.back().lightFalloffType = strtoul10(c); } // 'LightConeAngle': set cone angle of currently active light diff --git a/code/MD5Parser.cpp b/code/MD5Parser.cpp index d8a85bf9f..e8961aa20 100644 --- a/code/MD5Parser.cpp +++ b/code/MD5Parser.cpp @@ -114,7 +114,7 @@ void MD5Parser::ParseHeader() ReportError("Invalid MD5 file: MD5Version tag has not been found"); } SkipSpaces(); - unsigned int iVer = ::strtol10(buffer,(const char**)&buffer); + unsigned int iVer = ::strtoul10(buffer,(const char**)&buffer); if (10 != iVer) { ReportError("MD5 version tag is unknown (10 is expected)"); } @@ -233,10 +233,10 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) // now parse all sections for (SectionList::const_iterator iter = mSections.begin(), iterEnd = mSections.end();iter != iterEnd;++iter){ if ( (*iter).mName == "numMeshes") { - mMeshes.reserve(::strtol10((*iter).mGlobalValue.c_str())); + mMeshes.reserve(::strtoul10((*iter).mGlobalValue.c_str())); } else if ( (*iter).mName == "numJoints") { - mJoints.reserve(::strtol10((*iter).mGlobalValue.c_str())); + mJoints.reserve(::strtoul10((*iter).mGlobalValue.c_str())); } else if ((*iter).mName == "joints") { // "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 ) @@ -249,7 +249,7 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) AI_MD5_SKIP_SPACES(); // negative values, at least -1, is allowed here - desc.mParentIndex = (int)strtol10s(sz,&sz); + desc.mParentIndex = (int)strtol10(sz,&sz); AI_MD5_READ_TRIPLE(desc.mPositionXYZ); AI_MD5_READ_TRIPLE(desc.mRotationQuat); // normalized quaternion, so w is not there @@ -270,23 +270,23 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) // numverts attribute else if (TokenMatch(sz,"numverts",8)) { AI_MD5_SKIP_SPACES(); - desc.mVertices.resize(strtol10(sz)); + desc.mVertices.resize(strtoul10(sz)); } // numtris attribute else if (TokenMatch(sz,"numtris",7)) { AI_MD5_SKIP_SPACES(); - desc.mFaces.resize(strtol10(sz)); + desc.mFaces.resize(strtoul10(sz)); } // numweights attribute else if (TokenMatch(sz,"numweights",10)) { AI_MD5_SKIP_SPACES(); - desc.mWeights.resize(strtol10(sz)); + desc.mWeights.resize(strtoul10(sz)); } // vert attribute // "vert 0 ( 0.394531 0.513672 ) 0 1" else if (TokenMatch(sz,"vert",4)) { AI_MD5_SKIP_SPACES(); - const unsigned int idx = ::strtol10(sz,&sz); + const unsigned int idx = ::strtoul10(sz,&sz); AI_MD5_SKIP_SPACES(); if (idx >= desc.mVertices.size()) desc.mVertices.resize(idx+1); @@ -302,15 +302,15 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) if (')' != *sz++) MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); AI_MD5_SKIP_SPACES(); - vert.mFirstWeight = ::strtol10(sz,&sz); + vert.mFirstWeight = ::strtoul10(sz,&sz); AI_MD5_SKIP_SPACES(); - vert.mNumWeights = ::strtol10(sz,&sz); + vert.mNumWeights = ::strtoul10(sz,&sz); } // tri attribute // "tri 0 15 13 12" else if (TokenMatch(sz,"tri",3)) { AI_MD5_SKIP_SPACES(); - const unsigned int idx = strtol10(sz,&sz); + const unsigned int idx = strtoul10(sz,&sz); if (idx >= desc.mFaces.size()) desc.mFaces.resize(idx+1); @@ -318,20 +318,20 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) face.mIndices = new unsigned int[face.mNumIndices = 3]; for (unsigned int i = 0; i < 3;++i) { AI_MD5_SKIP_SPACES(); - face.mIndices[i] = strtol10(sz,&sz); + face.mIndices[i] = strtoul10(sz,&sz); } } // weight attribute // "weight 362 5 0.500000 ( -3.553583 11.893474 9.719339 )" else if (TokenMatch(sz,"weight",6)) { AI_MD5_SKIP_SPACES(); - const unsigned int idx = strtol10(sz,&sz); + const unsigned int idx = strtoul10(sz,&sz); AI_MD5_SKIP_SPACES(); if (idx >= desc.mWeights.size()) desc.mWeights.resize(idx+1); WeightDesc& weight = desc.mWeights[idx]; - weight.mBone = strtol10(sz,&sz); + weight.mBone = strtoul10(sz,&sz); AI_MD5_SKIP_SPACES(); sz = fast_atof_move(sz,weight.mWeight); AI_MD5_READ_TRIPLE(weight.vOffsetPosition); @@ -362,17 +362,17 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) AI_MD5_SKIP_SPACES(); // parent index - negative values are allowed (at least -1) - desc.mParentIndex = ::strtol10s(sz,&sz); + desc.mParentIndex = ::strtol10(sz,&sz); // flags (highest is 2^6-1) AI_MD5_SKIP_SPACES(); - if(63 < (desc.iFlags = ::strtol10(sz,&sz))){ + if(63 < (desc.iFlags = ::strtoul10(sz,&sz))){ MD5Parser::ReportWarning("Invalid flag combination in hierarchy section",(*eit).iLineNumber); } AI_MD5_SKIP_SPACES(); // index of the first animation keyframe component for this joint - desc.iFirstKeyIndex = ::strtol10(sz,&sz); + desc.iFirstKeyIndex = ::strtoul10(sz,&sz); } } else if((*iter).mName == "baseframe") { @@ -395,7 +395,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) mFrames.push_back ( FrameDesc () ); FrameDesc& desc = mFrames.back(); - desc.iIndex = strtol10((*iter).mGlobalValue.c_str()); + desc.iIndex = strtoul10((*iter).mGlobalValue.c_str()); // we do already know how much storage we will presumably need if (0xffffffff != mNumAnimatedComponents) @@ -411,10 +411,10 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) } } else if((*iter).mName == "numFrames") { - mFrames.reserve(strtol10((*iter).mGlobalValue.c_str())); + mFrames.reserve(strtoul10((*iter).mGlobalValue.c_str())); } else if((*iter).mName == "numJoints") { - const unsigned int num = strtol10((*iter).mGlobalValue.c_str()); + const unsigned int num = strtoul10((*iter).mGlobalValue.c_str()); mAnimatedBones.reserve(num); // try to guess the number of animated components if that element is not given @@ -422,7 +422,7 @@ MD5AnimParser::MD5AnimParser(SectionList& mSections) mNumAnimatedComponents = num * 6; } else if((*iter).mName == "numAnimatedComponents") { - mAnimatedBones.reserve( strtol10((*iter).mGlobalValue.c_str())); + mAnimatedBones.reserve( strtoul10((*iter).mGlobalValue.c_str())); } else if((*iter).mName == "frameRate") { fast_atof_move((*iter).mGlobalValue.c_str(),fFrameRate); @@ -440,17 +440,17 @@ MD5CameraParser::MD5CameraParser(SectionList& mSections) for (SectionList::const_iterator iter = mSections.begin(), iterEnd = mSections.end();iter != iterEnd;++iter) { if ((*iter).mName == "numFrames") { - frames.reserve(strtol10((*iter).mGlobalValue.c_str())); + frames.reserve(strtoul10((*iter).mGlobalValue.c_str())); } else if ((*iter).mName == "frameRate") { fFrameRate = fast_atof ((*iter).mGlobalValue.c_str()); } else if ((*iter).mName == "numCuts") { - cuts.reserve(strtol10((*iter).mGlobalValue.c_str())); + cuts.reserve(strtoul10((*iter).mGlobalValue.c_str())); } else if ((*iter).mName == "cuts") { for (ElementList::const_iterator eit = (*iter).mElements.begin(), eitEnd = (*iter).mElements.end(); eit != eitEnd; ++eit){ - cuts.push_back(strtol10((*eit).szStart)+1); + cuts.push_back(strtoul10((*eit).szStart)+1); } } else if ((*iter).mName == "camera") { diff --git a/code/MaterialSystem.cpp b/code/MaterialSystem.cpp index 0b5125739..e83a5905c 100644 --- a/code/MaterialSystem.cpp +++ b/code/MaterialSystem.cpp @@ -209,7 +209,7 @@ aiReturn aiGetMaterialIntegerArray(const aiMaterial* pMat, const char* cur = prop->mData+4; ai_assert(prop->mDataLength>=5 && !prop->mData[prop->mDataLength-1]); for (unsigned int a = 0; ;++a) { - pOut[a] = strtol10s(cur,&cur); + pOut[a] = strtol10(cur,&cur); if(a==iWrite-1) { break; } diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index 9eff9760e..16d715085 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -359,7 +359,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, } // read the numbr of vertices - unsigned int num = ::strtol10(sz,&sz); + unsigned int num = ::strtoul10(sz,&sz); // temporary storage std::vector tempColors; @@ -388,7 +388,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, if (TokenMatch(sz,"0x",2)) { hasColor = true; - register unsigned int numIdx = ::strtol16(sz,&sz); + register unsigned int numIdx = ::strtoul16(sz,&sz); aiColor4D clr; clr.a = 1.f; @@ -429,7 +429,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF2_GET_NEXT_TOKEN(); if (!num)throw DeadlyImportError("NFF2: There are zero vertices"); - num = ::strtol10(sz,&sz); + num = ::strtoul10(sz,&sz); std::vector tempIdx; tempIdx.reserve(10); @@ -437,7 +437,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, { AI_NFF2_GET_NEXT_TOKEN(); SkipSpaces(line,&sz); - unsigned int numIdx = ::strtol10(sz,&sz); + unsigned int numIdx = ::strtoul10(sz,&sz); // read all faces indices if (numIdx) @@ -449,7 +449,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, for (unsigned int a = 0; a < numIdx;++a) { SkipSpaces(sz,&sz); - m = ::strtol10(sz,&sz); + m = ::strtoul10(sz,&sz); if (m >= (unsigned int)tempPositions.size()) { DefaultLogger::get()->error("NFF2: Vertex index overflow"); @@ -477,7 +477,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, { hasColor = true; const char* sz2 = sz; - numIdx = ::strtol16(sz,&sz); + numIdx = ::strtoul16(sz,&sz); const unsigned int diff = (unsigned int)(sz-sz2); // 0xRRGGBB @@ -555,7 +555,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, else if (!materialTable.empty() && TokenMatch(sz,"matid",5)) { SkipSpaces(&sz); - matIdx = ::strtol10(sz,&sz); + matIdx = ::strtoul10(sz,&sz); if (matIdx >= materialTable.size()) { DefaultLogger::get()->error("NFF2: Material index overflow."); @@ -718,7 +718,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, sz = &line[1];out = currentMesh; } SkipSpaces(sz,&sz); - m = strtol10(sz); + m = strtoul10(sz); // ---- flip the face order out->vertices.resize(out->vertices.size()+m); @@ -977,7 +977,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, else if (TokenMatch(sz,"tess",4)) { SkipSpaces(&sz); - iTesselation = strtol10(sz); + iTesselation = strtoul10(sz); } // 'from' - camera position else if (TokenMatch(sz,"from",4)) diff --git a/code/OFFLoader.cpp b/code/OFFLoader.cpp index c0c67d235..ef574dee2 100644 --- a/code/OFFLoader.cpp +++ b/code/OFFLoader.cpp @@ -111,8 +111,8 @@ void OFFImporter::InternReadFile( const std::string& pFile, } const char* sz = line; SkipSpaces(&sz); - const unsigned int numVertices = strtol10(sz,&sz);SkipSpaces(&sz); - const unsigned int numFaces = strtol10(sz,&sz); + const unsigned int numVertices = strtoul10(sz,&sz);SkipSpaces(&sz); + const unsigned int numFaces = strtoul10(sz,&sz); pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes = 1 ]; aiMesh* mesh = pScene->mMeshes[0] = new aiMesh(); @@ -147,7 +147,7 @@ void OFFImporter::InternReadFile( const std::string& pFile, break; } sz = line;SkipSpaces(&sz); - if(!(faces->mNumIndices = strtol10(sz,&sz)) || faces->mNumIndices > 9) + if(!(faces->mNumIndices = strtoul10(sz,&sz)) || faces->mNumIndices > 9) { DefaultLogger::get()->error("OFF: Faces with zero indices aren't allowed"); --mesh->mNumFaces; @@ -171,14 +171,14 @@ void OFFImporter::InternReadFile( const std::string& pFile, unsigned int idx; sz = line;SkipSpaces(&sz); - if(!(idx = strtol10(sz,&sz)) || idx > 9) + if(!(idx = strtoul10(sz,&sz)) || idx > 9) continue; faces->mIndices = new unsigned int [faces->mNumIndices]; for (unsigned int m = 0; m < faces->mNumIndices;++m) { SkipSpaces(&sz); - if ((idx = strtol10(sz,&sz)) >= numVertices) + if ((idx = strtoul10(sz,&sz)) >= numVertices) { DefaultLogger::get()->error("OFF: Vertex index is out of range"); idx = numVertices-1; diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 4e6b9bb61..b6302cd29 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -386,7 +386,7 @@ bool PLY::Element::ParseElement (const char* pCur, if (!SkipSpaces(&pCur))return false; //parse the number of occurences of this element - pOut->NumOccur = strtol10(pCur,&pCur); + pOut->NumOccur = strtoul10(pCur,&pCur); // go to the next line SkipSpacesAndLineEnd(pCur,&pCur); @@ -799,14 +799,14 @@ bool PLY::PropertyInstance::ParseValue( case EDT_UShort: case EDT_UChar: - out->iUInt = (uint32_t)strtol10(pCur, &pCur); + out->iUInt = (uint32_t)strtoul10(pCur, &pCur); break; case EDT_Int: case EDT_Short: case EDT_Char: - out->iInt = (int32_t)strtol10s(pCur, &pCur); + out->iInt = (int32_t)strtol10(pCur, &pCur); break; case EDT_Float: diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 2092b312b..d2f7c607b 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -680,7 +680,7 @@ void SMDImporter::ParseFile() if (TokenMatch(szCurrent,"version",7)) { if(!SkipSpaces(szCurrent,&szCurrent)) break; - if (1 != strtol10(szCurrent,&szCurrent)) + if (1 != strtoul10(szCurrent,&szCurrent)) { DefaultLogger::get()->warn("SMD.version is not 1. This " "file format is not known. Continuing happily ..."); @@ -1030,7 +1030,7 @@ bool SMDImporter::ParseUnsignedInt(const char* szCurrent, if(!SkipSpaces(&szCurrent)) return false; - out = strtol10(szCurrent,szCurrentOut); + out = strtoul10(szCurrent,szCurrentOut); return true; } @@ -1042,7 +1042,7 @@ bool SMDImporter::ParseSignedInt(const char* szCurrent, if(!SkipSpaces(&szCurrent)) return false; - out = strtol10s(szCurrent,szCurrentOut); + out = strtol10(szCurrent,szCurrentOut); return true; } diff --git a/code/SceneCombiner.cpp b/code/SceneCombiner.cpp index 49494240b..e929b953d 100644 --- a/code/SceneCombiner.cpp +++ b/code/SceneCombiner.cpp @@ -404,7 +404,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master, aiString& s = *((aiString*)prop->mData); if ('*' == s.data[0]) { // Offset the index and write it back .. - const unsigned int idx = strtol10(&s.data[1]) + offset[n]; + const unsigned int idx = strtoul10(&s.data[1]) + offset[n]; ASSIMP_itoa10(&s.data[1],sizeof(s.data)-1,idx); } } diff --git a/code/UnrealLoader.cpp b/code/UnrealLoader.cpp index 05565c132..9ddf32712 100644 --- a/code/UnrealLoader.cpp +++ b/code/UnrealLoader.cpp @@ -265,7 +265,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile, for (;!IsLineEnd(*data);++data) { if (!::ASSIMP_strincmp(data,"NUM=",4)) { data += 4; - me.first = strtol10(data,&data); + me.first = strtoul10(data,&data); } else if (!::ASSIMP_strincmp(data,"TEXTURE=",8)) { data += 8; diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 3fef9781f..d548f0a2b 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -1286,7 +1286,7 @@ unsigned int XFileParser::ReadInt() { FindNextNoneWhiteSpace(); - // TODO: consider using strtol10s instead??? + // TODO: consider using strtol10 instead??? // check preceeding minus sign bool isNegative = false; diff --git a/code/fast_atof.h b/code/fast_atof.h index d2ae01849..1b64ec97a 100644 --- a/code/fast_atof.h +++ b/code/fast_atof.h @@ -7,7 +7,7 @@ // Adapted to the ASSIMP library because the builtin atof indeed takes AGES to parse a // float inside a large string. Before parsing, it does a strlen on the given point. // Changes: -// 22nd October 08 (Aramis_acg): Added temporary cast to double, added strtol10_64 +// 22nd October 08 (Aramis_acg): Added temporary cast to double, added strtoul10_64 // to ensure long numbers are handled correctly // ------------------------------------------------------------------------------------ @@ -43,7 +43,7 @@ const float fast_atof_table[16] = { // we write [16] here instead of [] to work // ------------------------------------------------------------------------------------ // Convert a string in decimal format to a number // ------------------------------------------------------------------------------------ -inline unsigned int strtol10( const char* in, const char** out=0) +inline unsigned int strtoul10( const char* in, const char** out=0) { unsigned int value = 0; @@ -63,7 +63,7 @@ inline unsigned int strtol10( const char* in, const char** out=0) // ------------------------------------------------------------------------------------ // Convert a string in octal format to a number // ------------------------------------------------------------------------------------ -inline unsigned int strtol8( const char* in, const char** out=0) +inline unsigned int strtoul8( const char* in, const char** out=0) { unsigned int value = 0; @@ -83,7 +83,7 @@ inline unsigned int strtol8( const char* in, const char** out=0) // ------------------------------------------------------------------------------------ // Convert a string in hex format to a number // ------------------------------------------------------------------------------------ -inline unsigned int strtol16( const char* in, const char** out=0) +inline unsigned int strtoul16( const char* in, const char** out=0) { unsigned int value = 0; @@ -140,15 +140,15 @@ inline uint8_t HexOctetToDecimal(const char* in) // ------------------------------------------------------------------------------------ -// signed variant of strtol10 +// signed variant of strtoul10 // ------------------------------------------------------------------------------------ -inline int strtol10s( const char* in, const char** out=0) +inline int strtol10( const char* in, const char** out=0) { bool inv = (*in=='-'); if (inv || *in=='+') ++in; - int value = strtol10(in,out); + int value = strtoul10(in,out); if (inv) { value = -value; } @@ -161,20 +161,20 @@ inline int strtol10s( const char* in, const char** out=0) // 0NNN - oct // NNN - dec // ------------------------------------------------------------------------------------ -inline unsigned int strtol_cppstyle( const char* in, const char** out=0) +inline unsigned int strtoul_cppstyle( const char* in, const char** out=0) { if ('0' == in[0]) { - return 'x' == in[1] ? strtol16(in+2,out) : strtol8(in+1,out); + return 'x' == in[1] ? strtoul16(in+2,out) : strtoul8(in+1,out); } - return strtol10(in, out); + return strtoul10(in, out); } // ------------------------------------------------------------------------------------ // Special version of the function, providing higher accuracy and safety // It is mainly used by fast_atof to prevent ugly and unwanted integer overflows. // ------------------------------------------------------------------------------------ -inline uint64_t strtol10_64( const char* in, const char** out=0, unsigned int* max_inout=0) +inline uint64_t strtoul10_64( const char* in, const char** out=0, unsigned int* max_inout=0) { unsigned int cur = 0; uint64_t value = 0; @@ -231,7 +231,7 @@ inline const char* fast_atof_move( const char* c, float& out) if (inv || *c=='+') ++c; - f = (float) strtol10_64 ( c, &c); + f = (float) strtoul10_64 ( c, &c); if (*c == '.' || (c[0] == ',' && (c[1] >= '0' || c[1] <= '9'))) // allow for commas, too { ++c; @@ -245,7 +245,7 @@ inline const char* fast_atof_move( const char* c, float& out) // number of digits to be read. AI_FAST_ATOF_RELAVANT_DECIMALS can be a value between // 1 and 15. unsigned int diff = AI_FAST_ATOF_RELAVANT_DECIMALS; - double pl = (double) strtol10_64 ( c, &c, &diff ); + double pl = (double) strtoul10_64 ( c, &c, &diff ); pl *= fast_atof_table[diff]; f += (float)pl; @@ -260,7 +260,7 @@ inline const char* fast_atof_move( const char* c, float& out) if (einv || *c=='+') ++c; - float exp = (float)strtol10_64(c, &c); + float exp = (float)strtoul10_64(c, &c); if (einv) exp *= -1.0f; diff --git a/doc/dox.h b/doc/dox.h index 57c833fd0..d58bea9c9 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -877,7 +877,7 @@ Mixed stuff for internal use by loaders, mostly documented (most of them are alr
  • StreamReader (StreamReader.h) - safe, endianess-correct, binary reading.
  • IrrXML (irrXMLWrapper.h) - for XML-parsing (SAX.
  • CommentRemover (RemoveComments.h) - remove single-line and multi-line comments from a text file.
  • -
  • fast_atof, strtol10, strtol16, SkipSpaceAndLineEnd, SkipToNextToken .. large family of low-level +
  • fast_atof, strtoul10, strtoul16, SkipSpaceAndLineEnd, SkipToNextToken .. large family of low-level parsing functions, mostly declared in fast_atof.h, StringComparison.h and ParsingUtils.h (a collection that grew historically, so don't expect perfect organization).
  • ComputeNormalsWithSmoothingsGroups() (SmoothingGroups.h) - Computes normal vectors from plain old smoothing groups.