From b8e94e1acd207771098bcb5c1a882b13740a850c Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Tue, 31 Dec 2019 19:02:48 +0000 Subject: COMMON: Rename PEResources::getNameList() to getIDList() --- devtools/create_titanic/winexe_pe.cpp | 32 ++++++++++++++++---------------- devtools/create_titanic/winexe_pe.h | 18 +++++++++--------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'devtools') diff --git a/devtools/create_titanic/winexe_pe.cpp b/devtools/create_titanic/winexe_pe.cpp index 16ad16ab63..9d35f592fc 100644 --- a/devtools/create_titanic/winexe_pe.cpp +++ b/devtools/create_titanic/winexe_pe.cpp @@ -151,7 +151,7 @@ void PEResources::parseResourceLevel(Section §ion, uint32 offset, int level) if (level == 0) _curType = id; else if (level == 1) - _curName = id; + _curID = id; else if (level == 2) _curLang = id; @@ -165,7 +165,7 @@ void PEResources::parseResourceLevel(Section §ion, uint32 offset, int level) resource.offset = _exe->readUint32LE() + section.offset - section.virtualAddress; resource.size = _exe->readUint32LE(); - _resources[_curType][_curName][_curLang] = resource; + _resources[_curType][_curID][_curLang] = resource; } _exe->seek(lastOffset); @@ -184,32 +184,32 @@ const Array PEResources::getTypeList() const { return array; } -const Array PEResources::getNameList(const WinResourceID &type) const { +const Array PEResources::getIDList(const WinResourceID &type) const { Array array; if (!_exe || !_resources.contains(type)) return array; - const NameMap &nameMap = _resources[type]; + const IDMap &idMap = _resources[type]; - for (NameMap::const_iterator it = nameMap.begin(); it != nameMap.end(); it++) + for (IDMap::const_iterator it = idMap.begin(); it != idMap.end(); it++) array.push_back(it->_key); return array; } -const Array PEResources::getLangList(const WinResourceID &type, const WinResourceID &name) const { +const Array PEResources::getLangList(const WinResourceID &type, const WinResourceID &id) const { Array array; if (!_exe || !_resources.contains(type)) return array; - const NameMap &nameMap = _resources[type]; + const IDMap &idMap = _resources[type]; - if (!nameMap.contains(name)) + if (!idMap.contains(id)) return array; - const LangMap &langMap = nameMap[name]; + const LangMap &langMap = idMap[id]; for (LangMap::const_iterator it = langMap.begin(); it != langMap.end(); it++) array.push_back(it->_key); @@ -217,13 +217,13 @@ const Array PEResources::getLangList(const WinResourceID &type, c return array; } -File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name) { - Array langList = getLangList(type, name); +File *PEResources::getResource(const WinResourceID &type, const WinResourceID &id) { + Array langList = getLangList(type, id); if (langList.empty()) return 0; - const Resource &resource = _resources[type][name][langList[0]]; + const Resource &resource = _resources[type][id][langList[0]]; byte *data = (byte *)malloc(resource.size); _exe->seek(resource.offset); _exe->read(data, resource.size); @@ -233,16 +233,16 @@ File *PEResources::getResource(const WinResourceID &type, const WinResourceID &n return file; } -File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang) { +File *PEResources::getResource(const WinResourceID &type, const WinResourceID &id, const WinResourceID &lang) { if (!_exe || !_resources.contains(type)) return 0; - const NameMap &nameMap = _resources[type]; + const IDMap &idMap = _resources[type]; - if (!nameMap.contains(name)) + if (!idMap.contains(id)) return 0; - const LangMap &langMap = nameMap[name]; + const LangMap &langMap = idMap[id]; if (!langMap.contains(lang)) return 0; diff --git a/devtools/create_titanic/winexe_pe.h b/devtools/create_titanic/winexe_pe.h index 3c960053b2..f72b6fbb04 100644 --- a/devtools/create_titanic/winexe_pe.h +++ b/devtools/create_titanic/winexe_pe.h @@ -54,17 +54,17 @@ public: /** Return a list of resource types. */ const Array getTypeList() const; - /** Return a list of names for a given type. */ - const Array getNameList(const WinResourceID &type) const; + /** Return a list of IDs for a given type. */ + const Array getIDList(const WinResourceID &type) const; - /** Return a list of languages for a given type and name. */ - const Array getLangList(const WinResourceID &type, const WinResourceID &name) const; + /** Return a list of languages for a given type and ID. */ + const Array getLangList(const WinResourceID &type, const WinResourceID &id) const; /** Return a stream to the specified resource, taking the first language found (or 0 if non-existent). */ - File *getResource(const WinResourceID &type, const WinResourceID &name); + File *getResource(const WinResourceID &type, const WinResourceID &id); /** Return a stream to the specified resource (or 0 if non-existent). */ - File *getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang); + File *getResource(const WinResourceID &type, const WinResourceID &id, const WinResourceID &lang); /** Returns true if the resources is empty */ bool empty() const { return _sections.empty(); } @@ -80,7 +80,7 @@ private: File *_exe; void parseResourceLevel(Section §ion, uint32 offset, int level); - WinResourceID _curType, _curName, _curLang; + WinResourceID _curType, _curID, _curLang; struct Resource { uint32 offset; @@ -88,8 +88,8 @@ private: }; typedef HashMap LangMap; - typedef HashMap NameMap; - typedef HashMap TypeMap; + typedef HashMap IDMap; + typedef HashMap TypeMap; TypeMap _resources; }; -- cgit v1.2.3