From 28b4534fdfc2825a80ff2f8dad021bf92eb097ea Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 4 Jan 2011 19:46:27 +0000 Subject: [PATCH] Removed unnecessary variable "ownId" in ftController::FileRequest. Optimized parameter of rsForums from "std::string" to "const std::string&". Recompile of the GUI needed. Cleared childTS in RsDistribMsg::clear. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3949 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftcontroller.cc | 1 - libretroshare/src/retroshare/rsforums.h | 18 +++++++++--------- libretroshare/src/serialiser/rsdistribitems.cc | 2 +- libretroshare/src/services/p3forums.cc | 16 ++++++++-------- libretroshare/src/services/p3forums.h | 16 ++++++++-------- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 920cd770c..d10270014 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1103,7 +1103,6 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has std::cerr << std::endl; #endif - std::string ownId = mConnMgr->getOwnId(); uint32_t rate = 0; if (flags & RS_FILE_HINTS_BACKGROUND) rate = FT_CNTRL_SLOW_RATE; diff --git a/libretroshare/src/retroshare/rsforums.h b/libretroshare/src/retroshare/rsforums.h index 1446c8f49..a34c564d6 100644 --- a/libretroshare/src/retroshare/rsforums.h +++ b/libretroshare/src/retroshare/rsforums.h @@ -127,28 +127,28 @@ virtual ~RsForums() { return; } virtual bool forumsChanged(std::list &forumIds) = 0; -virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) = 0; +virtual std::string createForum(const std::wstring &forumName, const std::wstring &forumDesc, uint32_t forumFlags) = 0; -virtual bool getForumInfo(std::string fId, ForumInfo &fi) = 0; +virtual bool getForumInfo(const std::string &fId, ForumInfo &fi) = 0; /*! * allows peers to change information for the forum: * can only change name and descriptions * */ -virtual bool setForumInfo(std::string fId, ForumInfo &fi) = 0; +virtual bool setForumInfo(const std::string &fId, ForumInfo &fi) = 0; virtual bool getForumList(std::list &forumList) = 0; -virtual bool getForumThreadList(std::string fId, std::list &msgs) = 0; -virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list &msgs) = 0; -virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0; +virtual bool getForumThreadList(const std::string &fId, std::list &msgs) = 0; +virtual bool getForumThreadMsgList(const std::string &fId, const std::string &pId, std::list &msgs) = 0; +virtual bool getForumMessage(const std::string &fId, const std::string &mId, ForumMsgInfo &msg) = 0; virtual bool setMessageStatus(const std::string& fId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0; virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0; -virtual bool ForumMessageSend(ForumMsgInfo &info) = 0; +virtual bool ForumMessageSend(ForumMsgInfo &info) = 0; -virtual bool forumSubscribe(std::string fId, bool subscribe) = 0; +virtual bool forumSubscribe(const std::string &fId, bool subscribe) = 0; -virtual bool getMessageCount(const std::string fId, unsigned int &newCount, unsigned int &unreadCount) = 0; +virtual bool getMessageCount(const std::string &fId, unsigned int &newCount, unsigned int &unreadCount) = 0; /****************************************/ diff --git a/libretroshare/src/serialiser/rsdistribitems.cc b/libretroshare/src/serialiser/rsdistribitems.cc index 3b8aaa730..5a4396c5d 100644 --- a/libretroshare/src/serialiser/rsdistribitems.cc +++ b/libretroshare/src/serialiser/rsdistribitems.cc @@ -40,7 +40,7 @@ void RsDistribMsg::clear() parentId.clear(); threadId.clear(); timestamp = 0; - + childTS = 0; msgId.clear(); publishSignature.TlvClear(); diff --git a/libretroshare/src/services/p3forums.cc b/libretroshare/src/services/p3forums.cc index 989ad9313..58c5cd186 100644 --- a/libretroshare/src/services/p3forums.cc +++ b/libretroshare/src/services/p3forums.cc @@ -105,7 +105,7 @@ bool p3Forums::forumsChanged(std::list &forumIds) return groupsChanged(forumIds); } -bool p3Forums::getForumInfo(std::string fId, ForumInfo &fi) +bool p3Forums::getForumInfo(const std::string &fId, ForumInfo &fi) { RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/ @@ -133,7 +133,7 @@ bool p3Forums::getForumInfo(std::string fId, ForumInfo &fi) * can only change name and descriptions * */ -bool p3Forums::setForumInfo(std::string fId, ForumInfo &fi) +bool p3Forums::setForumInfo(const std::string &fId, ForumInfo &fi) { GroupInfo gi; @@ -163,7 +163,7 @@ bool p3Forums::getForumList(std::list &forumList) return true; } -bool p3Forums::getForumThreadList(std::string fId, std::list &msgs) +bool p3Forums::getForumThreadList(const std::string &fId, std::list &msgs) { std::list msgIds; std::list::iterator it; @@ -199,7 +199,7 @@ bool p3Forums::getForumThreadList(std::string fId, std::list return true; } -bool p3Forums::getForumThreadMsgList(std::string fId, std::string pId, std::list &msgs) +bool p3Forums::getForumThreadMsgList(const std::string &fId, const std::string &pId, std::list &msgs) { std::list msgIds; std::list::iterator it; @@ -239,7 +239,7 @@ bool p3Forums::getForumThreadMsgList(std::string fId, std::string pId, std::list return true; } -bool p3Forums::getForumMessage(std::string fId, std::string mId, ForumMsgInfo &info) +bool p3Forums::getForumMessage(const std::string &fId, const std::string &mId, ForumMsgInfo &info) { RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/ @@ -360,7 +360,7 @@ bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId, } -std::string p3Forums::createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) +std::string p3Forums::createForum(const std::wstring &forumName, const std::wstring &forumDesc, uint32_t forumFlags) { std::string id = createGroup(forumName, forumDesc, @@ -452,12 +452,12 @@ uint32_t convertToExternalFlags(uint32_t intFlags) return intFlags; } -bool p3Forums::forumSubscribe(std::string fId, bool subscribe) +bool p3Forums::forumSubscribe(const std::string &fId, bool subscribe) { return subscribeToGroup(fId, subscribe); } -bool p3Forums::getMessageCount(const std::string fId, unsigned int &newCount, unsigned int &unreadCount) +bool p3Forums::getMessageCount(const std::string &fId, unsigned int &newCount, unsigned int &unreadCount) { newCount = 0; unreadCount = 0; diff --git a/libretroshare/src/services/p3forums.h b/libretroshare/src/services/p3forums.h index 3f0ec8b82..c959a44a1 100644 --- a/libretroshare/src/services/p3forums.h +++ b/libretroshare/src/services/p3forums.h @@ -47,21 +47,21 @@ void loadDummyData(); virtual bool forumsChanged(std::list &forumIds); -virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags); +virtual std::string createForum(const std::wstring &forumName, const std::wstring &forumDesc, uint32_t forumFlags); -virtual bool getForumInfo(std::string fId, ForumInfo &fi); -virtual bool setForumInfo(std::string fId, ForumInfo &fi); +virtual bool getForumInfo(const std::string &fId, ForumInfo &fi); +virtual bool setForumInfo(const std::string &fId, ForumInfo &fi); virtual bool getForumList(std::list &forumList); -virtual bool getForumThreadList(std::string fId, std::list &msgs); -virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list &msgs); -virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg); +virtual bool getForumThreadList(const std::string &fId, std::list &msgs); +virtual bool getForumThreadMsgList(const std::string &fId, const std::string &tId, std::list &msgs); +virtual bool getForumMessage(const std::string &fId, const std::string &mId, ForumMsgInfo &msg); virtual bool ForumMessageSend(ForumMsgInfo &info); virtual bool setMessageStatus(const std::string& fId, const std::string& mId, const uint32_t status, const uint32_t statusMask); virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status); -virtual bool forumSubscribe(std::string fId, bool subscribe); +virtual bool forumSubscribe(const std::string &fId, bool subscribe); -virtual bool getMessageCount(const std::string fId, unsigned int &newCount, unsigned int &unreadCount); +virtual bool getMessageCount(const std::string &fId, unsigned int &newCount, unsigned int &unreadCount); /***************************************************************************************/ /****************** Event Feedback (Overloaded form p3distrib) *************************/