summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-06 19:18:09 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-06 19:18:09 +0300
commitf3d00667c5a1bffa5a04d5e86676caca6979b58d (patch)
tree8c326bea9dfeee35670ad201f39818fc1a7765bc
parentbbfe142ec3b7879bbd618f36367f95c030d65968 (diff)
downloadplus-f3d00667c5a1bffa5a04d5e86676caca6979b58d.tar.gz
plus-f3d00667c5a1bffa5a04d5e86676caca6979b58d.tar.bz2
plus-f3d00667c5a1bffa5a04d5e86676caca6979b58d.tar.xz
plus-f3d00667c5a1bffa5a04d5e86676caca6979b58d.zip
Fix code style.
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/gui/models/beingslistmodel.h2
-rw-r--r--src/net/eathena/playerrecv.cpp2
-rw-r--r--src/render/vertexes/imagecollection.cpp4
-rw-r--r--src/render/vertexes/imagecollection.h2
-rw-r--r--src/render/vertexes/imagevertexes.h2
-rw-r--r--src/render/vertexes/openglgraphicsvertexes.cpp4
-rw-r--r--src/resources/ambientlayer.cpp4
-rw-r--r--src/resources/animation/animation.cpp4
-rw-r--r--src/resources/atlas/atlasitem.h4
-rw-r--r--src/resources/atlas/atlasresource.cpp4
-rw-r--r--src/resources/atlas/textureatlas.h4
-rw-r--r--src/resources/image.cpp4
-rw-r--r--src/resources/imageset.cpp4
-rw-r--r--src/resources/map/map.cpp4
-rw-r--r--src/resources/map/mapheights.cpp2
-rw-r--r--src/resources/map/maplayer.cpp4
-rw-r--r--src/resources/map/objectslayer.h2
-rw-r--r--src/resources/map/speciallayer.cpp4
-rw-r--r--src/resources/map/tileset.h6
-rw-r--r--src/resources/map/walklayer.cpp4
-rw-r--r--src/resources/resource.h2
-rw-r--r--src/resources/resourcemanager.cpp4
-rw-r--r--src/resources/sdlmusic.cpp2
-rw-r--r--src/resources/soundeffect.cpp4
-rw-r--r--src/resources/sprite/spritedef.cpp10
-rw-r--r--src/resources/subimage.cpp4
-rw-r--r--src/utils/checkutils_unittest.cc4
28 files changed, 43 insertions, 59 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index d167f4408..d7b00e1c6 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -3571,7 +3571,7 @@ void Being::recalcSpritesOrder() restrict2
if (updatedSprite[slot] == false &&
mSpriteDraw[slot] != id)
{
- setSprite(slot,
+ setSprite(static_cast<unsigned int>(slot),
id,
mSpriteColors[slot],
ItemColor_one,
diff --git a/src/gui/models/beingslistmodel.h b/src/gui/models/beingslistmodel.h
index 43ee37012..ccf0338c7 100644
--- a/src/gui/models/beingslistmodel.h
+++ b/src/gui/models/beingslistmodel.h
@@ -26,8 +26,6 @@
#include "utils/dtor.h"
-#include <vector>
-
class BeingsListModel final : public AvatarListModel
{
public:
diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp
index b58872712..8ceefa350 100644
--- a/src/net/eathena/playerrecv.cpp
+++ b/src/net/eathena/playerrecv.cpp
@@ -435,7 +435,7 @@ void PlayerRecv::processDressRoomOpen(Net::MessageIn &msg)
void PlayerRecv::processKilledBy(Net::MessageIn &msg)
{
const BeingId id = msg.readBeingId("killer id");
- Being *const dstBeing = actorManager->findBeing(id);
+ const Being *const dstBeing = actorManager->findBeing(id);
if (id == BeingId_zero)
{
debugMsg(strprintf(
diff --git a/src/render/vertexes/imagecollection.cpp b/src/render/vertexes/imagecollection.cpp
index 787fe3426..47c45b18c 100644
--- a/src/render/vertexes/imagecollection.cpp
+++ b/src/render/vertexes/imagecollection.cpp
@@ -20,10 +20,6 @@
#include "render/vertexes/imagecollection.h"
-#ifdef USE_OPENGL
-#include "render/graphics.h"
-#endif
-
#include "utils/dtor.h"
#include "debug.h"
diff --git a/src/render/vertexes/imagecollection.h b/src/render/vertexes/imagecollection.h
index e4567d85f..071499dbf 100644
--- a/src/render/vertexes/imagecollection.h
+++ b/src/render/vertexes/imagecollection.h
@@ -23,8 +23,6 @@
#include "main.h"
-#include "resources/rect/doublerect.h"
-
#include "render/vertexes/imagevertexes.h"
#include "localconsts.h"
diff --git a/src/render/vertexes/imagevertexes.h b/src/render/vertexes/imagevertexes.h
index eb6205d98..56786b421 100644
--- a/src/render/vertexes/imagevertexes.h
+++ b/src/render/vertexes/imagevertexes.h
@@ -25,8 +25,6 @@
#include "render/vertexes/openglgraphicsvertexes.h"
-#include <vector>
-
#include "localconsts.h"
class Image;
diff --git a/src/render/vertexes/openglgraphicsvertexes.cpp b/src/render/vertexes/openglgraphicsvertexes.cpp
index d111860d1..ee442355f 100644
--- a/src/render/vertexes/openglgraphicsvertexes.cpp
+++ b/src/render/vertexes/openglgraphicsvertexes.cpp
@@ -20,12 +20,10 @@
#ifdef USE_OPENGL
-#include "render/vertexes/imagecollection.h"
+#include "render/vertexes/openglgraphicsvertexes.h"
#include "render/graphics.h"
-#include "utils/dtor.h"
-
#include "debug.h"
unsigned int vertexBufSize = 500;
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index 389a2942d..3decec879 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -148,6 +148,6 @@ void AmbientLayer::draw(Graphics *const graphics, const int x,
int AmbientLayer::calcMemoryLocal() const
{
- return sizeof(AmbientLayer) +
- mName.capacity();
+ return static_cast<int>(sizeof(AmbientLayer) +
+ mName.capacity());
}
diff --git a/src/resources/animation/animation.cpp b/src/resources/animation/animation.cpp
index 9c3361db5..6eac889ed 100644
--- a/src/resources/animation/animation.cpp
+++ b/src/resources/animation/animation.cpp
@@ -101,8 +101,8 @@ int Animation::calcMemoryLocal() const
FOR_EACH (FramesCIter, it, mFrames)
{
const Frame &frame = *it;
- sz += sizeof(Frame) +
- frame.nextAction.capacity();
+ sz += static_cast<int>(sizeof(Frame) +
+ frame.nextAction.capacity());
}
return sz;
}
diff --git a/src/resources/atlas/atlasitem.h b/src/resources/atlas/atlasitem.h
index 835d7faa8..039000393 100644
--- a/src/resources/atlas/atlasitem.h
+++ b/src/resources/atlas/atlasitem.h
@@ -45,8 +45,8 @@ struct AtlasItem final : public MemoryCounter
int calcMemoryLocal() const override final
{
- return sizeof(AtlasItem) +
- name.capacity();
+ return static_cast<int>(sizeof(AtlasItem) +
+ name.capacity());
// +++ here need print, but not add to sum size of image
}
diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp
index 9ecc32692..48561bbbc 100644
--- a/src/resources/atlas/atlasresource.cpp
+++ b/src/resources/atlas/atlasresource.cpp
@@ -73,9 +73,9 @@ void AtlasResource::decRef()
int AtlasResource::calcMemoryLocal() const
{
- return sizeof(AtlasResource) +
+ return static_cast<int>(sizeof(AtlasResource)) +
Resource::calcMemoryLocal() +
- atlases.capacity() * sizeof(TextureAtlas*);
+ static_cast<int>(atlases.capacity() * sizeof(TextureAtlas*));
}
int AtlasResource::calcMemoryChilds(const int level) const
diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h
index 7208a7bf8..78819fa00 100644
--- a/src/resources/atlas/textureatlas.h
+++ b/src/resources/atlas/textureatlas.h
@@ -56,8 +56,8 @@ struct TextureAtlas final : public MemoryCounter
int calcMemoryLocal() const override final
{
- return sizeof(TextureAtlas) +
- items.capacity() * sizeof(AtlasItem*);
+ return static_cast<int>(sizeof(TextureAtlas) +
+ items.capacity() * sizeof(AtlasItem*));
}
int calcMemoryChilds(const int level) const override final
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index a537ebc75..c4bbf0a3c 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -477,8 +477,8 @@ void Image::SDLTerminateAlphaCache()
int Image::calcMemoryLocal() const
{
// +++ this calculation can be wrong for SDL2
- int sz = sizeof(Image) +
- sizeof(std::map<float, SDL_Surface*>) +
+ int sz = static_cast<int>(sizeof(Image) +
+ sizeof(std::map<float, SDL_Surface*>)) +
Resource::calcMemoryLocal();
if (mSDLSurface)
{
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index e20ad4eb4..e74ca3c07 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -78,7 +78,7 @@ Image* ImageSet::get(const size_type i) const
int ImageSet::calcMemoryLocal() const
{
- return sizeof(ImageSet) +
+ return static_cast<int>(sizeof(ImageSet)) +
Resource::calcMemoryLocal() +
- mImages.capacity() * sizeof(Image);
+ static_cast<int>(mImages.capacity() * sizeof(Image));
}
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 51bd7952c..ee4e0dc59 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -1701,7 +1701,7 @@ void Map::updateConditionLayers() restrict2
int Map::calcMemoryLocal() const
{
- return sizeof(Map) +
+ return static_cast<int>(sizeof(Map) +
mName.capacity() +
sizeof(MetaTile) * mWidth * mHeight +
sizeof(MapLayer*) * (mLayers.capacity() +
@@ -1714,7 +1714,7 @@ int Map::calcMemoryLocal() const
sizeof(ParticleEffectData) * mParticleEffects.capacity() +
sizeof(MapItem) * mMapPortals.capacity() +
(sizeof(TileAnimation) + sizeof(int)) * mTileAnimations.size() +
- sizeof(Tileset*) * mIndexedTilesetsSize;
+ sizeof(Tileset*) * mIndexedTilesetsSize);
}
int Map::calcMemoryChilds(const int level) const
diff --git a/src/resources/map/mapheights.cpp b/src/resources/map/mapheights.cpp
index 5d5c30aa8..b785df72c 100644
--- a/src/resources/map/mapheights.cpp
+++ b/src/resources/map/mapheights.cpp
@@ -42,6 +42,6 @@ void MapHeights::setHeight(const int x, const int y, const uint8_t height)
int MapHeights::calcMemoryLocal() const
{
- return sizeof(MapHeights) +
+ return static_cast<int>(sizeof(MapHeights)) +
mWidth * mHeight;
}
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 5d81cfb09..7ccf26396 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -749,9 +749,9 @@ void MapLayer::updateConditionTiles(MetaTile *const metaTiles,
int MapLayer::calcMemoryLocal() const
{
- return sizeof(MapLayer) +
+ return static_cast<int>(sizeof(MapLayer) +
sizeof(TileInfo) * mWidth * mHeight +
- sizeof(MapRowVertexes) * mTempRows.capacity();
+ sizeof(MapRowVertexes) * mTempRows.capacity());
}
int MapLayer::calcMemoryChilds(const int level) const
diff --git a/src/resources/map/objectslayer.h b/src/resources/map/objectslayer.h
index 09573a627..57e5dc1ff 100644
--- a/src/resources/map/objectslayer.h
+++ b/src/resources/map/objectslayer.h
@@ -23,8 +23,6 @@
#include "resources/memorycounter.h"
-#include <string>
-
#include "localconsts.h"
class MapObjectList;
diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp
index e57189d84..ddf5cc35e 100644
--- a/src/resources/map/speciallayer.cpp
+++ b/src/resources/map/speciallayer.cpp
@@ -154,6 +154,6 @@ void SpecialLayer::draw(Graphics *const graphics, int startX, int startY,
int SpecialLayer::calcMemoryLocal() const
{
- return sizeof(SpecialLayer) +
- sizeof(MapItem) * mWidth * mHeight;
+ return static_cast<int>(sizeof(SpecialLayer) +
+ sizeof(MapItem) * mWidth * mHeight);
}
diff --git a/src/resources/map/tileset.h b/src/resources/map/tileset.h
index c2f4a297c..93ff16c2d 100644
--- a/src/resources/map/tileset.h
+++ b/src/resources/map/tileset.h
@@ -77,15 +77,15 @@ class Tileset final : public ImageSet
int calcMemoryLocal() const override final
{
int sz = ImageSet::calcMemoryLocal() +
- sizeof(Tileset);
+ static_cast<int>(sizeof(Tileset));
const std::map<std::string, std::string>::const_iterator it_end =
mProperties.end();
std::map<std::string, std::string>::const_iterator it =
mProperties.begin();
while (it != it_end)
{
- sz += (*it).first.capacity() +
- (*it).second.capacity();
+ sz += static_cast<int>((*it).first.capacity() +
+ (*it).second.capacity());
++ it;
}
return sz;
diff --git a/src/resources/map/walklayer.cpp b/src/resources/map/walklayer.cpp
index 7bc505f18..a52f75179 100644
--- a/src/resources/map/walklayer.cpp
+++ b/src/resources/map/walklayer.cpp
@@ -46,6 +46,6 @@ int WalkLayer::getDataAt(const int x, const int y) const
int WalkLayer::calcMemoryLocal() const
{
return Resource::calcMemoryLocal() +
- sizeof(WalkLayer) +
- sizeof(int) * mWidth * mHeight;
+ static_cast<int>(sizeof(WalkLayer) +
+ sizeof(int) * mWidth * mHeight);
}
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 4d9e03f2d..71e22b812 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -25,8 +25,6 @@
#include "resources/memorycounter.h"
-#include <string>
-
#include "localconsts.h"
/**
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 2b1c3450d..b4eea1299 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1078,12 +1078,12 @@ int ResourceManager::calcMemoryChilds(const int level) const
int sz = 0;
FOR_EACH (ResourceCIterator, it, mResources)
{
- sz += (*it).first.capacity();
+ sz += static_cast<int>((*it).first.capacity());
sz += (*it).second->calcMemory(level + 1);
}
FOR_EACH (ResourceCIterator, it, mOrphanedResources)
{
- sz += (*it).first.capacity();
+ sz += static_cast<int>((*it).first.capacity());
sz += (*it).second->calcMemory(level + 1);
}
FOR_EACH (std::set<Resource*>::const_iterator, it, mDeletedResources)
diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp
index 0360ef37b..5834e8b49 100644
--- a/src/resources/sdlmusic.cpp
+++ b/src/resources/sdlmusic.cpp
@@ -81,6 +81,6 @@ bool SDLMusic::play(const int loops, const int fadeIn)
int SDLMusic::calcMemoryLocal() const
{
// +++ not used size of SDL_RWops
- return sizeof(SDLMusic) +
+ return static_cast<int>(sizeof(SDLMusic)) +
Resource::calcMemoryLocal();
}
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index f817f9c44..4491e993a 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -60,7 +60,7 @@ bool SoundEffect::play(const int loops, const int volume,
int SoundEffect::calcMemoryLocal() const
{
- return sizeof(SoundEffect) +
- sizeof(SDL_AudioSpec) +
+ return static_cast<int>(sizeof(SoundEffect) +
+ sizeof(SDL_AudioSpec)) +
Resource::calcMemoryLocal();
}
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index e0919b10b..d0985860c 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -596,14 +596,14 @@ bool SpriteDef::addSequence(const int start,
int SpriteDef::calcMemoryLocal() const
{
- int sz = sizeof(SpriteDef) +
+ int sz = static_cast<int>(sizeof(SpriteDef) +
sizeof(ImageSets) +
sizeof(Actions) +
- sizeof(std::set<std::string>) +
+ sizeof(std::set<std::string>)) +
Resource::calcMemoryLocal();
FOR_EACH (std::set<std::string>::const_iterator, it, mProcessedFiles)
{
- sz += (*it).capacity();
+ sz += static_cast<int>((*it).capacity());
}
return sz;
}
@@ -613,7 +613,7 @@ int SpriteDef::calcMemoryChilds(const int level) const
int sz = 0;
FOR_EACH (ImageSets::const_iterator, it, mImageSets)
{
- sz += (*it).first.capacity();
+ sz += static_cast<int>((*it).first.capacity());
const ImageSet *const imageSet = (*it).second;
sz += imageSet->calcMemory(level + 1);
}
@@ -623,7 +623,7 @@ int SpriteDef::calcMemoryChilds(const int level) const
const ActionMap *const actionMap = (*it).second;
FOR_EACHP (ActionMap::const_iterator, it2, actionMap)
{
- sz += (*it2).first.capacity();
+ sz += static_cast<int>((*it2).first.capacity());
Action *const action = (*it2).second;
sz += action->calcMemory(level + 1);
}
diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp
index 0652195dd..b6ec02479 100644
--- a/src/resources/subimage.cpp
+++ b/src/resources/subimage.cpp
@@ -225,8 +225,8 @@ void SubImage::decRef()
int SubImage::calcMemoryLocal() const
{
- int sz = sizeof(SubImage) +
- sizeof(std::map<float, SDL_Surface*>) +
+ int sz = static_cast<int>(sizeof(SubImage) +
+ sizeof(std::map<float, SDL_Surface*>)) +
Resource::calcMemoryLocal();
return sz;
}
diff --git a/src/utils/checkutils_unittest.cc b/src/utils/checkutils_unittest.cc
index 981e08f72..0d09143c3 100644
--- a/src/utils/checkutils_unittest.cc
+++ b/src/utils/checkutils_unittest.cc
@@ -130,14 +130,14 @@ TEST_CASE("CheckUtils")
SECTION("returnNullptr")
{
REQUIRE(testReturnNullptr(nullptr) == 0);
- REQUIRE(testReturnNullptr((void*)1) == 1);
+ REQUIRE(testReturnNullptr(reinterpret_cast<void*>(1)) == 1);
}
SECTION("returnNullptrV")
{
testReturnNullptrV(nullptr);
REQUIRE(flag == false);
- testReturnNullptrV((void*)1);
+ testReturnNullptrV(reinterpret_cast<void*>(1));
REQUIRE(flag == true);
}