Fix Android compilation after rebase on master

This commit is contained in:
Gioacchino Mazzurco 2020-04-01 01:30:57 +02:00
parent b42c0410f1
commit ce5f5faa97
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
3 changed files with 56 additions and 66 deletions

View file

@ -30,6 +30,7 @@
#include "retroshare/rsreputations.h" #include "retroshare/rsreputations.h"
#include "rsgxsflags.h" #include "rsgxsflags.h"
#include "util/rsdeprecate.h" #include "util/rsdeprecate.h"
#include "util/rsdebug.h"
/*! /*!
* This class only make method of internal members visible tu upper level to * This class only make method of internal members visible tu upper level to
@ -46,7 +47,7 @@
enum class TokenRequestType: uint8_t enum class TokenRequestType: uint8_t
{ {
UNDEFINED = 0x00, __NONE = 0x00, /// Used to detect uninitialized
GROUP_DATA = 0x01, GROUP_DATA = 0x01,
GROUP_META = 0x02, GROUP_META = 0x02,
POSTS = 0x03, POSTS = 0x03,
@ -55,6 +56,7 @@ enum class TokenRequestType: uint8_t
GROUP_STATISTICS = 0x06, GROUP_STATISTICS = 0x06,
SERVICE_STATISTICS = 0x07, SERVICE_STATISTICS = 0x07,
NO_KILL_TYPE = 0x08, NO_KILL_TYPE = 0x08,
__MAX /// Used to detect out of range
}; };
class RsGxsIfaceHelper class RsGxsIfaceHelper
@ -446,7 +448,7 @@ protected:
std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100), std::chrono::milliseconds checkEvery = std::chrono::milliseconds(100),
bool auto_delete_if_unsuccessful=true) bool auto_delete_if_unsuccessful=true)
{ {
#if defined(__ANDROID__) && (__ANDROID_API__ < 24) #if defined(__ANDROID__) && (__ANDROID_API__ < 24)
auto wkStartime = std::chrono::steady_clock::now(); auto wkStartime = std::chrono::steady_clock::now();
int maxWorkAroundCnt = 10; int maxWorkAroundCnt = 10;
LLwaitTokenBeginLabel: LLwaitTokenBeginLabel:
@ -454,7 +456,8 @@ LLwaitTokenBeginLabel:
auto timeout = std::chrono::steady_clock::now() + maxWait; auto timeout = std::chrono::steady_clock::now() + maxWait;
auto st = requestStatus(token); auto st = requestStatus(token);
while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE) && std::chrono::steady_clock::now() < timeout ) while( !(st == RsTokenService::FAILED || st >= RsTokenService::COMPLETE)
&& std::chrono::steady_clock::now() < timeout )
{ {
std::this_thread::sleep_for(checkEvery); std::this_thread::sleep_for(checkEvery);
st = requestStatus(token); st = requestStatus(token);
@ -503,19 +506,23 @@ private:
void locked_dumpTokens() void locked_dumpTokens()
{ {
uint16_t service_id = mGxs.serviceType(); const uint16_t service_id = mGxs.serviceType();
const auto countSize = static_cast<const size_t>(TokenRequestType::__MAX);
uint32_t count[countSize] = {0};
uint32_t count[7] = {0}; RsDbg() << __PRETTY_FUNCTION__ << "Service 0x" << std::hex << service_id
<< " (" << rsServiceControl->getServiceName(
RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id) )
<< ") this=0x" << static_cast<void*>(this)
<< ") Active tokens (per type): ";
RsDbg() << "Service " << std::hex << service_id << std::dec // let's count how many token of each type we've got.
<< " (" << rsServiceControl->getServiceName(RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id)) for(auto& it: mActiveTokens) ++count[static_cast<int>(it.second)];
<< ") this=" << std::hex << (void*)this << std::dec << ") Active tokens (per type): " ;
for(auto& it: mActiveTokens) // let's count how many token of each type we've got. for(uint32_t i=0; i < countSize; ++i)
++count[static_cast<int>(it.second)]; RsDbg().uStream() /* << i << ":" */ << count[i] << " ";
RsDbg().uStream() << std::endl;
for(uint32_t i=0;i<7;++i)
std::cerr << std::dec /* << i << ":" */ << count[i] << " ";
std::cerr << std::endl;
} }
RS_SET_CONTEXT_DEBUG_LEVEL(1)
}; };

View file

@ -191,37 +191,35 @@ struct RsMsgMetaData : RsSerializable
} }
}; };
struct RsGxsGenericMsgData struct GxsGroupStatistic : RsSerializable
{ {
virtual ~RsGxsGenericMsgData() = default; // making the type polymorphic GxsGroupStatistic() :
mNumMsgs(0), mTotalSizeOfMsgs(0), mNumThreadMsgsNew(0),
mNumThreadMsgsUnread(0), mNumChildMsgsNew(0), mNumChildMsgsUnread(0) {}
RsMsgMetaData mMeta; /// @see RsSerializable
}; void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx) override
class GxsGroupStatistic
{
public:
GxsGroupStatistic()
{ {
mNumMsgs = 0; RS_SERIAL_PROCESS(mGrpId);
mTotalSizeOfMsgs = 0; RS_SERIAL_PROCESS(mNumMsgs);
mNumThreadMsgsNew = 0; RS_SERIAL_PROCESS(mTotalSizeOfMsgs);
mNumThreadMsgsUnread = 0; RS_SERIAL_PROCESS(mNumThreadMsgsNew);
mNumChildMsgsNew = 0; RS_SERIAL_PROCESS(mNumThreadMsgsUnread);
mNumChildMsgsUnread = 0; RS_SERIAL_PROCESS(mNumChildMsgsNew);
RS_SERIAL_PROCESS(mNumChildMsgsUnread);
} }
public:
/// number of message
RsGxsGroupId mGrpId; RsGxsGroupId mGrpId;
uint32_t mNumMsgs; /// number of message, from the database
uint32_t mNumMsgs; // from the database
uint32_t mTotalSizeOfMsgs; uint32_t mTotalSizeOfMsgs;
uint32_t mNumThreadMsgsNew; uint32_t mNumThreadMsgsNew;
uint32_t mNumThreadMsgsUnread; uint32_t mNumThreadMsgsUnread;
uint32_t mNumChildMsgsNew; uint32_t mNumChildMsgsNew;
uint32_t mNumChildMsgsUnread; uint32_t mNumChildMsgsUnread;
~GxsGroupStatistic() override = default;
}; };
class GxsServiceStatistic class GxsServiceStatistic
@ -254,30 +252,15 @@ public:
uint32_t mSizeStore; uint32_t mSizeStore;
}; };
class UpdateItem class RS_DEPRECATED RsGxsGroupUpdateMeta
{
public:
virtual ~UpdateItem() { }
};
class StringUpdateItem : public UpdateItem
{
public:
StringUpdateItem(const std::string update) : mUpdate(update) {}
const std::string& getUpdate() const { return mUpdate; }
private:
std::string mUpdate;
};
class RsGxsGroupUpdateMeta
{ {
public: public:
// expand as support is added for other utypes // expand as support is added for other utypes
enum UpdateType { DESCRIPTION, NAME }; enum UpdateType { DESCRIPTION, NAME };
RsGxsGroupUpdateMeta(const RsGxsGroupId& groupId) : mGroupId(groupId) {} explicit RsGxsGroupUpdateMeta(const RsGxsGroupId& groupId):
mGroupId(groupId) {}
typedef std::map<UpdateType, std::string> GxsMetaUpdate; typedef std::map<UpdateType, std::string> GxsMetaUpdate;

View file

@ -37,7 +37,7 @@
#include "serialiser/rstypeserializer.h" #include "serialiser/rstypeserializer.h"
#include "util/rsdeprecate.h" #include "util/rsdeprecate.h"
struct RsIdentity; class RsIdentity;
/** /**
* Pointer to global instance of RsIdentity service implementation * Pointer to global instance of RsIdentity service implementation