From e482938fcd19ce3e879e906267a1122d09407ce7 Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Sat, 30 Dec 2017 23:44:42 +0000 Subject: [PATCH 10/31] FileList::files ~> std::vector --- src/fios.cpp | 2 +- src/fios.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fios.cpp b/src/fios.cpp index 5e78fb1b4..e465c255b 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -399,7 +399,7 @@ static void FiosGetFileList(SaveLoadOperation fop, fios_getlist_callback_proc *c { SortingBits order = _savegame_sort_order; _savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING; - QSortT(file_list.files.Begin(), file_list.files.Length(), CompareFiosItems); + QSortT(file_list.files.data(), file_list.Length(), CompareFiosItems); _savegame_sort_order = order; } diff --git a/src/fios.h b/src/fios.h index 5e17e8ee1..6bceb931a 100644 --- a/src/fios.h +++ b/src/fios.h @@ -113,7 +113,7 @@ public: */ inline FiosItem *Append() { - return this->files.Append(); + return &*Extend(this->files, 1); } /** @@ -122,7 +122,7 @@ public: */ inline uint Length() const { - return this->files.Length(); + return this->files.size(); } /** @@ -131,7 +131,7 @@ public: */ inline const FiosItem *Begin() const { - return this->files.Begin(); + return this->files.data(); } /** @@ -140,7 +140,7 @@ public: */ inline const FiosItem *End() const { - return this->files.End(); + return this->Begin() + this->Length(); } /** @@ -149,7 +149,7 @@ public: */ inline const FiosItem *Get(uint index) const { - return this->files.Get(index); + return this->files.data() + index; } /** @@ -158,7 +158,7 @@ public: */ inline FiosItem *Get(uint index) { - return this->files.Get(index); + return this->files.data() + index; } inline const FiosItem &operator[](uint index) const @@ -178,19 +178,19 @@ public: /** Remove all items from the list. */ inline void Clear() { - this->files.Clear(); + this->files.clear(); } /** Compact the list down to the smallest block size boundary. */ inline void Compact() { - this->files.Compact(); + this->files.shrink_to_fit(); } void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop); const FiosItem *FindItem(const char *file); - SmallVector files; ///< The list of files. + std::vector files; ///< The list of files. }; enum SortingBits { -- 2.14.1