classical fixes for C++, clang happy

This commit is contained in:
espie 2017-05-18 14:47:27 +00:00
parent 91521ef7ad
commit 84b9e136c6
7 changed files with 148 additions and 6 deletions

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_libbitdht_src_util_bdthreads_cc,v 1.1 2017/05/18 14:47:27 espie Exp $
pthread_t may be a pointer
Index: src/libbitdht/src/util/bdthreads.cc
--- src/libbitdht/src/util/bdthreads.cc.orig
+++ src/libbitdht/src/util/bdthreads.cc
@@ -129,7 +129,7 @@ void bdThread::join() /* waits for the the mTid thread
#if defined(_WIN32) || defined(__MINGW32__)
/* Its a struct in Windows compile and the member .p ist checked in the pthreads library */
#else
- if(mTid > 0)
+ if(mTid != 0)
#endif
pthread_join(mTid, NULL);

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-src_libretroshare_src_dbase_findex_cc,v 1.1 2017/05/18 14:47:27 espie Exp $
tr1 / non-tr1 dance
Index: src/libretroshare/src/dbase/findex.cc
--- src/libretroshare/src/dbase/findex.cc.orig
+++ src/libretroshare/src/dbase/findex.cc
@@ -31,7 +31,13 @@
#include <stdlib.h>
#include <algorithm>
#include <iostream>
+#ifndef __clang__
#include <tr1/unordered_set>
+using std::tr1::unordered_set;
+#else
+#include <unordered_set>
+using std::unordered_set;
+#endif
#include <iomanip>
#include <fstream>
#include <sys/stat.h>
@@ -52,7 +58,7 @@ static const char FILE_CACHE_SEPARATOR_CHAR = '|' ;
****/
static RsMutex FIndexPtrMtx("FIndexPtrMtx") ;
-std::tr1::unordered_set<void*> FileIndex::_pointers ;
+unordered_set<void*> FileIndex::_pointers ;
void FileIndex::registerEntry(void*p)
{

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-src_libretroshare_src_dbase_findex_h,v 1.1 2017/05/18 14:47:27 espie Exp $
tr1 / non-tr1 dance
Index: src/libretroshare/src/dbase/findex.h
--- src/libretroshare/src/dbase/findex.h.orig
+++ src/libretroshare/src/dbase/findex.h
@@ -27,7 +27,13 @@
#include <string>
#include <map>
#include <set>
+#ifndef __clang__
#include <tr1/unordered_set>
+using std::tr1::unordered_set;
+#else
+#include <unordered_set>
+using std::unordered_set;
+#endif
#include <list>
#include <vector>
#include <stdint.h>
@@ -246,7 +252,7 @@ class FileIndex
PersonEntry *root;
- static std::tr1::unordered_set<void*> _pointers ;
+ static unordered_set<void*> _pointers ;
static void registerEntry(void*p) ;
static void unregisterEntry(void*p) ;
static bool isValid(void*p) ;

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_libretroshare_src_retroshare_rsflags_h,v 1.1 2017/05/18 14:47:27 espie Exp $
templates are not macros, define iostream upfront
Index: src/libretroshare/src/retroshare/rsflags.h
--- src/libretroshare/src/retroshare/rsflags.h.orig
+++ src/libretroshare/src/retroshare/rsflags.h
@@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
+#include <iostream>
// This class provides a representation for flags that can be combined with bitwise
// operations. However, because the class is templated with an id, it's not possible to

View File

@ -1,12 +1,13 @@
$OpenBSD: patch-src_libretroshare_src_rsserver_rsinit_cc,v 1.1.1.1 2013/08/15 21:55:20 stsp Exp $
--- src/libretroshare/src/rsserver/rsinit.cc.orig Fri Mar 22 18:28:56 2013
+++ src/libretroshare/src/rsserver/rsinit.cc Mon Aug 12 23:54:53 2013
@@ -2176,7 +2176,7 @@ int RsServer::StartupRetroShare()
$OpenBSD: patch-src_libretroshare_src_rsserver_rsinit_cc,v 1.2 2017/05/18 14:47:27 espie Exp $
Index: src/libretroshare/src/rsserver/rsinit.cc
--- src/libretroshare/src/rsserver/rsinit.cc.orig
+++ src/libretroshare/src/rsserver/rsinit.cc
@@ -2154,7 +2154,7 @@ int RsServer::StartupRetroShare()
std::vector<std::string> plugins_directories ;
#ifndef WINDOWS_SYS
- plugins_directories.push_back(std::string("/usr/lib/retroshare/extensions/")) ;
+ plugins_directories.push_back(std::string("${TRUEPREFIX}/lib/retroshare/extensions/")) ;
#endif
plugins_directories.push_back(RsInitConfig::basedir + "/extensions/") ;
#ifdef DEBUG_PLUGIN_SYSTEM
std::string extensions_dir = RsInitConfig::basedir + "/extensions/" ;
plugins_directories.push_back(extensions_dir) ;

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-src_libretroshare_src_util_argstream_h,v 1.1 2017/05/18 14:47:27 espie Exp $
friend declarations can't have default params
Index: src/libretroshare/src/util/argstream.h
--- src/libretroshare/src/util/argstream.h.orig
+++ src/libretroshare/src/util/argstream.h
@@ -141,9 +141,9 @@ namespace
inline OptionHolder(char s,
const char* l,
const char* desc);
- friend OptionHolder help(char s='h',
- const char* l="help",
- const char* desc="Display this help");
+ friend OptionHolder help(char s,
+ const char* l,
+ const char* desc);
private:
std::string shortName_;
std::string longName_;
@@ -173,9 +173,9 @@ namespace
return OptionHolder(l,b,desc);
}
inline OptionHolder
- help(char s,
- const char* l,
- const char* desc)
+ help(char s ='h',
+ const char* l ="help",
+ const char* desc ="Display this help")
{
return OptionHolder(s,l,desc);
}

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_retroshare-gui_src_gui_common_GroupTreeWidget_cpp,v 1.1 2017/05/18 14:47:27 espie Exp $
can't shadow a parameter without a scope
Index: src/retroshare-gui/src/gui/common/GroupTreeWidget.cpp
--- src/retroshare-gui/src/gui/common/GroupTreeWidget.cpp.orig
+++ src/retroshare-gui/src/gui/common/GroupTreeWidget.cpp
@@ -501,6 +501,7 @@ void GroupTreeWidget::calculateScore(QTreeWidgetItem *
return;
}
+ {
/* Find out which has given word in it */
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
QTreeWidgetItem *item;
@@ -512,6 +513,7 @@ void GroupTreeWidget::calculateScore(QTreeWidgetItem *
}
calculateScore(item, filterText);
+ }
}
}