|
Added
Link Here
|
| 1 |
From 5e94c772b3e6033d37cb29d307e8df6ce0c33d1d Mon Sep 17 00:00:00 2001 |
| 2 |
From: Nyfor <arkanum@web.de> |
| 3 |
Date: Mon, 4 Apr 2016 12:07:09 +0200 |
| 4 |
Subject: [PATCH] Fixed compilation for Clang. |
| 5 |
|
| 6 |
diff --git libretroshare/src/grouter/p3grouter.h libretroshare/src/grouter/p3grouter.h |
| 7 |
index 1626da7..8c6fbab 100644 |
| 8 |
--- libretroshare/src/grouter/p3grouter.h |
| 9 |
+++ libretroshare/src/grouter/p3grouter.h |
| 10 |
@@ -225,20 +225,13 @@ class p3GRouter: public RsGRouter, public RsTurtleClientService, public p3Servic |
| 11 |
void handleLowLevelTransactionAckItem(RsGRouterTransactionAcknItem*) ; |
| 12 |
|
| 13 |
static Sha1CheckSum computeDataItemHash(RsGRouterGenericDataItem *data_item); |
| 14 |
-#ifdef __APPLE__ |
| 15 |
-public: |
| 16 |
-#endif |
| 17 |
- class nullstream: public std::ostream {}; |
| 18 |
|
| 19 |
std::ostream& grouter_debug() const |
| 20 |
{ |
| 21 |
- static nullstream null ; |
| 22 |
- |
| 23 |
+ static std::ostream null(0); |
| 24 |
return _debug_enabled?(std::cerr):null; |
| 25 |
} |
| 26 |
-#ifdef __APPLE__ |
| 27 |
-private: |
| 28 |
-#endif |
| 29 |
+ |
| 30 |
void routePendingObjects() ; |
| 31 |
void handleTunnels() ; |
| 32 |
void autoWash() ; |
| 33 |
@@ -364,5 +357,3 @@ class p3GRouter: public RsGRouter, public RsTurtleClientService, public p3Servic |
| 34 |
|
| 35 |
uint64_t _random_salt ; |
| 36 |
}; |
| 37 |
- |
| 38 |
-template<typename T> p3GRouter::nullstream& operator<<(p3GRouter::nullstream& ns,const T&) { return ns ; } |
| 39 |
diff --git libretroshare/src/rsserver/rsinit.cc libretroshare/src/rsserver/rsinit.cc |
| 40 |
index d064dab..dce5a3c 100644 |
| 41 |
--- libretroshare/src/rsserver/rsinit.cc |
| 42 |
+++ libretroshare/src/rsserver/rsinit.cc |
| 43 |
@@ -366,11 +366,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck |
| 44 |
#ifdef LOCALNET_TESTING |
| 45 |
>> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false) |
| 46 |
#endif |
| 47 |
-#ifdef __APPLE__ |
| 48 |
>> help('h',"help","Display this Help") ; |
| 49 |
-#else |
| 50 |
- >> help() ; |
| 51 |
-#endif |
| 52 |
|
| 53 |
as.defaultErrorHandling(true) ; |
| 54 |
|
| 55 |
diff --git libretroshare/src/util/argstream.h libretroshare/src/util/argstream.h |
| 56 |
index 83fb30f..325d76f 100644 |
| 57 |
--- libretroshare/src/util/argstream.h |
| 58 |
+++ libretroshare/src/util/argstream.h |
| 59 |
@@ -140,16 +140,11 @@ namespace |
| 60 |
protected: |
| 61 |
inline OptionHolder(char s, |
| 62 |
const char* l, |
| 63 |
- const char* desc); |
| 64 |
-#ifdef __APPLE__ |
| 65 |
+ const char* desc); |
| 66 |
friend OptionHolder help(char s, |
| 67 |
const char* l, |
| 68 |
const char* desc); |
| 69 |
-#else |
| 70 |
- friend OptionHolder help(char s='h', |
| 71 |
- const char* l="help", |
| 72 |
- const char* desc="Display this help"); |
| 73 |
-#endif |
| 74 |
+ |
| 75 |
private: |
| 76 |
std::string shortName_; |
| 77 |
std::string longName_; |
| 78 |
diff --git retroshare-gui/src/gui/elastic/graphwidget.cpp retroshare-gui/src/gui/elastic/graphwidget.cpp |
| 79 |
index 571cdc8..dd32051 100644 |
| 80 |
--- retroshare-gui/src/gui/elastic/graphwidget.cpp |
| 81 |
+++ retroshare-gui/src/gui/elastic/graphwidget.cpp |
| 82 |
@@ -259,7 +259,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event) |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
-static void convolveWithGaussian(double *forceMap,int S,int /*s*/) |
| 87 |
+static void convolveWithGaussian(double *forceMap,unsigned int S,int /*s*/) |
| 88 |
{ |
| 89 |
static double *bf = NULL ; |
| 90 |
|
| 91 |
@@ -267,8 +267,8 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/) |
| 92 |
{ |
| 93 |
bf = new double[S*S*2] ; |
| 94 |
|
| 95 |
- for(int i=0;i<S;++i) |
| 96 |
- for(int j=0;j<S;++j) |
| 97 |
+ for(unsigned int i=0;i<S;++i) |
| 98 |
+ for(unsigned int j=0;j<S;++j) |
| 99 |
{ |
| 100 |
int x = (i<S/2)?i:(S-i) ; |
| 101 |
int y = (j<S/2)?j:(S-j) ; |
| 102 |
@@ -284,8 +284,8 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/) |
| 103 |
unsigned long nn[2] = {S,S}; |
| 104 |
fourn(&forceMap[-1],&nn[-1],2,1) ; |
| 105 |
|
| 106 |
- for(int i=0;i<S;++i) |
| 107 |
- for(int j=0;j<S;++j) |
| 108 |
+ for(unsigned int i=0;i<S;++i) |
| 109 |
+ for(unsigned int j=0;j<S;++j) |
| 110 |
{ |
| 111 |
float a = forceMap[2*(i+S*j)]*bf[2*(i+S*j)] - forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)+1] ; |
| 112 |
float b = forceMap[2*(i+S*j)]*bf[2*(i+S*j)+1] + forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)] ; |
| 113 |
@@ -296,7 +296,7 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/) |
| 114 |
|
| 115 |
fourn(&forceMap[-1],&nn[-1],2,-1) ; |
| 116 |
|
| 117 |
- for(int i=0;i<S*S*2;++i) |
| 118 |
+ for(unsigned int i=0;i<S*S*2;++i) |
| 119 |
forceMap[i] /= S*S; |
| 120 |
} |
| 121 |
|
| 122 |
diff --git retroshare-gui/src/rshare.cpp retroshare-gui/src/rshare.cpp |
| 123 |
index fe7c102..58e6fce 100644 |
| 124 |
--- retroshare-gui/src/rshare.cpp |
| 125 |
+++ retroshare-gui/src/rshare.cpp |
| 126 |
@@ -362,21 +362,21 @@ Rshare::showUsageMessageBox() |
| 127 |
out << "<table>"; |
| 128 |
//out << trow(tcol("-"ARG_HELP) + |
| 129 |
// tcol(tr("Displays this usage message and exits."))); |
| 130 |
- out << trow(tcol("-"ARG_RESET) + |
| 131 |
+ out << trow(tcol("-" ARG_RESET) + |
| 132 |
tcol(tr("Resets ALL stored RetroShare settings."))); |
| 133 |
- out << trow(tcol("-"ARG_DATADIR" <dir>") + |
| 134 |
+ out << trow(tcol("-" ARG_DATADIR" <dir>") + |
| 135 |
tcol(tr("Sets the directory RetroShare uses for data files."))); |
| 136 |
- out << trow(tcol("-"ARG_LOGFILE" <file>") + |
| 137 |
+ out << trow(tcol("-" ARG_LOGFILE" <file>") + |
| 138 |
tcol(tr("Sets the name and location of RetroShare's logfile."))); |
| 139 |
- out << trow(tcol("-"ARG_LOGLEVEL" <level>") + |
| 140 |
+ out << trow(tcol("-" ARG_LOGLEVEL" <level>") + |
| 141 |
tcol(tr("Sets the verbosity of RetroShare's logging.") + |
| 142 |
"<br>[" + Log::logLevels().join("|") +"]")); |
| 143 |
- out << trow(tcol("-"ARG_GUISTYLE" <style>") + |
| 144 |
+ out << trow(tcol("-" ARG_GUISTYLE" <style>") + |
| 145 |
tcol(tr("Sets RetroShare's interface style.") + |
| 146 |
"<br>[" + QStyleFactory::keys().join("|") + "]")); |
| 147 |
- out << trow(tcol("-"ARG_GUISTYLESHEET" <stylesheet>") + |
| 148 |
+ out << trow(tcol("-" ARG_GUISTYLESHEET" <stylesheet>") + |
| 149 |
tcol(tr("Sets RetroShare's interface stylesheets."))); |
| 150 |
- out << trow(tcol("-"ARG_LANGUAGE" <language>") + |
| 151 |
+ out << trow(tcol("-" ARG_LANGUAGE" <language>") + |
| 152 |
tcol(tr("Sets RetroShare's language.") + |
| 153 |
"<br>[" + LanguageSupport::languageCodes().join("|") + "]")); |
| 154 |
out << "</table>"; |
| 155 |
diff --git retroshare-nogui/src/retroshare.cc retroshare-nogui/src/retroshare.cc |
| 156 |
index 59a1bf1..7ad45b0 100644 |
| 157 |
--- retroshare-nogui/src/retroshare.cc |
| 158 |
+++ retroshare-nogui/src/retroshare.cc |
| 159 |
@@ -85,12 +85,9 @@ int main(int argc, char **argv) |
| 160 |
args >> parameter("docroot", docroot, "path", "Serve static files from this path.", false); |
| 161 |
// unfinished |
| 162 |
//args >> parameter("http-listen", listenAddress, "ipv6 address", "Listen only on the specified address.", false); |
| 163 |
- args >> option("http-allow-all", allowAllIps, "allow connections from all IP adresses (default= localhost only)"); |
| 164 |
-#ifdef __APPLE__ |
| 165 |
+ args >> option("http-allow-all", allowAllIps, "allow connections from all IP adresses (default= localhost only)"); |
| 166 |
args >> help('h',"help","Display this Help"); |
| 167 |
-#else |
| 168 |
- args >> help(); |
| 169 |
-#endif |
| 170 |
+ |
| 171 |
if (args.helpRequested()) |
| 172 |
{ |
| 173 |
std::cerr << args.usage() << std::endl; |