From 3678766a934f5834ecbdb69e7e6797f26acbc1d1 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 24 Apr 2012 12:49:54 +0000 Subject: [PATCH] Changed parameter of RsChannels from "std::string" to "const std::string&". Recompile needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5117 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/distrib/p3distrib.cc | 2 +- libretroshare/src/distrib/p3distrib.h | 2 +- libretroshare/src/retroshare/rschannels.h | 20 ++++++++++---------- libretroshare/src/services/p3channels.cc | 22 +++++++++++----------- libretroshare/src/services/p3channels.h | 20 ++++++++++---------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/libretroshare/src/distrib/p3distrib.cc b/libretroshare/src/distrib/p3distrib.cc index 4e8bde08a..faed9e913 100644 --- a/libretroshare/src/distrib/p3distrib.cc +++ b/libretroshare/src/distrib/p3distrib.cc @@ -555,7 +555,7 @@ void p3GroupDistrib::loadFileMsgs(const std::string &filename, const CacheData& } -bool p3GroupDistrib::processCacheOptReq(std::string grpId) +bool p3GroupDistrib::processCacheOptReq(const std::string &grpId) { { RsStackMutex stack(distribMtx); diff --git a/libretroshare/src/distrib/p3distrib.h b/libretroshare/src/distrib/p3distrib.h index 3c0c67e36..9db10f408 100644 --- a/libretroshare/src/distrib/p3distrib.h +++ b/libretroshare/src/distrib/p3distrib.h @@ -324,7 +324,7 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu * @param grpId the group to process request for * @return false if group does not exist */ - bool processCacheOptReq(std::string grpId); + bool processCacheOptReq(const std::string &grpId); /*! * msg is loaded to its group and republished, diff --git a/libretroshare/src/retroshare/rschannels.h b/libretroshare/src/retroshare/rschannels.h index 8c98283cc..13160cdd6 100644 --- a/libretroshare/src/retroshare/rschannels.h +++ b/libretroshare/src/retroshare/rschannels.h @@ -156,7 +156,7 @@ virtual std::string createChannel(std::wstring chanName, std::wstring chanDesc, * @param cId channel id * @param ci channel info is store here */ -virtual bool getChannelInfo(std::string cId, ChannelInfo &ci) = 0; +virtual bool getChannelInfo(const std::string &cId, ChannelInfo &ci) = 0; /*! * @param chanList populated channelinfo for all channels @@ -168,12 +168,12 @@ virtual bool getChannelList(std::list &chanList) = 0; * @param cId channel id user wants messages for * @param msgs summary of messages for the given cId */ -virtual bool getChannelMsgList(std::string cId, std::list &msgs) = 0; +virtual bool getChannelMsgList(const std::string &cId, std::list &msgs) = 0; /*! * retrieve more comprehensive message info given channel id and message id */ -virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg) = 0; +virtual bool getChannelMessage(const std::string &cId, const std::string &mId, ChannelMsgInfo &msg) = 0; /*! * set message status @@ -198,7 +198,7 @@ virtual bool getMessageStatus(const std::string& cId, const std::string& mId, ui * @param newCount count of new messages * @param unreadCount count of unread messages */ -virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount) = 0; +virtual bool getMessageCount(const std::string &cId, unsigned int &newCount, unsigned int &unreadCount) = 0; /*! * send message contain in message info to the id indicated within it (make sure you set the channel id of the message info) @@ -211,7 +211,7 @@ virtual bool ChannelMessageSend(ChannelMsgInfo &info) = 0; * @param subscribe set to true if you want to subscribe and to false to unsubscribe * @param set true to allow autodownload of new content and false otherwise, ignored when second param is false */ -virtual bool channelSubscribe(std::string cId, bool subscribe, bool autoDl) = 0; +virtual bool channelSubscribe(const std::string &cId, bool subscribe, bool autoDl) = 0; /*! * This hashes a file which is not already shared by client or his peers, @@ -219,19 +219,19 @@ virtual bool channelSubscribe(std::string cId, bool subscribe, bool autoDl) = 0; * @param path This is full path to file * @param channel Id */ -virtual bool channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo) = 0; +virtual bool channelExtraFileHash(const std::string &path, const std::string &chId, FileInfo& fInfo) = 0; /*! * This removes hashed extra files, and also removes channels directory copy if it exists * @param chId channel id */ -virtual bool channelExtraFileRemove(std::string hash, std::string chId) = 0; +virtual bool channelExtraFileRemove(const std::string &hash, const std::string &chId) = 0; /*! * Restores channel private keys for channel in the event keys stored in configuration files are lost * @param chId channel id to restore keys for */ -virtual bool channelRestoreKeys(std::string chId) = 0; +virtual bool channelRestoreKeys(const std::string &chId) = 0; /*! * shares keys with peers @@ -239,7 +239,7 @@ virtual bool channelRestoreKeys(std::string chId) = 0; *@param peers peers in this list will be sent keys * */ -virtual bool channelShareKeys(std::string chId, std::list& peers) = 0; +virtual bool channelShareKeys(const std::string &chId, std::list& peers) = 0; /****************************************/ /*! @@ -247,7 +247,7 @@ virtual bool channelShareKeys(std::string chId, std::list& peers) = * can only change channel image, descriptions and name * */ -virtual bool channelEditInfo(std::string chId, ChannelInfo &ci) = 0; +virtual bool channelEditInfo(const std::string &chId, ChannelInfo &ci) = 0; /*! diff --git a/libretroshare/src/services/p3channels.cc b/libretroshare/src/services/p3channels.cc index b5ac5b2de..867e691d2 100644 --- a/libretroshare/src/services/p3channels.cc +++ b/libretroshare/src/services/p3channels.cc @@ -99,7 +99,7 @@ bool p3Channels::channelsChanged(std::list &chanIds) } -bool p3Channels::getChannelInfo(std::string cId, ChannelInfo &ci) +bool p3Channels::getChannelInfo(const std::string &cId, ChannelInfo &ci) { RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/ @@ -148,7 +148,7 @@ bool p3Channels::getChannelList(std::list &channelList) } -bool p3Channels::getChannelMsgList(std::string cId, std::list &msgs) +bool p3Channels::getChannelMsgList(const std::string &cId, std::list &msgs) { std::list msgIds; std::list::iterator it; @@ -181,7 +181,7 @@ bool p3Channels::getChannelMsgList(std::string cId, std::list return true; } -bool p3Channels::getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &info) +bool p3Channels::getChannelMessage(const std::string &cId, const std::string &mId, ChannelMsgInfo &info) { std::list msgIds; std::list::iterator it; @@ -234,7 +234,7 @@ bool p3Channels::getChannelMessage(std::string cId, std::string mId, ChannelMsgI return true; } -bool p3Channels::channelRestoreKeys(std::string chId){ +bool p3Channels::channelRestoreKeys(const std::string &chId){ return p3GroupDistrib::restoreGrpKeys(chId); } @@ -383,7 +383,7 @@ bool p3Channels::getMessageStatus(const std::string& cId, const std::string& mId return false; } -bool p3Channels::getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount) +bool p3Channels::getMessageCount(const std::string &cId, unsigned int &newCount, unsigned int &unreadCount) { newCount = 0; unreadCount = 0; @@ -462,11 +462,11 @@ bool p3Channels::getMessageCount(const std::string cId, unsigned int &newCount, return true; } -bool p3Channels::channelExtraFileHash(std::string path, std::string /*chId*/, FileInfo& fInfo){ +bool p3Channels::channelExtraFileHash(const std::string &path, const std::string & /*chId*/, FileInfo& fInfo){ // get file name std::string fname, fnameBuff; - std::string::reverse_iterator rit; + std::string::const_reverse_iterator rit; for(rit = path.rbegin(); *rit != '/' ; rit++){ fnameBuff.push_back(*rit); @@ -490,7 +490,7 @@ bool p3Channels::channelExtraFileHash(std::string path, std::string /*chId*/, Fi } -bool p3Channels::channelExtraFileRemove(std::string hash, std::string chId){ +bool p3Channels::channelExtraFileRemove(const std::string &hash, const std::string &chId){ uint32_t flags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA; @@ -543,7 +543,7 @@ bool p3Channels::locked_checkDistribMsg(RsDistribMsg */*msg*/) -bool p3Channels::channelSubscribe(std::string cId, bool subscribe, bool autoDl) +bool p3Channels::channelSubscribe(const std::string &cId, bool subscribe, bool autoDl) { #ifdef CHANNEL_DEBUG std::cerr << "p3Channels::channelSubscribe() " << cId << std::endl; @@ -621,7 +621,7 @@ void p3Channels::removeChannelReadStatusEntry(const std::string& cId) } } -bool p3Channels::channelShareKeys(std::string chId, std::list& peers){ +bool p3Channels::channelShareKeys(const std::string &chId, std::list& peers){ #ifdef CHANNEL_DEBUG std::cerr << "p3Channels::channelShareKeys() " << chId << std::endl; @@ -631,7 +631,7 @@ bool p3Channels::channelShareKeys(std::string chId, std::list& peer } -bool p3Channels::channelEditInfo(std::string chId, ChannelInfo& info){ +bool p3Channels::channelEditInfo(const std::string &chId, ChannelInfo& info){ #ifdef CHANNEL_DEBUG std::cerr << "p3Channels::channelUdateInfo() " << chId << std::endl; diff --git a/libretroshare/src/services/p3channels.h b/libretroshare/src/services/p3channels.h index 3abb42b67..0be306bdd 100644 --- a/libretroshare/src/services/p3channels.h +++ b/libretroshare/src/services/p3channels.h @@ -66,22 +66,22 @@ virtual bool channelsChanged(std::list &chanIds); virtual std::string createChannel(std::wstring chanName, std::wstring chanDesc, uint32_t chanFlags, unsigned char* pngImageData, uint32_t size); -virtual bool getChannelInfo(std::string cId, ChannelInfo &ci); +virtual bool getChannelInfo(const std::string &cId, ChannelInfo &ci); virtual bool getChannelList(std::list &chanList); -virtual bool getChannelMsgList(std::string cId, std::list &msgs); -virtual bool getChannelMessage(std::string cId, std::string mId, ChannelMsgInfo &msg); +virtual bool getChannelMsgList(const std::string &cId, std::list &msgs); +virtual bool getChannelMessage(const std::string &cId, const std::string &mId, ChannelMsgInfo &msg); virtual bool ChannelMessageSend(ChannelMsgInfo &info); virtual bool setMessageStatus(const std::string& cId, const std::string& mId, const uint32_t status, const uint32_t statusMask); virtual bool getMessageStatus(const std::string& cId, const std::string& mId, uint32_t& status); -virtual bool getMessageCount(const std::string cId, unsigned int &newCount, unsigned int &unreadCount); -virtual bool channelSubscribe(std::string cId, bool subscribe, bool autoDl); -virtual bool channelExtraFileHash(std::string path, std::string chId, FileInfo& fInfo); -virtual bool channelExtraFileRemove(std::string hash, std::string chId); -virtual bool channelRestoreKeys(std::string chId); -virtual bool channelShareKeys(std::string chId, std::list& peers); -virtual bool channelEditInfo(std::string chId, ChannelInfo &ci); +virtual bool getMessageCount(const std::string &cId, unsigned int &newCount, unsigned int &unreadCount); +virtual bool channelSubscribe(const std::string &cId, bool subscribe, bool autoDl); +virtual bool channelExtraFileHash(const std::string &path, const std::string &chId, FileInfo& fInfo); +virtual bool channelExtraFileRemove(const std::string &hash, const std::string &chId); +virtual bool channelRestoreKeys(const std::string &chId); +virtual bool channelShareKeys(const std::string &chId, std::list& peers); +virtual bool channelEditInfo(const std::string &chId, ChannelInfo &ci); virtual void getPubKeysAvailableGrpIds(std::list& grpIds); virtual bool channelSetAutoDl(const std::string& chId, bool autoDl); virtual bool channelGetAutoDl(const std::string& chId, bool& autoDl);