Commit e1cd83c8 authored by hybrid's avatar hybrid

Use new strtoul10 method where appropriate.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3674 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 0161971c
......@@ -64,10 +64,10 @@ IImage* CImageLoaderPPM::loadImage(io::IReadFile* file) const
core::stringc token;
getNextToken(file, token);
const u32 width = core::strtol10(token.c_str());
const u32 width = core::strtoul10(token.c_str());
getNextToken(file, token);
const u32 height = core::strtol10(token.c_str());
const u32 height = core::strtoul10(token.c_str());
u8* data = 0;
const u32 size = width*height;
......@@ -106,7 +106,7 @@ IImage* CImageLoaderPPM::loadImage(io::IReadFile* file) const
else
{
getNextToken(file, token);
const u32 maxDepth = core::strtol10(token.c_str());
const u32 maxDepth = core::strtoul10(token.c_str());
if (maxDepth > 255) // no double bytes yet
return 0;
......@@ -144,7 +144,7 @@ IImage* CImageLoaderPPM::loadImage(io::IReadFile* file) const
for (u32 i=0; i<size; ++i)
{
getNextToken(file, token);
const u8 num = (u8)core::strtol10(token.c_str());
const u8 num = (u8)core::strtoul10(token.c_str());
*ptr++ = num;
*ptr++ = num;
*ptr++ = num;
......@@ -186,11 +186,11 @@ IImage* CImageLoaderPPM::loadImage(io::IReadFile* file) const
for (u32 i=0; i<size; ++i)
{
getNextToken(file, token);
*ptr++ = (u8)core::strtol10(token.c_str());
*ptr++ = (u8)core::strtoul10(token.c_str());
getNextToken(file, token);
*ptr++ = (u8)core::strtol10(token.c_str());
*ptr++ = (u8)core::strtoul10(token.c_str());
getNextToken(file, token);
*ptr++ = (u8)core::strtol10(token.c_str());
*ptr++ = (u8)core::strtoul10(token.c_str());
*ptr++ = 255;
}
}
......
......@@ -166,7 +166,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
if (core::stringc("off")==smooth)
smoothingGroup=0;
else
smoothingGroup=core::strtol10(smooth, 0);
smoothingGroup=core::strtoul10(smooth);
}
break;
......@@ -862,10 +862,9 @@ bool COBJMeshFileLoader::retrieveVertexIndices(c8* vertexData, s32* idx, const c
// number is completed. Convert and store it
word[i] = '\0';
// if no number was found index will become 0 and later on -1 by decrement
if (word[0]=='-')
idx[idxType] = core::strtol10(word);
if (idx[idxType]<0)
{
idx[idxType] = core::strtol10(word+1,0);
idx[idxType] *= -1;
switch (idxType)
{
case 0:
......@@ -880,7 +879,7 @@ bool COBJMeshFileLoader::retrieveVertexIndices(c8* vertexData, s32* idx, const c
}
}
else
idx[idxType] = core::strtol10(word,0)-1;
idx[idxType]-=1;
// reset the word
word[0] = '\0';
......
......@@ -423,14 +423,14 @@ bool CXMeshFileLoader::readFileIntoMemory(io::IReadFile* file)
//! read minor and major version, e.g. 0302 or 0303
c8 tmp[3];
tmp[2] = 0x0;
tmp[0] = Buffer[4];
tmp[1] = Buffer[5];
MajorVersion = core::strtol10(tmp);
tmp[2] = 0x0;
MajorVersion = core::strtoul10(tmp);
tmp[0] = Buffer[6];
tmp[1] = Buffer[7];
MinorVersion = core::strtol10(tmp);
MinorVersion = core::strtoul10(tmp);
//! read format
if (strncmp(&Buffer[8], "txt ", 4) ==0)
......@@ -2307,7 +2307,7 @@ u32 CXMeshFileLoader::readInt()
else
{
findNextNoneWhiteSpaceNumber();
return core::strtol10(P, &P);
return core::strtoul10(P, &P);
}
}
......
......@@ -330,7 +330,7 @@ bool GetDMFMaterials(const StringList& RawFile,
materials[i].pathName.replace('\\','/');
materials[i].pathName += "/";
// temp[3] is reserved, temp[4] is the number of texture layers
materials[i].textureLayers = core::strtol10(temp[4].c_str());
materials[i].textureLayers = core::strtoul10(temp[4].c_str());
// Three values are separated by commas
temp1=SubdivideString(temp[5],",");
......@@ -449,7 +449,7 @@ bool GetDMFVerticesFaces(const StringList& RawFile/**<StringList representing a
offs++;
// load vertices
core::array<core::vector3df> pos;
const u32 posCount = core::strtol10(RawFile[offs].c_str());
const u32 posCount = core::strtoul10(RawFile[offs].c_str());
++offs;
pos.reallocate(posCount);
for (u32 i=0; i<posCount; ++i)
......@@ -461,27 +461,27 @@ bool GetDMFVerticesFaces(const StringList& RawFile/**<StringList representing a
++offs;
}
const s32 numFaces=atoi(RawFile[offs].c_str());
const u32 numFaces=core::strtoul10(RawFile[offs].c_str());
offs++;
if(!(wat1[0]=="water" && wat[2]=="0"))
{
for(s32 j=0; j<numFaces; ++j)
for(u32 j=0; j<numFaces; ++j)
{
temp=SubdivideString(RawFile[offs+j],";");
//first value is vertices number for this face
const s32 vert=core::strtol10(temp[0].c_str());
const u32 vert=core::strtoul10(temp[0].c_str());
faces[face_cnt].numVerts=vert;
//second is material ID
faces[face_cnt].materialID=atoi(temp[1].c_str());
faces[face_cnt].materialID=core::strtoul10(temp[1].c_str());
//vertices are ordined
faces[face_cnt].firstVert=vert_cnt;
//now we'll create vertices structure
for(s32 k=0; k<vert; ++k)
for(u32 k=0; k<vert; ++k)
{
//copy position
vertices[vert_cnt].pos.set(pos[core::strtol10(temp[2+k].c_str())]);
vertices[vert_cnt].pos.set(pos[core::strtoul10(temp[2+k].c_str())]);
//get uv coords for tex and light if any
vertices[vert_cnt].tc.set(core::fast_atof(temp[2+vert+(2*k)].c_str()),
core::fast_atof(temp[2+vert+(2*k)+1].c_str()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment