]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libradosstriper: build without "using namespace std"
authorKefu Chai <kchai@redhat.com>
Wed, 11 Aug 2021 04:00:21 +0000 (12:00 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 13 Aug 2021 04:23:38 +0000 (12:23 +0800)
* add "std::" prefix in headers
* add "using" declarations in .cc files.

so we don't rely on "using namespace std" in one or more included
headers.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/libradosstriper/RadosStriperImpl.cc
src/libradosstriper/RadosStriperImpl.h

index 6801fba68843047b28cf18a84c0343b65673eaad..aca8463a97e03612837fc114ee27fafe4f7c65df 100644 (file)
@@ -114,6 +114,10 @@ static const struct ceph_file_layout default_file_layout = {
   ceph_le32(-1),       // fl_pg_pool
 };
 
+using std::map;
+using std::pair;
+using std::string;
+using std::vector;
 using libradosstriper::MultiAioCompletionImplPtr;
 
 namespace {
@@ -658,7 +662,7 @@ static void rados_req_read_complete(rados_completion_t c, void *arg)
     // even exist if we've gone through previous case).
     // This is typical of sparse file and we need to complete with 0s.
     unsigned int lenOfZeros = data->m_expectedBytes-rc;
-    unsigned int existingDataToZero = min(data->m_bl->length()-rc, lenOfZeros);
+    unsigned int existingDataToZero = std::min(data->m_bl->length()-rc, lenOfZeros);
     if (existingDataToZero > 0) {
       data->m_bl->zero(rc, existingDataToZero);
     }
@@ -693,7 +697,7 @@ int libradosstriper::RadosStriperImpl::aio_read(const std::string& soid,
     // nothing to read ! We are done.
     read_len = 0;
   } else {
-    read_len = min(len, (size_t)(size-off));
+    read_len = std::min(len, (size_t)(size-off));
   }
   // get list of extents to be read from
   vector<ObjectExtent> *extents = new vector<ObjectExtent>();
index 8226a9ba2a23436d539975a815c65c2119726e6a..abe602ea4463a60e9825b3bd21757a7c0566b15b 100644 (file)
@@ -64,7 +64,7 @@ struct RadosStriperImpl {
   // xattrs
   int getxattr(const object_t& soid, const char *name, bufferlist& bl);
   int setxattr(const object_t& soid, const char *name, bufferlist& bl);
-  int getxattrs(const object_t& soid, map<string, bufferlist>& attrset);
+  int getxattrs(const object_t& soid, std::map<std::string, bufferlist>& attrset);
   int rmxattr(const object_t& soid, const char *name);
 
   // io