From 6abfa87e0eb8cba878df8a258c83853d53fdeec7 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sun, 6 May 2012 12:03:43 +0000 Subject: [PATCH] -replaced all safe_vectors by regular vectors, there is no need of it anymore, also removed miigotus wrapper --- source/channel/banner.h | 5 +- source/channel/channels.h | 4 +- source/config/config.cpp | 6 +- source/config/config.hpp | 3 +- source/devicemounter/PartitionHandle.h | 8 ++- source/gui/GameTDB.cpp | 8 +-- source/gui/GameTDB.hpp | 16 ++--- source/gui/WiiMovie.hpp | 2 +- source/gui/coverflow.cpp | 4 +- source/gui/coverflow.hpp | 7 +- source/gui/fanart.hpp | 3 +- source/gui/gcvid.cpp | 2 +- source/gui/gcvid.h | 8 +-- source/gui/gui.hpp | 4 +- source/gui/text.cpp | 18 +++-- source/gui/text.hpp | 16 +++-- source/gui/video.cpp | 8 +-- source/gui/video.hpp | 7 +- source/homebrew/homebrew.cpp | 6 +- source/list/cache.cpp | 14 ++-- source/list/cache.hpp | 16 ++--- source/list/cachedlist.cpp | 2 +- source/list/cachedlist.hpp | 3 +- source/list/list.cpp | 26 +++---- source/list/list.hpp | 8 +-- source/menu/menu.cpp | 26 ++++--- source/menu/menu.hpp | 18 ++--- source/menu/menu_config.cpp | 2 - source/menu/menu_config3.cpp | 2 - source/menu/menu_config4.cpp | 2 - source/menu/menu_config_adv.cpp | 4 +- source/menu/menu_config_game.cpp | 2 - source/menu/menu_config_screen.cpp | 3 - source/menu/menu_configsnd.cpp | 2 - source/menu/menu_download.cpp | 12 ++-- source/menu/menu_game.cpp | 8 +-- source/menu/menu_gameinfo.cpp | 4 +- source/menu/menu_input.cpp | 3 - source/menu/menu_main.cpp | 2 - source/menu/menu_nandemu.cpp | 4 +- source/menu/menu_plugin.cpp | 2 +- source/menu/menu_search.cpp | 24 +++---- source/menu/menu_wbfs.cpp | 2 - source/music/musicplayer.h | 2 +- source/plugin/plugin.cpp | 8 +-- source/plugin/plugin.hpp | 8 +-- source/safe_vector.hpp | 96 -------------------------- 47 files changed, 155 insertions(+), 285 deletions(-) delete mode 100644 source/safe_vector.hpp diff --git a/source/channel/banner.h b/source/channel/banner.h index ad29b30a..abc63574 100644 --- a/source/channel/banner.h +++ b/source/channel/banner.h @@ -29,9 +29,10 @@ #ifndef _BANNER_H_ #define _BANNER_H_ -#include "safe_vector.hpp" #include +using namespace std; + #define IMET_MAX_NAME_LEN 0x2a typedef struct @@ -56,8 +57,6 @@ typedef struct u8 md5[0x10]; } IMET; -using namespace std; - class Banner { public: diff --git a/source/channel/channels.h b/source/channel/channels.h index 8281ebfd..d185d606 100644 --- a/source/channel/channels.h +++ b/source/channel/channels.h @@ -29,7 +29,7 @@ #ifndef _CHANNELS_H_ #define _CHANNELS_H_ -#include "safe_vector.hpp" +#include #include #include "smartptr.hpp" @@ -70,7 +70,7 @@ class Channels u32 channelType; string langCode; - safe_vector channels; + vector channels; static int GetLanguage(const char *lang); u64* GetChannelList(u32* count); diff --git a/source/config/config.cpp b/source/config/config.cpp index 7b6f888b..2b45ec6c 100644 --- a/source/config/config.cpp +++ b/source/config/config.cpp @@ -6,8 +6,6 @@ #include "DeviceHandler.hpp" #include "gecko.h" -using namespace std; - static const char *g_whitespaces = " \f\n\r\t\v"; static const int g_floatPrecision = 10; @@ -332,9 +330,9 @@ string Config::getString(const string &domain, const string &key, const string & return data; } -safe_vector Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal) +vector Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal) { - safe_vector retval; + vector retval; if (domain.empty() || key.empty()) { diff --git a/source/config/config.hpp b/source/config/config.hpp index b41f2af6..a1a8668a 100644 --- a/source/config/config.hpp +++ b/source/config/config.hpp @@ -4,7 +4,6 @@ #include #include -#include "safe_vector.hpp" #include "video.hpp" #include "smartptr.hpp" @@ -36,7 +35,7 @@ public: // Get wstringEx getWString(const std::string &domain, const std::string &key, const wstringEx &defVal = wstringEx()); std::string getString(const std::string &domain, const std::string &key, const std::string &defVal = std::string()); - safe_vector getStrings(const std::string &domain, const std::string &key, char seperator = ',', const std::string &defval = std::string()); + vector getStrings(const std::string &domain, const std::string &key, char seperator = ',', const std::string &defval = std::string()); bool getBool(const std::string &domain, const std::string &key, bool defVal = false); int getOptBool(const std::string &domain, const std::string &key, int defVal = 2); bool testOptBool(const std::string &domain, const std::string &key, bool defVal); diff --git a/source/devicemounter/PartitionHandle.h b/source/devicemounter/PartitionHandle.h index 5a485e3c..671e1239 100644 --- a/source/devicemounter/PartitionHandle.h +++ b/source/devicemounter/PartitionHandle.h @@ -27,9 +27,11 @@ #define PARTITION_HANDLE_H #include -#include "safe_vector.hpp" #include "libwbfs/libwbfs.h" #include +#include + +using namespace std; #define MAX_PARTITIONS 32 /* Maximum number of partitions that can be found */ #define MAX_MOUNTS 10 /* Maximum number of mounts available at one time */ @@ -212,8 +214,8 @@ class PartitionHandle bool CheckGPT(void); const DISC_INTERFACE *interface; - safe_vector PartitionList; - safe_vector MountNameList; + vector PartitionList; + vector MountNameList; }; #endif diff --git a/source/gui/GameTDB.cpp b/source/gui/GameTDB.cpp index 516986da..6c1b5172 100644 --- a/source/gui/GameTDB.cpp +++ b/source/gui/GameTDB.cpp @@ -647,7 +647,7 @@ unsigned int GameTDB::GetPublishDate(const char * id) bool GameTDB::GetGenres(const char * id, string & gen) { - safe_vector genre; + vector genre; gen = ""; if(!id) return false; @@ -771,7 +771,7 @@ bool GameTDB::GetRatingValue(const char * id, string & rating_value) return true; } -int GameTDB::GetRatingDescriptors(const char * id, safe_vector & desc_list) +int GameTDB::GetRatingDescriptors(const char * id, vector & desc_list) { desc_list.clear(); if(!id) @@ -838,7 +838,7 @@ int GameTDB::GetWifiPlayers(const char * id) return players; } -int GameTDB::GetWifiFeatures(const char * id, safe_vector & feat_list) +int GameTDB::GetWifiFeatures(const char * id, vector & feat_list) { feat_list.clear(); if(!id) @@ -910,7 +910,7 @@ int GameTDB::GetPlayers(const char * id) return players; } -int GameTDB::GetAccessories(const char * id, safe_vector & acc_list) +int GameTDB::GetAccessories(const char * id, vector & acc_list) { acc_list.clear(); if(!id) diff --git a/source/gui/GameTDB.hpp b/source/gui/GameTDB.hpp index 55b976d3..5673af3f 100644 --- a/source/gui/GameTDB.hpp +++ b/source/gui/GameTDB.hpp @@ -24,7 +24,7 @@ #ifndef GAMETDB_HPP_ #define GAMETDB_HPP_ -#include "safe_vector.hpp" +#include #include using namespace std; @@ -47,11 +47,11 @@ typedef struct _GameXMLInfo string Genres; int RatingType; string RatingValue; - safe_vector RatingDescriptors; + vector RatingDescriptors; int WifiPlayers; - safe_vector WifiFeatures; + vector WifiFeatures; int Players; - safe_vector Accessories; + vector Accessories; int CaseColor; } GameXMLInfo; @@ -107,19 +107,19 @@ class GameTDB bool GetRatingValue(const char * id, string & rating_value); //! Get the rating descriptor list inside a vector for a specific game id //! Returns the amount of descriptors found or -1 if failed - int GetRatingDescriptors(const char * id, safe_vector & desc_list); + int GetRatingDescriptors(const char * id, vector & desc_list); //! Get the wifi player count for a specific game id //! Returns the amount of wifi players or -1 if failed int GetWifiPlayers(const char * id); //! Get the wifi feature list inside a vector for a specific game id //! Returns the amount of wifi features found or -1 if failed - int GetWifiFeatures(const char * id, safe_vector & feat_list); + int GetWifiFeatures(const char * id, vector & feat_list); //! Get the player count for a specific game id //! Returns the amount of players or -1 if failed int GetPlayers(const char * id); //! Returns the amount of accessoires found or -1 if failed //! Get the accessoire (inputs) list inside a vector for a specific game id - int GetAccessories(const char * id, safe_vector & acc_list); + int GetAccessories(const char * id, vector & acc_list); //! Get the box (case) color for a specific game id //! Returns the color in RGB (first 3 bytes) unsigned int GetCaseColor(const char * id); @@ -150,7 +150,7 @@ class GameTDB bool isLoaded; bool isParsed; - safe_vector OffsetMap; + vector OffsetMap; FILE * file; const char *filepath; string LangCode; diff --git a/source/gui/WiiMovie.hpp b/source/gui/WiiMovie.hpp index ef702e61..ab62ecb3 100644 --- a/source/gui/WiiMovie.hpp +++ b/source/gui/WiiMovie.hpp @@ -39,7 +39,7 @@ class WiiMovie float fps; Timer PlayTime; u32 VideoFrameCount; - safe_vector Frames; + vector Frames; bool Playing; bool ExitRequested; bool fullScreen; diff --git a/source/gui/coverflow.cpp b/source/gui/coverflow.cpp index 3bb8e476..24ae7799 100644 --- a/source/gui/coverflow.cpp +++ b/source/gui/coverflow.cpp @@ -310,7 +310,7 @@ void CCoverFlow::setFont(SFont font, const CColor &color) } } -void CCoverFlow::_transposeCover(safe_vector &dst, u32 rows, u32 columns, int pos) +void CCoverFlow::_transposeCover(vector &dst, u32 rows, u32 columns, int pos) { int i = pos - (int)(rows * columns / 2); int j = rows >= 3 ? abs(i) - ((abs(i) + (int)rows / 2) / (int)rows) * 2 : abs(i); @@ -331,7 +331,7 @@ void CCoverFlow::setRange(u32 rows, u32 columns) if (!m_covers.empty()) { stopCoverLoader(); - safe_vector tmpCovers; + vector tmpCovers; tmpCovers.resize(range); if (rows >= 3) for (u32 x = 0; x < columns; ++x) diff --git a/source/gui/coverflow.hpp b/source/gui/coverflow.hpp index 95a85bd9..5a267564 100644 --- a/source/gui/coverflow.hpp +++ b/source/gui/coverflow.hpp @@ -6,7 +6,6 @@ #include #include #include -#include "safe_vector.hpp" #include "wiiuse/wpad.h" #include @@ -227,8 +226,8 @@ private: Vector3D m_cameraAim; Vector3D m_targetCameraPos; Vector3D m_targetCameraAim; - safe_vector m_items; - safe_vector m_covers; + vector m_items; + vector m_covers; int m_delay; int m_minDelay; int m_jump; @@ -325,7 +324,7 @@ private: CLRet _loadCoverTex(u32 i, bool box, bool hq); bool _invisibleCover(u32 x, u32 y); void _instantTarget(int i); - void _transposeCover(safe_vector &dst, u32 rows, u32 columns, int pos); + void _transposeCover(vector &dst, u32 rows, u32 columns, int pos); void _playSound(void); void _stopSound(SmartGuiSound snd); diff --git a/source/gui/fanart.hpp b/source/gui/fanart.hpp index b0c35be3..105e5cbb 100644 --- a/source/gui/fanart.hpp +++ b/source/gui/fanart.hpp @@ -6,7 +6,6 @@ #include #include #include -#include "safe_vector.hpp" #include "config.hpp" #include "texture.hpp" @@ -74,7 +73,7 @@ public: void tick(); private: - safe_vector m_elms; + vector m_elms; bool m_animationComplete; u16 m_delayAfterAnimation; diff --git a/source/gui/gcvid.cpp b/source/gui/gcvid.cpp index 4d510e48..6a057c91 100644 --- a/source/gui/gcvid.cpp +++ b/source/gui/gcvid.cpp @@ -580,7 +580,7 @@ void MthVideoFile::getCurrentFrame(VideoFrame& f) const JpgVideoFile::JpgVideoFile(FILE* f) : VideoFile(f) { - safe_vector data(getFilesize(f)); + vector data(getFilesize(f)); fread(&data[0], 1, getFilesize(f), f); loadFrame(_currFrame, &data[0], getFilesize(f)); diff --git a/source/gui/gcvid.h b/source/gui/gcvid.h index 6ad2fe4d..4023a69e 100644 --- a/source/gui/gcvid.h +++ b/source/gui/gcvid.h @@ -31,8 +31,8 @@ #include //FILE* #include -#include "safe_vector.hpp" - +#include +using namespace std; #include @@ -285,7 +285,7 @@ class ThpVideoFile : public VideoFile int _currFrameNr; int _nextFrameOffset; int _nextFrameSize; - safe_vector _currFrameData; + vector _currFrameData; }; class MthVideoFile : public VideoFile @@ -311,7 +311,7 @@ class MthVideoFile : public VideoFile int _nextFrameOffset; int _nextFrameSize; int _thisFrameSize; - safe_vector _currFrameData; + vector _currFrameData; }; class JpgVideoFile : public VideoFile diff --git a/source/gui/gui.hpp b/source/gui/gui.hpp index cef9f18e..cbd5d0d2 100644 --- a/source/gui/gui.hpp +++ b/source/gui/gui.hpp @@ -14,8 +14,6 @@ #include "text.hpp" #include "gui_sound.h" -#include "safe_vector.hpp" - struct SButtonTextureSet { STexture left; @@ -138,7 +136,7 @@ private: virtual void tick(void); }; private: - safe_vector > m_elts; + vector > m_elts; u32 m_selected[WPAD_MAX_WIIMOTES]; bool m_rumbleEnabled; u8 m_rumble[WPAD_MAX_WIIMOTES]; diff --git a/source/gui/text.cpp b/source/gui/text.cpp index 5f20fba0..cd326b6c 100644 --- a/source/gui/text.cpp +++ b/source/gui/text.cpp @@ -1,7 +1,5 @@ #include "text.hpp" -using namespace std; - static const wchar_t *g_whitespaces = L" \f\n\r\t\v"; // Simplified use of sprintf @@ -104,7 +102,7 @@ wstringEx wfmt(const wstringEx &format, ...) return ws; } -string vectorToString(const safe_vector &vect, string sep) +string vectorToString(const vector &vect, string sep) { string s; for (u32 i = 0; i < vect.size(); ++i) @@ -116,7 +114,7 @@ string vectorToString(const safe_vector &vect, string sep) return s; } -wstringEx vectorToString(const safe_vector &vect, char sep) +wstringEx vectorToString(const vector &vect, char sep) { wstringEx s; for (u32 i = 0; i < vect.size(); ++i) @@ -128,9 +126,9 @@ wstringEx vectorToString(const safe_vector &vect, char sep) return s; } -safe_vector stringToVector(const string &text, char sep) +vector stringToVector(const string &text, char sep) { - safe_vector v; + vector v; if (text.empty()) return v; u32 count = 1; for (u32 i = 0; i < text.size(); ++i) @@ -154,9 +152,9 @@ safe_vector stringToVector(const string &text, char sep) return v; } -safe_vector stringToVector(const wstringEx &text, char sep) +vector stringToVector(const wstringEx &text, char sep) { - safe_vector v; + vector v; if (text.empty()) return v; u32 count = 1; for (u32 i = 0; i < text.size(); ++i) @@ -242,7 +240,7 @@ void CText::setText(SFont font, const wstringEx &t) firstLine = 0; // Don't care about performance - safe_vector lines = stringToVector(t, L'\n'); + vector lines = stringToVector(t, L'\n'); m_lines.reserve(lines.size()); // for (u32 k = 0; k < lines.size(); ++k) @@ -282,7 +280,7 @@ void CText::setText(SFont font, const wstringEx &t, u32 startline) firstLine = startline; // Don't care about performance - safe_vector lines = stringToVector(t, L'\n'); + vector lines = stringToVector(t, L'\n'); m_lines.reserve(lines.size()); // for (u32 k = 0; k < lines.size(); ++k) diff --git a/source/gui/text.hpp b/source/gui/text.hpp index 08437888..a3b1c210 100644 --- a/source/gui/text.hpp +++ b/source/gui/text.hpp @@ -2,7 +2,7 @@ #ifndef __TEXT_HPP #define __TEXT_HPP -#include "safe_vector.hpp" +#include #include #include "wstringEx.hpp" @@ -11,6 +11,8 @@ #include "smartptr.hpp" +using namespace std; + struct SFont { SmartBuf data; @@ -45,8 +47,8 @@ private: Vector3D targetPos; }; private: - typedef safe_vector CLine; - safe_vector m_lines; + typedef vector CLine; + vector m_lines; SFont m_font; CColor m_color; u32 firstLine; @@ -64,10 +66,10 @@ const char *fmt(const char *format, ...); std::string sfmt(const char *format, ...); wstringEx wfmt(const wstringEx &format, ...); bool checkFmt(const wstringEx &ref, const wstringEx &format); -std::string vectorToString(const safe_vector &vect, std::string sep); -wstringEx vectorToString(const safe_vector &vect, char sep); -safe_vector stringToVector(const wstringEx &text, char sep); -safe_vector stringToVector(const std::string &text, char sep); +std::string vectorToString(const vector &vect, std::string sep); +wstringEx vectorToString(const vector &vect, char sep); +vector stringToVector(const wstringEx &text, char sep); +vector stringToVector(const std::string &text, char sep); std::string upperCase(std::string text); std::string lowerCase(std::string text); std::string ltrim(std::string s); diff --git a/source/gui/video.cpp b/source/gui/video.cpp index e7042cc9..93314937 100644 --- a/source/gui/video.cpp +++ b/source/gui/video.cpp @@ -6,8 +6,6 @@ #define DEFAULT_FIFO_SIZE (256 * 1024) -using namespace std; - extern const u8 wait_01_png[]; extern const u8 wait_02_png[]; extern const u8 wait_03_png[]; @@ -454,7 +452,7 @@ void CVideo::_showWaitMessages(CVideo *m) s8 PNGfadeDirection = 1; s16 currentLightLevel = 0; - safe_vector::iterator waitItr = m->m_waitMessages.begin(); + vector::iterator waitItr = m->m_waitMessages.begin(); gprintf("Going to show a wait message screen, delay: %d, # images: %d\n", waitFrames, m->m_waitMessages.size()); m->waitMessage(*waitItr); @@ -538,10 +536,10 @@ void CVideo::CheckWaitThread() void CVideo::waitMessage(float delay) { - waitMessage(safe_vector(), delay); + waitMessage(vector(), delay); } -void CVideo::waitMessage(const safe_vector &tex, float delay, bool useWiiLight) +void CVideo::waitMessage(const vector &tex, float delay, bool useWiiLight) { hideWaitMessage(); diff --git a/source/gui/video.hpp b/source/gui/video.hpp index 66f6a746..2c413794 100644 --- a/source/gui/video.hpp +++ b/source/gui/video.hpp @@ -3,12 +3,13 @@ #define __VIDEO_HPP #include +#include #include "smartptr.hpp" #include "vector.hpp" #include "texture.hpp" -#include "safe_vector.hpp" +using namespace std; class CTexCoord { @@ -67,7 +68,7 @@ public: int stencilVal(int x, int y); void hideWaitMessage(); void waitMessage(float delay); - void waitMessage(const safe_vector &tex, float delay, bool useWiiLight = true); + void waitMessage(const vector &tex, float delay, bool useWiiLight = true); void waitMessage(const STexture &tex); void CheckWaitThread(); s32 TakeScreenshot(const char *); @@ -99,7 +100,7 @@ private: bool m_showWaitMessage; volatile bool m_showingWaitMessages; bool m_useWiiLight; - safe_vector m_waitMessages; + vector m_waitMessages; // static const int _stencilWidth; static const int _stencilHeight; diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index 9d82b3a3..76cc571c 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -3,7 +3,7 @@ #include #include #include -#include "safe_vector.hpp" +#include #include #include "smartptr.hpp" #include "gecko.h" @@ -12,6 +12,8 @@ #define BOOTER_ADDR ((u8 *) 0x93000000) #define ARGS_ADDR ((u8 *) 0x93200000) +using namespace std; + extern const u8 app_booter_bin[]; extern const u32 app_booter_bin_size; @@ -20,7 +22,7 @@ extern "C" { void __exception_closeall(); } static u8 *homebrewbuffer = EXECUTE_ADDR; static u32 homebrewsize = 0; -static safe_vector Arguments; +static vector Arguments; bool bootHB; diff --git a/source/list/cache.cpp b/source/list/cache.cpp index 57e578c5..846569f0 100644 --- a/source/list/cache.cpp +++ b/source/list/cache.cpp @@ -23,7 +23,7 @@ CCache::CCache(T &tmp, string path, u32 index, CMode mode) /* Load/Save One * } template -CCache::CCache(safe_vector &list, string path , CMode mode) /* Load/Save All */ +CCache::CCache(vector &list, string path , CMode mode) /* Load/Save All */ { filename = path; //gprintf("Opening DB: %s\n", filename.c_str()); @@ -45,7 +45,7 @@ CCache::CCache(safe_vector &list, string path , CMode mode) /* Load/Save A } template -CCache::CCache(safe_vector &list, string path, T tmp, CMode mode) /* Add One */ +CCache::CCache(vector &list, string path, T tmp, CMode mode) /* Add One */ { filename = path; //gprintf("Openning DB: %s\n", filename.c_str()); @@ -64,7 +64,7 @@ CCache::CCache(safe_vector &list, string path, T tmp, CMode mode) /* Add O } template -CCache::CCache(safe_vector &list, string path, u32 index, CMode mode) /* Remove One */ +CCache::CCache(vector &list, string path, u32 index, CMode mode) /* Remove One */ { filename = path; //gprintf("Openning DB: %s\n", filename.c_str()); @@ -91,7 +91,7 @@ CCache::~CCache() } template -void CCache::SaveAll(safe_vector list) +void CCache::SaveAll(vector list) { //gprintf("Updating DB: %s\n", filename.c_str()); if(!cache) return; @@ -108,7 +108,7 @@ void CCache::SaveOne(T tmp, u32 index) } template -void CCache::LoadAll(safe_vector &list) +void CCache::LoadAll(vector &list) { if(!cache) return; @@ -142,7 +142,7 @@ void CCache::LoadOne(T &tmp, u32 index) } template -void CCache::AddOne(safe_vector &list, T tmp) +void CCache::AddOne(vector &list, T tmp) { //gprintf("Adding Item number %u in DB: %s\n", list.size()+1, filename.c_str()); list.push_back(tmp); @@ -152,7 +152,7 @@ void CCache::AddOne(safe_vector &list, T tmp) } template -void CCache::RemoveOne(safe_vector &list, u32 index) +void CCache::RemoveOne(vector &list, u32 index) { //gprintf("Removing Item number %u in DB: %s\n", index, filename.c_str()); list.erase(list.begin() + index); diff --git a/source/list/cache.hpp b/source/list/cache.hpp index ea6ec0c5..3a700419 100644 --- a/source/list/cache.hpp +++ b/source/list/cache.hpp @@ -4,7 +4,7 @@ #include #include #include -#include "safe_vector.hpp" +#include #include "disc.h" //#include "gecko.h" @@ -30,18 +30,18 @@ class CCache { public: CCache(T &tmp, string path, u32 index, CMode mode); /* Load/Save One */ - CCache(safe_vector &list, string path, CMode mode); /* Load/Save All */ - CCache(safe_vector &list, string path, T tmp, CMode mode); /* Add One */ - CCache(safe_vector &list, string path, u32 index, CMode mode); /* Remove One */ + CCache(vector &list, string path, CMode mode); /* Load/Save All */ + CCache(vector &list, string path, T tmp, CMode mode); /* Add One */ + CCache(vector &list, string path, u32 index, CMode mode); /* Remove One */ ~CCache(); private: - void SaveAll(safe_vector list); + void SaveAll(vector list); void SaveOne(T tmp, u32 index); - void LoadAll(safe_vector &list); + void LoadAll(vector &list); void LoadOne(T &tmp, u32 index); - void AddOne(safe_vector &list, T tmp); - void RemoveOne(safe_vector &list, u32 index); + void AddOne(vector &list, T tmp); + void RemoveOne(vector &list, u32 index); FILE *cache; string filename; diff --git a/source/list/cachedlist.cpp b/source/list/cachedlist.cpp index e24a6e22..32ebd76c 100644 --- a/source/list/cachedlist.cpp +++ b/source/list/cachedlist.cpp @@ -78,7 +78,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, { gprintf("Calling list to update filelist\n"); - safe_vector pathlist; + vector pathlist; list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL))); list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin); diff --git a/source/list/cachedlist.hpp b/source/list/cachedlist.hpp index 510bde17..117ad8ea 100644 --- a/source/list/cachedlist.hpp +++ b/source/list/cachedlist.hpp @@ -3,7 +3,6 @@ #include "list.hpp" #include "cache.hpp" -#include "safe_vector.hpp" #include "gecko.h" #include "config/config.hpp" @@ -19,7 +18,7 @@ enum { }; template -class CachedList : public safe_vector +class CachedList : public vector { public: void Init(string cachedir, string settingsDir, string curLanguage, string DMLgameDir, bool extcheck) /* Initialize Private Variables */ diff --git a/source/list/list.cpp b/source/list/list.cpp index 0a6608f8..995ba129 100644 --- a/source/list/list.cpp +++ b/source/list/list.cpp @@ -7,7 +7,7 @@ #include "gc.h" template -void CList::GetPaths(safe_vector &pathlist, string containing, string directory, bool wbfs_fs, bool dml) +void CList::GetPaths(vector &pathlist, string containing, string directory, bool wbfs_fs, bool dml) { if (!wbfs_fs) { @@ -15,8 +15,8 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string DIR *dir_itr = opendir(directory.c_str()); if (!dir_itr) return; - safe_vector compares = stringToVector(containing, '|'); - safe_vector temp_pathlist; + vector compares = stringToVector(containing, '|'); + vector temp_pathlist; struct dirent *ent; @@ -28,7 +28,7 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string if(ent->d_type == DT_REG) { - for(safe_vector::iterator compare = compares.begin(); compare != compares.end(); compare++) + for(vector::iterator compare = compares.begin(); compare != compares.end(); compare++) if (strcasestr(ent->d_name, (*compare).c_str()) != NULL) { //gprintf("Pushing %s to the list.\n", sfmt("%s/%s", directory.c_str(), ent->d_name).c_str()); @@ -44,7 +44,7 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string if(temp_pathlist.size() > 0) { bool FoundDMLgame; - for(safe_vector::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++) + for(vector::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++) { dir_itr = opendir((*templist).c_str()); if (!dir_itr) continue; @@ -55,7 +55,7 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string { if(ent->d_type == DT_REG && strlen(ent->d_name) > 7) { - for(safe_vector::iterator compare = compares.begin(); compare != compares.end(); compare++) + for(vector::iterator compare = compares.begin(); compare != compares.end(); compare++) { if(strcasestr(ent->d_name, (*compare).c_str()) != NULL) { @@ -98,19 +98,19 @@ void CList::GetPaths(safe_vector &pathlist, string containing, string } template <> -void CList::GetHeaders(safe_vector pathlist, safe_vector &headerlist, string, string, string, Config&) +void CList::GetHeaders(vector pathlist, vector &headerlist, string, string, string, Config&) { //gprintf("Getting headers for CList\n"); if(pathlist.size() < 1) return; headerlist.reserve(pathlist.size() + headerlist.size()); - for(safe_vector::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) + for(vector::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) headerlist.push_back((*itr).c_str()); } template <> -void CList::GetHeaders(safe_vector pathlist, safe_vector &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin) +void CList::GetHeaders(vector pathlist, vector &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin) { if(pathlist.size() < 1) return; headerlist.reserve(pathlist.size() + headerlist.size()); @@ -136,7 +136,7 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) + for(vector::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) { bzero(&tmp, sizeof(dir_discHdr)); strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path)); @@ -413,10 +413,10 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector types = plugin.getStrings("PLUGIN","fileTypes",'|'); + vector types = plugin.getStrings("PLUGIN","fileTypes",'|'); if (types.size() > 0) { - for(safe_vector::iterator type_itr = types.begin(); type_itr != types.end(); type_itr++) + for(vector::iterator type_itr = types.begin(); type_itr != types.end(); type_itr++) { if(lowerCase(*itr).rfind((*type_itr).c_str()) != string::npos) { @@ -455,7 +455,7 @@ void CList::GetHeaders(safe_vector pathlist, safe_vector -void CList::GetChannels(safe_vector &headerlist, string settingsDir, u32 channelType, string curLanguage) +void CList::GetChannels(vector &headerlist, string settingsDir, u32 channelType, string curLanguage) { Channels m_channels; m_channels.Init(channelType, curLanguage, true); diff --git a/source/list/list.hpp b/source/list/list.hpp index d62e7a97..a5ba7d1d 100644 --- a/source/list/list.hpp +++ b/source/list/list.hpp @@ -9,7 +9,6 @@ #include #include "DeviceHandler.hpp" -#include "safe_vector.hpp" #include "wbfs_ext.h" #include "libwbfs/libwbfs.h" #include "disc.h" @@ -17,16 +16,15 @@ #include "cache.hpp" #include "config/config.hpp" -using namespace std; template class CList { public: CList(){}; ~CList(){}; - void GetPaths(safe_vector &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false); - void GetHeaders(safe_vector pathlist, safe_vector &headerlist, string, string, string, Config &plugin); - void GetChannels(safe_vector &headerlist, string, u32, string); + void GetPaths(vector &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false); + void GetHeaders(vector pathlist, vector &headerlist, string, string, string, Config &plugin); + void GetChannels(vector &headerlist, string, u32, string); private: void Check_For_ID(u8 *id, string path, string one, string two); }; diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index 585897a7..2dbab3aa 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -105,8 +105,6 @@ extern const u8 butzhcnoffs_png[]; extern const u8 checkbox_png[]; extern const u8 checkboxs_png[]; -using namespace std; - CMenu::CMenu(CVideo &vid) : m_vid(vid) { @@ -441,14 +439,14 @@ void CMenu::init(void) m_cfg.getString("GAMERCARD", "dutag_key", ""); if (m_cfg.getBool("GAMERCARD", "gamercards_enable", false)) { - safe_vector gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|'); + vector gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|'); if (gamercards.size() == 0) { gamercards.push_back("wiinnertag"); gamercards.push_back("dutag"); } - for (safe_vector::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++) + for (vector::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++) { gprintf("Found gamercard provider: %s\n",(*itr).c_str()); register_card_provider( @@ -1093,16 +1091,16 @@ SFont CMenu::_font(CMenu::FontSet &fontSet, const char *domain, const char *key, return retFont; } -safe_vector CMenu::_textures(TexSet &texSet, const char *domain, const char *key) +vector CMenu::_textures(TexSet &texSet, const char *domain, const char *key) { - safe_vector textures; + vector textures; if (m_theme.loaded()) { - safe_vector filenames = m_theme.getStrings(domain, key); + vector filenames = m_theme.getStrings(domain, key); if (filenames.size() > 0) { - for (safe_vector::iterator itr = filenames.begin(); itr != filenames.end(); itr++) + for (vector::iterator itr = filenames.begin(); itr != filenames.end(); itr++) { string filename = *itr; @@ -1455,7 +1453,7 @@ void CMenu::_initCF(void) m_cf.clear(); m_cf.reserve(m_gameList.size()); - safe_vector EnabledPlugins; + vector EnabledPlugins; if(m_current_view == COVERFLOW_EMU) EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); @@ -2010,7 +2008,7 @@ bool CMenu::_loadEmuList() pdir = opendir(m_pluginsDir.c_str()); - safe_vector emuList; + vector emuList; Config m_plugin_cfg; while ((pent = readdir(pdir)) != NULL) @@ -2029,16 +2027,16 @@ bool CMenu::_loadEmuList() if(strcasestr(m_plugin_cfg.getString("PLUGIN","romDir","").c_str(), "scummvm.ini") == NULL) { m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString("PLUGIN","romDir","").c_str()), m_plugin_cfg.getString("PLUGIN","fileTypes","").c_str(), m_cfg.getString("EMULATOR", "lastlanguage", "EN").c_str(), m_plugin_cfg); - for(safe_vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) + for(vector::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) emuList.push_back(*tmp_itr); } else { Config scummvm; - safe_vector scummvmList; + vector scummvmList; scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini")); scummvmList = m_plugin.ParseScummvmINI(scummvm, string(DeviceName[currentPartition])); - for(safe_vector::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++) + for(vector::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++) emuList.push_back(*tmp_itr); } } @@ -2047,7 +2045,7 @@ bool CMenu::_loadEmuList() } closedir(pdir); m_gameList.clear(); - for(safe_vector::iterator tmp_itr = emuList.begin(); tmp_itr != emuList.end(); tmp_itr++) + for(vector::iterator tmp_itr = emuList.begin(); tmp_itr != emuList.end(); tmp_itr++) m_gameList.push_back(*tmp_itr); emuList.clear(); //If we return to the coverflow before wiiflow quit we dont need to reload plugins diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index f5f056ec..f8593c56 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -4,8 +4,8 @@ //#define SHOWMEMGECKO #include "wiiuse/wpad.h" #include +#include -#include "safe_vector.hpp" #include "cachedlist.hpp" #include "plugin/plugin.hpp" @@ -30,6 +30,8 @@ #define PART_FS_NTFS 2 #define PART_FS_EXT 3 +using namespace std; + extern "C" {extern u8 currentPartition;} extern bool bootHB; @@ -69,7 +71,7 @@ private: Config m_version; Plugin m_plugin; Channels m_channels; - safe_vector m_homebrewArgs; + vector m_homebrewArgs; SmartBuf m_base_font; u32 m_base_font_size; u8 m_aa; @@ -951,10 +953,10 @@ private: // void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false); // - safe_vector _searchGamesByID(const char *gameId); -/* safe_vector _searchGamesByTitle(wchar_t letter); - safe_vector _searchGamesByType(const char type); - safe_vector _searchGamesByRegion(const char region); */ + vector _searchGamesByID(const char *gameId); +/* vector _searchGamesByTitle(wchar_t letter); + vector _searchGamesByType(const char type); + vector _searchGamesByRegion(const char region); */ public: void _directlaunch(const std::string &id); private: @@ -963,7 +965,7 @@ private: void _launch(dir_discHdr *hdr); void _launchGame(dir_discHdr *hdr, bool dvd); void _launchChannel(dir_discHdr *hdr); - void _launchHomebrew(const char *filepath, safe_vector arguments); + void _launchHomebrew(const char *filepath, vector arguments); void _launchGC(dir_discHdr *hdr, bool DML); void _setAA(int aa); void _loadCFCfg(SThemeData &theme); @@ -982,7 +984,7 @@ private: void RemoveCover( char * id ); SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey); STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def); - safe_vector _textures(TexSet &texSet, const char *domain, const char *key); + vector _textures(TexSet &texSet, const char *domain, const char *key); void _showWaitMessage(); public: void _hideWaitMessage(); diff --git a/source/menu/menu_config.cpp b/source/menu/menu_config.cpp index 655213fa..2a7bf40c 100644 --- a/source/menu/menu_config.cpp +++ b/source/menu/menu_config.cpp @@ -6,8 +6,6 @@ #include "loader/alt_ios.h" #include "gecko/gecko.h" -using namespace std; - const int CMenu::_nbCfgPages = 6; static const int g_curPage = 1; diff --git a/source/menu/menu_config3.cpp b/source/menu/menu_config3.cpp index a034433f..ec98cdb4 100644 --- a/source/menu/menu_config3.cpp +++ b/source/menu/menu_config3.cpp @@ -4,8 +4,6 @@ #define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) -using namespace std; - static const int g_curPage = 3; template static inline T loopNum(T i, T s) diff --git a/source/menu/menu_config4.cpp b/source/menu/menu_config4.cpp index 61a7bbee..cf96e102 100644 --- a/source/menu/menu_config4.cpp +++ b/source/menu/menu_config4.cpp @@ -6,8 +6,6 @@ #include "defines.h" #include "nand.hpp" -using namespace std; - static const int g_curPage = 4; static inline int loopNum(int i, int s) diff --git a/source/menu/menu_config_adv.cpp b/source/menu/menu_config_adv.cpp index dafd92ec..661e5aab 100644 --- a/source/menu/menu_config_adv.cpp +++ b/source/menu/menu_config_adv.cpp @@ -65,7 +65,7 @@ void CMenu::_showConfigAdv(void) m_btnMgr.setText(m_configAdvLblCurTheme, m_cfg.getString("GENERAL", "theme")); } -static void listThemes(const char * path, safe_vector &themes) +static void listThemes(const char * path, vector &themes) { DIR *d; struct dirent *dir; @@ -94,7 +94,7 @@ static void listThemes(const char * path, safe_vector &themes) int CMenu::_configAdv(void) { int change = CONFIG_PAGE_NO_CHANGE; - safe_vector themes; + vector themes; string prevTheme = m_cfg.getString("GENERAL", "theme"); bool lang_changed = false; diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index 0c37a268..2883dec6 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -7,8 +7,6 @@ #define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) -using namespace std; - static inline int loopNum(int i, int s) { return i < 0 ? (s - (-i % s)) % s : i % s; diff --git a/source/menu/menu_config_screen.cpp b/source/menu/menu_config_screen.cpp index 0bae6ad6..01d1c8a5 100644 --- a/source/menu/menu_config_screen.cpp +++ b/source/menu/menu_config_screen.cpp @@ -1,9 +1,6 @@ #include "menu.hpp" - -using namespace std; - static const int g_curPage = 6; void CMenu::_hideConfigScreen(bool instant) diff --git a/source/menu/menu_configsnd.cpp b/source/menu/menu_configsnd.cpp index d2d77db4..89a6b937 100644 --- a/source/menu/menu_configsnd.cpp +++ b/source/menu/menu_configsnd.cpp @@ -1,8 +1,6 @@ #include "menu.hpp" -using namespace std; - static const int g_curPage = 5; void CMenu::_hideConfigSnd(bool instant) diff --git a/source/menu/menu_download.cpp b/source/menu/menu_download.cpp index 4f7dca6e..6e4cbb60 100644 --- a/source/menu/menu_download.cpp +++ b/source/menu/menu_download.cpp @@ -29,8 +29,6 @@ #define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE" #define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt" -using namespace std; - static const char FMT_BPIC_URL[] = "http://art.gametdb.com/wii/coverfullHQ/{loc}/{gameid}.png"\ "|http://art.gametdb.com/wii/coverfull/{loc}/{gameid}.png"; static const char FMT_PIC_URL[] = "http://art.gametdb.com/wii/cover/{loc}/{gameid}.png"; @@ -455,7 +453,7 @@ void CMenu::_deinitNetwork() int CMenu::_coverDownloader(bool missingOnly) { string path; - safe_vector coverList; + vector coverList; int count = 0, countFlat = 0; float listWeight = missingOnly ? 0.125f : 0.f; // 1/8 of the progress bar for testing the PNGs we already have float dlWeight = 1.f - listWeight; @@ -472,10 +470,10 @@ int CMenu::_coverDownloader(bool missingOnly) } bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true); - safe_vector fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|'); - safe_vector fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|'); - safe_vector fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|'); - safe_vector fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|'); + vector fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|'); + vector fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|'); + vector fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|'); + vector fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|'); u32 nbSteps = m_gameList.size(); u32 step = 0; diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 7c0dc483..1b49d480 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -32,8 +32,6 @@ #include "defines.h" #include "gc/gc.h" -using namespace std; - extern const u8 btngamecfg_png[]; extern const u8 btngamecfgs_png[]; extern const u8 stopkidon_png[]; @@ -619,7 +617,7 @@ void CMenu::_directlaunch(const string &id) DeviceHandler::Instance()->Open_WBFS(i); CList list; string path = sfmt(GAMES_DIR, DeviceName[i]); - safe_vector pathlist; + vector pathlist; list.GetPaths(pathlist, id.c_str(), path, strncasecmp(DeviceHandler::Instance()->PathToFSName(path.c_str()), "WBFS", 4) == 0); @@ -645,7 +643,7 @@ void CMenu::_launch(dir_discHdr *hdr) if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL) wiiflow_dol.erase(3,1); string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size())); - safe_vector arguments; + vector arguments; gprintf("Game title: %s\n", title.c_str()); if(strstr(path.c_str(), ":/") != NULL) { @@ -771,7 +769,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML) Sys_LoadMenu(); } -void CMenu::_launchHomebrew(const char *filepath, safe_vector arguments) +void CMenu::_launchHomebrew(const char *filepath, vector arguments) { gprintf("Filepath of homebrew: %s\n",filepath); if(LoadHomebrew(filepath)) diff --git a/source/menu/menu_gameinfo.cpp b/source/menu/menu_gameinfo.cpp index c5d50405..5c91bfe4 100644 --- a/source/menu/menu_gameinfo.cpp +++ b/source/menu/menu_gameinfo.cpp @@ -430,7 +430,7 @@ void CMenu::_textGameInfo(void) zapper=0; //check required controlls - for (safe_vector::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) + for (vector::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) { if (!acc_itr->Required) continue; @@ -549,7 +549,7 @@ void CMenu::_textGameInfo(void) udraw = 0, zapper=0; - for (safe_vector::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) + for (vector::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) { if (acc_itr->Required) continue; diff --git a/source/menu/menu_input.cpp b/source/menu/menu_input.cpp index 375f41ab..94b83892 100644 --- a/source/menu/menu_input.cpp +++ b/source/menu/menu_input.cpp @@ -2,9 +2,6 @@ #include "gecko.h" #include -using namespace std; - - static const u32 g_repeatDelay = 25; void CMenu::SetupInput() diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index b58dd41a..e84b6a26 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -16,8 +16,6 @@ #include "loader/alt_ios.h" #include "GameTDB.hpp" -using namespace std; - extern const u8 btnconfig_png[]; extern const u8 btnconfigs_png[]; extern const u8 btninfo_png[]; diff --git a/source/menu/menu_nandemu.cpp b/source/menu/menu_nandemu.cpp index 7d1a8945..75f32d34 100644 --- a/source/menu/menu_nandemu.cpp +++ b/source/menu/menu_nandemu.cpp @@ -8,8 +8,6 @@ #include "gecko/gecko.h" #include "defines.h" -using namespace std; - static inline int loopNum(int i, int s) { return i < 0 ? (s - (-i % s)) % s : i % s; @@ -515,7 +513,7 @@ int CMenu::_NandDumper(void *obj) { bool missingOnly = !m.m_saveall; string path, npath; - safe_vector saveList; + vector saveList; m.m_sgdump = true; if(m.m_saveExtGameId.empty()) diff --git a/source/menu/menu_plugin.cpp b/source/menu/menu_plugin.cpp index 3085bead..dc5672ef 100644 --- a/source/menu/menu_plugin.cpp +++ b/source/menu/menu_plugin.cpp @@ -68,7 +68,7 @@ void CMenu::_updatePluginCheckboxes(void) m_btnMgr.hide(m_pluginLblCat[i]); } - safe_vector EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); + vector EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); if(Plugin_curPage == 1) { int j = 11; diff --git a/source/menu/menu_search.cpp b/source/menu/menu_search.cpp index b6f82308..71af2fa7 100644 --- a/source/menu/menu_search.cpp +++ b/source/menu/menu_search.cpp @@ -5,40 +5,40 @@ // Returns a list of games which starts with the specified (partial) gameId // We can enhance the code in this file later on to support more search features // Using a search class as argument or something like that -safe_vector CMenu::_searchGamesByID(const char *gameId) +vector CMenu::_searchGamesByID(const char *gameId) { - safe_vector retval; - for (safe_vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) + vector retval; + for (vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) if (strncmp((const char *) (*itr).hdr.id, gameId, strlen(gameId)) == 0) retval.push_back(*itr); return retval; } /* -safe_vector CMenu::_searchGamesByTitle(wchar_t letter) +vector CMenu::_searchGamesByTitle(wchar_t letter) { - safe_vector retval; - for (safe_vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) + vector retval; + for (vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) if ((*itr).title[0] == letter) retval.push_back(*itr); return retval; } -safe_vector CMenu::_searchGamesByType(const char type) +vector CMenu::_searchGamesByType(const char type) { - safe_vector retval; - for (safe_vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) + vector retval; + for (vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) if ((*itr).id[0] == type) retval.push_back(*itr); return retval; } -safe_vector CMenu::_searchGamesByRegion(const char region) +vector CMenu::_searchGamesByRegion(const char region) { - safe_vector retval; - for (safe_vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) + vector retval; + for (vector::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) if ((*itr).id[3] == region) retval.push_back(*itr); diff --git a/source/menu/menu_wbfs.cpp b/source/menu/menu_wbfs.cpp index 62f19630..67ac0117 100644 --- a/source/menu/menu_wbfs.cpp +++ b/source/menu/menu_wbfs.cpp @@ -10,8 +10,6 @@ #include "defines.h" #include "wdvd.h" -using namespace std; - void CMenu::_hideWBFS(bool instant) { m_btnMgr.hide(m_wbfsLblTitle, instant); diff --git a/source/music/musicplayer.h b/source/music/musicplayer.h index 7e15ad37..48a8c04f 100644 --- a/source/music/musicplayer.h +++ b/source/music/musicplayer.h @@ -44,7 +44,7 @@ private: void LoadCurrentFile(); CachedList m_music_files; - safe_vector::iterator m_current_music; + vector::iterator m_current_music; int m_fade_rate; diff --git a/source/plugin/plugin.cpp b/source/plugin/plugin.cpp index 72c21974..bfcea0ef 100644 --- a/source/plugin/plugin.cpp +++ b/source/plugin/plugin.cpp @@ -152,9 +152,9 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode) } } -safe_vector Plugin::GetEnabledPlugins(Config &cfg) +vector Plugin::GetEnabledPlugins(Config &cfg) { - safe_vector enabledPlugins; + vector enabledPlugins; char PluginMagicWord[8]; u8 enabledPluginsNumber = 0; for(u8 i = 0; i < Plugins.size(); i++) @@ -178,10 +178,10 @@ u32 Plugin::getPluginMagic(u8 pos) return Plugins[pos].magicWord; } -safe_vector Plugin::ParseScummvmINI(Config &ini, string Device) +vector Plugin::ParseScummvmINI(Config &ini, string Device) { gprintf("Parsing scummvm.ini\n"); - safe_vector gameHeader; + vector gameHeader; if(!ini.loaded()) return gameHeader; string game(ini.firstDomain()); diff --git a/source/plugin/plugin.hpp b/source/plugin/plugin.hpp index 500a2865..2888deb6 100644 --- a/source/plugin/plugin.hpp +++ b/source/plugin/plugin.hpp @@ -10,9 +10,9 @@ #include #include #include +#include #include "config/config.hpp" -#include "safe_vector.hpp" #include "loader/disc.h" using namespace std; @@ -40,16 +40,16 @@ public: u32 getPluginMagic(u8 pos); bool PluginExist(u8 pos); void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0); - safe_vector GetEnabledPlugins(Config &cfg); + vector GetEnabledPlugins(Config &cfg); bool UseReturnLoader(u32 magic); void init(string); void Cleanup(); void EndAdd(); - safe_vector ParseScummvmINI(Config &ini, string Device); + vector ParseScummvmINI(Config &ini, string Device); private: s8 GetPluginPosition(u32 magic); - safe_vector Plugins; + vector Plugins; s8 Plugin_Pos; string pluginsDir; bool adding; diff --git a/source/safe_vector.hpp b/source/safe_vector.hpp deleted file mode 100644 index a220793e..00000000 --- a/source/safe_vector.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/*****************************************| -|-----vector class wrapper by Miigotu-----| -|---Thx to dimok and r-win for guidance---| -|*****************************************/ - -#ifndef SAFE_VECTOR -#define SAFE_VECTOR - -#include -#include - -template -class safe_vector -{ - public: - typedef size_t size_type; - typedef typename std::vector::iterator iterator; - typedef typename std::vector::const_iterator const_iterator; - typedef typename std::vector::reference reference; - typedef typename std::vector::const_reference const_reference; - - safe_vector(){}; - safe_vector(size_type n){thevector.resize(n);} - ~safe_vector(){clear();}; - - void clear() - { - thevector.clear(); - std::vector().swap(thevector); - } - - void push_back(const T& x) - { - if(thevector.size() * sizeof(T) == thevector.capacity() && thevector.capacity() < thevector.max_size() - 20) - thevector.reserve(thevector.size() + 20); - thevector.push_back(x); - } - - void resize(size_type sz, T c = T()) - { - thevector.resize(sz, c); - realloc(sz); - } - - size_type size() const { return thevector.size(); } - - void reserve(size_type n) {thevector.reserve(n);} - - size_type capacity() const {return thevector.capacity();} - - bool empty() const {return thevector.empty();} - - reference operator[](size_type n) {return thevector[n];} - const_reference operator[](size_type n) const {return thevector[n];} - - iterator erase(iterator position) {return thevector.erase(position);} - iterator erase(iterator first, iterator last) {return thevector.erase(first, last);} - - iterator begin() {return thevector.begin();} - const_iterator begin() const {return thevector.begin();} - - iterator end() {return thevector.end();} - const_iterator end() const {return thevector.end();} - - const_reference at (size_type n) const {return thevector.at(n);} - reference at (size_type n) {return thevector.at(n);} - - reference back() {return thevector.back();} - const_reference back() const {return thevector.back();} - - void realloc(size_type sz) - { - if(thevector.size() * sizeof(T) < thevector.capacity() || sz * sizeof(T) < thevector.capacity() || sz < thevector.size()) - { - iterator itr; - - std::vector newvector; - newvector.reserve(sz); - for (itr = thevector.begin(); newvector.size() < sz && itr < thevector.end(); itr++) - newvector.push_back(*itr); - - clear(); - - thevector.reserve(sz); - for (itr = newvector.begin(); thevector.size() < sz && itr < newvector.end(); itr++) - thevector.push_back(*itr); - - newvector.clear(); - std::vector().swap(newvector); - } - } - private: - std::vector thevector; -}; - -#endif /*- SAFE_VECTOR -*/ \ No newline at end of file