Skip to content

Commit 84eafc0

Browse files
author
devsh
committed
correct parsing mistakes
1 parent ab95861 commit 84eafc0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

include/nbl/asset/interchange/IGeometryLoader.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class IGeometryLoader : public IAssetLoader
2121
virtual inline uint64_t getSupportedAssetTypesBitfield() const override {return IAsset::ET_GEOMETRY;}
2222

2323
protected:
24-
IGeometryLoader() {}
25-
virtual ~IGeometryLoader() = 0;
24+
inline IGeometryLoader() {}
2625

2726
private:
2827
};

src/nbl/asset/interchange/CPLYMeshFileLoader.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct SContext
209209
}
210210
else
211211
{
212-
LineEndPointer = terminator;
212+
LineEndPointer = terminator-1;
213213
WordLength = -1;
214214
// return pointer to the start of the line
215215
return StartPointer;
@@ -236,14 +236,14 @@ struct SContext
236236
auto wordEnd = std::find_first_of(StartPointer,LineEndPointer,WhiteSpace.begin(),WhiteSpace.end());
237237
// null terminate the next word
238238
if (wordEnd!=LineEndPointer)
239-
*wordEnd = '\0';
239+
*(wordEnd++) = '\0';
240240
// find next word
241241
auto notWhiteSpace = [WhiteSpace](const char c)->bool
242242
{
243-
return std::find(WhiteSpace.begin(),WhiteSpace.end(),c)!=WhiteSpace.end();
243+
return std::find(WhiteSpace.begin(),WhiteSpace.end(),c)==WhiteSpace.end();
244244
};
245245
auto nextWord = std::find_if(wordEnd,LineEndPointer,notWhiteSpace);
246-
WordLength = std::distance(StartPointer,wordEnd)-1;
246+
WordLength = std::distance(StartPointer,nextWord)-1;
247247
}
248248
// return pointer to the start of current word
249249
return StartPointer;
@@ -618,7 +618,7 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
618618
{
619619
word = ctx.getNextWord();
620620

621-
if (!ctx.ElementList.empty())
621+
if (ctx.ElementList.empty())
622622
{
623623
_params.logger.log("PLY property token found before element %s", system::ILogger::ELL_WARNING, word);
624624
}
@@ -691,7 +691,10 @@ SAssetBundle CPLYMeshFileLoader::loadAsset(system::IFile* _file, const IAssetLoa
691691
ctx.IsBinaryFile = true;
692692
ctx.IsWrongEndian = true;
693693
}
694-
else if (strcmp(word, "ascii"))
694+
else if (strcmp(word, "ascii")==0)
695+
{
696+
}
697+
else
695698
{
696699
// abort if this isn't an ascii or a binary mesh
697700
_params.logger.log("Unsupported PLY mesh format %s", system::ILogger::ELL_ERROR, word);

0 commit comments

Comments
 (0)