]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implemented printf-specific String::psize()
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 11 Feb 2009 15:28:22 +0000 (16:28 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 11 Feb 2009 15:28:22 +0000 (16:28 +0100)
Fixed unit tests.

src/HttpHeader.h
src/Makefile.am
src/SquidString.h
src/String.cc
src/String.cci
src/protos.h
src/tests/testEvent.cc
src/tests/testString.cc

index 9e7a1d4f5ca321054de99db8fd574759c9761071..9ee36b60e0c63b849afdcccc7799204cbec4f100 100644 (file)
 #ifndef SQUID_HTTPHEADER_H
 #define SQUID_HTTPHEADER_H
 
-
 /* because we pass a spec by value */
 #include "HttpHeaderRange.h"
 /* HttpHeader holds a HttpHeaderMask */
 #include "HttpHeaderMask.h"
 
+
+/* class forward declarations */
+class HttpVersion;
+class HttpHdrContRange;
+class HttpHdrCc;
+class HttpHdrSc;
+class HttpHdrRange;
+class String;
+
+
 /* constant attributes of http header fields */
 
 /** recognized or "known" header fields; @?@ add more! */
@@ -149,13 +158,6 @@ struct _HttpHeaderFieldAttrs {
     field_type type;
 };
 
-class HttpVersion;
-
-class HttpHdrContRange;
-
-class HttpHdrCc;
-
-class HttpHdrSc;
 
 /** Iteration for headers; use HttpHeaderPos as opaque type, do not interpret */
 typedef ssize_t HttpHeaderPos;
index 357d44a4bda50f58251c6abc9d39fdf5547cf1c4..177d9b7b9a704ecdcafcfe9d5bacfd27aef0c96c 100644 (file)
@@ -1512,6 +1512,7 @@ nodist_tests_testDiskIO_SOURCES= \
        $(SWAP_TEST_GEN_SOURCES)
 tests_testDiskIO_LDADD = \
        ip/libip.la \
+       libsquid.la \
        @DISK_LIBS@ \
        $(SWAP_TEST_LDADD) \
        SquidConfig.o
index 47e1194b2160e0c9842949b3a42a11c47c621f14..7fe23b112e2f4d6e76bfd5679c9385763fb95294 100644 (file)
@@ -36,8 +36,6 @@
 #define SQUID_STRING_H
 
 #include "config.h"
-#include "TextException.h"
-
 
 /** todo checks to wrap this include properly */
 #include <ostream>
@@ -104,7 +102,7 @@ public:
     _SQUID_INLINE_ size_type size() const;
     /// variant of size() suited to be used for printf-alikes.
     /// throws when size() > MAXINT
-    _SQUID_INLINE_ int psize() const;
+    int psize() const;
     _SQUID_INLINE_ char const * unsafeBuf() const;
 
     /**
index bc129f14fab871466831d07fa75f8a639d01c876..dded212de9ad4f33ae506194deab5d5c0d60b15f 100644 (file)
 
 #include "squid.h"
 #include "Store.h"
+#include "TextException.h"
+
+int
+String::psize() const
+{
+    Must(size() < INT_MAX);
+    return size();
+}
+
 
 // low-level buffer allocation,
 // does not free old buffer and does not adjust or look at len_
index 751086aa59381f3675cbf0c6cc28244596f5eb1a..263fd9931b01d60c35332663a0d5d55b395f66c4 100644 (file)
@@ -58,13 +58,6 @@ String::size() const
     return len_;
 }
 
-int
-String::psize() const
-{
-    Must(size() < INT_MAX);
-    return size();
-}
-
 char const *
 String::unsafeBuf() const
 {
index 4df70c98aa69cf3587d6cf335a06413204eab91c..eb906c5eefa1309ebd226f5bb6754eeafa87e81b 100644 (file)
@@ -179,6 +179,7 @@ class FwdState;
 SQUIDCEXTERN void ftpStart(FwdState *);
 
 class HttpRequest;
+class HttpReply;
 
 /// \ingroup ServerProtocolFTPAPI
 SQUIDCEXTERN const char *ftpUrlWith2f(HttpRequest *);
index fa03c48075b31510989bd6aa756ba7b5dc75607d..1cafcf5cc1511cd697596d672eae57c67fe8ba0b 100644 (file)
@@ -97,7 +97,7 @@ testEvent::testDump()
     /* loop over the strings, showing exactly where they differ (if at all) */
     printf("Actual Text:\n");
     /* TODO: these should really be just [] lookups, but String doesn't have those here yet. */
-    for ( int i = 0; i < anEntry->_appended_text.size(); i++) {
+    for ( unsigned int i = 0; i < anEntry->_appended_text.size(); i++) {
         CPPUNIT_ASSERT( expect[i] );
         CPPUNIT_ASSERT( anEntry->_appended_text[i] );
 
index f615b43a460df0ab9338690eeed7c77e9ebf40b2..9b0df39333c8b655b350a76e2c742f71d1c26860 100644 (file)
@@ -65,5 +65,5 @@ void testString::testSubstr()
     String s("0123456789");
     String check=s.substr(3,5);
     String ref("34");
-    CPPUNIT_ASSERT(s1 == ref);
+    CPPUNIT_ASSERT(check == ref);
 }