]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw,test: Fix build errors in 32 bit platforms 45135/head
authorLuciano Lo Giudice <luciano.logiudice@canonical.com>
Wed, 23 Feb 2022 19:01:58 +0000 (16:01 -0300)
committerKefu Chai <tchaikov@gmail.com>
Wed, 27 Jul 2022 00:56:55 +0000 (08:56 +0800)
When building on 32 bit platforms (tested on armhf), 2 errors were detected:
The first involves the compiler being unable to disambiguate a call to
deserialize an integer (apparently because there isn't a specialization for it).
The second involves invalid usage of the builtin reinterpret_cast.

Signed-off-by: Luciano Lo Giudice <luciano.logiudice@canonical.com>
src/rgw/store/dbstore/sqlite/sqliteDB.cc
src/test/libcephfs/ceph_pthread_self.h

index 649c644bebfa1f34db609fb0a3ae201311c5f10f..3727293d9daede86fe6f07b0239caff5c111d4f0 100644 (file)
@@ -580,10 +580,13 @@ static int list_lc_head(const DoutPrefixProvider *dpp, DBOpInfo &op, sqlite3_stm
   if (!stmt)
     return -1;
 
+  int64_t start_date;
+
   op.lc_head.index = (const char*)sqlite3_column_text(stmt, LCHeadIndex);
   op.lc_head.head.set_marker((const char*)sqlite3_column_text(stmt, LCHeadMarker));
  
-  SQL_DECODE_BLOB_PARAM(dpp, stmt, LCHeadStartDate, op.lc_head.head.get_start_date(), sdb);
+  SQL_DECODE_BLOB_PARAM(dpp, stmt, LCHeadStartDate, start_date, sdb);
+  op.lc_head.head.get_start_date() = start_date;
 
   return 0;
 }
@@ -2803,7 +2806,7 @@ int SQLInsertLCHead::Bind(const DoutPrefixProvider *dpp, struct DBOpParams *para
   SQL_BIND_TEXT(dpp, stmt, index, params->op.lc_head.head.get_marker().c_str(), sdb);
 
   SQL_BIND_INDEX(dpp, stmt, index, p_params.op.lc_head.start_date, sdb);
-  SQL_ENCODE_BLOB_PARAM(dpp, stmt, index, params->op.lc_head.head.get_start_date(), sdb);
+  SQL_ENCODE_BLOB_PARAM(dpp, stmt, index, static_cast<int64_t>(params->op.lc_head.head.start_date), sdb);
 
 out:
   return rc;
index 4c0c98f6ee3f76a5ef523e825fe9681b9ceddb42..9e3cdfa99e20fcb9ee2cc2bb40876a0be41e8405 100644 (file)
@@ -25,7 +25,7 @@ static uint64_t ceph_pthread_self() {
   static_assert(std::is_convertible_v<decltype(me), uint64_t> ||
                 std::is_pointer_v<decltype(me)>,
                 "we need to use pthread_self() for the owner parameter");
-  return reinterpret_cast<uint64_t>(me);
+  return static_cast<uint64_t>(me);
 }
 
 #endif