]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build: Bump language to C++17
authorAdam C. Emerson <aemerson@redhat.com>
Fri, 22 Dec 2017 20:04:17 +0000 (15:04 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 8 Jan 2018 20:30:03 +0000 (15:30 -0500)
Fix up all of the fallout from that.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
18 files changed:
src/CMakeLists.txt
src/common/ceph_crypto.h
src/common/config.cc
src/common/config.h
src/common/dout.h
src/os/filestore/LFNIndex.cc
src/rgw/rgw_common.cc
src/rgw/rgw_crypt.cc
src/rgw/rgw_file.cc
src/rgw/rgw_iam_policy.cc
src/rgw/rgw_keystone.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_torrent.cc
src/test/ceph_crypto.cc
src/test/rgw/test_rgw_iam_policy.cc

index 4d74c4db9c53fc47ab8bc049a68f1a4b2bc51010..6337805198eabc4cf84d9586e62cbb02de48dbb4 100644 (file)
@@ -38,6 +38,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-null-sentinel -Woverloaded-virtual")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-new-ttp-matching")
   if(NOT WITH_OSD_INSTRUMENT_FUNCTIONS)
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
   endif()
@@ -140,15 +141,15 @@ else(no_yasm)
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
 endif(no_yasm)
 
-# require c++14
-if(CMAKE_VERSION VERSION_LESS "3.1")
+# require c++17
+if(CMAKE_VERSION VERSION_LESS "3.8")
   include(CheckCXXCompilerFlag)
-  CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
-  if(NOT COMPILER_SUPPORTS_CXX14)
+  CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
+  if(NOT COMPILER_SUPPORTS_CXX17)
     message(FATAL_ERROR
-      "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support.")
+      "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support.")
   endif()
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
   include(CheckCCompilerFlag)
   CHECK_C_COMPILER_FLAG("-std=gnu99" COMPILER_SUPPORTS_GNU99)
   if(NOT COMPILER_SUPPORTS_GNU99)
@@ -157,7 +158,7 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
   endif()
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
 else()
-  set(CMAKE_CXX_STANDARD 14)
+  set(CMAKE_CXX_STANDARD 17)
   set(CMAKE_CXX_EXTENSIONS OFF)
   set(CMAKE_CXX_STANDARD_REQUIRED ON)
   set(CMAKE_C_STANDARD 99)
index 9c302392923df326673ad36df4246637f6e9118e..e5a9292dc6ff6e286bd57673a48528fd5dbd5613 100644 (file)
@@ -35,7 +35,7 @@ namespace ceph {
 
     class HMACSHA1: public CryptoPP::HMAC<CryptoPP::SHA1> {
     public:
-      HMACSHA1 (const byte *key, size_t length)
+    HMACSHA1 (const ::byte *key, size_t length)
        : CryptoPP::HMAC<CryptoPP::SHA1>(key, length)
        {
        }
@@ -44,7 +44,7 @@ namespace ceph {
 
     class HMACSHA256: public CryptoPP::HMAC<CryptoPP::SHA256> {
     public:
-      HMACSHA256 (const byte *key, size_t length)
+    HMACSHA256 (const ::byte *key, size_t length)
         : CryptoPP::HMAC<CryptoPP::SHA256>(key, length)
         {
         }
@@ -90,14 +90,14 @@ namespace ceph {
        s = PK11_DigestBegin(ctx);
        assert(s == SECSuccess);
       }
-      void Update (const byte *input, size_t length) {
+      void Update (const ::byte *input, size_t length) {
         if (length) {
          SECStatus s;
          s = PK11_DigestOp(ctx, input, length);
          assert(s == SECSuccess);
         }
       }
-      void Final (byte *digest) {
+      void Final (::byte *digest) {
        SECStatus s;
        unsigned int dummy;
        s = PK11_DigestFinal(ctx, digest, &dummy, digest_size);
@@ -128,7 +128,7 @@ namespace ceph {
       PK11Context *ctx;
       unsigned int digest_size;
     public:
-      HMAC (CK_MECHANISM_TYPE cktype, unsigned int digestsize, const byte *key, size_t length) {
+      HMAC (CK_MECHANISM_TYPE cktype, unsigned int digestsize, const ::byte *key, size_t length) {
         digest_size = digestsize;
        slot = PK11_GetBestSlot(cktype, NULL);
        assert(slot);
@@ -153,12 +153,12 @@ namespace ceph {
        s = PK11_DigestBegin(ctx);
        assert(s == SECSuccess);
       }
-      void Update (const byte *input, size_t length) {
+      void Update (const ::byte *input, size_t length) {
        SECStatus s;
        s = PK11_DigestOp(ctx, input, length);
        assert(s == SECSuccess);
       }
-      void Final (byte *digest) {
+      void Final (::byte *digest) {
        SECStatus s;
        unsigned int dummy;
        s = PK11_DigestFinal(ctx, digest, &dummy, digest_size);
@@ -170,12 +170,12 @@ namespace ceph {
 
     class HMACSHA1 : public HMAC {
     public:
-      HMACSHA1 (const byte *key, size_t length) : HMAC(CKM_SHA_1_HMAC, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, key, length) { }
+      HMACSHA1 (const ::byte *key, size_t length) : HMAC(CKM_SHA_1_HMAC, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, key, length) { }
     };
 
     class HMACSHA256 : public HMAC {
     public:
-      HMACSHA256 (const byte *key, size_t length) : HMAC(CKM_SHA256_HMAC, CEPH_CRYPTO_HMACSHA256_DIGESTSIZE, key, length) { }
+      HMACSHA256 (const ::byte *key, size_t length) : HMAC(CKM_SHA256_HMAC, CEPH_CRYPTO_HMACSHA256_DIGESTSIZE, key, length) { }
     };
   }
 }
index 12040e5b7da3c0ed50d0f422cc014a3ca6560c3a..cb2a756f036c1e7a861248739e2467826ad128eb 100644 (file)
@@ -89,7 +89,9 @@ md_config_t::md_config_t(bool is_daemon)
                 << std::endl;
       ceph_abort();
     }
-    schema.insert({i.name, i});
+    schema.emplace(std::piecewise_construct,
+                  std::forward_as_tuple(i.name),
+                  std::forward_as_tuple(i));
   }
 
   // Populate list of legacy_values according to the OPTION() definitions
index ed1c23f9e373f3b15b8a8698e8bbfe640e7aef24..0e87a08080e574a1f5448204d2f4786699e726c1 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef CEPH_CONFIG_H
 #define CEPH_CONFIG_H
 
+#include <map>
 #include "common/backport_std.h"
 #include "common/ConfUtils.h"
 #include "common/entity_name.h"
@@ -81,7 +82,7 @@ public:
    * The configuration schema, in the form of Option objects describing
    * possible settings.
    */
-  std::map<std::string, const Option &> schema;
+  std::map<std::string, const Option&> schema;
 
   /**
    * The current values of all settings described by the schema
index 41a330ee49ab8fa871d641a96f08f1cb18235691..60bee71122ae5c376d56bdfe663ea767eed7dfda 100644 (file)
@@ -50,7 +50,7 @@ public:
   do {                                                                 \
   if (cct->_conf->subsys.should_gather(sub, v)) {                      \
     if (0) {                                                           \
-      char __array[((v >= -1) && (v <= 200)) ? 0 : -1] __attribute__((unused)); \
+      [[maybe_unused]] char __array[((v >= -1) && (v <= 200)) ? 0 : -1] = {}; \
     }                                                                  \
     static size_t _log_exp_length = 80;                                \
     ceph::logging::Entry *_dout_e = cct->_log->create_entry(v, sub, &_log_exp_length); \
index 9c4765e622b0fcbd34543763340a27431a4974d7..9591d66e7f44cebc3474f5bc054e347328267ae1 100644 (file)
@@ -1279,10 +1279,10 @@ int LFNIndex::hash_filename(const char *filename, char *hash, int buf_len)
   char hex[FILENAME_LFN_DIGEST_SIZE * 2];
 
   SHA1 h;
-  h.Update((const byte *)filename, strlen(filename));
-  h.Final((byte *)buf);
+  h.Update((const ::byte *)filename, strlen(filename));
+  h.Final((::byte *)buf);
 
-  buf_to_hex((byte *)buf, (FILENAME_HASH_LEN + 1) / 2, hex);
+  buf_to_hex((::byte *)buf, (FILENAME_HASH_LEN + 1) / 2, hex);
   strncpy(hash, hex, FILENAME_HASH_LEN);
   hash[FILENAME_HASH_LEN] = '\0';
   return 0;
index 3f6211012ec40f57faa5c6f6a208354a3eda2da4..06e49df231c17240651df749d86e61d23fe7fa12 100644 (file)
@@ -36,9 +36,6 @@
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
 
-using boost::none;
-using boost::optional;
-
 using rgw::IAM::ARN;
 using rgw::IAM::Effect;
 using rgw::IAM::op_to_perm;
@@ -1087,11 +1084,11 @@ bool verify_requester_payer_permission(struct req_state *s)
 }
 
 namespace {
-Effect eval_or_pass(const optional<Policy>& policy,
-                          const rgw::IAM::Environment& env,
-                          const rgw::auth::Identity& id,
-                          const uint64_t op,
-                          const ARN& arn) {
+Effect eval_or_pass(const boost::optional<Policy>& policy,
+                   const rgw::IAM::Environment& env,
+                   const rgw::auth::Identity& id,
+                   const uint64_t op,
+                   const ARN& arn) {
   if (!policy)
     return Effect::Pass;
   else
@@ -1103,7 +1100,7 @@ bool verify_bucket_permission(struct req_state * const s,
                              const rgw_bucket& bucket,
                               RGWAccessControlPolicy * const user_acl,
                               RGWAccessControlPolicy * const bucket_acl,
-                             const optional<Policy>& bucket_policy,
+                             const boost::optional<Policy>& bucket_policy,
                               const uint64_t op)
 {
   if (!verify_requester_payer_permission(s))
@@ -1188,7 +1185,7 @@ static inline bool check_deferred_bucket_perms(struct req_state * const s,
                                               const rgw_bucket& bucket,
                                               RGWAccessControlPolicy * const user_acl,
                                               RGWAccessControlPolicy * const bucket_acl,
-                                              const optional<Policy>& bucket_policy,
+                                              const boost::optional<Policy>& bucket_policy,
                                               const uint8_t deferred_check,
                                               const uint64_t op)
 {
@@ -1211,7 +1208,7 @@ bool verify_object_permission(struct req_state * const s,
                               RGWAccessControlPolicy * const user_acl,
                               RGWAccessControlPolicy * const bucket_acl,
                               RGWAccessControlPolicy * const object_acl,
-                              const optional<Policy>& bucket_policy,
+                              const boost::optional<Policy>& bucket_policy,
                               const uint64_t op)
 {
   if (!verify_requester_payer_permission(s))
index cc23bf0bef71a4a6cf3df436bf4090c9b5d91721..9e4e5c0a1dfe6ac03f2d6c1f43b462b894dff21a 100644 (file)
@@ -81,7 +81,7 @@ public:
 #ifdef USE_CRYPTOPP
 
   bool encrypt(bufferlist& input, off_t in_ofs, size_t size, bufferlist& output, off_t stream_offset) {
-    byte iv[AES_256_IVSIZE];
+    ::byte iv[AES_256_IVSIZE];
     ldout(cct, 25)
         << "Encrypt in_ofs " << in_ofs
         << " size=" << size
@@ -98,7 +98,7 @@ public:
     CTR_Mode< AES >::Encryption e;
     e.SetKeyWithIV(key, AES_256_KEYSIZE, iv, AES_256_IVSIZE);
     buf.zero();
-    e.ProcessData((byte*)buf.c_str(), (byte*)buf.c_str(), buf.length());
+    e.ProcessData((::byte*)buf.c_str(), (::byte*)buf.c_str(), buf.length());
     buf.set_length(size);
     off_t plaintext_pos = in_ofs;
     off_t crypt_pos = 0;
@@ -110,8 +110,8 @@ public:
     }
     while (iter != input.buffers().end()) {
       off_t cnt = std::min<off_t>(iter->length() - plaintext_pos, size - crypt_pos);
-      byte* src = (byte*)iter->c_str() + plaintext_pos;
-      byte* dst = (byte*)buf.c_str() + crypt_pos;
+      auto src = (::byte*)iter->c_str() + plaintext_pos;
+      auto dst = (::byte*)buf.c_str() + crypt_pos;
       for (off_t i = 0; i < cnt; i++) {
         dst[i] ^= src[i];
       }
@@ -195,7 +195,7 @@ public:
          return encrypt(input, in_ofs, size, output, stream_offset);
   }
 
-  void prepare_iv(byte iv[AES_256_IVSIZE], off_t offset) {
+  void prepare_iv(::byte iv[AES_256_IVSIZE], off_t offset) {
     off_t index = offset / AES_256_IVSIZE;
     off_t i = AES_256_IVSIZE - 1;
     unsigned int val;
@@ -515,7 +515,7 @@ public:
   }
 
 
-  void prepare_iv(byte (&iv)[AES_256_IVSIZE], off_t offset) {
+  void prepare_iv(::byte (&iv)[AES_256_IVSIZE], off_t offset) {
     off_t index = offset / AES_256_IVSIZE;
     off_t i = AES_256_IVSIZE - 1;
     unsigned int val;
@@ -1098,8 +1098,8 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
       }
 
       MD5 key_hash;
-      byte key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
-      key_hash.Update(reinterpret_cast<const byte*>(key_bin.c_str()), key_bin.size());
+      ::byte key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
+      key_hash.Update(reinterpret_cast<const ::byte*>(key_bin.c_str()), key_bin.size());
       key_hash.Final(key_hash_res);
 
       if (memcmp(key_hash_res, keymd5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) {
@@ -1335,7 +1335,7 @@ int rgw_s3_prepare_decrypt(struct req_state* s,
 
     MD5 key_hash;
     uint8_t key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
-    key_hash.Update(reinterpret_cast<const byte*>(key_bin.c_str()), key_bin.size());
+    key_hash.Update(reinterpret_cast<const ::byte*>(key_bin.c_str()), key_bin.size());
     key_hash.Final(key_hash_res);
 
     if ((memcmp(key_hash_res, keymd5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) ||
index 1c0d1c75b39dc44db1c67ee312527a06a86f3d63..818afa44879c0d5d2a16928b3f2cb8a5d5e85e73 100644 (file)
@@ -1363,7 +1363,7 @@ namespace rgw {
     if (need_to_wait) {
       orig_data = data;
     }
-    hash.Update((const byte *)data.c_str(), data.length());
+    hash.Update((const ::byte *)data.c_str(), data.length());
     op_ret = put_data_and_throttle(filter, data, ofs, need_to_wait);
     if (op_ret < 0) {
       if (!need_to_wait || op_ret != -EEXIST) {
index ea07310f4c419b8200a4b4a116d4d112027aa4b7..11078d494c02b93bda66d0147310adf7cc39b6d1 100644 (file)
@@ -34,8 +34,6 @@ using std::uint64_t;
 using std::unordered_map;
 
 using boost::container::flat_set;
-using boost::none;
-using boost::optional;
 using boost::regex;
 using boost::regex_constants::ECMAScript;
 using boost::regex_constants::optimize;
@@ -63,8 +61,8 @@ struct actpair {
 };
 
 namespace {
-optional<Partition> to_partition(const smatch::value_type& p,
-                                bool wildcards) {
+boost::optional<Partition> to_partition(const smatch::value_type& p,
+                                       bool wildcards) {
   if (p == "aws") {
     return Partition::aws;
   } else if (p == "aws-cn") {
@@ -74,14 +72,14 @@ optional<Partition> to_partition(const smatch::value_type& p,
   } else if (p == "*" && wildcards) {
     return Partition::wildcard;
   } else {
-    return none;
+    return boost::none;
   }
 
   ceph_abort();
 }
 
-optional<Service> to_service(const smatch::value_type& s,
-                            bool wildcards) {
+boost::optional<Service> to_service(const smatch::value_type& s,
+                                   bool wildcards) {
   static const unordered_map<string, Service> services = {
     { "acm", Service::acm },
     { "apigateway", Service::apigateway },
@@ -170,7 +168,7 @@ optional<Service> to_service(const smatch::value_type& s,
 
   auto i = services.find(s);
   if (i == services.end()) {
-    return none;
+    return boost::none;
   } else {
     return i->second;
   }
@@ -205,7 +203,7 @@ ARN::ARN(const rgw_bucket& b, const string& o)
   resource.append(o);
 }
 
-optional<ARN> ARN::parse(const string& s, bool wildcards) {
+boost::optional<ARN> ARN::parse(const string& s, bool wildcards) {
   static const char str_wild[] = "arn:([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)";
   static const regex rx_wild(str_wild,
                                    sizeof(str_wild) - 1,
@@ -228,7 +226,7 @@ optional<ARN> ARN::parse(const string& s, bool wildcards) {
       }
     }
   }
-  return none;
+  return boost::none;
 }
 
 string ARN::to_string() const {
@@ -721,8 +719,8 @@ bool ParseState::key(const char* s, size_t l) {
 
 // I should just rewrite a few helper functions to use iterators,
 // which will make all of this ever so much nicer.
-static optional<Principal> parse_principal(CephContext* cct, TokenID t,
-                                          string&& s) {
+static boost::optional<Principal> parse_principal(CephContext* cct, TokenID t,
+                                                 string&& s) {
   // Wildcard!
   if ((t == TokenID::AWS) && (s == "*")) {
     return Principal::wildcard();
@@ -1048,10 +1046,10 @@ bool Condition::eval(const Environment& env) const {
   }
 }
 
-optional<MaskedIP> Condition::as_network(const string& s) {
+boost::optional<MaskedIP> Condition::as_network(const string& s) {
   MaskedIP m;
   if (s.empty()) {
-    return none;
+    return boost::none;
   }
 
   m.v6 = (s.find(':') == string::npos) ? false : true;
@@ -1064,7 +1062,7 @@ optional<MaskedIP> Condition::as_network(const string& s) {
     m.prefix = strtoul(s.data() + slash + 1, &end, 10);
     if (*end != 0 || (m.v6 && m.prefix > 128) ||
        (!m.v6 && m.prefix > 32)) {
-      return none;
+      return boost::none;
     }
   }
 
@@ -1079,7 +1077,7 @@ optional<MaskedIP> Condition::as_network(const string& s) {
   if (m.v6) {
     struct in6_addr a;
     if (inet_pton(AF_INET6, p->c_str(), static_cast<void*>(&a)) != 1) {
-      return none;
+      return boost::none;
     }
 
     m.addr |= Address(a.s6_addr[15]) << 0;
@@ -1101,7 +1099,7 @@ optional<MaskedIP> Condition::as_network(const string& s) {
   } else {
     struct in_addr a;
     if (inet_pton(AF_INET, p->c_str(), static_cast<void*>(&a)) != 1) {
-      return none;
+      return boost::none;
     }
 
     m.addr = ntohl(a.s_addr);
@@ -1233,7 +1231,7 @@ ostream& operator <<(ostream& m, const Condition& c) {
 }
 
 Effect Statement::eval(const Environment& e,
-                      optional<const rgw::auth::Identity&> ida,
+                      boost::optional<const rgw::auth::Identity&> ida,
                       uint64_t act, const ARN& res) const {
   if (ida && (!ida->is_identity(princ) || ida->is_identity(noprinc))) {
     return Effect::Pass;
@@ -1538,7 +1536,7 @@ Policy::Policy(CephContext* cct, const string& tenant,
 }
 
 Effect Policy::eval(const Environment& e,
-                   optional<const rgw::auth::Identity&> ida,
+                   boost::optional<const rgw::auth::Identity&> ida,
                    std::uint64_t action, const ARN& resource) const {
   auto allowed = false;
   for (auto& s : statements) {
index 3294380ba100c5b580d6689f6dda8ea078098383..eea1d2922c7c48b79972b761e3e63123610dd44e 100644 (file)
@@ -113,7 +113,7 @@ void rgw_get_token_id(const string& token, string& token_id)
   unsigned char m[CEPH_CRYPTO_MD5_DIGESTSIZE];
 
   MD5 hash;
-  hash.Update((const byte *)token.c_str(), token.size());
+  hash.Update((const ::byte *)token.c_str(), token.size());
   hash.Final(m);
 
   char calc_md5[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
index 666ef23946260b940097341eb154c1a9472fa00b..1f97a35e411765936498a498e37f167fa67f4c50 100644 (file)
@@ -242,10 +242,10 @@ static int get_bucket_policy_from_attr(CephContext *cct,
   return get_bucket_instance_policy_from_attr(cct, store, bucket_info, bucket_attrs, policy);
 }
 
-static optional<Policy> get_iam_policy_from_attr(CephContext* cct,
-                                                RGWRados* store,
-                                                map<string, bufferlist>& attrs,
-                                                const string& tenant) {
+static boost::optional<Policy> get_iam_policy_from_attr(CephContext* cct,
+                                                       RGWRados* store,
+                                                       map<string, bufferlist>& attrs,
+                                                       const string& tenant) {
   auto i = attrs.find(RGW_ATTR_IAM_POLICY);
   if (i != attrs.end()) {
     return Policy(cct, tenant, i->second);
@@ -323,7 +323,7 @@ static int read_obj_policy(RGWRados *store,
                            RGWBucketInfo& bucket_info,
                            map<string, bufferlist>& bucket_attrs,
                            RGWAccessControlPolicy* acl,
-                          optional<Policy>& policy,
+                          boost::optional<Policy>& policy,
                            rgw_bucket& bucket,
                            rgw_obj_key& object)
 {
@@ -1047,7 +1047,7 @@ bool RGWOp::generate_cors_headers(string& origin, string& method, string& header
 int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
                                        const rgw_bucket_dir_entry& ent,
                                        RGWAccessControlPolicy * const bucket_acl,
-                                       const optional<Policy>& bucket_policy,
+                                       const boost::optional<Policy>& bucket_policy,
                                        const off_t start_ofs,
                                        const off_t end_ofs)
 {
@@ -1146,14 +1146,14 @@ static int iterate_user_manifest_parts(CephContext * const cct,
                                        RGWBucketInfo *pbucket_info,
                                        const string& obj_prefix,
                                        RGWAccessControlPolicy * const bucket_acl,
-                                       const optional<Policy>& bucket_policy,
+                                       const boost::optional<Policy>& bucket_policy,
                                        uint64_t * const ptotal_len,
                                        uint64_t * const pobj_size,
                                        string * const pobj_sum,
                                        int (*cb)(rgw_bucket& bucket,
                                                  const rgw_bucket_dir_entry& ent,
                                                  RGWAccessControlPolicy * const bucket_acl,
-                                                 const optional<Policy>& bucket_policy,
+                                                 const boost::optional<Policy>& bucket_policy,
                                                  off_t start_ofs,
                                                  off_t end_ofs,
                                                  void *param),
@@ -1194,7 +1194,7 @@ static int iterate_user_manifest_parts(CephContext * const cct,
 
       obj_ofs += obj_size;
       if (pobj_sum) {
-        etag_sum.Update((const byte *)ent.meta.etag.c_str(),
+        etag_sum.Update((const ::byte *)ent.meta.etag.c_str(),
                         ent.meta.etag.length());
       }
 
@@ -1252,7 +1252,7 @@ static int iterate_slo_parts(CephContext *cct,
                              int (*cb)(rgw_bucket& bucket,
                                        const rgw_bucket_dir_entry& ent,
                                        RGWAccessControlPolicy *bucket_acl,
-                                       const optional<Policy>& bucket_policy,
+                                       const boost::optional<Policy>& bucket_policy,
                                        off_t start_ofs,
                                        off_t end_ofs,
                                        void *param),
@@ -1304,7 +1304,7 @@ static int iterate_slo_parts(CephContext *cct,
        // SLO is a Swift thing, and Swift has no knowledge of S3 Policies.
         int r = cb(part.bucket, ent, part.bucket_acl,
                   (part.bucket_policy ?
-                   optional<Policy>(*part.bucket_policy) : none),
+                   boost::optional<Policy>(*part.bucket_policy) : none),
                   start_ofs, end_ofs, cb_param);
        if (r < 0)
           return r;
@@ -1320,7 +1320,7 @@ static int iterate_slo_parts(CephContext *cct,
 static int get_obj_user_manifest_iterate_cb(rgw_bucket& bucket,
                                             const rgw_bucket_dir_entry& ent,
                                             RGWAccessControlPolicy * const bucket_acl,
-                                            const optional<Policy>& bucket_policy,
+                                            const boost::optional<Policy>& bucket_policy,
                                             const off_t start_ofs,
                                             const off_t end_ofs,
                                             void * const param)
@@ -1347,8 +1347,8 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
 
   RGWAccessControlPolicy _bucket_acl(s->cct);
   RGWAccessControlPolicy *bucket_acl;
-  optional<Policy> _bucket_policy;
-  optional<Policy>* bucket_policy;
+  boost::optional<Policy> _bucket_policy;
+  boost::optional<Policy>* bucket_policy;
   RGWBucketInfo bucket_info;
   RGWBucketInfo *pbucket_info;
 
@@ -1441,7 +1441,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl)
   ldout(s->cct, 2) << "RGWGetObj::handle_slo_manifest()" << dendl;
 
   vector<RGWAccessControlPolicy> allocated_acls;
-  map<string, pair<RGWAccessControlPolicy *, optional<Policy>>> policies;
+  map<string, pair<RGWAccessControlPolicy *, boost::optional<Policy>>> policies;
   map<string, rgw_bucket> buckets;
 
   map<uint64_t, rgw_slo_part> slo_parts;
@@ -1532,7 +1532,7 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl)
                       << " etag=" << part.etag
                       << dendl;
 
-    etag_sum.Update((const byte *)entry.etag.c_str(),
+    etag_sum.Update((const ::byte *)entry.etag.c_str(),
                     entry.etag.length());
 
     slo_parts[total_len] = part;
@@ -2960,7 +2960,7 @@ int RGWPutObj::verify_permission()
   if (copy_source) {
 
     RGWAccessControlPolicy cs_acl(s->cct);
-    optional<Policy> policy;
+    boost::optional<Policy> policy;
     map<string, bufferlist> cs_attrs;
     rgw_bucket cs_bucket(copy_source_bucket_info.bucket);
     rgw_obj_key cs_object(copy_source_object_name, copy_source_version_id);
@@ -3449,7 +3449,7 @@ void RGWPutObj::execute()
     }
 
     if (need_calc_md5) {
-      hash.Update((const byte *)data.c_str(), data.length());
+      hash.Update((const ::byte *)data.c_str(), data.length());
     }
 
     /* update torrrent */
@@ -3595,7 +3595,7 @@ void RGWPutObj::execute()
     ::encode(*slo_info, manifest_bl);
     emplace_attr(RGW_ATTR_SLO_MANIFEST, std::move(manifest_bl));
 
-    hash.Update((byte *)slo_info->raw_data, slo_info->raw_data_len);
+    hash.Update((::byte *)slo_info->raw_data, slo_info->raw_data_len);
     complete_etag(hash, &etag);
     ldout(s->cct, 10) << __func__ << ": calculated md5 for user manifest: " << etag << dendl;
   }
@@ -3785,7 +3785,7 @@ void RGWPostObj::execute()
         break;
       }
 
-      hash.Update((const byte *)data.c_str(), data.length());
+      hash.Update((const ::byte *)data.c_str(), data.length());
       op_ret = put_data_and_throttle(filter, data, ofs, false);
 
       ofs += len;
@@ -4352,7 +4352,7 @@ bool RGWCopyObj::parse_copy_location(const string& url_src, string& bucket_name,
 int RGWCopyObj::verify_permission()
 {
   RGWAccessControlPolicy src_acl(s->cct);
-  optional<Policy> src_policy;
+  boost::optional<Policy> src_policy;
   op_ret = get_params();
   if (op_ret < 0)
     return op_ret;
@@ -4860,7 +4860,7 @@ void RGWPutLC::execute()
 
   MD5 data_hash;
   unsigned char data_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
-  data_hash.Update(reinterpret_cast<const byte*>(data), len);
+  data_hash.Update(reinterpret_cast<const ::byte*>(data), len);
   data_hash.Final(data_hash_res);
 
   if (memcmp(data_hash_res, content_md5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) {
@@ -5445,7 +5445,7 @@ void RGWCompleteMultipart::execute()
 
       hex_to_buf(obj_iter->second.etag.c_str(), petag,
                CEPH_CRYPTO_MD5_DIGESTSIZE);
-      hash.Update((const byte *)petag, sizeof(petag));
+      hash.Update((const ::byte *)petag, sizeof(petag));
 
       RGWUploadPartInfo& obj_part = obj_iter->second;
 
@@ -5498,7 +5498,7 @@ void RGWCompleteMultipart::execute()
       accounted_size += obj_part.accounted_size;
     }
   } while (truncated);
-  hash.Final((byte *)final_etag);
+  hash.Final((::byte *)final_etag);
 
   buf_to_hex((unsigned char *)final_etag, sizeof(final_etag), final_etag_str);
   snprintf(&final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2],  sizeof(final_etag_str) - CEPH_CRYPTO_MD5_DIGESTSIZE * 2,
@@ -6424,7 +6424,7 @@ int RGWBulkUploadOp::handle_file(const boost::string_ref path,
       op_ret = len;
       return op_ret;
     } else if (len > 0) {
-      hash.Update((const byte *)data.c_str(), data.length());
+      hash.Update((const ::byte *)data.c_str(), data.length());
       op_ret = put_data_and_throttle(filter, data, ofs, false);
       if (op_ret < 0) {
         ldout(s->cct, 20) << "processor->thottle_data() returned ret="
index 8e0c74f7c9e0525df06f32d19010c697cf06aa8c..079bda6d53c80d807df37f0c19e652b1457dc3b5 100644 (file)
@@ -2039,7 +2039,7 @@ static inline void complete_etag(MD5& hash, string *etag)
   char etag_buf[CEPH_CRYPTO_MD5_DIGESTSIZE];
   char etag_buf_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
 
-  hash.Final((byte *)etag_buf);
+  hash.Final((::byte *)etag_buf);
   buf_to_hex((const unsigned char *)etag_buf, CEPH_CRYPTO_MD5_DIGESTSIZE,
            etag_buf_str);
 
index 393a4ccebb864c44d74276e1bd5054f725ff6815..c1fa1a964abaec87333c37b218e3145f1bccf12c 100644 (file)
@@ -1915,7 +1915,7 @@ static uint32_t gen_short_zone_id(const std::string zone_id)
 {
   unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
   MD5 hash;
-  hash.Update((const byte *)zone_id.c_str(), zone_id.size());
+  hash.Update((const ::byte *)zone_id.c_str(), zone_id.size());
   hash.Final(md5);
 
   uint32_t short_id;
@@ -3994,7 +3994,7 @@ int RGWRados::replace_region_with_zonegroup()
     unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
     char md5_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
     MD5 hash;
-    hash.Update((const byte *)new_realm_name.c_str(), new_realm_name.length());
+    hash.Update((const ::byte *)new_realm_name.c_str(), new_realm_name.length());
     hash.Final(md5);
     buf_to_hex(md5, CEPH_CRYPTO_MD5_DIGESTSIZE, md5_str);
     string new_realm_id(md5_str);
@@ -9059,12 +9059,12 @@ static void generate_fake_tag(RGWRados *store, map<string, bufferlist>& attrset,
   unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
   char md5_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
   MD5 hash;
-  hash.Update((const byte *)manifest_bl.c_str(), manifest_bl.length());
+  hash.Update((const ::byte *)manifest_bl.c_str(), manifest_bl.length());
 
   map<string, bufferlist>::iterator iter = attrset.find(RGW_ATTR_ETAG);
   if (iter != attrset.end()) {
     bufferlist& bl = iter->second;
-    hash.Update((const byte *)bl.c_str(), bl.length());
+    hash.Update((const ::byte *)bl.c_str(), bl.length());
   }
 
   hash.Final(md5);
index 958ebc9e77bde0593f0054b6ca4b3a95535b2cb3..e371dee8e18b29313eb29fbe13b0d0722aaeb7a9 100644 (file)
@@ -889,7 +889,7 @@ int RGWPutObj_ObjStore_SWIFT::get_params()
     MD5 etag_sum;
     uint64_t total_size = 0;
     for (const auto& entry : slo_info->entries) {
-      etag_sum.Update((const byte *)entry.etag.c_str(),
+      etag_sum.Update((const ::byte *)entry.etag.c_str(),
                       entry.etag.length());
       total_size += entry.size_bytes;
 
index cff77b3d981cd053c79a08095eab57b9e718b734..7df0f0cf7360f34276b7148dfa09762343389a5d 100644 (file)
@@ -156,8 +156,8 @@ void seed::sha1(SHA1 *h, bufferlist &bl, off_t bl_len)
   for (off_t i = 0; i < num; i++)
   {
     memset(sha, 0x00, sizeof(sha));
-    h->Update((byte *)pstr, info.piece_length);
-    h->Final((byte *)sha);
+    h->Update((::byte *)pstr, info.piece_length);
+    h->Final((::byte *)sha);
     set_info_pieces(sha);
     pstr += info.piece_length;
   }
@@ -166,8 +166,8 @@ void seed::sha1(SHA1 *h, bufferlist &bl, off_t bl_len)
   if (0 != remain)
   {
     memset(sha, 0x00, sizeof(sha));
-    h->Update((byte *)pstr, remain);
-    h->Final((byte *)sha);
+    h->Update((::byte *)pstr, remain);
+    h->Final((::byte *)sha);
     set_info_pieces(sha);
   }
 }
index 86b5c62cfc19daea6328a718a11c33abb86fc344..030e8a87c1c33021025b9448b10796c50c5621eb 100644 (file)
@@ -14,7 +14,7 @@ public:
 
 TEST(MD5, Simple) {
   ceph::crypto::MD5 h;
-  h.Update((const byte*)"foo", 3);
+  h.Update((const ::byte*)"foo", 3);
   unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -28,11 +28,11 @@ TEST(MD5, Simple) {
 
 TEST(MD5, MultiUpdate) {
   ceph::crypto::MD5 h;
-  h.Update((const byte*)"", 0);
-  h.Update((const byte*)"fo", 2);
-  h.Update((const byte*)"", 0);
-  h.Update((const byte*)"o", 1);
-  h.Update((const byte*)"", 0);
+  h.Update((const ::byte*)"", 0);
+  h.Update((const ::byte*)"fo", 2);
+  h.Update((const ::byte*)"", 0);
+  h.Update((const ::byte*)"o", 1);
+  h.Update((const ::byte*)"", 0);
   unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -46,9 +46,9 @@ TEST(MD5, MultiUpdate) {
 
 TEST(MD5, Restart) {
   ceph::crypto::MD5 h;
-  h.Update((const byte*)"bar", 3);
+  h.Update((const ::byte*)"bar", 3);
   h.Restart();
-  h.Update((const byte*)"foo", 3);
+  h.Update((const ::byte*)"foo", 3);
   unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -61,8 +61,8 @@ TEST(MD5, Restart) {
 }
 
 TEST(HMACSHA1, Simple) {
-  ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
-  h.Update((const byte*)"foo", 3);
+  ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+  h.Update((const ::byte*)"foo", 3);
   unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -75,12 +75,12 @@ TEST(HMACSHA1, Simple) {
 }
 
 TEST(HMACSHA1, MultiUpdate) {
-  ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
-  h.Update((const byte*)"", 0);
-  h.Update((const byte*)"fo", 2);
-  h.Update((const byte*)"", 0);
-  h.Update((const byte*)"o", 1);
-  h.Update((const byte*)"", 0);
+  ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+  h.Update((const ::byte*)"", 0);
+  h.Update((const ::byte*)"fo", 2);
+  h.Update((const ::byte*)"", 0);
+  h.Update((const ::byte*)"o", 1);
+  h.Update((const ::byte*)"", 0);
   unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -93,10 +93,10 @@ TEST(HMACSHA1, MultiUpdate) {
 }
 
 TEST(HMACSHA1, Restart) {
-  ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
-  h.Update((const byte*)"bar", 3);
+  ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+  h.Update((const ::byte*)"bar", 3);
   h.Restart();
-  h.Update((const byte*)"foo", 3);
+  h.Update((const ::byte*)"foo", 3);
   unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
   h.Final(digest);
   int err;
@@ -133,7 +133,7 @@ void do_simple_crypto() {
   // not exit status 0
   ceph::crypto::init(g_ceph_context);
   ceph::crypto::MD5 h;
-  h.Update((const byte*)"foo", 3);
+  h.Update((const ::byte*)"foo", 3);
   unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
   h.Final(digest);
   exit(0);
index 50d428a86be90e6d8208b8175340b9098d0e0bbf..ecad57adb72e71b236dea07b793f743aaac13df0 100644 (file)
@@ -35,7 +35,6 @@ using boost::container::flat_set;
 using boost::intrusive_ptr;
 using boost::make_optional;
 using boost::none;
-using boost::optional;
 
 using rgw::auth::Identity;
 using rgw::auth::Principal;
@@ -132,7 +131,7 @@ public:
 };
 
 TEST_F(PolicyTest, Parse1) {
-  optional<Policy> p;
+  boost::optional<Policy> p;
 
   ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
                             bufferlist::static_from_string(example1)));
@@ -183,7 +182,7 @@ TEST_F(PolicyTest, Eval1) {
 }
 
 TEST_F(PolicyTest, Parse2) {
-  optional<Policy> p;
+  boost::optional<Policy> p;
 
   ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
                             bufferlist::static_from_string(example2)));
@@ -264,7 +263,7 @@ TEST_F(PolicyTest, Eval2) {
 }
 
 TEST_F(PolicyTest, Parse3) {
-  optional<Policy> p;
+  boost::optional<Policy> p;
 
   ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
                             bufferlist::static_from_string(example3)));
@@ -622,7 +621,7 @@ TEST_F(IPPolicyTest, IPEnvironment) {
 }
 
 TEST_F(IPPolicyTest, ParseIPAddress) {
-  optional<Policy> p;
+  boost::optional<Policy> p;
 
   ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
                             bufferlist::static_from_string(ip_address_full_example)));
@@ -659,7 +658,7 @@ TEST_F(IPPolicyTest, ParseIPAddress) {
   EXPECT_EQ(p->statements[0].conditions[0].vals.size(), 2U);
   EXPECT_EQ(p->statements[0].conditions[0].vals[0], "192.168.1.0/24");
   EXPECT_EQ(p->statements[0].conditions[0].vals[1], "::1");
-  optional<rgw::IAM::MaskedIP> convertedIPv4 = rgw::IAM::Condition::as_network(p->statements[0].conditions[0].vals[0]);
+  boost::optional<rgw::IAM::MaskedIP> convertedIPv4 = rgw::IAM::Condition::as_network(p->statements[0].conditions[0].vals[0]);
   EXPECT_TRUE(convertedIPv4.is_initialized());
   if (convertedIPv4.is_initialized()) {
     EXPECT_EQ(*convertedIPv4, allowedIPv4Range);
@@ -671,7 +670,7 @@ TEST_F(IPPolicyTest, ParseIPAddress) {
   EXPECT_EQ(p->statements[0].conditions[1].vals.size(), 2U);
   EXPECT_EQ(p->statements[0].conditions[1].vals[0], "192.168.1.1/32");
   EXPECT_EQ(p->statements[0].conditions[1].vals[1], "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
-  optional<rgw::IAM::MaskedIP> convertedIPv6 = rgw::IAM::Condition::as_network(p->statements[0].conditions[1].vals[1]);
+  boost::optional<rgw::IAM::MaskedIP> convertedIPv6 = rgw::IAM::Condition::as_network(p->statements[0].conditions[1].vals[1]);
   EXPECT_TRUE(convertedIPv6.is_initialized());
   if (convertedIPv6.is_initialized()) {
     EXPECT_EQ(*convertedIPv6, allowedIPv6);