]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix a few warnings
authorYehuda Sadeh <yehuda@inktank.com>
Sun, 31 Mar 2013 06:27:58 +0000 (23:27 -0700)
committerSage Weil <sage@inktank.com>
Mon, 1 Apr 2013 04:51:59 +0000 (21:51 -0700)
Adjust data types

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_cors.h
src/rgw/rgw_cors_s3.cc
src/rgw/rgw_cors_swift.h

index f28892aab5d04a0981519d7fe9e606852f250241..415f3f0b869b74daf57db714acb9726669946e06 100644 (file)
@@ -46,7 +46,7 @@ protected:
 public:
   RGWCORSRule() : max_age(CORS_MAX_AGE_INVALID),allowed_methods(0) {}
   RGWCORSRule(std::set<string>& o, std::set<string>& h, 
-              std::list<string>& e, uint8_t f, unsigned a)
+              std::list<string>& e, uint8_t f, uint32_t a)
       :max_age(a),
        allowed_methods(f),
        allowed_hdrs(h),
index 4dc12bf838bf75a86158510678b290a6388b1770..847c54a46af43e7fb8a8c68bc529c6ccbbc9b857 100644 (file)
@@ -121,9 +121,13 @@ bool RGWCORSRule_S3::xml_end(const char *el) {
   iter = find("MaxAgeSeconds");
   if ((obj = iter.get_next())) {
     char *end = NULL;
-    max_age = strtoul(obj->get_data().c_str(), &end, 10);
-    if (max_age == ULONG_MAX)
+
+    unsigned long ul = strtoul(obj->get_data().c_str(), &end, 10);
+    if (ul == ULONG_MAX || ul >= 0x100000000LL) {
       max_age = CORS_MAX_AGE_INVALID;
+    } else  {
+      max_age = (uint32_t)ul;
+    }
     dout(10) << "RGWCORSRule : max_age : " << max_age << dendl;
   }
   /*Check and update ExposeHeader*/
index 2b10681d7681d3ea0cc8e9ae5458cf5451ed60a3..d40a0cc30ea1bfdaec0889f2516c09ccc3d0830c 100644 (file)
@@ -35,7 +35,7 @@ class RGWCORSConfiguration_SWIFT : public RGWCORSConfiguration
                   const char *expose_headers, const char *max_age) {
       set<string> o, h, oc;
       list<string> e;
-      unsigned a = CORS_MAX_AGE_INVALID;
+      unsigned long a = CORS_MAX_AGE_INVALID;
       uint8_t flags = RGW_CORS_ALL;
 
       string ao = allow_origins;