From c3b6da6386991541b292c69935fc84d4aa3eff07 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 9 Jun 2010 19:51:46 +0000 Subject: [PATCH] cleaned some compiler warnings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3092 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/dbase/fistore.cc | 4 ---- libretroshare/src/pqi/authgpg.cc | 7 ++++++- libretroshare/src/rsserver/rsinit.cc | 2 +- libretroshare/src/serialiser/rsdistribitems.h | 2 +- libretroshare/src/services/p3blogs.cc | 2 +- libretroshare/src/services/p3distrib.cc | 21 +++++++------------ libretroshare/src/turtle/rsturtleitem.cc | 7 +++++++ libretroshare/src/upnp/upnputil.c | 2 +- 8 files changed, 25 insertions(+), 22 deletions(-) diff --git a/libretroshare/src/dbase/fistore.cc b/libretroshare/src/dbase/fistore.cc index 29e7a7a89..d507c7a98 100644 --- a/libretroshare/src/dbase/fistore.cc +++ b/libretroshare/src/dbase/fistore.cc @@ -186,7 +186,6 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f std::cerr << "FileIndexStore::RequestDirDetails() ref=" << ref << " flags: " << flags << std::endl; #endif - bool found = true; std::map::const_iterator pit; lockData(); @@ -307,7 +306,6 @@ int FileIndexStore::SearchKeywords(std::list keywords, std::list firesults; results.clear() ; - time_t now = time(NULL); #ifdef FIS_DEBUG std::cerr << "FileIndexStore::SearchKeywords()" << std::endl; @@ -362,8 +360,6 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list &resul std::list::iterator rit; std::list firesults; - time_t now = time(NULL); - #ifdef FIS_DEBUG std::cerr << "FileIndexStore::searchBoolExp()" << std::endl; #endif diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index 49c4ba24e..f6f17062a 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -46,7 +46,9 @@ static std::string setKeyPairParams(bool useRsa, unsigned int blen, std::string name, std::string comment, std::string email, std::string inPassphrase); +#ifdef UNUSED_CODE static gpgme_key_t getKey(gpgme_ctx_t, std::string, std::string, std::string); +#endif static gpg_error_t keySignCallback(void *, gpgme_status_code_t, \ const char *, int); @@ -732,7 +734,10 @@ bool AuthGPG::DoOwnSignature_locked(const void *data, unsigned int datalen, void return false; } - gpgme_sign_result_t res = gpgme_op_sign_result(CTX); +#ifdef GPG_DEBUG + gpgme_sign_result_t res = +#endif + gpgme_op_sign_result(CTX); #ifdef GPG_DEBUG if (res) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index d42c77e18..f565f4406 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -210,7 +210,7 @@ void RsInit::InitRsConfig() #ifdef WINDOWS_SYS // test for portable version - if (GetFileAttributes ("gpg.exe") != -1 && GetFileAttributes ("gpgme-w32spawn.exe") != -1) { + if (GetFileAttributes ("gpg.exe") != (DWORD) -1 && GetFileAttributes ("gpgme-w32spawn.exe") != (DWORD) -1) { // use portable version RsInitConfig::portable = true; } diff --git a/libretroshare/src/serialiser/rsdistribitems.h b/libretroshare/src/serialiser/rsdistribitems.h index 02e34a367..896255b93 100644 --- a/libretroshare/src/serialiser/rsdistribitems.h +++ b/libretroshare/src/serialiser/rsdistribitems.h @@ -60,7 +60,7 @@ virtual std::ostream& print(std::ostream &out, uint16_t indent = 0); /* Not Serialised */ std::string msgId; /* Msg Id */ - uint32_t childTS; /* timestamp of most recent child */ + time_t childTS; /* timestamp of most recent child */ RsTlvKeySignature publishSignature; RsTlvKeySignature personalSignature; }; diff --git a/libretroshare/src/services/p3blogs.cc b/libretroshare/src/services/p3blogs.cc index c2d896173..e8f64fddc 100644 --- a/libretroshare/src/services/p3blogs.cc +++ b/libretroshare/src/services/p3blogs.cc @@ -369,7 +369,7 @@ bool p3Blogs::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std::s } /* check age */ - time_t age = time(NULL) - msg->timestamp; + uint32_t age = time(NULL) - msg->timestamp; if (age > DOWNLOAD_PERIOD) { diff --git a/libretroshare/src/services/p3distrib.cc b/libretroshare/src/services/p3distrib.cc index adecc10bf..df974134a 100644 --- a/libretroshare/src/services/p3distrib.cc +++ b/libretroshare/src/services/p3distrib.cc @@ -64,9 +64,6 @@ p3GroupDistrib::p3GroupDistrib(uint16_t subtype, mMaxCacheSubId(1), mKeyBackUpDir(keyBackUpDir), BACKUP_KEY_FILE("key.log"), mLastKeyPublishTime(0) { - /* not much yet */ - time_t now = time(NULL); - /* force publication of groups (cleared if local cache file found) */ mGroupsRepublish = true; @@ -90,7 +87,7 @@ int p3GroupDistrib::tick() { RsStackMutex stack(distribMtx); /**** STACK LOCKED MUTEX ****/ - toPublish = (mPendingPublish.size() > 0) && (now > mPubPeriod + mLastPublishTime); + toPublish = (mPendingPublish.size() > 0) && (now > (time_t) (mPubPeriod + mLastPublishTime)); } @@ -352,7 +349,7 @@ void p3GroupDistrib::loadFileMsgs(std::string filename, uint16_t cacheSubId, std mMaxCacheSubId = cacheSubId; } - if ((ts < now) && (ts > mLastPublishTime)) + if (((time_t) ts < now) && ((time_t) ts > mLastPublishTime)) { #ifdef DISTRIB_DEBUG std::cerr << "p3GroupDistrib::loadFileMsgs() New LastPublishTime"; @@ -1528,7 +1525,6 @@ std::string p3GroupDistrib::createGroup(std::wstring name, std::wstring desc, ui std::cerr << std::endl; #endif /* Create a Group */ - GroupInfo grpInfo; std::string grpId; time_t now = time(NULL); @@ -1664,7 +1660,7 @@ std::string p3GroupDistrib::createGroup(std::wstring name, std::wstring desc, ui unsigned int siglen = EVP_PKEY_size(key_admin); unsigned char sigbuf[siglen]; - int ans = EVP_SignFinal(mdctx, sigbuf, &siglen, key_admin); + EVP_SignFinal(mdctx, sigbuf, &siglen, key_admin); /* save signature */ newGrp->adminSignature.signData.setBinData(sigbuf, siglen); @@ -2091,7 +2087,7 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign) unsigned int siglen = EVP_PKEY_size(publishKey); unsigned char sigbuf[siglen]; - int ans = EVP_SignFinal(mdctx, sigbuf, &siglen, publishKey); + EVP_SignFinal(mdctx, sigbuf, &siglen, publishKey); /* save signature */ signedMsg->publishSignature.signData.setBinData(sigbuf, siglen); @@ -2370,7 +2366,7 @@ bool p3GroupDistrib::locked_editGroup(std::string grpId, GroupInfo& gi){ unsigned int siglen = EVP_PKEY_size(key_admin); unsigned char sigbuf[siglen]; - int ans = EVP_SignFinal(mdctx, sigbuf, &siglen, key_admin); + EVP_SignFinal(mdctx, sigbuf, &siglen, key_admin); /* save signature */ gi_curr->distribGroup->adminSignature.signData.setBinData(sigbuf, siglen); @@ -3009,11 +3005,10 @@ bool p3GroupDistrib::locked_checkDistribMsg( /* check timestamp */ time_t now = time(NULL); - time_t min = now - mStorePeriod; - time_t minPub = now - mStorePeriod / 2.0; - time_t max = now + GROUP_MAX_FWD_OFFSET; + uint32_t min = now - mStorePeriod; + uint32_t max = now + GROUP_MAX_FWD_OFFSET; - if ((msg->timestamp < min) || (msg->timestamp > max)) + if ((msg->timestamp < min) || (msg->timestamp > max)) { #ifdef DISTRIB_DEBUG std::cerr << "p3GroupDistrib::locked_checkDistribMsg() TS out of range"; diff --git a/libretroshare/src/turtle/rsturtleitem.cc b/libretroshare/src/turtle/rsturtleitem.cc index bd0a7a518..15eaf8010 100644 --- a/libretroshare/src/turtle/rsturtleitem.cc +++ b/libretroshare/src/turtle/rsturtleitem.cc @@ -359,6 +359,7 @@ RsTurtleStringSearchRequestItem::RsTurtleStringSearchRequestItem(void *data,uint ok &= getRawUInt16(data, pktsize, &offset, &depth); #ifdef WINDOWS_SYS // No Exceptions in Windows compile. (drbobs). + UNREFERENCED_LOCAL_VARIABLE(rssize); #else if (offset != rssize) throw std::runtime_error("Size error while deserializing.") ; @@ -399,6 +400,7 @@ RsTurtleRegExpSearchRequestItem::RsTurtleRegExpSearchRequestItem(void *data,uint for(uint32_t i=0;i