if (startPos > length())
return npos;
- // ignore invalid startPos
- if (startPos < 0)
- startPos = 0;
-
const void *i = memchr(buf()+startPos, (int)c, (size_type)length()-startPos);
if (i == NULL)
return npos;
}
- if (startPos < 0)
- startPos = 0;
-
// std::string allows needle to overhang hay but not start outside
if (startPos > length()) {
++stats.find;
// on npos input std::string compares last octet of hay
if (endPos == npos || endPos >= length()) {
endPos = length();
- } else if (endPos < 0) {
- return npos;
} else {
// NP: off-by-one weirdness:
// endPos is an offset ... 0-based
if (startPos >= length())
return npos;
- if (startPos < 0)
- startPos = 0;
-
if (set.length() == 0)
return npos;
void
SBuf::checkAccessBounds(size_type pos) const
{
- if (pos < 0)
- throw OutOfBoundsException(*this, pos, __FILE__, __LINE__);
if (pos >= length())
throw OutOfBoundsException(*this, pos, __FILE__, __LINE__);
}