linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05692
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2944: GCC 4.7
------------------------------------------------------------
revno: 2944
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2012-06-08 17:27:48 +0200
message:
GCC 4.7
modified:
Compile.txt
SConstruct
dcpp/AdcHub.cpp
dcpp/ClientManager.cpp
dcpp/ConnectionManager.h
dcpp/FavoriteManager.cpp
dcpp/HashManager.cpp
dcpp/NmdcHub.cpp
dcpp/QueueManager.cpp
dcpp/ShareManager.cpp
dcpp/atomic.h
dcpp/compiler.h
dcpp/noexcept.h
dwt/include/dwt/aspects/Scrollable.h
dwt/include/dwt/forward.h
dwt/include/dwt/widgets/Table.h
dwt/include/dwt/widgets/ToolBar.h
dwt/src/widgets/ScrolledContainer.cpp
dwt/src/widgets/Table.cpp
dwt/src/widgets/Tree.cpp
win32/DirectoryListingFrame.cpp
win32/HubFrame.cpp
win32/PrivateFrame.cpp
win32/QueueFrame.cpp
win32/UserInfoBase.h
win32/UsersFrame.cpp
win32/compiler.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'Compile.txt'
--- Compile.txt 2012-06-01 18:52:20 +0000
+++ Compile.txt 2012-06-08 15:27:48 +0000
@@ -54,7 +54,7 @@
2. Compiler
- a. MinGW (GCC 4.6 or later):
+ a. MinGW (GCC 4.7 or later):
<http://sourceforge.net/projects/mingw/files/>
The easiest way to install is via mingw-get. Extract it to C:\MinGW and run:
=== modified file 'SConstruct'
--- SConstruct 2012-03-03 15:04:23 +0000
+++ SConstruct 2012-06-08 15:27:48 +0000
@@ -12,7 +12,7 @@
}
gcc_xxflags = {
- 'common' : ['-std=gnu++0x'],
+ 'common' : ['-std=gnu++11'],
'debug' : [],
'release' : []
}
=== modified file 'dcpp/AdcHub.cpp'
--- dcpp/AdcHub.cpp 2012-05-24 17:47:25 +0000
+++ dcpp/AdcHub.cpp 2012-06-08 15:27:48 +0000
@@ -82,7 +82,7 @@
{
Lock l(cs);
- ou = users.insert(make_pair(aSID, new OnlineUser(p, *this, aSID))).first->second;
+ ou = users.emplace(aSID, new OnlineUser(p, *this, aSID)).first->second;
}
if(aSID != AdcCommand::HUB_SID)
@@ -947,7 +947,7 @@
c.addParam(var, value);
}
} else if(!value.empty()) {
- lastInfoMap.insert(make_pair(var, value));
+ lastInfoMap.emplace(var, value);
c.addParam(var, value);
}
}
=== modified file 'dcpp/ClientManager.cpp'
--- dcpp/ClientManager.cpp 2012-05-15 23:26:22 +0000
+++ dcpp/ClientManager.cpp 2012-06-08 15:27:48 +0000
@@ -259,7 +259,7 @@
UserPtr p(new User(cid));
p->setFlag(User::NMDC);
- users.insert(make_pair(cid, p));
+ users.emplace(cid, p);
return p;
}
@@ -272,7 +272,7 @@
}
UserPtr p(new User(cid));
- users.insert(make_pair(cid, p));
+ users.emplace(cid, p);
return p;
}
@@ -306,7 +306,7 @@
void ClientManager::putOnline(OnlineUser* ou) noexcept {
{
Lock l(cs);
- onlineUsers.insert(make_pair(ou->getUser()->getCID(), ou));
+ onlineUsers.emplace(ou->getUser()->getCID(), ou);
}
if(!ou->getUser()->isOnline()) {
@@ -554,7 +554,7 @@
Lock l(cs);
if(!me) {
me = new User(getMyCID());
- users.insert(make_pair(me->getCID(), me));
+ users.emplace(me->getCID(), me);
}
}
return me;
=== modified file 'dcpp/ConnectionManager.h'
--- dcpp/ConnectionManager.h 2012-01-13 20:55:20 +0000
+++ dcpp/ConnectionManager.h 2012-06-08 15:27:48 +0000
@@ -19,6 +19,9 @@
#ifndef DCPLUSPLUS_DCPP_CONNECTION_MANAGER_H
#define DCPLUSPLUS_DCPP_CONNECTION_MANAGER_H
+#include <memory>
+#include <unordered_map>
+
#include "TimerManager.h"
#include "UserConnectionListener.h"
#include "CriticalSection.h"
@@ -30,6 +33,7 @@
namespace dcpp {
using std::unique_ptr;
+using std::unordered_map;
class SocketException;
@@ -65,7 +69,7 @@
public:
void add(const string& aNick, const string& aMyNick, const string& aHubUrl) {
Lock l(cs);
- expectedConnections.insert(make_pair(aNick, make_pair(aMyNick, aHubUrl)));
+ expectedConnections.emplace(aNick, make_pair(aMyNick, aHubUrl));
}
StringPair remove(const string& aNick) {
@@ -83,7 +87,7 @@
private:
/** Nick -> myNick, hubUrl for expected NMDC incoming connections */
- typedef map<string, StringPair> ExpectMap;
+ typedef unordered_map<string, StringPair> ExpectMap;
ExpectMap expectedConnections;
CriticalSection cs;
=== modified file 'dcpp/FavoriteManager.cpp'
--- dcpp/FavoriteManager.cpp 2012-05-15 23:26:22 +0000
+++ dcpp/FavoriteManager.cpp 2012-06-08 15:27:48 +0000
@@ -172,7 +172,7 @@
if(nicks.empty())
nicks.push_back(Util::emptyString);
- auto i = users.insert(make_pair(aUser->getCID(), FavoriteUser(aUser, nicks[0], urls[0]))).first;
+ auto i = users.emplace(aUser->getCID(), FavoriteUser(aUser, nicks[0], urls[0])).first;
fire(FavoriteManagerListener::UserAdded(), i->second);
save();
}
@@ -499,7 +499,7 @@
}
ClientManager::getInstance()->saveUser(u->getCID());
- auto i = users.insert(make_pair(u->getCID(), FavoriteUser(u, nick, hubUrl))).first;
+ auto i = users.emplace(u->getCID(), FavoriteUser(u, nick, hubUrl)).first;
if(aXml.getBoolChildAttrib("GrantSlot"))
i->second.setFlag(FavoriteUser::FLAG_GRANTSLOT);
=== modified file 'dcpp/HashManager.cpp'
--- dcpp/HashManager.cpp 2012-03-03 19:33:45 +0000
+++ dcpp/HashManager.cpp 2012-06-08 15:27:48 +0000
@@ -109,7 +109,7 @@
try {
File f(getDataFile(), File::READ | File::WRITE, File::OPEN);
int64_t index = saveTree(f, tt);
- treeIndex.insert(make_pair(tt.getRoot(), TreeInfo(tt.getFileSize(), index, tt.getBlockSize())));
+ treeIndex.emplace(tt.getRoot(), TreeInfo(tt.getFileSize(), index, tt.getBlockSize()));
dirty = true;
} catch (const FileException& e) {
LogManager::getInstance()->message(str(F_("Error saving hash data: %1%") % e.getError()));
@@ -251,12 +251,7 @@
}
for (auto& i: fileIndex) {
-#ifndef __GNUC__
auto fi = newFileIndex.emplace(i.first, FileInfoList()).first;
-#else
- /// @todo retry with emplace on GCC 4.7 (see comment in compiler.h)
- auto fi = newFileIndex.insert(make_pair(i.first, FileInfoList())).first;
-#endif
for (auto& j: i.second) {
if (newTreeIndex.find(j.getRoot()) != newTreeIndex.end()) {
@@ -469,7 +464,7 @@
void HashManager::Hasher::hashFile(const string& fileName, int64_t size) {
Lock l(cs);
- if (w.insert(make_pair(fileName, size)).second) {
+ if(w.insert(make_pair(fileName, size)).second) {
if(paused > 0)
paused++;
else
=== modified file 'dcpp/NmdcHub.cpp'
--- dcpp/NmdcHub.cpp 2012-05-24 17:47:25 +0000
+++ dcpp/NmdcHub.cpp 2012-06-08 15:27:48 +0000
@@ -88,7 +88,7 @@
{
Lock l(cs);
- u = users.insert(make_pair(aNick, new OnlineUser(p, *this, 0))).first->second;
+ u = users.emplace(aNick, new OnlineUser(p, *this, 0)).first->second;
u->getIdentity().setNick(aNick);
if(u->getUser() == getMyIdentity().getUser()) {
setMyIdentity(u->getIdentity());
=== modified file 'dcpp/QueueManager.cpp'
--- dcpp/QueueManager.cpp 2012-06-08 14:15:53 +0000
+++ dcpp/QueueManager.cpp 2012-06-08 15:27:48 +0000
@@ -90,7 +90,7 @@
void QueueManager::FileQueue::add(QueueItem* qi) {
if(lastInsert == queue.end())
- lastInsert = queue.insert(make_pair(const_cast<string*>(&qi->getTarget()), qi)).first;
+ lastInsert = queue.emplace(const_cast<string*>(&qi->getTarget()), qi).first;
else
lastInsert = queue.insert(lastInsert, make_pair(const_cast<string*>(&qi->getTarget()), qi));
}
@@ -712,7 +712,7 @@
}
// Unique directory, fine...
- directories.insert(make_pair(aUser, new DirectoryItem(aUser, aDir, aTarget, p)));
+ directories.emplace(aUser, new DirectoryItem(aUser, aDir, aTarget, p));
needList = (dp.first == dp.second);
setDirty();
}
@@ -745,7 +745,7 @@
});
std::for_each(dir->files.cbegin(), dir->files.cend(), [&](DirectoryListing::File* f) {
- tthMap.insert(make_pair(f->getTTH(), f));
+ tthMap.emplace(f->getTTH(), f);
});
}
}
=== modified file 'dcpp/ShareManager.cpp'
--- dcpp/ShareManager.cpp 2012-05-27 14:02:55 +0000
+++ dcpp/ShareManager.cpp 2012-06-08 15:27:48 +0000
@@ -347,7 +347,7 @@
const string& virtualName = aXml.getChildAttrib("Virtual");
string vName = validateVirtual(virtualName.empty() ? Util::getLastDir(realPath) : virtualName);
- shares.insert(make_pair(realPath, vName));
+ shares.emplace(realPath, vName);
if(getByVirtual(vName) == directories.end()) {
directories.push_back(Directory::create(vName));
}
@@ -485,7 +485,7 @@
{
Lock l(cs);
- shares.insert(make_pair(realPath, vName));
+ shares.emplace(realPath, vName);
updateIndices(*merge(dp));
setDirty();
@@ -516,7 +516,7 @@
if(findFile(subSource->getName()) != files.end()) {
dcdebug("File named the same as directory");
} else {
- directories.insert(make_pair(subSource->getName(), subSource));
+ directories.emplace(subSource->getName(), subSource);
subSource->parent = this;
}
} else {
=== modified file 'dcpp/atomic.h'
--- dcpp/atomic.h 2012-03-03 15:04:23 +0000
+++ dcpp/atomic.h 2012-06-08 15:27:48 +0000
@@ -19,8 +19,9 @@
#ifndef DCPLUSPLUS_DCPP_ATOMIC_HPP_
#define DCPLUSPLUS_DCPP_ATOMIC_HPP_
-// GCC 4.6 and below has issues with atomic - see https://bugs.launchpad.net/dcplusplus/+bug/735512
-#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7))
+// GCC has issues with atomic - see https://bugs.launchpad.net/dcplusplus/+bug/735512
+/// @todo check this again when GCC improves their threading support
+#if defined(__GNUC__)
#include <boost/atomic.hpp>
=== modified file 'dcpp/compiler.h'
--- dcpp/compiler.h 2012-03-03 15:04:23 +0000
+++ dcpp/compiler.h 2012-06-08 15:27:48 +0000
@@ -20,11 +20,8 @@
#define DCPLUSPLUS_DCPP_COMPILER_H
#if defined(__GNUC__)
-#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
-#error GCC 4.6 is required
-
-/** @todo when switching to GCC 4.7, see if unordered_map's insert/make_pair combo can be changed
-to emplace. <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44436> */
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
+#error GCC 4.7 is required
#endif
=== modified file 'dcpp/noexcept.h'
--- dcpp/noexcept.h 2012-01-13 20:55:20 +0000
+++ dcpp/noexcept.h 2012-06-08 15:27:48 +0000
@@ -21,15 +21,7 @@
// for compilers that don't support noexcept, use an exception specifier
-#ifdef __GNUC__
-#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) // GCC 4.6 is the first GCC to implement noexcept.
-
-#ifndef noexcept
-#define noexcept throw()
-#endif
-
-#endif
-#elif defined(_MSC_VER)
+#ifdef _MSC_VER
#ifndef noexcept
#define noexcept throw()
=== modified file 'dwt/include/dwt/aspects/Scrollable.h'
--- dwt/include/dwt/aspects/Scrollable.h 2012-04-17 17:32:56 +0000
+++ dwt/include/dwt/aspects/Scrollable.h 2012-06-08 15:27:48 +0000
@@ -54,7 +54,7 @@
public:
/// @ refer to the ::GetScrollInfo doc for information on the params.
- SCROLLINFO getScrollInfo(int fnBar, int mask = SIF_ALL) const;
+ SCROLLINFO getScrollInfo(int fnBar, unsigned mask = SIF_ALL) const;
bool scrollIsAtEnd() const;
/** catch horizontal scrolling events.
@@ -86,7 +86,7 @@
};
template<typename WidgetType>
-SCROLLINFO Scrollable<WidgetType>::getScrollInfo(int fnBar, int mask) const {
+SCROLLINFO Scrollable<WidgetType>::getScrollInfo(int fnBar, unsigned mask) const {
SCROLLINFO info = { sizeof(SCROLLINFO), mask };
if(!::GetScrollInfo(H(), fnBar, &info)) {
throw Win32Exception("aspects::Scrollable: Can't get scroll info");
=== modified file 'dwt/include/dwt/forward.h'
--- dwt/include/dwt/forward.h 2012-01-22 20:39:56 +0000
+++ dwt/include/dwt/forward.h 2012-06-08 15:27:48 +0000
@@ -117,7 +117,7 @@
typedef MDIParent* MDIParentPtr;
// Not a Color - corresponds to 1 + 0xFFFFFF (the max value of a COLORREF)
-enum { NaC = 0x1000000 };
+static const COLORREF NaC = 0x1000000;
class Notification;
typedef std::unique_ptr<Notification> NotificationPtr;
=== modified file 'dwt/include/dwt/widgets/Table.h'
--- dwt/include/dwt/widgets/Table.h 2012-01-13 20:55:20 +0000
+++ dwt/include/dwt/widgets/Table.h 2012-06-08 15:27:48 +0000
@@ -364,7 +364,7 @@
void setTableStyle(int style);
- int insert(int mask, int i, LPCTSTR text, UINT state, UINT stateMask, int image, LPARAM lparam);
+ int insert(unsigned mask, int i, LPCTSTR text, unsigned state, unsigned stateMask, int image, LPARAM lparam);
int getNext(int i, int type) const;
@@ -630,7 +630,7 @@
}
inline int Table::find(const tstring& b, int start, bool aPartial) {
- LVFINDINFO fi = { aPartial ? LVFI_PARTIAL : LVFI_STRING, b.c_str() };
+ LVFINDINFO fi = { static_cast<UINT>(aPartial ? LVFI_PARTIAL : LVFI_STRING), b.c_str() };
return ListView_FindItem(handle(), start, &fi);
}
=== modified file 'dwt/include/dwt/widgets/ToolBar.h'
--- dwt/include/dwt/widgets/ToolBar.h 2012-06-01 17:26:20 +0000
+++ dwt/include/dwt/widgets/ToolBar.h 2012-06-08 15:27:48 +0000
@@ -315,7 +315,7 @@
inline bool ToolBar::getButtonVisible( unsigned int id )
{
- TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, id };
+ TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, static_cast<int>(id) };
sendMessage(TB_GETBUTTONINFO, id, reinterpret_cast< LPARAM >( & tb ) );
return ( tb.fsState & TBSTATE_HIDDEN ) == 0;
}
@@ -327,14 +327,14 @@
inline bool ToolBar::getButtonEnabled( unsigned int id )
{
- TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, id };
+ TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, static_cast<int>(id) };
sendMessage(TB_GETBUTTONINFO, id, reinterpret_cast< LPARAM >( & tb ) );
return ( tb.fsState & TBSTATE_ENABLED ) == TBSTATE_ENABLED;
}
inline bool ToolBar::getButtonChecked( unsigned int id )
{
- TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, id };
+ TBBUTTONINFO tb = { sizeof(TBBUTTONINFO), TBIF_STATE, static_cast<int>(id) };
sendMessage(TB_GETBUTTONINFO, id, reinterpret_cast< LPARAM >( & tb ) );
return ( tb.fsState & TBSTATE_CHECKED ) == TBSTATE_CHECKED;
}
=== modified file 'dwt/src/widgets/ScrolledContainer.cpp'
--- dwt/src/widgets/ScrolledContainer.cpp 2012-01-13 20:55:20 +0000
+++ dwt/src/widgets/ScrolledContainer.cpp 2012-06-08 15:27:48 +0000
@@ -65,7 +65,7 @@
}
void ScrolledContainer::setScrollInfo(int type, int page, int max, int pos) {
- SCROLLINFO si = { sizeof(SCROLLINFO), SIF_ALL, 0, max - 1, page, pos };
+ SCROLLINFO si = { sizeof(SCROLLINFO), SIF_ALL, 0, max - 1, static_cast<UINT>(page), pos };
::SetScrollInfo(handle(), type, &si, TRUE);
}
=== modified file 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp 2012-03-03 19:33:45 +0000
+++ dwt/src/widgets/Table.cpp 2012-06-08 15:27:48 +0000
@@ -220,7 +220,7 @@
return ret;
}
-int Table::insert(int mask, int i, LPCTSTR text, UINT state, UINT stateMask, int image, LPARAM lparam) {
+int Table::insert(unsigned mask, int i, LPCTSTR text, unsigned state, unsigned stateMask, int image, LPARAM lparam) {
LVITEM item = { mask };
item.state = state;
item.stateMask = stateMask;
@@ -482,7 +482,7 @@
}
void Table::setIcon(unsigned row, unsigned column, int newIconIndex) {
- LVITEM item = { LVIF_IMAGE, row, column };
+ LVITEM item = { LVIF_IMAGE, static_cast<int>(row), static_cast<int>(column) };
item.iImage = newIconIndex;
ListView_SetItem(handle(), &item);
}
=== modified file 'dwt/src/widgets/Tree.cpp'
--- dwt/src/widgets/Tree.cpp 2012-02-04 18:51:03 +0000
+++ dwt/src/widgets/Tree.cpp 2012-06-08 15:27:48 +0000
@@ -139,7 +139,7 @@
}
} else {
auto i = texts.find(node);
- if(i != texts.end() && i->second.size() > column) {
+ if(i != texts.end() && i->second.size() > static_cast<size_t>(column)) {
return i->second[column];
}
}
@@ -152,9 +152,9 @@
TVITEMEX item = { TVIF_HANDLE | TVIF_TEXT, node };
item.pszText = const_cast<LPTSTR>(text.c_str());
TreeView_SetItem(treeHandle(), &item);
- } else if(column < getColumnCount()) {
+ } else if(static_cast<size_t>(column) < getColumnCount()) {
auto &v = texts[node];
- if(v.size() <= column) v.resize(column + 1);
+ if(v.size() <= static_cast<size_t>(column)) v.resize(column + 1);
v[column] = text;
}
}
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2012-06-08 13:55:30 +0000
+++ win32/DirectoryListingFrame.cpp 2012-06-08 15:27:48 +0000
@@ -400,7 +400,7 @@
layout();
- lists.insert(make_pair(aUser, this));
+ lists.emplace(aUser, this);
}
DirectoryListingFrame::~DirectoryListingFrame() {
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2012-06-03 17:49:39 +0000
+++ win32/HubFrame.cpp 2012-06-08 15:27:48 +0000
@@ -717,7 +717,7 @@
auto i = userMap.find(u.user);
if(i == userMap.end()) {
UserInfo* ui = new UserInfo(u);
- userMap.insert(make_pair(u.user, ui));
+ userMap.emplace(u.user, ui);
if(!ui->isHidden() && showUsers->getChecked())
users->insert(ui);
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2012-05-28 21:43:42 +0000
+++ win32/PrivateFrame.cpp 2012-06-08 15:27:48 +0000
@@ -194,7 +194,7 @@
updateOnlineStatus();
});
- frames.insert(make_pair(replyTo.getUser(), this));
+ frames.emplace(replyTo.getUser(), this);
addRecent();
}
=== modified file 'win32/QueueFrame.cpp'
--- win32/QueueFrame.cpp 2012-05-04 21:20:44 +0000
+++ win32/QueueFrame.cpp 2012-06-08 15:27:48 +0000
@@ -248,7 +248,7 @@
const string& dir = ii->getPath();
bool updateDir = (directories.find(dir) == directories.end());
- directories.insert(make_pair(dir, ii));
+ directories.emplace(dir, ii);
if(updateDir) {
addDirectory(dir, ii->isSet(QueueItem::FLAG_USER_LIST));
=== modified file 'win32/UserInfoBase.h'
--- win32/UserInfoBase.h 2012-05-28 21:43:42 +0000
+++ win32/UserInfoBase.h 2012-06-08 15:27:48 +0000
@@ -36,6 +36,7 @@
class UserInfoBase {
public:
UserInfoBase(const HintedUser& u) : user(u) { }
+ virtual ~UserInfoBase() { }
virtual void getList();
virtual void browseList();
=== modified file 'win32/UsersFrame.cpp'
--- win32/UsersFrame.cpp 2012-03-03 19:33:45 +0000
+++ win32/UsersFrame.cpp 2012-06-08 15:27:48 +0000
@@ -289,7 +289,7 @@
auto ui = userInfos.find(aUser);
if(ui == userInfos.end()) {
- auto x = userInfos.insert(make_pair(aUser, UserInfo(aUser, false))).first;
+ auto x = userInfos.emplace(aUser, UserInfo(aUser, false)).first;
if(matches(x->second)) {
x->second.update(aUser, true);
=== modified file 'win32/compiler.h'
--- win32/compiler.h 2012-03-03 15:04:23 +0000
+++ win32/compiler.h 2012-06-08 15:27:48 +0000
@@ -17,8 +17,8 @@
*/
#if defined(__GNUC__)
-#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
-#error GCC 4.6 is required
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
+#error GCC 4.7 is required
#endif
#elif defined(_MSC_VER)