]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: std::string:npos is not always appropriate for String::npos
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 1 Dec 2013 07:24:58 +0000 (00:24 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 1 Dec 2013 07:24:58 +0000 (00:24 -0700)
On some systems such as Windows MinGW the signed/unsigned property of
std::string::npos does not match up with the Squdi String class size_type
signed/unsigned property. Resulting in compiler signed vs unsigned
mismatch errors when compiling.

  This is an iCelero project.

src/SquidString.h

index dabd1e204f8cdc5112a3f5e54fcd713503737bb3..e8f69f3c3b32030a59f2057eb387b722736755a1 100644 (file)
@@ -53,7 +53,7 @@ public:
     ~String();
 
     typedef size_t size_type; //storage size intentionally unspecified
-    const static size_type npos = std::string::npos;
+    const static size_type npos = -1;
 
     String &operator =(char const *);
     String &operator =(String const &);