From e1a78f9827428dba47001f26b1904cfc2df1035b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Sat, 30 Mar 2013 23:27:58 -0700 Subject: [PATCH] rgw: fix a few warnings Adjust data types Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_cors.h | 2 +- src/rgw/rgw_cors_s3.cc | 8 ++++++-- src/rgw/rgw_cors_swift.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_cors.h b/src/rgw/rgw_cors.h index f28892aab5d04..415f3f0b869b7 100644 --- a/src/rgw/rgw_cors.h +++ b/src/rgw/rgw_cors.h @@ -46,7 +46,7 @@ protected: public: RGWCORSRule() : max_age(CORS_MAX_AGE_INVALID),allowed_methods(0) {} RGWCORSRule(std::set& o, std::set& h, - std::list& e, uint8_t f, unsigned a) + std::list& e, uint8_t f, uint32_t a) :max_age(a), allowed_methods(f), allowed_hdrs(h), diff --git a/src/rgw/rgw_cors_s3.cc b/src/rgw/rgw_cors_s3.cc index 4dc12bf838bf7..847c54a46af43 100644 --- a/src/rgw/rgw_cors_s3.cc +++ b/src/rgw/rgw_cors_s3.cc @@ -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*/ diff --git a/src/rgw/rgw_cors_swift.h b/src/rgw/rgw_cors_swift.h index 2b10681d7681d..d40a0cc30ea1b 100644 --- a/src/rgw/rgw_cors_swift.h +++ b/src/rgw/rgw_cors_swift.h @@ -35,7 +35,7 @@ class RGWCORSConfiguration_SWIFT : public RGWCORSConfiguration const char *expose_headers, const char *max_age) { set o, h, oc; list e; - unsigned a = CORS_MAX_AGE_INVALID; + unsigned long a = CORS_MAX_AGE_INVALID; uint8_t flags = RGW_CORS_ALL; string ao = allow_origins; -- 2.39.5