Skip to content

Commit fcdc8e2

Browse files
committed
Revert "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"
This reverts commit 0460b84.
1 parent 0460b84 commit fcdc8e2

File tree

23 files changed

+49
-49
lines changed

23 files changed

+49
-49
lines changed

external/libendian

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.data(), static_cast<int>(data.size()));
145+
SDL_RWops* rwOps = SDL_RWFromConstMem(&data[0], 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.data(), stacktrace.size());
138+
const auto num_frames = backtrace(&stacktrace[0], 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.data()), stacktraceLen);
270+
return SendString(reinterpret_cast<const char*>(&endStacktrace[0]), 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(what), state(state)
450+
: Coords(GCType::SetInventorySetting, pt), what(std::move(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(what), count(count)
809+
: Coords(GCType::Trade, pt), what(std::move(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.data(), rs);
617+
&length[0], 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.data(), rs);
624+
best[0] = FindWarehouse(*rs->GetF1(), FW::HasFigure(Job::Helper, false), false, false, &length[0], 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.data(), road);
881+
best[0] = FindWarehouse(*road->GetF1(), FW::HasFigure(Job::PackDonkey, false), false, false, &length[0], 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.data(), mapInfo.mapData.data.size());
158+
file_.WriteRawData(&mapInfo.mapData.data[0], 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.data(), mapInfo.luaData.data.size());
162+
file_.WriteRawData(&mapInfo.luaData.data[0], 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.data(), mapInfo.mapData.data.size());
272+
file_.ReadRawData(&mapInfo.mapData.data[0], 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.data(), mapInfo.luaData.data.size());
276+
file_.ReadRawData(&mapInfo.luaData.data[0], mapInfo.luaData.data.size());
277277
break;
278278
case MapType::Savegame:
279279
mapInfo.savegame = std::make_unique<Savegame>();

libs/s25main/SavedFile.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void SavedFile::WriteExtHeader(BinaryFile& file, const std::string& mapName)
3838
mapName_ = mapName;
3939

4040
// Program version
41-
file.WriteRawData(revision.data(), revision.size());
41+
file.WriteRawData(&revision[0], revision.size());
4242
s25util::time64_t tmpTime = libendian::ConvertEndianess<false>::fromNative(saveTime_);
4343
file.WriteRawData(&tmpTime, sizeof(tmpTime));
4444
file.WriteShortString(mapName);
@@ -57,7 +57,7 @@ bool SavedFile::ReadFileHeader(BinaryFile& file)
5757
throw std::range_error("Program signature is to long!");
5858
try
5959
{
60-
file.ReadRawData(read_signature.data(), signature.size());
60+
file.ReadRawData(&read_signature[0], signature.size());
6161

6262
// Signatur überprüfen
6363
if(!std::equal(signature.begin(), signature.end(), read_signature.begin()))
@@ -88,7 +88,7 @@ bool SavedFile::ReadFileHeader(BinaryFile& file)
8888

8989
bool SavedFile::ReadExtHeader(BinaryFile& file)
9090
{
91-
file.ReadRawData(revision.data(), revision.size());
91+
file.ReadRawData(&revision[0], revision.size());
9292
file.ReadRawData(&saveTime_, sizeof(saveTime_));
9393
saveTime_ = libendian::ConvertEndianess<false>::toNative(saveTime_);
9494
mapName_ = file.ReadShortString();

libs/s25main/ai/aijh/Jobs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class JobWithTarget
5757
{
5858
public:
5959
JobWithTarget() : target(MapPoint::Invalid()) {}
60-
MapPoint GetTarget() const { return target; }
60+
inline MapPoint GetTarget() const { return target; }
6161
void SetTarget(MapPoint newTarget) { target = newTarget; }
6262

6363
protected:
@@ -72,8 +72,8 @@ class BuildJob : public AIJob, public JobWithTarget
7272
{}
7373

7474
void ExecuteJob() override;
75-
BuildingType GetType() const { return type; }
76-
MapPoint GetAround() const { return around; }
75+
inline BuildingType GetType() const { return type; }
76+
inline MapPoint GetAround() const { return around; }
7777

7878
private:
7979
BuildingType type;

libs/s25main/controls/ctrlChat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void ctrlChat::Draw_()
117117
for(unsigned i = 0; i < show_lines; ++i)
118118
{
119119
DrawPoint curTextPos = textPos;
120-
if(auto* line = get_if<PrimaryChatLine>(&chat_lines[i + pos]))
120+
if(PrimaryChatLine* line = get_if<PrimaryChatLine>(&chat_lines[i + pos]))
121121
{
122122
// Zeit, Spieler und danach Textnachricht
123123
if(!line->time_string.empty())
@@ -154,8 +154,8 @@ void ctrlChat::WrapLine(unsigned short i)
154154

155155
// Breite von Zeitstring und Spielername berechnen (falls vorhanden)
156156
unsigned short prefix_width =
157-
(!line.time_string.empty() ? font->getWidth(line.time_string) : 0)
158-
+ (!line.player.empty() ? (bracket1_size + bracket2_size + font->getWidth(line.player)) : 0);
157+
(line.time_string.length() ? font->getWidth(line.time_string) : 0)
158+
+ (line.player.length() ? (bracket1_size + bracket2_size + font->getWidth(line.player)) : 0);
159159

160160
// Reicht die Breite des Textfeldes noch nichtmal dafür aus?
161161
if(prefix_width > GetSize().x - 2 - SCROLLBAR_WIDTH)

libs/s25main/controls/ctrlEdit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ void ctrlEdit::AddChar(char32_t c)
184184
*/
185185
void ctrlEdit::RemoveChar()
186186
{
187-
if(cursorPos_ > 0 && !text_.empty())
187+
if(cursorPos_ > 0 && text_.length() > 0)
188188
{
189189
text_.erase(cursorPos_ - 1, 1);
190190

191191
// View verschieben
192-
while(!text_.empty() && text_.length() <= viewStart_)
192+
while(text_.length() > 0 && text_.length() <= viewStart_)
193193
--viewStart_;
194194

195195
CursorLeft();

0 commit comments

Comments
 (0)