summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--bitmap.c1
-rw-r--r--cache.h3
3 files changed, 4 insertions, 1 deletions
diff --git a/HISTORY b/HISTORY
index a50fab5..6a315b4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7,6 +7,7 @@ VDR Plugin 'text2skin' Revision History
- Documentation spelling fixes.
- Added experimental RELAX NG schema for skin XML files.
- Set minimum value of bitmap cache size in menu to 1.
+- Fix bitmap cache size initialization when built with gcc 4.6.
2010-06-21: Version 1.3.1
diff --git a/bitmap.c b/bitmap.c
index 5319333..8159536 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -90,6 +90,7 @@ void cText2SkinBitmap::Init(void) {
#ifdef HAVE_IMAGEMAGICK
InitializeMagick(NULL);
#endif
+ mCache.SetMaxItems(Text2SkinSetup.MaxCacheFill);
}
cText2SkinBitmap::cText2SkinBitmap(void) {
diff --git a/cache.h b/cache.h
index b3cc782..f37e693 100644
--- a/cache.h
+++ b/cache.h
@@ -31,6 +31,7 @@ public:
bool Contains(const key_type &Key);
data_type &operator[](const key_type &Key);
uint Count(void) { return mUsage.size(); }
+ void SetMaxItems(uint MaxItems) { mMaxItems = MaxItems; }
};
template<class key_type, class data_type>
@@ -85,7 +86,7 @@ data_type &cxCache<key_type, data_type>::operator[](const key_type &Key)
return it->second;
}
- if (mUsage.size() == mMaxItems) {
+ while (mUsage.size() >= mMaxItems) {
item_iterator it = mItems.find(*mUsage.begin());
DeleteObject(it->first, it->second);
mUsage.erase(mUsage.begin());