diff options
author | Sabrina Shanman <cosmic@lindenlab.com> | 2022-06-24 16:57:44 +0000 |
---|---|---|
committer | Sabrina Shanman <cosmic@lindenlab.com> | 2022-06-24 16:57:44 +0000 |
commit | 8728a68bb7ec583912d78c3d2844d82df3483e7c (patch) | |
tree | 51be076dea7cbe5679666c5c729a0647a46317e1 | |
parent | 264ad0ce0cf1970b8faf07baca7a871aae9bd1d7 (diff) | |
parent | 4f834711660e17055cdbc285f0d426aec94ddc13 (diff) |
Merged in SL-17329 (pull request #1035)
SL-17329: Fix cache sizes due to overflow. Improve typing.
Approved-by: Andrey Lihatskiy
-rw-r--r-- | indra/newview/llappviewer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 50600a979d..0adbdb3647 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4262,14 +4262,14 @@ bool LLAppViewer::initCache() const U32 MB = 1024 * 1024; const U64 MIN_CACHE_SIZE = 256 * MB; const U64 MAX_CACHE_SIZE = 9984ll * MB; - const U64 setting_cache_total_size = (U64)gSavedSettings.getU32("CacheSize") * MB; - const U64 cache_total_size = llclamp(setting_cache_total_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE); - const F64 disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal"); - const F64 texture_cache_percent = 100.0 - disk_cache_percent; + const uintmax_t setting_cache_total_size = (uintmax_t)gSavedSettings.getU32("CacheSize") * MB; + const uintmax_t cache_total_size = llclamp(setting_cache_total_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE); + const F32 disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal"); + const F32 texture_cache_percent = 100.0 - disk_cache_percent; // note that the maximum size of this cache is defined as a percentage of the // total cache size - the 'CacheSize' pref - for all caches. - const U32 disk_cache_size = cache_total_size * disk_cache_percent / 100; + const uintmax_t disk_cache_size = cache_total_size * disk_cache_percent / 100; const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo"); bool texture_cache_mismatch = false; @@ -4344,7 +4344,7 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate the remaining percent which is not allocated to the disk cache - const U32 texture_cache_size = cache_total_size * texture_cache_percent / 100; + const S64 texture_cache_size = S64(cache_total_size * texture_cache_percent / 100); LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch); |