From d7e82c10876f7032c9a74099004cef7cc57307ad Mon Sep 17 00:00:00 2001 From: John Bolton Date: Sun, 4 Oct 2020 16:00:38 -0700 Subject: [PATCH] Fixed a bad fix. Fixed more warnings. These warnings have not been fixed because the are legitimate and/or I don't know how to fix them: test\googletest\googletest\include\gtest/gtest-printers.h(888,43): warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED. lib\serializer\JsonSerializeFormat.h(523,26): warning C4244: 'argument': conversion from 'type1' to 'type2', possible loss of data include\boost/iostreams/positioning.hpp(96,15): warning C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The member std::fpos::seekpos() is non-Standard, ... source\lib\filesystem\FileStream.h(39,69): warning C4910: 'boost::iostreams::stream,std::allocator>': '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation include\boost/optional/optional.hpp(274,53): warning C4244: 'argument': conversion from 'T' to 'T', possible loss of data client\widgets\../gui/SDL_Extensions.h(112,14): warning C4244: 'initializing': conversion from 'type1' to 'type2', possible loss of data client\CServerHandler.cpp(421,24): warning C4834: discarding return value of function with 'nodiscard' attribute (see https://bugs.vcmi.eu/view.php?id=3144) client\CVideoHandler.cpp(130,25): warning C4996: 'AVStream::codec': was declared deprecated --- lib/CTownHandler.cpp | 2 +- test/battle/CUnitStateTest.cpp | 2 +- test/map/CMapEditManagerTest.cpp | 2 +- test/vcai/ResurceManagerTest.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index ffee9e0c5..e62daa417 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -364,7 +364,7 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons ret->identifier = stringID; ret->town = town; - ret->bid = BuildingID((BuildingID::EBuildingID)source["id"].Float()); + ret->bid = BuildingID((si32)source["id"].Float()); ret->name = source["name"].String(); ret->description = source["description"].String(); ret->resources = TResources(source["cost"]); diff --git a/test/battle/CUnitStateTest.cpp b/test/battle/CUnitStateTest.cpp index 6079bbc44..2d7384289 100644 --- a/test/battle/CUnitStateTest.cpp +++ b/test/battle/CUnitStateTest.cpp @@ -178,7 +178,7 @@ TEST_F(UnitStateTest, attackWithFrenzy) bonusMock.addNewBonus(std::make_shared(Bonus::PERMANENT, Bonus::IN_FRENZY, Bonus::SPELL_EFFECT, 50, 0)); - int expectedAttack = DEFAULT_ATTACK + 0.5 * DEFAULT_DEFENCE; + int expectedAttack = static_cast(DEFAULT_ATTACK + 0.5 * DEFAULT_DEFENCE); EXPECT_EQ(subject.getAttack(false), expectedAttack); EXPECT_EQ(subject.getAttack(true), expectedAttack); diff --git a/test/map/CMapEditManagerTest.cpp b/test/map/CMapEditManagerTest.cpp index 58bdd55a9..572b7e0cd 100644 --- a/test/map/CMapEditManagerTest.cpp +++ b/test/map/CMapEditManagerTest.cpp @@ -141,7 +141,7 @@ TEST(MapManager, DrawTerrain_View) { const auto & posVector = posNode.Vector(); if(posVector.size() != 3) throw std::runtime_error("A position should consist of three values x,y,z. Continue with next position."); - int3 pos(posVector[0].Float(), posVector[1].Float(), posVector[2].Float()); + int3 pos((si32)posVector[0].Float(), (si32)posVector[1].Float(), (si32)posVector[2].Float()); const auto & originalTile = originalMap->getTile(pos); editManager->getTerrainSelection().selectRange(MapRect(pos, 1, 1)); editManager->drawTerrain(originalTile.terType, &gen); diff --git a/test/vcai/ResurceManagerTest.cpp b/test/vcai/ResurceManagerTest.cpp index 263dde49b..b0d7afc93 100644 --- a/test/vcai/ResurceManagerTest.cpp +++ b/test/vcai/ResurceManagerTest.cpp @@ -205,7 +205,7 @@ TEST_F(ResourceManagerTest, reservedResources) TEST_F(ResourceManagerTest, freeResources) { ON_CALL(gcm, getResourceAmount()) //in case callback or gs gets crazy - .WillByDefault(Return(TResources(-1, 0, -13.0f, -38763, -93764, -464, -12, -98765))); + .WillByDefault(Return(TResources(-1, 0, -13, -38763, -93764, -464, -12, -98765))); auto res = rm->freeResources(); ASSERT_GE(res[Res::WOOD], 0);