summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-08 22:44:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-08 22:44:39 +0300
commita61ac4664d55cddb18d2d861e76629bd07676129 (patch)
tree59f5ba3ff7e65bbe94651db9ad2cf68b847d8f96
parentbb3a85b045a6135f7228023a7ba55fb1c9e6bd90 (diff)
downloadmanaverse-a61ac4664d55cddb18d2d861e76629bd07676129.tar.gz
manaverse-a61ac4664d55cddb18d2d861e76629bd07676129.tar.bz2
manaverse-a61ac4664d55cddb18d2d861e76629bd07676129.tar.xz
manaverse-a61ac4664d55cddb18d2d861e76629bd07676129.zip
Add some missing const.
-rw-r--r--src/gui/popups/popupmenu.cpp8
-rw-r--r--src/gui/popups/popupmenu.h10
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h2
-rw-r--r--src/gui/windows/chatwindow.cpp3
-rw-r--r--src/gui/windows/chatwindow.h3
-rw-r--r--src/gui/windows/inventorywindow.cpp2
-rw-r--r--src/gui/windows/inventorywindow.h2
-rw-r--r--src/gui/windows/ministatuswindow.cpp2
-rw-r--r--src/gui/windows/ministatuswindow.h2
-rw-r--r--src/listeners/inventorylistener.h2
-rw-r--r--src/net/buyingstorehandler.h2
-rw-r--r--src/net/cashshophandler.h2
-rw-r--r--src/net/eathena/buyingstorehandler.cpp2
-rw-r--r--src/net/eathena/buyingstorehandler.h2
-rw-r--r--src/net/eathena/cashshophandler.cpp3
-rw-r--r--src/net/eathena/cashshophandler.h2
-rw-r--r--src/net/eathena/markethandler.cpp8
-rw-r--r--src/net/eathena/markethandler.h3
-rw-r--r--src/net/eathena/npchandler.h3
-rw-r--r--src/net/eathena/vendinghandler.cpp2
-rw-r--r--src/net/eathena/vendinghandler.h3
-rw-r--r--src/net/markethandler.h2
-rw-r--r--src/net/tmwa/buyingstorehandler.cpp2
-rw-r--r--src/net/tmwa/buyingstorehandler.h2
-rw-r--r--src/net/tmwa/cashshophandler.cpp3
-rw-r--r--src/net/tmwa/cashshophandler.h2
-rw-r--r--src/net/tmwa/markethandler.cpp3
-rw-r--r--src/net/tmwa/markethandler.h2
-rw-r--r--src/net/tmwa/vendinghandler.cpp3
-rw-r--r--src/net/tmwa/vendinghandler.h4
-rw-r--r--src/net/vendinghandler.h2
-rw-r--r--src/resources/map/map.cpp2
-rw-r--r--src/resources/map/map.h2
-rw-r--r--src/resources/map/maplayer.h4
-rw-r--r--src/utils/copynpaste.cpp16
-rw-r--r--src/utils/copynpaste.h2
-rw-r--r--src/utils/stringutils.cpp4
38 files changed, 70 insertions, 55 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index b9fc252b8..a7c493b8e 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -989,7 +989,7 @@ void PopupMenu::showWindowPopup(Window *const window)
showPopup(mX, mY);
}
-void PopupMenu::addWindowMenu(Window *const window)
+void PopupMenu::addWindowMenu(const Window *const window)
{
if (!window)
return;
@@ -1756,7 +1756,7 @@ void PopupMenu::showItemPopup(const int x, const int y,
}
void PopupMenu::showItemPopup(const int x, const int y,
- Item *const item)
+ const Item *const item)
{
mX = x;
mY = y;
@@ -1810,7 +1810,9 @@ void PopupMenu::showItemPopup(const int x, const int y,
showPopup(x, y);
}
-void PopupMenu::showDropPopup(const int x, const int y, Item *const item)
+void PopupMenu::showDropPopup(const int x,
+ const int y,
+ const Item *const item)
{
mX = x;
mY = y;
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index ca6d58ee6..dfcb64513 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -108,13 +108,17 @@ class PopupMenu final : public Popup, public LinkHandler
void showPopup(const int x, const int y, MapItem *const mapItem);
- void showItemPopup(const int x, const int y, Item *const item);
+ void showItemPopup(const int x,
+ const int y,
+ const Item *const item);
void showItemPopup(const int x, const int y,
const int itemId,
const ItemColor color);
- void showDropPopup(const int x, const int y, Item *const item);
+ void showDropPopup(const int x,
+ const int y,
+ const Item *const item);
void showOutfitsWindowPopup(const int x, const int y);
@@ -204,7 +208,7 @@ class PopupMenu final : public Popup, public LinkHandler
void addNormalRelations();
- void addWindowMenu(Window *const window);
+ void addWindowMenu(const Window *const window);
#ifdef EATHENA_SUPPORT
void addChat(const Being *const being);
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 942ade320..3b074e64f 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -442,7 +442,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args)
return handleCommand(type, args);
}
-void ChatTab::saveToLogFile(std::string msg) const
+void ChatTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
{
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
index 831c2a110..dc2062946 100644
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ b/src/gui/widgets/tabs/chat/chattab.h
@@ -142,7 +142,7 @@ class ChatTab notfinal : public Tab
ChatTabType::Type getType() const A_WARN_UNUSED
{ return mType; }
- void saveToLogFile(std::string msg) const;
+ void saveToLogFile(const std::string &msg) const;
const std::list<std::string> &getRows() const A_WARN_UNUSED
{ return mTextOutput->getRows(); }
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 057feb8d7..1551c10ae 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1937,7 +1937,8 @@ void ChatWindow::saveState() const
}
}
-bool ChatWindow::saveTab(const int num, ChatTab *const tab) const
+bool ChatWindow::saveTab(const int num,
+ const ChatTab *const tab) const
{
if (!tab)
return false;
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index f586e97f7..644134158 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -245,7 +245,8 @@ class ChatWindow final : public Window,
void saveState() const;
- bool saveTab(const int num, ChatTab *const tab) const;
+ bool saveTab(const int num,
+ const ChatTab *const tab) const;
void loadCustomList();
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 76dfef268..e21299583 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -868,7 +868,7 @@ void InventoryWindow::updateWeight()
Units::formatWeight(max).c_str()));
}
-void InventoryWindow::slotsChanged(Inventory *const inventory)
+void InventoryWindow::slotsChanged(const Inventory *const inventory)
{
if (inventory == mInventory)
{
diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h
index 930ce9e72..e19b219f8 100644
--- a/src/gui/windows/inventorywindow.h
+++ b/src/gui/windows/inventorywindow.h
@@ -125,7 +125,7 @@ class InventoryWindow final : public Window,
*/
void close() override final;
- void slotsChanged(Inventory *const inventory) override final;
+ void slotsChanged(const Inventory *const inventory) override final;
bool isMainInventory() const A_WARN_UNUSED
{ return mInventory ? mInventory->isMainInventory() : false; }
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index 1e43ce3b5..fc2e9a82c 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -535,7 +535,7 @@ void MiniStatusWindow::saveBars() const
config.setValue("ministatussaved", true);
}
-void MiniStatusWindow::slotsChanged(Inventory *const inventory)
+void MiniStatusWindow::slotsChanged(const Inventory *const inventory)
{
if (!inventory)
return;
diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h
index a26b8e06d..bdf4dcd29 100644
--- a/src/gui/windows/ministatuswindow.h
+++ b/src/gui/windows/ministatuswindow.h
@@ -83,7 +83,7 @@ class MiniStatusWindow final : public Window,
void updateBars();
- void slotsChanged(Inventory *const inventory) override final;
+ void slotsChanged(const Inventory *const inventory) override final;
std::vector <ProgressBar*> &getBars() A_WARN_UNUSED
{ return mBars; }
diff --git a/src/listeners/inventorylistener.h b/src/listeners/inventorylistener.h
index 7d49b2f61..493ba4c8f 100644
--- a/src/listeners/inventorylistener.h
+++ b/src/listeners/inventorylistener.h
@@ -33,7 +33,7 @@ class InventoryListener notfinal
virtual ~InventoryListener()
{ }
- virtual void slotsChanged(Inventory *const inventory) = 0;
+ virtual void slotsChanged(const Inventory *const inventory) = 0;
protected:
InventoryListener()
diff --git a/src/net/buyingstorehandler.h b/src/net/buyingstorehandler.h
index 0c5cc7c5c..3d994b2bc 100644
--- a/src/net/buyingstorehandler.h
+++ b/src/net/buyingstorehandler.h
@@ -46,7 +46,7 @@ class BuyingStoreHandler notfinal
virtual void create(const std::string &name,
const int maxMoney,
const bool flag,
- std::vector<ShopItem*> &items) const = 0;
+ const std::vector<ShopItem*> &items) const = 0;
virtual void close() const = 0;
diff --git a/src/net/cashshophandler.h b/src/net/cashshophandler.h
index a5aca004a..73bd6f399 100644
--- a/src/net/cashshophandler.h
+++ b/src/net/cashshophandler.h
@@ -46,7 +46,7 @@ class CashShopHandler notfinal
const ItemColor color,
const int amount) const = 0;
- virtual void buyItems(std::vector<ShopItem*> &items) const = 0;
+ virtual void buyItems(const std::vector<ShopItem*> &items) const = 0;
virtual void close() const = 0;
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index 5fcc9c4aa..88928183c 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -45,7 +45,7 @@ BuyingStoreHandler::BuyingStoreHandler()
void BuyingStoreHandler::create(const std::string &name,
const int maxMoney,
const bool flag,
- std::vector<ShopItem*> &items) const
+ const std::vector<ShopItem*> &items) const
{
createOutPacket(CMSG_BUYINGSTORE_CREATE);
outMsg.writeInt16(CAST_S16(89 + items.size() * 8), "len");
diff --git a/src/net/eathena/buyingstorehandler.h b/src/net/eathena/buyingstorehandler.h
index 026d80306..f271dc60d 100644
--- a/src/net/eathena/buyingstorehandler.h
+++ b/src/net/eathena/buyingstorehandler.h
@@ -37,7 +37,7 @@ class BuyingStoreHandler final : public Net::BuyingStoreHandler
void create(const std::string &name,
const int maxMoney,
const bool flag,
- std::vector<ShopItem*> &items) const override final;
+ const std::vector<ShopItem*> &items) const override final;
void close() const override final;
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index 026297673..56b6b3fbf 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -50,7 +50,8 @@ void CashShopHandler::buyItem(const int points,
outMsg.writeInt16(CAST_S16(itemId), "item id");
}
-void CashShopHandler::buyItems(std::vector<ShopItem*> &items A_UNUSED) const
+void CashShopHandler::buyItems(const std::vector<ShopItem*> &items A_UNUSED)
+ const
{
// +++ probably need impliment buy many items at same time
}
diff --git a/src/net/eathena/cashshophandler.h b/src/net/eathena/cashshophandler.h
index d6a1e2f14..7d7fe1fbc 100644
--- a/src/net/eathena/cashshophandler.h
+++ b/src/net/eathena/cashshophandler.h
@@ -39,7 +39,7 @@ class CashShopHandler final : public Net::CashShopHandler
const ItemColor color,
const int amount) const override final;
- void buyItems(std::vector<ShopItem*> &items) const override final
+ void buyItems(const std::vector<ShopItem*> &items) const override final
A_CONST;
void close() const override final;
diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp
index b055d574a..c019c6251 100644
--- a/src/net/eathena/markethandler.cpp
+++ b/src/net/eathena/markethandler.cpp
@@ -64,14 +64,14 @@ void MarketHandler::buyItem(const int itemId,
}
}
-void MarketHandler::buyItems(std::vector<ShopItem*> &items) const
+void MarketHandler::buyItems(const std::vector<ShopItem*> &items) const
{
int cnt = 0;
const int pairSize = 6;
- FOR_EACH (std::vector<ShopItem*>::iterator, it, items)
+ FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items)
{
- ShopItem *const item = *it;
+ const ShopItem *const item = *it;
const int usedQuantity = item->getUsedQuantity();
const int type = item->getType();
if (!usedQuantity)
@@ -87,7 +87,7 @@ void MarketHandler::buyItems(std::vector<ShopItem*> &items) const
createOutPacket(CMSG_NPC_MARKET_BUY);
outMsg.writeInt16(CAST_S16(4 + pairSize * cnt), "len");
- FOR_EACH (std::vector<ShopItem*>::iterator, it, items)
+ FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items)
{
ShopItem *const item = *it;
const int usedQuantity = item->getUsedQuantity();
diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h
index 797ed28bd..e99aa6bc9 100644
--- a/src/net/eathena/markethandler.h
+++ b/src/net/eathena/markethandler.h
@@ -40,7 +40,8 @@ class MarketHandler final : public Net::MarketHandler
const ItemColor color,
const int amount) const override final;
- void buyItems(std::vector<ShopItem*> &items) const override final;
+ void buyItems(const std::vector<ShopItem*> &items) const
+ override final;
};
} // namespace EAthena
diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h
index 5a718fe98..049d69a72 100644
--- a/src/net/eathena/npchandler.h
+++ b/src/net/eathena/npchandler.h
@@ -59,7 +59,8 @@ class NpcHandler final : public Ea::NpcHandler
const ItemColor color,
const int amount) const override final;
- void buyItems(std::vector<ShopItem*> &items) const override final;
+ void buyItems(std::vector<ShopItem*> &items) const
+ override final;
void sellItem(const BeingId beingId,
const int itemId,
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index ce2b8d384..739f39acd 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -91,7 +91,7 @@ void VendingHandler::buy2(const Being *const being,
void VendingHandler::createShop(const std::string &name,
const bool flag,
- std::vector<ShopItem*> &items) const
+ const std::vector<ShopItem*> &items) const
{
createOutPacket(CMSG_VENDING_CREATE_SHOP);
outMsg.writeInt16(CAST_S16(85 + items.size() * 8), "len");
diff --git a/src/net/eathena/vendinghandler.h b/src/net/eathena/vendinghandler.h
index 531b5f5ec..b824a8d8e 100644
--- a/src/net/eathena/vendinghandler.h
+++ b/src/net/eathena/vendinghandler.h
@@ -47,7 +47,8 @@ class VendingHandler final : public Net::VendingHandler
void createShop(const std::string &name,
const bool flag,
- std::vector<ShopItem*> &items) const override final;
+ const std::vector<ShopItem*> &items) const
+ override final;
};
} // namespace EAthena
diff --git a/src/net/markethandler.h b/src/net/markethandler.h
index aaf10d2d1..88a18601e 100644
--- a/src/net/markethandler.h
+++ b/src/net/markethandler.h
@@ -48,7 +48,7 @@ class MarketHandler notfinal
const ItemColor color,
const int amount) const = 0;
- virtual void buyItems(std::vector<ShopItem*> &items) const = 0;
+ virtual void buyItems(const std::vector<ShopItem*> &items) const = 0;
};
} // namespace Net
diff --git a/src/net/tmwa/buyingstorehandler.cpp b/src/net/tmwa/buyingstorehandler.cpp
index b6b594d4c..882206761 100644
--- a/src/net/tmwa/buyingstorehandler.cpp
+++ b/src/net/tmwa/buyingstorehandler.cpp
@@ -35,7 +35,7 @@ BuyingStoreHandler::BuyingStoreHandler()
void BuyingStoreHandler::create(const std::string &name A_UNUSED,
const int maxMoney A_UNUSED,
const bool flag A_UNUSED,
- std::vector<ShopItem*> &items A_UNUSED) const
+ const std::vector<ShopItem*> &items A_UNUSED) const
{
}
diff --git a/src/net/tmwa/buyingstorehandler.h b/src/net/tmwa/buyingstorehandler.h
index 557267022..b9816310a 100644
--- a/src/net/tmwa/buyingstorehandler.h
+++ b/src/net/tmwa/buyingstorehandler.h
@@ -38,7 +38,7 @@ class BuyingStoreHandler final : public Net::BuyingStoreHandler
void create(const std::string &name,
const int maxMoney,
const bool flag,
- std::vector<ShopItem*> &items) const override final
+ const std::vector<ShopItem*> &items) const override final
A_CONST;
void close() const override final A_CONST;
diff --git a/src/net/tmwa/cashshophandler.cpp b/src/net/tmwa/cashshophandler.cpp
index e0856dae6..53bb46392 100644
--- a/src/net/tmwa/cashshophandler.cpp
+++ b/src/net/tmwa/cashshophandler.cpp
@@ -39,7 +39,8 @@ void CashShopHandler::buyItem(const int points A_UNUSED,
{
}
-void CashShopHandler::buyItems(std::vector<ShopItem*> &items A_UNUSED) const
+void CashShopHandler::buyItems(const std::vector<ShopItem*> &items A_UNUSED)
+ const
{
}
diff --git a/src/net/tmwa/cashshophandler.h b/src/net/tmwa/cashshophandler.h
index 2d6836d28..6c622270d 100644
--- a/src/net/tmwa/cashshophandler.h
+++ b/src/net/tmwa/cashshophandler.h
@@ -40,7 +40,7 @@ class CashShopHandler final : public Net::CashShopHandler
const ItemColor color,
const int amount) const override final A_CONST;
- void buyItems(std::vector<ShopItem*> &items) const override final
+ void buyItems(const std::vector<ShopItem*> &items) const override final
A_CONST;
void close() const override final A_CONST;
diff --git a/src/net/tmwa/markethandler.cpp b/src/net/tmwa/markethandler.cpp
index 3d65c6b8a..f9cb58d41 100644
--- a/src/net/tmwa/markethandler.cpp
+++ b/src/net/tmwa/markethandler.cpp
@@ -43,7 +43,8 @@ void MarketHandler::buyItem(const int itemId A_UNUSED,
{
}
-void MarketHandler::buyItems(std::vector<ShopItem*> &items A_UNUSED) const
+void MarketHandler::buyItems(const std::vector<ShopItem*> &items A_UNUSED)
+ const
{
}
diff --git a/src/net/tmwa/markethandler.h b/src/net/tmwa/markethandler.h
index e0cb95c7d..4c40abe16 100644
--- a/src/net/tmwa/markethandler.h
+++ b/src/net/tmwa/markethandler.h
@@ -41,7 +41,7 @@ class MarketHandler final : public Net::MarketHandler
const ItemColor color,
const int amount) const override final A_CONST;
- void buyItems(std::vector<ShopItem*> &items) const override final
+ void buyItems(const std::vector<ShopItem*> &items) const override final
A_CONST;
};
diff --git a/src/net/tmwa/vendinghandler.cpp b/src/net/tmwa/vendinghandler.cpp
index c69adcb85..b2da37855 100644
--- a/src/net/tmwa/vendinghandler.cpp
+++ b/src/net/tmwa/vendinghandler.cpp
@@ -55,7 +55,8 @@ void VendingHandler::buy2(const Being *const being A_UNUSED,
void VendingHandler::createShop(const std::string &name A_UNUSED,
const bool flag A_UNUSED,
- std::vector<ShopItem*> &items A_UNUSED) const
+ const std::vector<ShopItem*> &items A_UNUSED)
+ const
{
}
diff --git a/src/net/tmwa/vendinghandler.h b/src/net/tmwa/vendinghandler.h
index 585614fab..b06b15263 100644
--- a/src/net/tmwa/vendinghandler.h
+++ b/src/net/tmwa/vendinghandler.h
@@ -50,8 +50,8 @@ class VendingHandler final : public Net::VendingHandler
void createShop(const std::string &name,
const bool flag,
- std::vector<ShopItem*> &items) const override final
- A_CONST;
+ const std::vector<ShopItem*> &items) const
+ override final A_CONST;
};
} // namespace TmwAthena
diff --git a/src/net/vendinghandler.h b/src/net/vendinghandler.h
index f89ff3b0c..e313d2ac8 100644
--- a/src/net/vendinghandler.h
+++ b/src/net/vendinghandler.h
@@ -55,7 +55,7 @@ class VendingHandler notfinal
virtual void createShop(const std::string &name,
const bool flag,
- std::vector<ShopItem*> &items) const = 0;
+ const std::vector<ShopItem*> &items) const = 0;
};
} // namespace Net
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 51bb90f9d..39dc4b28f 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -1566,7 +1566,7 @@ void Map::reduce() restrict2
#endif
}
-void Map::addHeights(MapHeights *restrict const heights) restrict2
+void Map::addHeights(const MapHeights *restrict const heights) restrict2
{
delete mHeights;
mHeights = heights;
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index 4ee387f8f..3ffedc3de 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -348,7 +348,7 @@ class Map final : public Properties, public ConfigListener
void setWalkLayer(WalkLayer *restrict const layer) restrict2 noexcept
{ mWalkLayer = layer; }
- void addHeights(MapHeights *restrict const heights) restrict2;
+ void addHeights(const MapHeights *restrict const heights) restrict2;
uint8_t getHeightOffset(const int x, const int y) const restrict2;
diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h
index a02c031d1..59276a378 100644
--- a/src/resources/map/maplayer.h
+++ b/src/resources/map/maplayer.h
@@ -141,10 +141,10 @@ class MapLayer final: public ConfigListener
bool isFringeLayer() const restrict noexcept A_WARN_UNUSED
{ return mIsFringeLayer; }
- void setSpecialLayer(SpecialLayer *restrict const val) restrict
+ void setSpecialLayer(const SpecialLayer *restrict const val) restrict
{ mSpecialLayer = val; }
- void setTempLayer(SpecialLayer *restrict const val) restrict
+ void setTempLayer(const SpecialLayer *restrict const val) restrict
{ mTempLayer = val; }
int getWidth() const restrict noexcept A_WARN_UNUSED
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 8a413c1f7..8bce3a4c0 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -59,7 +59,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return false;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
return !SDL_SetClipboardText(text.c_str());
}
@@ -120,7 +120,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return ret;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
const int wCharsLen = MultiByteToWideChar(CP_UTF8,
0, text.c_str(), -1, nullptr, 0);
@@ -293,7 +293,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
}
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
return false;
}
@@ -402,17 +402,17 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return false;
}
-static bool runxsel(std::string& text, const char *p1,
+static bool runxsel(const std::string &text, const char *p1,
const char *p2 = nullptr);
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
runxsel(text, "-i");
runxsel(text, "-b", "-i");
return true;
}
-static bool runxsel(std::string& text, const char *p1, const char *p2)
+static bool runxsel(const std::string &text, const char *p1, const char *p2)
{
pid_t pid;
int fd[2];
@@ -484,7 +484,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return true;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
naclPostMessage("clipboard-copy", text);
return true;
@@ -495,7 +495,7 @@ bool retrieveBuffer(std::string&, size_t&)
return false;
}
-bool sendBuffer(std::string& text A_UNUSED)
+bool sendBuffer(const std::string &restrict text A_UNUSED)
{
return false;
}
diff --git a/src/utils/copynpaste.h b/src/utils/copynpaste.h
index 4d30f61d0..f536eca1c 100644
--- a/src/utils/copynpaste.h
+++ b/src/utils/copynpaste.h
@@ -37,6 +37,6 @@
*/
bool retrieveBuffer(std::string& text, size_t& pos) A_WARN_UNUSED;
-bool sendBuffer(std::string& text);
+bool sendBuffer(const std::string &restrict text);
#endif // UTILS_COPYNPASTE_H
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 041003988..9cc21f23a 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -876,8 +876,8 @@ bool parse2Str(const std::string &args, std::string &str1, std::string &str2)
{
if (pos + 1 < args.length())
{
- str1 = args.substr(0, pos).c_str();
- str2 = args.substr(pos + 1, args.length()).c_str();
+ str1 = args.substr(0, pos);
+ str2 = args.substr(pos + 1, args.length());
isValid = true;
}
}