Fix some minor bugs
parent
dc1f9b2fab
commit
7697d8c3de
|
@ -155,7 +155,7 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp
|
|||
mSkip_empty_lines(skip_empty_lines),
|
||||
mTrim(trim) {
|
||||
mCur.reserve(1024);
|
||||
mEnd = mCur.c_str() + 1024;
|
||||
mEnd = mCur.c_str() + mCur.size();
|
||||
operator++();
|
||||
mIdx = 0;
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
|
|||
|
||||
char s;
|
||||
mCur.clear();
|
||||
mEnd = mCur.c_str() + mCur.size();
|
||||
while (mStream.GetRemainingSize() && (s = mStream.GetI1(), 1)) {
|
||||
if (s == '\n' || s == '\r') {
|
||||
if (mSkip_empty_lines) {
|
||||
|
@ -194,6 +195,7 @@ AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
|
|||
break;
|
||||
}
|
||||
mCur += s;
|
||||
mEnd = mCur.c_str() + mCur.size();
|
||||
}
|
||||
++mIdx;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ AI_FORCE_INLINE bool SkipSpaces(const char_t *in, const char_t **out, const char
|
|||
++in;
|
||||
}
|
||||
*out = in;
|
||||
return !IsLineEnd<char_t>(*in);
|
||||
return in < end && !IsLineEnd<char_t>(*in);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
@ -128,7 +128,7 @@ AI_FORCE_INLINE bool SkipLine(const char_t *in, const char_t **out, const char_t
|
|||
++in;
|
||||
}
|
||||
*out = in;
|
||||
return *in != (char_t)'\0';
|
||||
return in < end && *in != (char_t)'\0';
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
@ -144,7 +144,7 @@ AI_FORCE_INLINE bool SkipSpacesAndLineEnd(const char_t *in, const char_t **out,
|
|||
++in;
|
||||
}
|
||||
*out = in;
|
||||
return *in != '\0';
|
||||
return in < end && *in != '\0';
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue