]> 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>
Fri, 6 Dec 2013 12:15:11 +0000 (05:15 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 6 Dec 2013 12:15:11 +0000 (05:15 -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 41d060eaa44cfcfade8853a79d0957fe1cb088f2..33262a242f9a57431c42fdd89c0e4ca77db1da2f 100644 (file)
@@ -87,7 +87,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 &);