From: Francesco Chemolli Date: Fri, 6 Feb 2015 16:53:38 +0000 (+0100) Subject: Removed default-length parameter from some SBuf functions X-Git-Tag: merge-candidate-3-v1~258^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=976cbfaffb499c95dddc7dcdbb13d0b34fe1bc0a;p=thirdparty%2Fsquid.git Removed default-length parameter from some SBuf functions --- diff --git a/src/SBuf.h b/src/SBuf.h index 7434726126..58af282be8 100644 --- a/src/SBuf.h +++ b/src/SBuf.h @@ -146,7 +146,8 @@ public: * \note it is the caller's responsibility not to go out of bounds * \note bounds is 0 <= pos < length(); caller must pay attention to signedness */ - explicit SBuf(const char *S, size_type n = npos); + explicit SBuf(const char *S, size_type n); + explicit SBuf(const char *S) : SBuf(S,strlen(S)) {} /** Constructor: import SquidString, copying contents. * @@ -181,7 +182,8 @@ public: * \note to assign a std::string use the pattern: * assign(stdstr.data(), stdstd.length()) */ - SBuf& assign(const char *S, size_type n = npos); + SBuf& assign(const char *S, size_type n); + SBuf& assign(const char *S) {return assign(S,strlen(S));} /** Assignment operator. Copy a NULL-terminated c-style string into a SBuf. * @@ -218,7 +220,8 @@ public: * \note to append a std::string use the pattern * cstr_append(stdstr.data(), stdstd.length()) */ - SBuf& append(const char * S, size_type Ssize = npos); + SBuf& append(const char * S, size_type Ssize); + SBuf& append(const char * S) { return append(S,strlen(S)); } /** Assignment operation with printf(3)-style definition * \note arguments may be evaluated more than once, be careful @@ -279,30 +282,48 @@ public: * \retval <0 argument of the call is smaller than called SBuf * \retval 0 argument of the call has the same contents of called SBuf */ - int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const; + int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n) const; + int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive) const { + return compare(S, isCaseSensitive, S.length()); + } /// shorthand version for compare() - inline int cmp(const SBuf &S, const size_type n = npos) const { + inline int cmp(const SBuf &S, const size_type n) const { return compare(S,caseSensitive,n); } + inline int cmp(const SBuf &S) const { + return compare(S,caseSensitive,S.length()); + } /// shorthand version for case-insensitive compare() - inline int caseCmp(const SBuf &S, const size_type n = npos) const { + inline int caseCmp(const SBuf &S, const size_type n) const { return compare(S,caseInsensitive,n); } + inline int caseCmp(const SBuf &S) const { + return compare(S,caseInsensitive,S.length()); + } /// Comparison with a C-string. - int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const; + int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n) const; + int compare(const char *s, const SBufCaseSensitive isCaseSensitive) const { + return compare(s,isCaseSensitive,strlen(s)); + } /// Shorthand version for C-string compare(). - inline int cmp(const char *S, const size_type n = npos) const { + inline int cmp(const char *S, const size_type n) const { return compare(S,caseSensitive,n); } + inline int cmp(const char *S) const { + return compare(S,caseSensitive,strlen(S)); + } /// Shorthand version for case-insensitive C-string compare(). - inline int caseCmp(const char *S, const size_type n = npos) const { + inline int caseCmp(const char *S, const size_type n) const { return compare(S,caseInsensitive,n); } + inline int caseCmp(const char *S) const { + return compare(S,caseInsensitive,strlen(S)); + } /** check whether the entire supplied argument is a prefix of the SBuf. * \param S the prefix to match against