src/qt3support/tools/q3gcache.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
   224     bool  remove_string(Q3CacheItem *item)
   224     bool  remove_string(Q3CacheItem *item)
   225 	{ return Q3GDict::remove_string(*((QString*)(item->key)),item); }
   225 	{ return Q3GDict::remove_string(*((QString*)(item->key)),item); }
   226     bool  remove_ascii(Q3CacheItem *item)
   226     bool  remove_ascii(Q3CacheItem *item)
   227 	{ return Q3GDict::remove_ascii((const char *)item->key,item); }
   227 	{ return Q3GDict::remove_ascii((const char *)item->key,item); }
   228     bool  remove_int(Q3CacheItem *item)
   228     bool  remove_int(Q3CacheItem *item)
   229 	{ return Q3GDict::remove_int((long)item->key,item);}
   229 	{ return Q3GDict::remove_int((quintptr)item->key,item);}
   230 
   230 
   231     void  statistics()			{ Q3GDict::statistics(); }
   231     void  statistics()			{ Q3GDict::statistics(); }
   232 
   232 
   233 private:
   233 private:
   234     void deleteItem(void *item)
   234     void deleteItem(void *item)
   424     Q_CHECK_PTR(ci);
   424     Q_CHECK_PTR(ci);
   425     lruList->insert(0, ci);
   425     lruList->insert(0, ci);
   426     if (keytype == AsciiKey)
   426     if (keytype == AsciiKey)
   427 	dict->insert_ascii(key, ci);
   427 	dict->insert_ascii(key, ci);
   428     else
   428     else
   429 	dict->insert_int((long)key, ci);
   429 	dict->insert_int((quintptr)key, ci);
   430     tCost += cost;
   430     tCost += cost;
   431     return true;
   431     return true;
   432 }
   432 }
   433 
   433 
   434 
   434 
   484 {
   484 {
   485     Q3CacheItem *ci;
   485     Q3CacheItem *ci;
   486     if (keytype == AsciiKey)
   486     if (keytype == AsciiKey)
   487 	ci = dict->take_ascii(key);
   487 	ci = dict->take_ascii(key);
   488     else
   488     else
   489 	ci = dict->take_int((long)key);
   489 	ci = dict->take_int((quintptr)key);
   490     Item d;
   490     Item d;
   491     if (ci) {
   491     if (ci) {
   492 	d = ci->data;
   492 	d = ci->data;
   493 	tCost -= ci->cost;
   493 	tCost -= ci->cost;
   494 	lruList->take(ci);			// take from list
   494 	lruList->take(ci);			// take from list
   561 */
   561 */
   562 
   562 
   563 Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const
   563 Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const
   564 {
   564 {
   565     Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key)
   565     Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key)
   566 					 : dict->find_int((long)key);
   566 					 : dict->find_int((quintptr)key);
   567 #if defined(QT_DEBUG)
   567 #if defined(QT_DEBUG)
   568     lruList->finds++;
   568     lruList->finds++;
   569 #endif
   569 #endif
   570     if (ci) {
   570     if (ci) {
   571 #if defined(QT_DEBUG)
   571 #if defined(QT_DEBUG)
   809 */
   809 */
   810 
   810 
   811 long Q3GCacheIterator::getKeyInt() const
   811 long Q3GCacheIterator::getKeyInt() const
   812 {
   812 {
   813     Q3CacheItem *item = it->current();
   813     Q3CacheItem *item = it->current();
   814     return item ? (long)item->key : 0;
   814     return item ? (quintptr)item->key : 0;
   815 }
   815 }
   816 
   816 
   817 /*!
   817 /*!
   818   Moves to the next item (postfix).
   818   Moves to the next item (postfix).
   819 */
   819 */