]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/basic_type: use the standard usage of string 9593/head
authorYan Jun <yan.jun8@zte.com.cn>
Mon, 6 Jun 2016 15:31:19 +0000 (23:31 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Mon, 6 Jun 2016 15:38:25 +0000 (23:38 +0800)
string::find() returns a value of size_t type, we'd better
use the std::string::npos when it find nothing.

Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
src/rgw/rgw_basic_types.h

index 00ad16e50aa7c987e936bea040862ce8741abca2..d1c06d1bac78fbd8a0afe4ef80ff5ee10ee6604f 100644 (file)
@@ -52,8 +52,8 @@ struct rgw_user {
   }
 
   void from_str(const std::string& str) {
-    ssize_t pos = str.find('$');
-    if (pos >= 0) {
+    size_t pos = str.find('$');
+    if (pos != std::string::npos) {
       tenant = str.substr(0, pos);
       id = str.substr(pos + 1);
     } else {