Removed some more compiler warnings from Windows compile (GCC 4.4).

Added -Wextra to the Windows compile.
Added new define in libbitdht for snprintf and fprintf to proper handling of "%ll" under Windows.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4951 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-02-17 10:03:38 +00:00
parent 2d2b7230d1
commit 970d88200d
35 changed files with 170 additions and 125 deletions

View File

@ -36,7 +36,6 @@ void bdMsgHistoryList::printHistory(std::ostream &out, int mode, time_t start_ts
sit = msgHistory.lower_bound(start_ts);
eit = msgHistory.upper_bound(end_ts);
time_t curr_ts = 0;
time_t old_ts = 0;
bool time_changed = false;
bool first_line = true;
@ -45,7 +44,6 @@ void bdMsgHistoryList::printHistory(std::ostream &out, int mode, time_t start_ts
time_changed = false;
if (curr_ts != it->first)
{
old_ts = curr_ts;
curr_ts = it->first;
time_changed = true;
}

View File

@ -168,7 +168,7 @@ bool bdNodeManager::setAttachMode(bool on)
}
/* Friend Tracking */
void bdNodeManager::addBadPeer(const struct sockaddr_in &addr, uint32_t source, uint32_t reason, uint32_t age)
void bdNodeManager::addBadPeer(const struct sockaddr_in &/*addr*/, uint32_t /*source*/, uint32_t /*reason*/, uint32_t /*age*/)
{
std::cerr << "bdNodeManager::addBadPeer() not implemented yet!";
std::cerr << std::endl;

View File

@ -27,6 +27,7 @@
#include "bitdht/bdpeer.h"
#include "util/bdnet.h"
#include "util/bdrandom.h"
#include "util/bdstring.h"
#include "bitdht/bdiface.h"
#include <stdlib.h>
@ -941,13 +942,13 @@ int bdSpace::printDHT()
if (size)
{
if (doPrint)
fprintf(stderr, "Estimated NetSize >> %llu\n", no_nets);
bd_fprintf(stderr, "Estimated NetSize >> %llu\n", no_nets);
}
else
{
#ifdef BITDHT_DEBUG
if (doPrint)
fprintf(stderr, " Bucket = Net / >> %llu\n", no_nets);
bd_fprintf(stderr, " Bucket = Net / >> %llu\n", no_nets);
#endif
}
}
@ -957,14 +958,14 @@ int bdSpace::printDHT()
if (size)
{
if (doPrint)
fprintf(stderr, "Estimated NetSize = %llu\n", no_peers);
bd_fprintf(stderr, "Estimated NetSize = %llu\n", no_peers);
}
else
{
#ifdef BITDHT_DEBUG
if (doPrint)
fprintf(stderr, " Bucket = Net / %llu\n", no_nets);
bd_fprintf(stderr, " Bucket = Net / %llu\n", no_nets);
#endif
}
@ -994,7 +995,7 @@ int bdSpace::printDHT()
}
else
{
fprintf(stderr, "Estimated Network Size = (%llu / %d) = %llu\n", sum, count, sum / count);
bd_fprintf(stderr, "Estimated Network Size = (%llu / %d) = %llu\n", sum, count, sum / count);
}
return 1;

View File

@ -364,7 +364,6 @@ int bdQuery::addClosestPeer(const bdId *id, uint32_t mode)
#ifdef DEBUG_QUERY
fprintf(stderr, "Dropping Peer that dont reply\n");
#endif
bool removed = false;
for(it = mClosest.begin(); it != mClosest.end(); ++it)
{
time_t sendts = ts - it->second.mLastSendTime;
@ -379,7 +378,6 @@ int bdQuery::addClosestPeer(const bdId *id, uint32_t mode)
fprintf(stderr, "\n");
#endif
mClosest.erase(it);
removed = true;
break ;
}
}
@ -568,12 +566,10 @@ int bdQuery::updatePotentialPeer(const bdId *id, uint32_t mode, uint32_t addType
sit = mPotentialPeers.lower_bound(dist);
eit = mPotentialPeers.upper_bound(dist);
bool found = false;
for(it = sit; it != eit; it++)
{
if (mFns->bdSimilarId(id, &(it->second.mPeerId)))
{
found = true;
it->second.mPeerFlags |= mode;
it->second.mLastRecvTime = now;

View File

@ -161,7 +161,6 @@ void bdStore::addStore(bdPeer *peer)
#endif
/* remove old entry */
bool removed = false;
std::list<bdPeer>::iterator it;
for(it = store.begin(); it != store.end(); )
@ -169,7 +168,6 @@ void bdStore::addStore(bdPeer *peer)
if ((it->mPeerId.addr.sin_addr.s_addr == peer->mPeerId.addr.sin_addr.s_addr) &&
(it->mPeerId.addr.sin_port == peer->mPeerId.addr.sin_port))
{
removed = true;
#ifdef DEBUG_STORE
std::cerr << "bdStore::addStore() Removed Existing Entry: ";
mFns->bdPrintId(std::cerr, &(it->mPeerId));

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h> /* malloc() realloc() free() strtoll() */
#include <string.h> /* memset() */
#include "util/bdstring.h"
#include "bitdht/bencode.h"
@ -425,7 +426,7 @@ int be_encode(be_node *node, char *str, int len)
switch (node->type) {
case BE_STR:
snprintf(str, len, "%lli:", be_str_len(node));
bd_snprintf(str, len, "%lli:", be_str_len(node));
loc += strlen(&(str[loc]));
memcpy(&(str[loc]), node->val.s, be_str_len(node));
@ -433,7 +434,7 @@ int be_encode(be_node *node, char *str, int len)
break;
case BE_INT:
snprintf(str, len, "i%llie", node->val.i);
bd_snprintf(str, len, "i%llie", node->val.i);
loc += strlen(&(str[loc]));
break;

View File

@ -19,6 +19,10 @@ debug {
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
}
# treat warnings as error for better removing
#QMAKE_CFLAGS += -Werror
#QMAKE_CXXFLAGS += -Werror
################################# Linux ##########################################
linux-* {
DESTDIR = lib
@ -59,6 +63,10 @@ win32 {
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
DESTDIR = lib
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
@ -107,6 +115,7 @@ HEADERS += \
util/bdnet.h \
util/bdthreads.h \
util/bdrandom.h \
util/bdstring.h \
udp/udplayer.h \
udp/udpstack.h \
udp/udpbitdht.h \

View File

@ -0,0 +1,35 @@
#ifndef BITDHT_UTILS_BDSTRING_H
#define BITDHT_UTILS_BDSTRING_H
/****************************************************************
* libbitdht is distributed under the following license:
*
* Copyright (C) 2012 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifdef WIN32
// for proper handling of %ll
#define bd_snprintf __mingw_snprintf
#define bd_fprintf __mingw_fprintf
#else
#define bd_snprintf snprintf
#define bd_fprintf fprintf
#endif
#endif

View File

@ -343,9 +343,9 @@ int addKnownNode(const bdId *id, uint32_t flags);
private:
DhtPeerDetails *addInternalPeer_locked(const std::string pid, int type);
DhtPeerDetails *addInternalPeer_locked(const std::string pid, uint32_t type);
int removeInternalPeer_locked(const std::string pid);
DhtPeerDetails *findInternalDhtPeer_locked(const bdNodeId *id, int type);
DhtPeerDetails *findInternalDhtPeer_locked(const bdNodeId *id, uint32_t type);
DhtPeerDetails *findInternalRsPeer_locked(const std::string &pid);
bool havePeerTranslation_locked(const std::string &pid);

View File

@ -46,7 +46,7 @@
* -> do we care if we know them? not really!
*/
int p3BitDht::InfoCallback(const bdId *id, uint32_t type, uint32_t flags, std::string info)
int p3BitDht::InfoCallback(const bdId *id, uint32_t /*type*/, uint32_t /*flags*/, std::string /*info*/)
{
/* translate info */
std::string rsid;
@ -1893,7 +1893,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
std::cerr << std::endl;
#endif
uint32_t touConnectMode = 0;
// uint32_t touConnectMode = 0;
std::string rsId;
{
@ -1923,7 +1923,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
{
default:
case BITDHT_CONNECT_MODE_DIRECT:
touConnectMode = RSDHT_TOU_MODE_DIRECT;
// touConnectMode = RSDHT_TOU_MODE_DIRECT;
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
delay = delayOrBandwidth;
break;
@ -1941,12 +1941,12 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
delay = delayOrBandwidth;
if (useProxyPort)
{
touConnectMode = RSDHT_TOU_MODE_PROXY;
// touConnectMode = RSDHT_TOU_MODE_PROXY;
connectFlags |= RS_CB_FLAG_MODE_UDP_PROXY;
}
else
{
touConnectMode = RSDHT_TOU_MODE_DIRECT;
// touConnectMode = RSDHT_TOU_MODE_DIRECT;
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
}
@ -1954,7 +1954,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
break;
case BITDHT_CONNECT_MODE_RELAY:
touConnectMode = RSDHT_TOU_MODE_RELAY;
// touConnectMode = RSDHT_TOU_MODE_RELAY;
connectFlags |= RS_CB_FLAG_MODE_UDP_RELAY;
bandwidth = delayOrBandwidth;
break;

View File

@ -184,7 +184,7 @@ bool p3BitDht::dropPeer(std::string pid)
********************************* Basic Peer Details *************************************
******************************************************************************************/
int p3BitDht::addBadPeer(const struct sockaddr_in &addr, uint32_t reason, uint32_t flags, uint32_t age)
int p3BitDht::addBadPeer(const struct sockaddr_in &addr, uint32_t /*reason*/, uint32_t /*flags*/, uint32_t /*age*/)
{
//mUdpBitDht->updateKnownPeer(&id, 0, bdflags);
@ -359,7 +359,7 @@ int p3BitDht::removePeer(const std::string pid)
********************************* Basic Peer Details *************************************
******************************************************************************************/
DhtPeerDetails *p3BitDht::addInternalPeer_locked(const std::string pid, int type)
DhtPeerDetails *p3BitDht::addInternalPeer_locked(const std::string pid, uint32_t type)
{
/* create the data structure */
if (!havePeerTranslation_locked(pid))
@ -417,7 +417,7 @@ int p3BitDht::removeInternalPeer_locked(const std::string pid)
/* indexed by bdNodeId, as this is the more used call interface */
DhtPeerDetails *p3BitDht::findInternalDhtPeer_locked(const bdNodeId *id, int type)
DhtPeerDetails *p3BitDht::findInternalDhtPeer_locked(const bdNodeId *id, uint32_t type)
{
std::map<bdNodeId, DhtPeerDetails>::iterator it = mPeers.find(*id);
if (it == mPeers.end())

View File

@ -66,13 +66,13 @@
* #define DEBUG_DWLQUEUE 1
*****/
static const uint32_t SAVE_TRANSFERS_DELAY = 61 ; // save transfer progress every 61 seconds.
static const uint32_t INACTIVE_CHUNKS_CHECK_DELAY = 240 ; // time after which an inactive chunk is released
static const uint32_t MAX_TIME_INACTIVE_REQUEUED = 120 ; // time after which an inactive ftFileControl is bt-queued
static const uint32_t TIMOUT_CACHE_FILE_TRANSFER = 800 ; // time after which cache transfer gets cancelled if inactive.
static const int32_t SAVE_TRANSFERS_DELAY = 61 ; // save transfer progress every 61 seconds.
static const int32_t INACTIVE_CHUNKS_CHECK_DELAY = 240 ; // time after which an inactive chunk is released
static const int32_t MAX_TIME_INACTIVE_REQUEUED = 120 ; // time after which an inactive ftFileControl is bt-queued
static const int32_t TIMOUT_CACHE_FILE_TRANSFER = 800 ; // time after which cache transfer gets cancelled if inactive.
static const uint32_t FT_FILECONTROL_QUEUE_ADD_END = 0 ;
static const uint32_t FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE = 1 ;
static const int32_t FT_FILECONTROL_QUEUE_ADD_END = 0 ;
static const int32_t FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE = 1 ;
ftFileControl::ftFileControl()
:mTransfer(NULL), mCreator(NULL),

View File

@ -28,7 +28,9 @@ release {
#DEFINES *= PQI_DISABLE_UDP
}
# treat warnings as error for better removing
#QMAKE_CFLAGS += -Werror
#QMAKE_CXXFLAGS += -Werror
testnetwork {
# used in rsserver/rsinit.cc Enabled Port Restrictions, and makes Proxy Port next to Dht Port.
@ -262,40 +264,44 @@ win32-x-g++ {
win32 {
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
DEFINES += USE_CMD_ARGS
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
#miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
DEFINES += USE_CMD_ARGS
#miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
UPNPC_DIR = ../../../../miniupnpc-1.3
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
UPNPC_DIR = ../../../../miniupnpc-1.3
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
PTHREADS_DIR = ../../../../pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../../zlib-1.2.3
SSL_DIR = ../../../../OpenSSL
PTHREADS_DIR = ../../../../pthreads-w32-2-8-0-release
ZLIB_DIR = ../../../../zlib-1.2.3
SSL_DIR = ../../../../OpenSSL
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}

View File

@ -197,7 +197,7 @@ void *dlopen( const char *file, int mode )
else
{
char lpFileName[MAX_PATH];
int i;
unsigned int i;
/* MSDN says backslashes *must* be used instead of forward slashes. */
for( i = 0 ; i < sizeof(lpFileName)-1 ; i++ )

View File

@ -329,10 +329,10 @@ bool p3ConfigMgr::backedUpFileSave(const std::string& fname, const std::string&
return true;
}
if(size_file != fwrite(config_buff,1, size_file, file))
if(size_file != (int) fwrite(config_buff,1, size_file, file))
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + fname_backup + "\nIs your disc full or out of quota ?");
if(size_sign != fwrite(sign_buff, 1, size_sign, sign))
if(size_sign != (int) fwrite(sign_buff, 1, size_sign, sign))
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing main signature file " + sign_fname_backup + "\nIs your disc full or out of quota ?");
fclose(file);
@ -1124,7 +1124,7 @@ bool p3Config::backedUpFileSave(const std::string& cfg_fname, const std::string&
#endif
}
if(size_file != fwrite(buff, 1, size_file, cfg_file))
if(size_file != (int) fwrite(buff, 1, size_file, cfg_file))
{
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + cfg_fname_backup + "\nIs your disc full or out of quota ?");
fclose(cfg_file);

View File

@ -270,7 +270,7 @@ bool p3PeerMgrIMPL::getGpgId(const std::string &ssl_id, std::string &gpgId)
}
// Placeholder until we implement this functionality.
uint32_t p3PeerMgrIMPL::getConnectionType(const std::string &sslId)
uint32_t p3PeerMgrIMPL::getConnectionType(const std::string &/*sslId*/)
{
return RS_NET_CONN_TYPE_FRIEND;
}

View File

@ -351,7 +351,7 @@ int pqiarchive::writePkt(RsItem *pqi)
out << "Writing Pkt Body" << std::endl;
// write packet.
if (len != bio->senddata(ptr, len))
if ((int) len != bio->senddata(ptr, len))
{
out << "Problems with Send Data!";
out << std::endl;

View File

@ -294,7 +294,7 @@ int pqistore::writePkt(RsItem *pqi)
out << "Writing Pkt Body" << std::endl;
#endif
// write packet.
if (len != bio->senddata(ptr, len))
if (len != (uint32_t) bio->senddata(ptr, len))
{
#ifdef PQISTORE_DEBUG
out << "Problems with Send Data!";

View File

@ -143,7 +143,7 @@ bool p3BanList::recvBanItem(RsBanListItem *item)
}
/* overloaded from pqiNetAssistSharePeer */
void p3BanList::updatePeer(std::string id, struct sockaddr_in addr, int type, int reason, int age)
void p3BanList::updatePeer(std::string /*id*/, struct sockaddr_in addr, int /*type*/, int /*reason*/, int age)
{
std::string ownId = mLinkMgr->getOwnId();
@ -160,7 +160,7 @@ void p3BanList::updatePeer(std::string id, struct sockaddr_in addr, int type, in
}
bool p3BanList::addBanEntry(const std::string &peerId, const struct sockaddr_in &addr, uint32_t level, uint32_t reason, uint32_t age)
bool p3BanList::addBanEntry(const std::string &peerId, const struct sockaddr_in &addr, int level, uint32_t reason, uint32_t age)
{
RsStackMutex stack(mBanMtx); /****** LOCKED MUTEX *******/
@ -217,7 +217,7 @@ bool p3BanList::addBanEntry(const std::string &peerId, const struct sockaddr_in
/* see if it needs an update */
if ((mit->second.reason != reason) ||
(mit->second.level != level) ||
(mit->second.mTs < now - age))
(mit->second.mTs < (time_t) (now - age)))
{
/* update */
mit->second.addr = addr;

View File

@ -94,7 +94,7 @@ class p3BanList: /* public RsBanList, */ public p3Service, public pqiNetAssistPe
bool recvBanItem(RsBanListItem *item);
bool addBanEntry(const std::string &peerId, const struct sockaddr_in &addr,
uint32_t level, uint32_t reason, uint32_t age);
int level, uint32_t reason, uint32_t age);
void sendBanLists();
int sendBanSet(std::string peerid);

View File

@ -708,7 +708,7 @@ void p3ChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
#endif
if(time(NULL)+100 > item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
if(time(NULL)+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
{
std::cerr << "Received severely outdated lobby event item! Dropping it!" << std::endl;
std::cerr << "Message item is:" << std::endl;
@ -820,7 +820,7 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *ci)
return true ;
}
if(now+100 > cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
if(now+100 > (time_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
{
std::cerr << "Received severely outdated message!Dropping it!" << std::endl;
std::cerr << "Message item is:" << std::endl;

View File

@ -95,7 +95,7 @@ int tou_init(void **in_udpsubrecvs, int *type, int number)
}
noUdpSR = number;
int i;
uint32_t i;
for(i = 0; i < noUdpSR; i++)
{
udpSR[i] = usrArray[i];
@ -110,7 +110,7 @@ int tou_init(void **in_udpsubrecvs, int *type, int number)
/* open - allocates a sockfd, and checks that the type is okay */
int tou_socket(int recvIdx, int type, int /*protocol*/)
int tou_socket(uint32_t recvIdx, uint32_t type, int /*protocol*/)
{
if (!tou_inited)
{

View File

@ -104,7 +104,7 @@ int tou_init(void **udpSubRecvs, int *udpTypes, int nUdps);
*/
/* creation/connections */
int tou_socket(int domain, int type, int protocol);
int tou_socket(uint32_t domain, uint32_t type, int protocol);
int tou_bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen); /* null op now */
int tou_listen(int sockfd, int backlog); /* null op now */
int tou_connect(int sockfd, const struct sockaddr *serv_addr,

View File

@ -41,9 +41,9 @@ static const int STUN_TTL = 64;
//#define DEBUG_UDP_STUNNER 1
const int32_t TOU_STUN_MAX_FAIL_COUNT = 3; /* 3 tries (could be higher?) */
const uint32_t TOU_STUN_MAX_FAIL_COUNT = 3; /* 3 tries (could be higher?) */
const int32_t TOU_STUN_MAX_SEND_RATE = 5; /* every 5 seconds */
const int32_t TOU_STUN_MAX_RECV_RATE = 25; /* every 25 seconds */
const uint32_t TOU_STUN_MAX_RECV_RATE = 25; /* every 25 seconds */
// TIMEOUT is now tied to STUN RATE ... const int32_t TOU_STUN_ADDR_MAX_AGE = 120; /* 2 minutes */
const int32_t TOU_STUN_DEFAULT_TARGET_RATE = 15; /* 20 secs is minimum to keep a NAT UDP port open */
@ -384,7 +384,7 @@ bool UdpStunner::externalAddr(struct sockaddr_in &external, uint8_t &stable)
/* address timeout
* no timeout if in exclusive mode
*/
if ((time(NULL) - eaddrTime > (mTargetStunPeriod * 2)) && (!mExclusiveMode))
if ((time(NULL) - eaddrTime > (long) (mTargetStunPeriod * 2)) && (!mExclusiveMode))
{
std::cerr << "UdpStunner::externalAddr() eaddr expired";
std::cerr << std::endl;
@ -839,7 +839,7 @@ bool UdpStunner::attemptStun()
{
RsStackMutex stack(stunMtx); /********** LOCK MUTEX *********/
int i;
size_t i;
for(i = 0; ((i < mStunList.size()) && (mStunList.size() > 0) && (!found)); i++)
{
/* extract entry */
@ -1053,7 +1053,7 @@ bool UdpStunner::locked_checkExternalAddress()
#else
(isExternalNet(&(it->eaddr.sin_addr))) &&
#endif
(it->failCount == 0) && (age < (mTargetStunPeriod * 2)))
(it->failCount == 0) && (age < (long) (mTargetStunPeriod * 2)))
{
if (!found1)
{

View File

@ -955,6 +955,9 @@ m_WanService(NULL)
#ifdef UPNP_DEBUG
std::cerr << "UPnPControlPoint::CUPnPControlPoint() bound to " << ipAddress << ":" <<
port << "." << std::endl;
#else
// unused variable
(void)port;
#endif
ret = UpnpRegisterClient(

View File

@ -22,6 +22,10 @@ minimal {
DEFINES += MINIMAL_RSGUI
}
# treat warnings as error for better removing
#QMAKE_CFLAGS += -Werror
#QMAKE_CXXFLAGS += -Werror
################################# Linux ##########################################
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
linux-* {
@ -91,36 +95,40 @@ win32-x-g++ {
#################################### Windows #####################################
win32 {
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
OBJECTS_DIR = temp/obj
#LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats"
#QTPLUGIN += qjpeg
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
OBJECTS_DIR = temp/obj
#LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats"
#QTPLUGIN += qjpeg
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"../../../../lib"
LIBS += -lssl -lcrypto -lgpgme -lpthreadGC2d -lminiupnpc -lz
PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"../../../../lib"
LIBS += -lssl -lcrypto -lgpgme -lpthreadGC2d -lminiupnpc -lz
# added after bitdht
# LIBS += -lws2_32
LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32
LIBS += -lole32 -lwinmm
RC_FILE = gui/images/retroshare_win.rc
LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32
LIBS += -lole32 -lwinmm
RC_FILE = gui/images/retroshare_win.rc
DEFINES += WINDOWS_SYS
DEFINES += WINDOWS_SYS
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
INCLUDEPATH += . $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
INCLUDEPATH += . $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}
##################################### MacOS ######################################

View File

@ -285,13 +285,13 @@ void AWidget::addBlob(int x, int y, int radius, int height) {
// Set up the pointers
int *newptr;
int *oldptr;
// int *oldptr;
if (page == 0) {
newptr = &heightField1.front();
oldptr = &heightField2.front();
// oldptr = &heightField2.front();
} else {
newptr = &heightField2.front();
oldptr = &heightField1.front();
// oldptr = &heightField1.front();
}
int rquad = radius * radius;

View File

@ -31,7 +31,7 @@
#define IMAGE_UNSUBSCRIBE ""
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
: RsAutoUpdatePage(5000,parent)
: RsAutoUpdatePage(5000, parent, flags)
{
setupUi(this);
@ -330,7 +330,7 @@ void ChatLobbyWidget::unsubscribeItem()
rsMsgs->unsubscribeChatLobby(id);
}
void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int column)
void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
{
subscribeLobby(item);
}

View File

@ -4,8 +4,8 @@
bool RsAutoUpdatePage::_locked = false ;
RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period,QWidget *parent)
: MainPage(parent)
RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period, QWidget *parent, Qt::WindowFlags flags)
: MainPage(parent, flags)
{
_timer = new QTimer ;
_timer->setInterval(ms_update_period);

View File

@ -18,7 +18,7 @@ class RsAutoUpdatePage: public MainPage
Q_OBJECT
public:
RsAutoUpdatePage(int ms_update_period = 1000,QWidget *parent=NULL) ;
RsAutoUpdatePage(int ms_update_period = 1000, QWidget *parent = NULL, Qt::WindowFlags flags = 0) ;
virtual ~RsAutoUpdatePage() ;
virtual void updateDisplay() {}

View File

@ -41,7 +41,7 @@ public:
static void closeChat(const std::string &peerId);
static void chatChanged(int list, int type);
virtual void showDialog(uint chatflags) {}
virtual void showDialog(uint /*chatflags*/) {}
virtual ChatWidget *getChatWidget() = 0;
virtual bool hasPeerStatus() = 0;
@ -79,7 +79,7 @@ protected:
virtual bool canClose() { return true; }
virtual void init(const std::string &peerId, const QString &title);
virtual void onChatChanged(int list, int type) {}
virtual void onChatChanged(int /*list*/, int /*type*/) {}
virtual void addIncomingChatMsg(const ChatInfo& info) = 0;

View File

@ -297,7 +297,7 @@ void PopupChatWindow::getAvatar()
}
}
void PopupChatWindow::tabClosed(ChatDialog *dialog)
void PopupChatWindow::tabClosed(ChatDialog */*dialog*/)
{
if (tabbedWindow) {
if (ui.tabWidget->count() == 0) {

View File

@ -30,7 +30,7 @@ class MainPage : public QWidget
{
public:
/** Default Constructor */
MainPage(QWidget *parent = 0) : QWidget(parent) {}
MainPage(QWidget *parent = 0, Qt::WindowFlags flags = 0) : QWidget(parent, flags) {}
virtual void retranslateUi() {}
};

View File

@ -446,13 +446,6 @@ void NotifyQt::notifyListPreChange(int list, int /*type*/)
void NotifyQt::UpdateGUI()
{
#ifndef MINIMAL_RSGUI
/* hack to force updates until we've fixed that part */
static time_t lastTs = 0;
// std::cerr << "Got update signal t=" << lastTs << std::endl ;
lastTs = time(NULL) ;
static bool already_updated = false ; // these only update once at start because they may already have been set before
// the gui is running, then they get updated by callbacks.
if(!already_updated)
@ -656,9 +649,6 @@ void NotifyQt::runningTick()
{
// QMutexLocker lock(&runningToasterMutex);
QDesktopWidget *desktop = QApplication::desktop();
QRect desktopGeometry = desktop->availableGeometry(desktop->primaryScreen());
int interval = runningToasterTimer->interval();
QPoint diff;

View File

@ -61,7 +61,7 @@ RelayPage::RelayPage(QWidget * parent, Qt::WFlags flags)
}
/** Saves the changes on this page */
bool RelayPage::save(QString &errmsg)
bool RelayPage::save(QString &/*errmsg*/)
{
int nFriends = ui.noFriendSpinBox->value();