mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-18 03:06:06 -04:00
More constness in SafeBuf
This commit is contained in:
14
SafeBuf.cpp
14
SafeBuf.cpp
@ -1572,7 +1572,7 @@ bool SafeBuf::printTimeAgo ( int32_t ago , int32_t now , bool shorthand ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SafeBuf::hasDigits() {
|
||||
bool SafeBuf::hasDigits() const {
|
||||
if ( m_length <= 0 ) return false;
|
||||
for ( int32_t i = 0 ; i < m_length ; i++ )
|
||||
if ( is_digit(m_buf[i]) ) return true;
|
||||
@ -1580,10 +1580,12 @@ bool SafeBuf::hasDigits() {
|
||||
}
|
||||
|
||||
|
||||
int32_t SafeBuf::indexOf(char c) {
|
||||
char* p = m_buf;
|
||||
char* pend = m_buf + m_length;
|
||||
while (p < pend && *p != c) p++;
|
||||
if (p == pend) return -1;
|
||||
int32_t SafeBuf::indexOf(char c) const {
|
||||
const char *p = m_buf;
|
||||
const char *pend = m_buf + m_length;
|
||||
while (p < pend && *p != c)
|
||||
p++;
|
||||
if(p == pend)
|
||||
return -1;
|
||||
return p - m_buf;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
bool brify( const char *s, int32_t slen, int32_t cols, const char *sep = "<br>",
|
||||
bool isHtml = true );
|
||||
|
||||
bool hasDigits();
|
||||
bool hasDigits() const;
|
||||
|
||||
// . like "1 minute ago" "5 hours ago" "3 days ago" etc.
|
||||
// . "ts" is the delta-t in seconds
|
||||
@ -221,7 +221,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t indexOf(char c);
|
||||
int32_t indexOf(char c) const;
|
||||
|
||||
bool safeCdataMemcpy(const char *s, int32_t len);
|
||||
bool pushChar (char i) {
|
||||
|
Reference in New Issue
Block a user