]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/string_view.h
StringView: rfind: pos should be end of substr, not start
[apt.git] / apt-pkg / contrib / string_view.h
index b4ce0431ccb28dcb63e64c4ed343e406d2261db9..37a30a6dffcd32d225920ce1aaf6d724c6518374 100644 (file)
@@ -55,9 +55,9 @@ public:
         return found - data_;
     }
 
-    size_t rfind(int c, size_t pos=0) const {
-        if (pos != 0)
-            return substr(pos).find(c);
+    size_t rfind(int c, size_t pos=npos) const {
+        if (pos != npos)
+            return substr(0, pos).rfind(c);
 
         const char *found = static_cast<const char*>(memrchr(data_, c, size_));