summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2022-06-24 09:20:40 -0700
committerCosmic Linden <cosmic@lindenlab.com>2022-06-24 09:21:27 -0700
commit4f834711660e17055cdbc285f0d426aec94ddc13 (patch)
tree95ae09fd50ffb1fb9de8d19ff4b8d12da38c0faf /indra/newview
parent9511040af547e9d50a0dc7d34837f6439a7c1106 (diff)
SL-17329: Fix cache sizes due to overflow. Improve typing.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp12
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);