diff --git a/mozilla/network/cache/nu/src/CacheStubs.cpp b/mozilla/network/cache/nu/src/CacheStubs.cpp index 98fa050c7ed..1eb4ad90236 100644 --- a/mozilla/network/cache/nu/src/CacheStubs.cpp +++ b/mozilla/network/cache/nu/src/CacheStubs.cpp @@ -350,8 +350,7 @@ CacheObject_Synch(void* pThis) if (pThis) { nsCacheObject* pObj = (nsCacheObject*) pThis; - PRBool bStatus = CACHEMGR->GetModule(pObj->Module())->AddObject(pObj); - return bStatus; + return CACHEMGR->GetModule(pObj->Module())->AddObject(pObj); } return PR_FALSE; } diff --git a/mozilla/network/cache/nu/src/makefile.win b/mozilla/network/cache/nu/src/makefile.win index 83ddb468aeb..5a658acdb03 100644 --- a/mozilla/network/cache/nu/src/makefile.win +++ b/mozilla/network/cache/nu/src/makefile.win @@ -33,7 +33,7 @@ LLIBS = \ $(DIST)\lib\libplc21.lib \ $(DIST)\lib\dbm32.lib \ $(DIST)\lib\xpcom32.lib \ - $(DIST)\lib\libpref.lib \ + $(DIST)\lib\libpref.lib \ $(NULL) MISCDEP = $(LLIBS) @@ -49,7 +49,7 @@ OBJS = \ .\$(OBJDIR)\nsCacheManager.obj \ .\$(OBJDIR)\nsCachePref.obj \ .\$(OBJDIR)\nsMemCacheObject.obj \ - .\$(OBJDIR)\nsBkgThread.obj \ + .\$(OBJDIR)\nsBkgThread.obj \ .\$(OBJDIR)\nsCacheBkgThd.obj \ .\$(OBJDIR)\CacheStubs.obj \ .\$(OBJDIR)\nsFileStream.obj \ @@ -57,7 +57,7 @@ OBJS = \ .\$(OBJDIR)\nsMonitorable.obj \ $(NULL) -LINCS = \ +LINCS = \ -I$(PUBLIC)\xpcom \ -I$(PUBLIC)\dbm \ -I$(PUBLIC)\pref \ diff --git a/mozilla/network/cache/nu/src/nsCachePref.cpp b/mozilla/network/cache/nu/src/nsCachePref.cpp index 00d04f23d13..858ff19eeb1 100644 --- a/mozilla/network/cache/nu/src/nsCachePref.cpp +++ b/mozilla/network/cache/nu/src/nsCachePref.cpp @@ -40,10 +40,12 @@ static const PRUint32 BKG_THREAD_SLEEP = 15*60; /*in seconds, 15 minutes */ static const PRUint16 BUGS_FOUND_SO_FAR = 0; //Preferences -static const char const* MEM_CACHE_PREF = "browser.cache.memory_cache_size"; -static const char const* DISK_CACHE_PREF = "browser.cache.disk_cache_size"; -static const char const* CACHE_DIR_PREF = "browser.cache.directory"; -static const char const* FREQ_PREF = "browser.cache.check_doc_frequency"; +static const char * const MEM_CACHE_PREF = "browser.cache.memory_cache_size"; +static const char * const DISK_CACHE_PREF = "browser.cache.disk_cache_size"; +static const char * const CACHE_DIR_PREF = "browser.cache.directory"; +static const char * const FREQ_PREF = "browser.cache.check_doc_frequency"; +//Not implemented as yet... +static const char * const BKG_CLEANUP = "browser.cache.cleanup_period"; //Default for BKG_THREAD_SLEEP /* Find a bug in NU_CACHE, get these many chocolates */ static const PRUint16 CHOCOLATES_PER_BUG_FOUND = 2^BUGS_FOUND_SO_FAR; @@ -174,7 +176,8 @@ nsCachePref::SetupPrefs(const char* i_Pref) // Create the dir. status = PR_MkDir(cacheDir, 0600); if (PR_SUCCESS != status) { - m_DiskCacheFolder = 0; + m_DiskCacheFolder = new char[1]; + *m_DiskCacheFolder = '\0'; return; } } diff --git a/mozilla/network/cache/nu/src/nsDiskModule.cpp b/mozilla/network/cache/nu/src/nsDiskModule.cpp index 9c8f6e38e9a..00a9138643f 100644 --- a/mozilla/network/cache/nu/src/nsDiskModule.cpp +++ b/mozilla/network/cache/nu/src/nsDiskModule.cpp @@ -138,6 +138,10 @@ PRBool nsDiskModule::AddObject(nsCacheObject* io_pObject) if (io_pObject->Address()) { MonitorLocker ml(this); + + //Remove the earliar copy- silently handles if not found + Remove(io_pObject->Address()); + // TODO optimize these further- make static - Gagan DBT* key = PR_NEW(DBT); DBT* data = PR_NEW(DBT); @@ -415,6 +419,11 @@ PRBool nsDiskModule::Remove(nsCacheObject* pObject) { --m_Entries; m_SizeInUse -= pObject->Size(); + if (-1 == (*m_pDB->sync)(m_pDB, 0)) + { + //Failed to sync database + PR_ASSERT(0); + } } //Remove it from the recently used list