]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix warning
authorSage Weil <sage@inktank.com>
Mon, 1 Apr 2013 04:47:38 +0000 (21:47 -0700)
committerSage Weil <sage@inktank.com>
Mon, 1 Apr 2013 04:51:59 +0000 (21:51 -0700)
On a 64-bit arch, we still want to make sure it's a 32-bit value.  Gcc is
too smart for us to just cast; it will still warn on 32-bit arch that the
comparison is always true.

Signed-off-by: Sage Weil <sage@inktank.com>
src/rgw/rgw_cors_s3.cc

index acf43a2d2a3826f75b22927e186982160d075f6b..154d5cb70886693858f1d335153dabcc61ca0a0c 100644 (file)
@@ -123,11 +123,11 @@ bool RGWCORSRule_S3::xml_end(const char *el) {
   if ((obj = iter.get_next())) {
     char *end = NULL;
 
-    unsigned long ul = strtoul(obj->get_data().c_str(), &end, 10);
-    if (ul == ULONG_MAX || ul >= 0x100000000LL) {
+    unsigned long long ull = strtoull(obj->get_data().c_str(), &end, 10);
+    if (ull >= 0x100000000ull) {
       max_age = CORS_MAX_AGE_INVALID;
     } else  {
-      max_age = (uint32_t)ul;
+      max_age = (uint32_t)ull;
     }
     dout(10) << "RGWCORSRule : max_age : " << max_age << dendl;
   }