mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-27 02:56:30 -05:00
Use safer rstime_t instead of time_t
Avoid problems to serialization on different platforms, without breaking nested STL containers serialization. The conversion have been made with sed, and checked with grep, plus kdiff3 visual ispection, plus rutime tests, so it should be fine.
This commit is contained in:
parent
41aa675a9b
commit
329050a9c2
223 changed files with 930 additions and 911 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/rsnet.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsBanList;
|
||||
extern RsBanList *rsBanList ;
|
||||
|
|
@ -70,7 +71,7 @@ public:
|
|||
uint32_t level; // LOCAL, FRIEND, FoF.
|
||||
bool state ; // true=>active, false=>just stored but inactive
|
||||
int connect_attempts ; // recorded by the BanList service
|
||||
time_t mTs;
|
||||
rstime_t mTs;
|
||||
std::string comment ; //
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -149,13 +149,13 @@ struct RsConfigDataRates : RsSerializable
|
|||
float mRateMaxIn;
|
||||
float mAllocIn;
|
||||
|
||||
time_t mAllocTs;
|
||||
rstime_t mAllocTs;
|
||||
|
||||
float mRateOut;
|
||||
float mRateMaxOut;
|
||||
float mAllowedOut;
|
||||
|
||||
time_t mAllowedTs;
|
||||
rstime_t mAllowedTs;
|
||||
|
||||
int mQueueIn;
|
||||
int mQueueOut;
|
||||
|
|
@ -181,7 +181,7 @@ struct RsConfigDataRates : RsSerializable
|
|||
|
||||
struct RSTrafficClue : RsSerializable
|
||||
{
|
||||
time_t TS ;
|
||||
rstime_t TS ;
|
||||
uint32_t size ;
|
||||
uint8_t priority ;
|
||||
uint16_t service_id ;
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ class RsDhtPeer
|
|||
int mBucket;
|
||||
std::string mDhtId;
|
||||
std::string mAddr;
|
||||
time_t mLastSendTime;
|
||||
time_t mLastRecvTime;
|
||||
time_t mFoundTime;
|
||||
rstime_t mLastSendTime;
|
||||
rstime_t mLastRecvTime;
|
||||
rstime_t mFoundTime;
|
||||
uint32_t mPeerFlags;
|
||||
uint32_t mExtraFlags;
|
||||
};
|
||||
|
|
@ -132,7 +132,7 @@ class RsDhtRelayEnd
|
|||
std::string mLocalAddr;
|
||||
std::string mProxyAddr;
|
||||
std::string mRemoteAddr;
|
||||
time_t mCreateTS;
|
||||
rstime_t mCreateTS;
|
||||
};
|
||||
|
||||
class RsDhtRelayProxy
|
||||
|
|
@ -145,11 +145,11 @@ class RsDhtRelayProxy
|
|||
|
||||
double mBandwidth;
|
||||
int mRelayClass;
|
||||
time_t mLastTS;
|
||||
time_t mCreateTS;
|
||||
rstime_t mLastTS;
|
||||
rstime_t mCreateTS;
|
||||
|
||||
//uint32_t mDataSize;
|
||||
//time_t mLastBandwidthTS;
|
||||
//rstime_t mLastBandwidthTS;
|
||||
|
||||
};
|
||||
class RsDhtFilteredPeer
|
||||
|
|
@ -157,8 +157,8 @@ class RsDhtFilteredPeer
|
|||
public:
|
||||
struct sockaddr_in mAddr;
|
||||
uint32_t mFilterFlags; /* reasons why we are filtering */
|
||||
time_t mFilterTS;
|
||||
time_t mLastSeen;
|
||||
rstime_t mFilterTS;
|
||||
rstime_t mLastSeen;
|
||||
};
|
||||
|
||||
class RsDht
|
||||
|
|
|
|||
|
|
@ -24,8 +24,10 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "util/rsprint.h"
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******************************************************************************************
|
||||
Enumerations defining the Operators usable in the Boolean search expressions
|
||||
|
|
@ -113,7 +115,7 @@ class ExpFileEntry
|
|||
public:
|
||||
virtual const std::string& file_name() const =0;
|
||||
virtual uint64_t file_size() const =0;
|
||||
virtual time_t file_modtime() const =0;
|
||||
virtual rstime_t file_modtime() const =0;
|
||||
virtual uint32_t file_popularity() const =0;
|
||||
virtual std::string file_parent_path() const =0;
|
||||
virtual const RsFileHash& file_hash() const =0;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "rstypes.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "rsturtle.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsFiles;
|
||||
|
||||
|
|
@ -187,7 +188,7 @@ struct BannedFileEntry
|
|||
|
||||
uint64_t size ;
|
||||
std::string filename ;
|
||||
time_t ban_time_stamp;
|
||||
rstime_t ban_time_stamp;
|
||||
};
|
||||
|
||||
class RsFiles
|
||||
|
|
@ -339,7 +340,7 @@ public:
|
|||
virtual bool turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const std::list<TurtleFileInfo>& results)>& multiCallback,
|
||||
std::time_t maxWait = 300 ) = 0;
|
||||
rstime_t maxWait = 300 ) = 0;
|
||||
|
||||
virtual TurtleRequestId turtleSearch(const std::string& string_to_match) = 0;
|
||||
virtual TurtleRequestId turtleSearch(
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ public:
|
|||
GRouterMsgPropagationId mid ;
|
||||
std::set<RsPeerId> local_origin;
|
||||
GRouterKeyId destination ;
|
||||
time_t routing_time;
|
||||
time_t last_tunnel_attempt_time;
|
||||
time_t last_sent_time;
|
||||
rstime_t routing_time;
|
||||
rstime_t last_tunnel_attempt_time;
|
||||
rstime_t last_sent_time;
|
||||
bool receipt_available ;
|
||||
uint32_t duplication_factor ;
|
||||
uint32_t data_status ;
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ public:
|
|||
virtual bool turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const RsGxsGroupSummary& result)>& multiCallback,
|
||||
std::time_t maxWait = 300 ) = 0;
|
||||
rstime_t maxWait = 300 ) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Distant synchronisation methods ///
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct RsGxsNetTunnelVirtualPeerInfo
|
|||
virtual ~RsGxsNetTunnelVirtualPeerInfo(){}
|
||||
|
||||
uint8_t vpid_status ; // status of the peer
|
||||
time_t last_contact ; // last time some data was sent/recvd
|
||||
rstime_t last_contact ; // last time some data was sent/recvd
|
||||
uint8_t side ; // client/server
|
||||
uint8_t encryption_master_key[32];
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ struct RsGxsNetTunnelGroupInfo
|
|||
|
||||
GroupPolicy group_policy ;
|
||||
GroupStatus group_status ;
|
||||
time_t last_contact ;
|
||||
rstime_t last_contact ;
|
||||
RsFileHash hash ;
|
||||
uint16_t service_id ;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ struct RsGxsGroupSummary : RsSerializable
|
|||
RsGxsGroupId mGroupId;
|
||||
std::string mGroupName;
|
||||
RsGxsId mAuthorId;
|
||||
time_t mPublishTs;
|
||||
rstime_t mPublishTs;
|
||||
uint32_t mNumberOfMessages;
|
||||
time_t mLastMessageTs;
|
||||
rstime_t mLastMessageTs;
|
||||
uint32_t mSignFlags;
|
||||
uint32_t mPopularity;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "retroshare/rsids.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
typedef GXSGroupId RsGxsGroupId;
|
||||
typedef Sha1CheckSum RsGxsMessageId;
|
||||
|
|
@ -67,7 +68,7 @@ struct RsGroupMetaData : RsSerializable
|
|||
uint32_t mGroupFlags; // Combination of FLAG_PRIVACY_PRIVATE | FLAG_PRIVACY_RESTRICTED | FLAG_PRIVACY_PUBLIC: diffusion
|
||||
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK, i.e. what signatures are required for parent and child msgs
|
||||
|
||||
time_t mPublishTs; // Mandatory.
|
||||
rstime_t mPublishTs; // Mandatory.
|
||||
RsGxsId mAuthorId; // Author of the group. Left to "000....0" if anonymous
|
||||
|
||||
// for circles
|
||||
|
|
@ -84,7 +85,7 @@ struct RsGroupMetaData : RsSerializable
|
|||
|
||||
uint32_t mPop; // Popularity = number of friend subscribers
|
||||
uint32_t mVisibleMsgCount; // Max messages reported by friends
|
||||
time_t mLastPost; // Timestamp for last message. Not used yet.
|
||||
rstime_t mLastPost; // Timestamp for last message. Not used yet.
|
||||
|
||||
uint32_t mGroupStatus;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
|
@ -136,7 +137,7 @@ struct RsMsgMetaData : RsSerializable
|
|||
RsGxsId mAuthorId;
|
||||
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
rstime_t mPublishTs;
|
||||
|
||||
/// the lower 16 bits for service, upper 16 bits for GXS
|
||||
uint32_t mMsgFlags;
|
||||
|
|
@ -147,7 +148,7 @@ struct RsMsgMetaData : RsSerializable
|
|||
/// the first 16 bits for service, last 16 for GXS
|
||||
uint32_t mMsgStatus;
|
||||
|
||||
time_t mChildTs;
|
||||
rstime_t mChildTs;
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
|
||||
/// @see RsSerializable
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ struct RsGxsIdGroup : RsSerializable
|
|||
|
||||
// Avatar
|
||||
RsGxsImage mImage ;
|
||||
time_t mLastUsageTS ;
|
||||
rstime_t mLastUsageTS ;
|
||||
|
||||
// Not Serialised - for GUI's benefit.
|
||||
bool mPgpKnown;
|
||||
|
|
@ -168,8 +168,8 @@ struct RsRecognTagDetails
|
|||
valid_from(0), valid_to(0), tag_class(0), tag_type(0), is_valid(false),
|
||||
is_pending(false) {}
|
||||
|
||||
time_t valid_from;
|
||||
time_t valid_to;
|
||||
rstime_t valid_from;
|
||||
rstime_t valid_to;
|
||||
uint16_t tag_class;
|
||||
uint16_t tag_type;
|
||||
|
||||
|
|
@ -315,9 +315,9 @@ struct RsIdentityDetails : RsSerializable
|
|||
|
||||
RsGxsImage mAvatar;
|
||||
|
||||
time_t mLastUsageTS;
|
||||
rstime_t mLastUsageTS;
|
||||
|
||||
std::map<RsIdentityUsage,time_t> mUseCases;
|
||||
std::map<RsIdentityUsage,rstime_t> mUseCases;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,
|
||||
|
|
@ -390,7 +390,7 @@ struct RsIdentity : RsGxsIfaceHelper
|
|||
* \param id
|
||||
* \return
|
||||
*/
|
||||
virtual time_t getLastUsageTS(const RsGxsId &id) =0;
|
||||
virtual rstime_t getLastUsageTS(const RsGxsId &id) =0;
|
||||
|
||||
// Specific RsIdentity Functions....
|
||||
/* Specific Service Data */
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class MessageInfo_v2
|
|||
//
|
||||
std::string subject;
|
||||
std::string msg;
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
|
||||
//std::list<MessageHeader> headers ;
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class MsgInfoSummary
|
|||
|
||||
std::string title;
|
||||
int count; /* file count */
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ public:
|
|||
std::set<RsPeerId> participating_friends ; // list of direct friend who participate.
|
||||
|
||||
uint32_t total_number_of_peers ; // total number of particpating peers. Might not be
|
||||
time_t last_report_time ; // last time the lobby was reported.
|
||||
rstime_t last_report_time ; // last time the lobby was reported.
|
||||
ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE
|
||||
|
||||
// RsSerializable interface
|
||||
|
|
@ -410,8 +410,8 @@ public:
|
|||
RsGxsId gxs_id ; // ID to sign messages
|
||||
|
||||
ChatLobbyFlags lobby_flags ; // see RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC / RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE
|
||||
std::map<RsGxsId, time_t> gxs_ids ; // list of non direct friend who participate. Used to display only.
|
||||
time_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
|
||||
std::map<RsGxsId, rstime_t> gxs_ids ; // list of non direct friend who participate. Used to display only.
|
||||
rstime_t last_activity ; // last recorded activity. Useful for removing dead lobbies.
|
||||
|
||||
// RsSerializable interface
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "retroshare/rsids.h"
|
||||
#include "util/rsurl.h"
|
||||
#include "util/rsdeprecate.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsPeers;
|
||||
|
||||
|
|
@ -272,7 +273,7 @@ struct RsPeerDetails : RsSerializable
|
|||
|
||||
/* have we been denied */
|
||||
bool wasDeniedConnection;
|
||||
time_t deniedTS;
|
||||
rstime_t deniedTS;
|
||||
|
||||
/* linkType */
|
||||
uint32_t linkType;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
|
@ -236,7 +236,7 @@ class RsPluginHandler
|
|||
virtual void allowAllPlugins(bool b) = 0 ;
|
||||
virtual bool getAllowAllPlugins() const = 0 ;
|
||||
|
||||
virtual void slowTickPlugins(time_t sec) = 0 ;
|
||||
virtual void slowTickPlugins(rstime_t sec) = 0 ;
|
||||
|
||||
virtual const std::string& getLocalCacheDir() const =0;
|
||||
virtual const std::string& getRemoteCacheDir() const =0;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class RsPostedPost
|
|||
mNewScore = 0;
|
||||
}
|
||||
|
||||
bool calculateScores(time_t ref_time);
|
||||
bool calculateScores(rstime_t ref_time);
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mLink;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class StatusInfo
|
|||
public:
|
||||
RsPeerId id;
|
||||
uint32_t status;
|
||||
time_t time_stamp; /// for owner time set, and for their peers time sent
|
||||
rstime_t time_stamp; /// for owner time set, and for their peers time sent
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ struct RsTokReqOptions
|
|||
uint32_t mSubscribeFilter, mSubscribeMask; // Only for Groups.
|
||||
|
||||
// Time range... again applied after Options.
|
||||
time_t mBefore;
|
||||
time_t mAfter;
|
||||
rstime_t mBefore;
|
||||
rstime_t mAfter;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <retroshare/rsflags.h>
|
||||
#include <serialiser/rsserializable.h>
|
||||
#include <serialiser/rstypeserializer.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#define USE_NEW_CHUNK_CHECKING_CODE
|
||||
|
||||
|
|
@ -225,7 +226,7 @@ struct FileInfo : RsSerializable
|
|||
std::vector<TransferInfo> peers;
|
||||
|
||||
DwlSpeed priority;
|
||||
time_t lastTS;
|
||||
rstime_t lastTS;
|
||||
|
||||
std::list<RsNodeGroupId> parent_groups;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue