Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxxi committed Jan 31, 2016
1 parent 77ff892 commit ba3862b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions xbmc/guilib/GUIFontCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include <stdint.h>
#include <utility>
#include <vector>
#include "GUIFontTTF.h"
#include "GraphicContext.h"
Expand All @@ -28,14 +29,15 @@ class CGUIFontCacheImpl
{
struct EntryList
{
typedef std::multimap<size_t, CGUIFontCacheEntry<Position, Value>*> HashMap;
typedef std::multimap<size_t, typename HashMap::iterator> AgeMap;
using HashMap = std::multimap<size_t, CGUIFontCacheEntry<Position, Value>*>;
using HashIter = typename HashMap::iterator;
using AgeMap = std::multimap<size_t, HashIter>;

typename HashMap::iterator Insert(size_t hash, CGUIFontCacheEntry<Position, Value> *v)
HashIter Insert(size_t hash, CGUIFontCacheEntry<Position, Value> *v)
{
auto r (hashMap.insert(typename HashMap::value_type(hash, v)));
auto r = hashMap.insert(std::make_pair(hash, v));
if (r->second)
ageMap.insert(typename AgeMap::value_type(r->second->m_lastUsedMillis, r));
ageMap.insert(std::make_pair(r->second->m_lastUsedMillis, r));
return r;
}
void Flush()
Expand All @@ -49,9 +51,8 @@ class CGUIFontCacheImpl
{
CGUIFontCacheHash<Position> hashGen;
CGUIFontCacheKeysMatch<Position> keyMatch;
typename HashMap::iterator ret;
auto range = hashMap.equal_range(hashGen(key));
for (ret = range.first; ret != range.second; ++ret)
for (auto ret = range.first; ret != range.second; ++ret)
{
if (keyMatch(ret->second->m_key, key))
{
Expand All @@ -60,16 +61,15 @@ class CGUIFontCacheImpl
}
return hashMap.end();
}
void UpdateAge(typename HashMap::iterator it, size_t millis)
void UpdateAge(HashIter it, size_t millis)
{
auto range = ageMap.equal_range(millis);
typename AgeMap::iterator ageit;
for (ageit = range.first; ageit != range.second; ++ageit)
for (auto ageit = range.first; ageit != range.second; ++ageit)
{
if (ageit->second == it)
{
ageMap.erase(ageit);
ageMap.insert(typename AgeMap::value_type(millis, it));
ageMap.insert(std::make_pair(millis, it));
it->second->m_lastUsedMillis = millis;
return;
}
Expand Down

1 comment on commit ba3862b

@FernetMenta
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer using value_type as mentioned in the docs, further I don't like the additional include

Please sign in to comment.