Skip to content

Commit 0460b84

Browse files
committed
Automatic fixes of clang-tidy warnings: misc-unused-using-decls,modernize-use-auto,performance-inefficient-vector-operation,performance-move-const-arg,readability-container-size-empty,readability-redundant-member-init,bugprone-exception-escape,performance-noexcept-swap,readability-redundant-inline-specifier,readability-container-data-pointer
1 parent ec41919 commit 0460b84

File tree

27 files changed

+53
-53
lines changed

27 files changed

+53
-53
lines changed

external/libendian

external/libsiedler2

external/libutil

external/mygettext

external/s25edit

extras/audioDrivers/SDL/AudioSDL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ driver::RawSoundHandle AudioSDL::LoadEffect(const std::string& filepath)
142142

143143
driver::RawSoundHandle AudioSDL::LoadEffect(const std::vector<char>& data, const std::string& /*ext*/)
144144
{
145-
SDL_RWops* rwOps = SDL_RWFromConstMem(&data[0], static_cast<int>(data.size()));
145+
SDL_RWops* rwOps = SDL_RWFromConstMem(data.data(), static_cast<int>(data.size()));
146146
Mix_Chunk* sound = Mix_LoadWAV_RW(rwOps, true); //-V601
147147

148148
if(sound == nullptr)

libs/s25main/Debug.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bool captureBacktrace(DebugInfo::stacktrace_t& stacktrace, LPCONTEXT ctx) noexce
135135
bool captureBacktrace(DebugInfo::stacktrace_t& stacktrace, void*) noexcept
136136
{
137137
# if RTTR_BACKTRACE_HAS_FUNCTION
138-
const auto num_frames = backtrace(&stacktrace[0], stacktrace.size());
138+
const auto num_frames = backtrace(stacktrace.data(), stacktrace.size());
139139
stacktrace.resize(num_frames);
140140
return true;
141141
# else
@@ -267,7 +267,7 @@ bool DebugInfo::SendStackTrace(const stacktrace_t& stacktrace)
267267
endStacktrace.push_back(reinterpret_cast<littleVoid_t::value_type>(ptr));
268268

269269
unsigned stacktraceLen = sizeof(littleVoid_t) * endStacktrace.size();
270-
return SendString(reinterpret_cast<const char*>(&endStacktrace[0]), stacktraceLen);
270+
return SendString(reinterpret_cast<const char*>(endStacktrace.data()), stacktraceLen);
271271
}
272272

273273
bool DebugInfo::SendReplay()

libs/s25main/GameCommands.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class SetInventorySetting : public Coords
447447

448448
protected:
449449
SetInventorySetting(const MapPoint pt, boost_variant2<GoodType, Job> what, const InventorySetting state)
450-
: Coords(GCType::SetInventorySetting, pt), what(std::move(what)), state(state)
450+
: Coords(GCType::SetInventorySetting, pt), what(what), state(state)
451451
{}
452452
SetInventorySetting(Serializer& ser) : Coords(GCType::SetInventorySetting, ser)
453453

@@ -806,7 +806,7 @@ class TradeOverLand : public Coords
806806
protected:
807807
/// Note: Can only trade wares or figures!
808808
TradeOverLand(const MapPoint pt, boost_variant2<GoodType, Job> what, const uint32_t count)
809-
: Coords(GCType::Trade, pt), what(std::move(what)), count(count)
809+
: Coords(GCType::Trade, pt), what(what), count(count)
810810
{}
811811
TradeOverLand(Serializer& ser) : Coords(GCType::Trade, ser)
812812
{

libs/s25main/GamePlayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,14 +614,14 @@ bool GamePlayer::FindCarrierForRoad(RoadSegment* rs) const
614614
{
615615
// dann braucht man Träger UND Boot
616616
best[0] = FindWarehouse(*rs->GetF1(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false,
617-
&length[0], rs);
617+
length.data(), rs);
618618
// 2. Flagge des Weges
619619
best[1] = FindWarehouse(*rs->GetF2(), FW::HasWareAndFigure(GoodType::Boat, Job::Helper, false), false, false,
620620
&length[1], rs);
621621
} else
622622
{
623623
// 1. Flagge des Weges
624-
best[0] = FindWarehouse(*rs->GetF1(), FW::HasFigure(Job::Helper, false), false, false, &length[0], rs);
624+
best[0] = FindWarehouse(*rs->GetF1(), FW::HasFigure(Job::Helper, false), false, false, length.data(), rs);
625625
// 2. Flagge des Weges
626626
best[1] = FindWarehouse(*rs->GetF2(), FW::HasFigure(Job::Helper, false), false, false, &length[1], rs);
627627
}
@@ -878,7 +878,7 @@ nofCarrier* GamePlayer::OrderDonkey(RoadSegment* road) const
878878
std::array<nobBaseWarehouse*, 2> best;
879879

880880
// 1. Flagge des Weges
881-
best[0] = FindWarehouse(*road->GetF1(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[0], road);
881+
best[0] = FindWarehouse(*road->GetF1(), FW::HasFigure(Job::PackDonkey, false), false, false, length.data(), road);
882882
// 2. Flagge des Weges
883883
best[1] = FindWarehouse(*road->GetF2(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[1], road);
884884

libs/s25main/Replay.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ bool Replay::StartRecording(const boost::filesystem::path& filepath, const MapIn
155155
RTTR_Assert(!mapInfo.savegame);
156156
file_.WriteUnsignedInt(mapInfo.mapData.uncompressedLength);
157157
file_.WriteUnsignedInt(mapInfo.mapData.data.size());
158-
file_.WriteRawData(&mapInfo.mapData.data[0], mapInfo.mapData.data.size());
158+
file_.WriteRawData(mapInfo.mapData.data.data(), mapInfo.mapData.data.size());
159159
file_.WriteUnsignedInt(mapInfo.luaData.uncompressedLength);
160160
file_.WriteUnsignedInt(mapInfo.luaData.data.size());
161161
if(!mapInfo.luaData.data.empty())
162-
file_.WriteRawData(&mapInfo.luaData.data[0], mapInfo.luaData.data.size());
162+
file_.WriteRawData(mapInfo.luaData.data.data(), mapInfo.luaData.data.size());
163163
break;
164164
case MapType::Savegame: mapInfo.savegame->Save(file_, GetMapName()); break;
165165
}
@@ -269,11 +269,11 @@ bool Replay::LoadGameData(MapInfo& mapInfo)
269269
case MapType::OldMap:
270270
mapInfo.mapData.uncompressedLength = file_.ReadUnsignedInt();
271271
mapInfo.mapData.data.resize(file_.ReadUnsignedInt());
272-
file_.ReadRawData(&mapInfo.mapData.data[0], mapInfo.mapData.data.size());
272+
file_.ReadRawData(mapInfo.mapData.data.data(), mapInfo.mapData.data.size());
273273
mapInfo.luaData.uncompressedLength = file_.ReadUnsignedInt();
274274
mapInfo.luaData.data.resize(file_.ReadUnsignedInt());
275275
if(!mapInfo.luaData.data.empty())
276-
file_.ReadRawData(&mapInfo.luaData.data[0], mapInfo.luaData.data.size());
276+
file_.ReadRawData(mapInfo.luaData.data.data(), mapInfo.luaData.data.size());
277277
break;
278278
case MapType::Savegame:
279279
mapInfo.savegame = std::make_unique<Savegame>();

0 commit comments

Comments
 (0)