]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kv/KineticStore: Fix broken split_key 6574/head
authorHaomai Wang <haomai@xsky.com>
Fri, 13 Nov 2015 17:04:11 +0000 (01:04 +0800)
committerHaomai Wang <haomai@xsky.com>
Fri, 13 Nov 2015 17:04:11 +0000 (01:04 +0800)
Introduced by PR #6312

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/kv/KineticStore.cc
src/kv/KineticStore.h

index d11975b4aeabb6e4998920f0ca58756f2af39912..71559f03d3eeab3ba68377e06b36616fa5505487 100644 (file)
@@ -203,7 +203,7 @@ bufferlist KineticStore::to_bufferlist(const kinetic::KineticRecord &record)
   return bl;
 }
 
-int KineticStore::split_key(string in_prefix, string *prefix, string *key)
+int KineticStore::split_key(string &in, string *prefix, string *key)
 {
   size_t prefix_len = 0;
   char* in_data = in.c_str();
@@ -213,14 +213,14 @@ int KineticStore::split_key(string in_prefix, string *prefix, string *key)
   if (separator == NULL)
      return -EINVAL;
   prefix_len = size_t(separator - in_data);
-  if (prefix_len >= in_prefix.size())
+  if (prefix_len >= in.size())
     return -EINVAL;
 
   // Fetch prefix and/or key directly from Slice
   if (prefix)
     *prefix = string(in_data, prefix_len);
   if (key)
-    *key = string(separator+1, in_prefix.size()-prefix_len-1);
+    *key = string(separator+1, in.size()-prefix_len-1);
   return 0;
 }
 
index 14c35d771225e298c693b5456b4710dc19565435..657dfebb451ec34e9181a1d9fda81c4c20861c86 100644 (file)
@@ -137,7 +137,7 @@ public:
 
   /// Utility
   static string combine_strings(const string &prefix, const string &value);
-  static int split_key(string in_prefix, string *prefix, string *key);
+  static int split_key(string &in_prefix, string *prefix, string *key);
   static bufferlist to_bufferlist(const kinetic::KineticRecord &record);
   virtual uint64_t get_estimated_size(map<string,uint64_t> &extra) {
     // not used by the osd