]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed copyright statements from SBuf code, pending project policy
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 4 Oct 2013 13:55:21 +0000 (15:55 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 4 Oct 2013 13:55:21 +0000 (15:55 +0200)
Made SBuf::size_type unsigned and adjusted tests accordingly
Add documentation for SBuf::spaceSize

src/MemBlob.cc
src/MemBlob.h
src/SBuf.cc
src/SBuf.h
src/SBufExceptions.cc
src/SBufExceptions.h
src/SquidString.h
src/icmp/Makefile.am
src/tests/SBufFindTest.cc
src/tests/SBufFindTest.h
src/tests/testSBuf.cc

index 4acdb569a8fe9453d167e027d69cec65a1ab9baa..c57d9c57501bac90c4f92e78b655109656da7ebf 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * MemBlob.cc (C) 2009 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
index 0dcca1952393f3dc09ea4a40a9b4f448a65cda5d..804e0a6442c8cf5238855d1799847e6909be6207 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * MemBlob.h (C) 2009 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
@@ -68,7 +66,7 @@ class MemBlob: public RefCountable
 {
 public:
     typedef RefCount<MemBlob> Pointer;
-    typedef int32_t size_type;
+    typedef uint32_t size_type;
 
     MEMPROXY_CLASS(MemBlob);
 
index a23b5a57ca9d8578544e9ceb9280f2ea04e8b98f..650042040a393c47c649991e903355d3fc287b7c 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * SBuf.cc (C) 2008 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
@@ -183,7 +181,6 @@ SBuf::assign(const char *S, size_type n)
 void
 SBuf::reserveCapacity(size_type minCapacity)
 {
-    Must(0 <= minCapacity);
     Must(minCapacity <= maxSize);
     cow(minCapacity);
 }
@@ -191,7 +188,6 @@ SBuf::reserveCapacity(size_type minCapacity)
 char *
 SBuf::rawSpace(size_type minSpace)
 {
-    Must(0 <= minSpace);
     Must(length() <= maxSize - minSpace);
     debugs(24, 7, "reserving " << minSpace << " for " << id);
     ++stats.rawAccess;
@@ -236,8 +232,6 @@ SBuf::append(const SBuf &S)
 SBuf &
 SBuf::append(const char * S, size_type Ssize)
 {
-    Must (Ssize == npos || Ssize >= 0);
-
     if (S == NULL)
         return *this;
     if (Ssize == npos)
@@ -388,7 +382,6 @@ memcasecmp(const char *b1, const char *b2, SBuf::size_type len)
 int
 SBuf::compare(const SBuf &S, SBufCaseSensitive isCaseSensitive, size_type n) const
 {
-    Must(n == npos || n >= 0);
     if (n != npos)
         return substr(0,n).compare(S.substr(0,n),isCaseSensitive);
 
@@ -451,7 +444,6 @@ SBuf::operator !=(const SBuf & S) const
 SBuf
 SBuf::consume(size_type n)
 {
-    Must (n == npos || n >= 0);
     if (n == npos)
         n = length();
     else
@@ -470,8 +462,6 @@ SBufStats& SBuf::GetStats()
 SBuf::size_type
 SBuf::copy(char *dest, size_type n) const
 {
-    Must(n >= 0);
-
     size_type toexport = min(n,length());
     memcpy(dest, buf(), toexport);
     ++stats.copyOut;
@@ -511,10 +501,6 @@ SBuf::c_str()
 SBuf&
 SBuf::chop(size_type pos, size_type n)
 {
-    if (pos != npos && pos < 0)
-        pos = 0;
-    if (n != npos && n < 0)
-        n = npos;
     if (pos == npos || pos > length() || n == 0) {
         clear();
         return *this;
index dc030b64cbf181af49106e7c2b340fc416bd1746..15c80cf68405136cab43b5f5f04611faf20e165c 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * SBuf.h (C) 2008 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
@@ -112,7 +110,7 @@ class SBuf
 {
 public:
     typedef MemBlob::size_type size_type;
-    static const size_type npos = -1;
+    static const size_type npos = 0xffffffff; // max(uint32_t)
 
     /// Maximum size of a SBuf. By design it MUST be < MAX(size_type)/2. Currently 256Mb.
     static const size_type maxSize = 0xfffffff;
@@ -129,7 +127,7 @@ public:
      * \param n how many bytes to import into the SBuf. If it is npos
      *              or unspecified, imports to end-of-cstring
      * \note it is the caller's responsibility not to go out of bounds
-     * \note bounds is 0 <= pos < length()
+     * \note bounds is 0 <= pos < length(); caller must pay attention to signedness
      */
     explicit SBuf(const char *S, size_type n = npos);
 
@@ -239,7 +237,7 @@ public:
     /** random-access read to any char within the SBuf.
      *
      * \throw OutOfBoundsException when access is out of bounds
-     * \note bounds is 0 <= pos < length()
+     * \note bounds is 0 <= pos < length(); caller must pay attention to signedness
      */
     const char at(size_type pos) const {checkAccessBounds(pos); return operator[](pos);}
 
@@ -248,7 +246,7 @@ public:
      * \param pos the position to be overwritten
      * \param toset the value to be written
      * \throw OutOfBoundsException when pos is of bounds
-     * \note bounds is 0 <= pos < length()
+     * \note bounds is 0 <= pos < length(); caller must pay attention to signedness
      * \note performs a copy-on-write if needed.
      */
     void setAt(size_type pos, char toset);
@@ -355,8 +353,10 @@ public:
      */
     char *rawSpace(size_type minSize);
 
-    /**
+    /** Obtain how much free space is available in the backing store.
      *
+     * \note: unless the client just cow()ed, it is not guaranteed that
+     *        the free space can be used.
      */
     size_type spaceSize() const { return store_->spaceSize(); }
 
@@ -439,11 +439,10 @@ public:
      * It is an in-place-modifying version of substr.
      * \param pos start sub-stringing from this byte. If it is
      *      npos or it is greater than the SBuf length, the SBuf is cleared and
-     *      an empty SBuf is returned. If it is <0, it is ignored
+     *      an empty SBuf is returned.
      * \param n maximum number of bytes of the resulting SBuf.
      *     npos means "to end of SBuf".
      *     if it is 0, the SBuf is cleared and an empty SBuf is returned.
-     *     if it is < 0, it is ignored (same as supplying npos)
      *     if it overflows the end of the SBuf, it is capped to the end of SBuf
      * \see substr, trim
      */
@@ -482,7 +481,6 @@ public:
      * sequence contained in the str argument.
      * \param startPos if specified, ignore any occurrences before that position
      *     if startPos is npos or greater than length() npos is always returned
-     *     if startPos is < 0, it is ignored
      * \return npos if the SBuf was not found
      */
     size_type find(const SBuf & str, size_type startPos = 0) const;
@@ -493,7 +491,6 @@ public:
      * \return npos if the char was not found
      * \param endPos if specified, ignore any occurrences after that position.
      *   if npos or greater than length(), the whole SBuf is considered
-     *   if < 0, npos is always returned
      */
     size_type rfind(char c, size_type endPos = npos) const;
 
@@ -504,7 +501,6 @@ public:
      * \return npos if the sequence  was not found
      * \param endPos if specified, ignore any occurrences after that position
      *   if npos or greater than length(), the whole SBuf is considered
-     *   if < 0, npos is always returned
      */
     size_type rfind(const SBuf &str, size_type endPos = npos) const;
 
@@ -515,7 +511,6 @@ public:
      * \return npos if no character in the set could be found
      * \param startPos if specified, ignore any occurrences before that position
      *   if npos, then npos is always returned
-     *   if <0, it is ignored.
      */
     size_type find_first_of(const SBuf &set, size_type startPos = 0) const;
 
index 01106c4d01fb50633fa6f68c68afaa5376c54df0..b682d122073e3b70cfa6faa9f068052984378209 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * SBufExceptions.cc (C) 2008 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
index 70ec2a76a658a395a0095e9cd45bb664fee43c8b..451f8ec0779407f04a3ec22bc8ba7ad0ee5851ca 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * SBufExceptions.h (C) 2008 Francesco Chemolli <kinkie@squid-cache.org>
- *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
  *
index 41d060eaa44cfcfade8853a79d0957fe1cb088f2..7be3f7170d66ae9c1f7bdf0752a6ca997c01b534 100644 (file)
 #define SQUIDSTRINGPRINT(s) (s).psize(),(s).rawBuf()
 #endif /* SQUIDSTRINGPH */
 
-#define DEBUGSTRINGS 0
-#if DEBUGSTRINGS
-#include "splay.h"
-
-class String;
-
-class StringRegistry
-{
-
-public:
-    static StringRegistry &Instance();
-
-    void add(String const *);
-
-    StringRegistry();
-
-    void remove(String const *);
-
-private:
-    static OBJH Stat;
-
-    static StringRegistry Instance_;
-
-    static SplayNode<String const *>::SPLAYWALKEE Stater;
-
-    Splay<String const *> entries;
-
-    bool registered;
-
-};
-
-class StoreEntry;
-#endif
-
 class String
 {
 
@@ -150,10 +116,6 @@ public:
 
     _SQUID_INLINE_ void cut(size_type newLength);
 
-#if DEBUGSTRINGS
-    void stat(StoreEntry *) const;
-#endif
-
 private:
     void allocAndFill(const char *str, int len);
     void allocBuffer(size_type sz);
index bbc76b59e883639af738bf5fbf9829f1976eed77..cb022bd0bdb99ec0be74407256dc7c6bf540b820 100644 (file)
@@ -22,6 +22,25 @@ libexec_PROGRAMS = $(PINGER)
 
 noinst_LTLIBRARIES = libicmp-core.la libicmp.la
 
+SBUF_SOURCE= \
+       $(top_srcdir)/src/SBuf.h \
+       $(top_srcdir)/src/SBuf.cc \
+       $(top_srcdir)/src/MemBlob.h \
+       $(top_srcdir)/src/MemBlob.cc \
+       $(top_srcdir)/src/OutOfBoundsException.h \
+       $(top_srcdir)/src/SBufExceptions.h \
+       $(top_srcdir)/src/SBufExceptions.cc \
+       $(top_srcdir)/src/SBufTokenizer.h \
+       $(top_srcdir)/src/SBufTokenizer.cc \
+       $(top_srcdir)/src/SBufList.h \
+       $(top_srcdir)/src/SBufList.cc \
+       $(top_srcdir)/src/SBufUtil.h \
+       $(top_srcdir)/src/SBufUtil.cc \
+       $(top_srcdir)/src/String.cc \
+       $(top_srcdir)/src/SquidString.h \
+       $(top_srcdir)/src/base/TextException.h \
+       $(top_srcdir)/src/base/TextException.cc
+
 # ICMP API definition ...
 libicmp_core_la_SOURCES = \
        Icmp.h \
index cd3d2079fcfa11f2562e3aa17cd4b9534be4a885..d07f5b0e3501fc0cdd4478c906c2f5eb951b5eb7 100644 (file)
@@ -31,11 +31,11 @@ SBufFindTest::run()
 {
     srandom(randomSeed);
 
-    for (SBuf::size_type hayLen = 0; hayLen <= maxHayLength; nextLen(hayLen, maxHayLength)) {
+    for (SBuf::size_type hayLen = 0U; hayLen <= maxHayLength; nextLen(hayLen, maxHayLength)) {
         const SBuf cleanHay = RandomSBuf(hayLen);
 
         const SBuf::size_type maxNeedleLen = hayLen + 10;
-        for (SBuf::size_type needleLen = 0; needleLen <= maxNeedleLen; nextLen(needleLen, maxNeedleLen)) {
+        for (SBuf::size_type needleLen = 0U; needleLen <= maxNeedleLen; nextLen(needleLen, maxNeedleLen)) {
             theSBufNeedle = RandomSBuf(needleLen);
 
             for (int i = 0; i < placeEof; i++) {
@@ -386,7 +386,7 @@ SBufFindTest::RandomSBuf(const int length)
 /// increments len to quickly cover [0, max] range, slowing down in risky areas
 /// jumps to max+1 if caseLimit is reached
 void
-SBufFindTest::nextLen(int &len, const int max)
+SBufFindTest::nextLen(SBuf::size_type &len, const SBuf::size_type max)
 {
     assert(len <= max);
 
index c4202e8e91214caf0ce81f8a91ac703f9620480a..7756ee4557f6b872c0dc192d6a6942401353eb10 100644 (file)
@@ -33,7 +33,7 @@ public:
 protected:
 
     static SBuf RandomSBuf(const int length);
-    void nextLen(int &len, const int max);
+    void nextLen(SBuf::size_type &len, const SBuf::size_type max);
     void placeNeedle(const SBuf &cleanHay);
 
     void testAllMethods();
index 2a796c7891d5afde21905ef2a9c827e6af92bafb..c971fdb2c581079225443ea876b179e4a25095ea 100644 (file)
@@ -48,7 +48,7 @@ testSBuf::testSBufConstructDestruct()
     //  test accessors on empty SBuf.
     {
         SBuf s1;
-        CPPUNIT_ASSERT_EQUAL(0,s1.length());
+        CPPUNIT_ASSERT_EQUAL(0U,s1.length());
         CPPUNIT_ASSERT_EQUAL(SBuf(""),s1);
         CPPUNIT_ASSERT_EQUAL(empty_sbuf,s1);
         CPPUNIT_ASSERT_EQUAL(0,strcmp("",s1.c_str()));
@@ -57,7 +57,7 @@ testSBuf::testSBufConstructDestruct()
     // TEST: copy-construct NULL string (implicit destructor non-crash test)
     {
         SBuf s1(NULL);
-        CPPUNIT_ASSERT_EQUAL(0,s1.length());
+        CPPUNIT_ASSERT_EQUAL(0U,s1.length());
         CPPUNIT_ASSERT_EQUAL(SBuf(""),s1);
         CPPUNIT_ASSERT_EQUAL(empty_sbuf,s1);
         CPPUNIT_ASSERT_EQUAL(0,strcmp("",s1.c_str()));
@@ -66,7 +66,7 @@ testSBuf::testSBufConstructDestruct()
     // TEST: copy-construct empty string (implicit destructor non-crash test)
     {
         SBuf s1("");
-        CPPUNIT_ASSERT_EQUAL(0,s1.length());
+        CPPUNIT_ASSERT_EQUAL(0U,s1.length());
         CPPUNIT_ASSERT_EQUAL(SBuf(""),s1);
         CPPUNIT_ASSERT_EQUAL(empty_sbuf,s1);
         CPPUNIT_ASSERT_EQUAL(0,strcmp("",s1.c_str()));
@@ -75,7 +75,7 @@ testSBuf::testSBufConstructDestruct()
     // TEST: copy-construct from a SBuf
     {
         SBuf s1(empty_sbuf);
-        CPPUNIT_ASSERT_EQUAL(0,s1.length());
+        CPPUNIT_ASSERT_EQUAL(0U,s1.length());
         CPPUNIT_ASSERT_EQUAL(SBuf(""),s1);
         CPPUNIT_ASSERT_EQUAL(empty_sbuf,s1);
         CPPUNIT_ASSERT_EQUAL(0,strcmp("",s1.c_str()));
@@ -441,7 +441,7 @@ testSBuf::testFindChar()
     // FORWARD SEARCH
     // needle in haystack
     idx=s1.find('d');
-    CPPUNIT_ASSERT_EQUAL(3,idx);
+    CPPUNIT_ASSERT_EQUAL(3U,idx);
     CPPUNIT_ASSERT_EQUAL('d',s1[idx]);
 
     // needle not present in haystack
@@ -449,21 +449,17 @@ testSBuf::testFindChar()
     CPPUNIT_ASSERT_EQUAL(nposResult,idx);
 
     // search in portion
-    idx=s1.find('e',3);
-    CPPUNIT_ASSERT_EQUAL(4,idx);
+    idx=s1.find('e',3U);
+    CPPUNIT_ASSERT_EQUAL(4U,idx);
 
     // char not in searched portion
-    idx=s1.find('e',5);
+    idx=s1.find('e',5U);
     CPPUNIT_ASSERT_EQUAL(nposResult,idx);
 
     // invalid start position
     idx=s1.find('d',SBuf::npos);
     CPPUNIT_ASSERT_EQUAL(nposResult,idx);
 
-    // invalid start position
-    idx=s1.find('d', -5);
-    CPPUNIT_ASSERT_EQUAL(3, idx);
-
     // search outside of haystack
     idx=s1.find('d',s1.length()+1);
     CPPUNIT_ASSERT_EQUAL(nposResult,idx);
@@ -471,7 +467,7 @@ testSBuf::testFindChar()
     // REVERSE SEARCH
     // needle in haystack
     idx=s1.rfind('d');
-    CPPUNIT_ASSERT_EQUAL(3, idx);
+    CPPUNIT_ASSERT_EQUAL(3U, idx);
     CPPUNIT_ASSERT_EQUAL('d', s1[idx]);
 
     // needle not present in haystack
@@ -480,19 +476,15 @@ testSBuf::testFindChar()
 
     // search in portion
     idx=s1.rfind('e',5);
-    CPPUNIT_ASSERT_EQUAL(4,idx);
+    CPPUNIT_ASSERT_EQUAL(4U,idx);
 
     // char not in searched portion
     idx=s1.rfind('e',3);
     CPPUNIT_ASSERT_EQUAL(nposResult,idx);
 
-    // invalid start position
-    idx=s1.rfind('d', -5);
-    CPPUNIT_ASSERT_EQUAL(nposResult,idx);
-
     // overlong haystack specification
     idx=s1.rfind('d',s1.length()+1);
-    CPPUNIT_ASSERT_EQUAL(3,idx);
+    CPPUNIT_ASSERT_EQUAL(3U,idx);
 }
 
 void
@@ -506,10 +498,10 @@ testSBuf::testFindSBuf()
     // FORWARD search
     // needle in haystack
     idx = haystack.find(SBuf("def"));
-    CPPUNIT_ASSERT_EQUAL(3,idx);
+    CPPUNIT_ASSERT_EQUAL(3U,idx);
 
     idx = haystack.find(SBuf("xyz"));
-    CPPUNIT_ASSERT_EQUAL(23,idx);
+    CPPUNIT_ASSERT_EQUAL(23U,idx);
 
     // needle not in haystack, no initial char match
     idx = haystack.find(SBuf(" eq"));
@@ -535,10 +527,6 @@ testSBuf::testFindSBuf()
     idx = haystack.find(SBuf("def"),SBuf::npos);
     CPPUNIT_ASSERT_EQUAL(nposResult, idx);
 
-    // invalid start position: negative
-    idx = haystack.find(SBuf("def"),-5);
-    CPPUNIT_ASSERT_EQUAL(3, idx);
-
     // needle bigger than haystack
     idx = SBuf("def").find(haystack);
     CPPUNIT_ASSERT_EQUAL(nposResult, idx);
@@ -549,19 +537,19 @@ testSBuf::testFindSBuf()
         h2.append(haystack);
 
         idx = h2.find(SBuf("def"));
-        CPPUNIT_ASSERT_EQUAL(3,idx);
+        CPPUNIT_ASSERT_EQUAL(3U,idx);
 
         idx = h2.find(SBuf("xyzab"));
-        CPPUNIT_ASSERT_EQUAL(23,idx);
+        CPPUNIT_ASSERT_EQUAL(23U,idx);
     }
 
     // REVERSE search
     // needle in haystack
     idx = haystack.rfind(SBuf("def"));
-    CPPUNIT_ASSERT_EQUAL(3,idx);
+    CPPUNIT_ASSERT_EQUAL(3U,idx);
 
     idx = haystack.rfind(SBuf("xyz"));
-    CPPUNIT_ASSERT_EQUAL(23,idx);
+    CPPUNIT_ASSERT_EQUAL(23U,idx);
 
     // needle not in haystack, no initial char match
     idx = haystack.rfind(SBuf(" eq"));
@@ -577,7 +565,7 @@ testSBuf::testFindSBuf()
 
     // search in portion: needle in searched part
     idx = haystack.rfind(SBuf("def"),7);
-    CPPUNIT_ASSERT_EQUAL(3, idx);
+    CPPUNIT_ASSERT_EQUAL(3U, idx);
 
     // search in portion: needle not in searched part
     idx = haystack.rfind(SBuf("mno"),3);
@@ -585,15 +573,11 @@ testSBuf::testFindSBuf()
 
     // search in portion: overhang
     idx = haystack.rfind(SBuf("def"),4);
-    CPPUNIT_ASSERT_EQUAL(3, idx);
+    CPPUNIT_ASSERT_EQUAL(3U, idx);
 
     // npos start position
     idx = haystack.rfind(SBuf("def"),SBuf::npos);
-    CPPUNIT_ASSERT_EQUAL(3, idx);
-
-    // invalid start position: negative
-    idx = haystack.rfind(SBuf("def"),-5);
-    CPPUNIT_ASSERT_EQUAL(nposResult, idx);
+    CPPUNIT_ASSERT_EQUAL(3U, idx);
 
     // needle bigger than haystack
     idx = SBuf("def").rfind(haystack);
@@ -605,10 +589,10 @@ testSBuf::testFindSBuf()
         h2.append(haystack);
 
         idx = h2.rfind(SBuf("def"));
-        CPPUNIT_ASSERT_EQUAL(29,idx);
+        CPPUNIT_ASSERT_EQUAL(29U,idx);
 
         idx = h2.find(SBuf("xyzab"));
-        CPPUNIT_ASSERT_EQUAL(23,idx);
+        CPPUNIT_ASSERT_EQUAL(23U,idx);
     }
 }
 
@@ -618,7 +602,7 @@ testSBuf::testRFindChar()
     SBuf s1(literal);
     SBuf::size_type idx;
     idx=s1.rfind(' ');
-    CPPUNIT_ASSERT_EQUAL(40,idx);
+    CPPUNIT_ASSERT_EQUAL(40U,idx);
     CPPUNIT_ASSERT_EQUAL(' ',s1[idx]);
 }
 
@@ -638,7 +622,7 @@ testSBuf::testRFindSBuf()
     CPPUNIT_ASSERT_EQUAL(SBuf::npos,idx);
 
     idx=haystack.rfind(SBuf("fox"));
-    CPPUNIT_ASSERT_EQUAL(16,idx);
+    CPPUNIT_ASSERT_EQUAL(16U,idx);
 
     // needle not found, no match for first char
     idx=goobar.rfind(SBuf("foo"));
@@ -650,15 +634,15 @@ testSBuf::testRFindSBuf()
 
     SBuf g("g"); //match at the last char
     idx=haystack.rfind(g);
-    CPPUNIT_ASSERT_EQUAL(43,idx);
+    CPPUNIT_ASSERT_EQUAL(43U,idx);
     CPPUNIT_ASSERT_EQUAL('g',haystack[idx]);
 
     idx=haystack.rfind(SBuf("The"));
-    CPPUNIT_ASSERT_EQUAL(0,idx);
+    CPPUNIT_ASSERT_EQUAL(0U,idx);
 
     haystack.append("The");
     idx=haystack.rfind(SBuf("The"));
-    CPPUNIT_ASSERT_EQUAL(44,idx);
+    CPPUNIT_ASSERT_EQUAL(44U,idx);
 
     //partial match
     haystack="The quick brown fox";
@@ -697,7 +681,7 @@ void testSBuf::testCopy()
     CPPUNIT_ASSERT_EQUAL(s.length(),s.copy(buf,40));
     CPPUNIT_ASSERT_EQUAL(0,strncmp(s.rawContent(),buf,s.length()));
     s=literal;
-    CPPUNIT_ASSERT_EQUAL(40,s.copy(buf,40));
+    CPPUNIT_ASSERT_EQUAL(40U,s.copy(buf,40));
     s2.assign(buf,40);
     s.chop(0,40);
     CPPUNIT_ASSERT_EQUAL(s2,s);
@@ -774,7 +758,7 @@ void testSBuf::testFindFirstOf()
 
     // found at beginning
     idx=haystack.find_first_of(SBuf("THANDF"));
-    CPPUNIT_ASSERT_EQUAL(0,idx);
+    CPPUNIT_ASSERT_EQUAL(0U,idx);
 
     //found at end of haystack
     idx=haystack.find_first_of(SBuf("QWERYVg"));
@@ -782,7 +766,7 @@ void testSBuf::testFindFirstOf()
 
     //found in the middle of haystack
     idx=haystack.find_first_of(SBuf("QWERqYV"));
-    CPPUNIT_ASSERT_EQUAL(4,idx);
+    CPPUNIT_ASSERT_EQUAL(4U,idx);
 }
 
 void testSBuf::testAutoFind()