diff options
Diffstat (limited to 'Source/Internal/cachefile.cpp')
-rw-r--r-- | Source/Internal/cachefile.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Source/Internal/cachefile.cpp b/Source/Internal/cachefile.cpp index f255a905..7b19890c 100644 --- a/Source/Internal/cachefile.cpp +++ b/Source/Internal/cachefile.cpp @@ -28,55 +28,55 @@ bool CacheFile::CheckForCache(const std::string &path, const std::string &suffix, std::string *load_path, uint16_t *checksum) { ModID modsource; - return CheckForCache(path,suffix,load_path,&modsource,checksum); + return CheckForCache(path, suffix, load_path, &modsource, checksum); } -bool CacheFile::CheckForCache(const std::string &path, const std::string &suffix, std::string *load_path, ModID *load_modsource, uint16_t *checksum){ +bool CacheFile::CheckForCache(const std::string &path, const std::string &suffix, std::string *load_path, ModID *load_modsource, uint16_t *checksum) { std::string cache_str = path + suffix; const int kMaxPaths = 5; char abs_cache_paths[kPathSize * kMaxPaths]; ModID cache_modsources[kMaxPaths]; char abs_base_paths[kPathSize * kMaxPaths]; - int num_cache_paths_found = FindFilePaths(cache_str.c_str(), abs_cache_paths, kPathSize, kMaxPaths, kAnyPath, false, NULL, cache_modsources ); - int num_base_paths_found = FindFilePaths(path.c_str(), abs_base_paths, kPathSize, kMaxPaths, kAnyPath, false, NULL, NULL ); + int num_cache_paths_found = FindFilePaths(cache_str.c_str(), abs_cache_paths, kPathSize, kMaxPaths, kAnyPath, false, NULL, cache_modsources); + int num_base_paths_found = FindFilePaths(path.c_str(), abs_base_paths, kPathSize, kMaxPaths, kAnyPath, false, NULL, NULL); - char* cache_path = &abs_cache_paths[0]; + char *cache_path = &abs_cache_paths[0]; ModID cache_modsource = cache_modsources[0]; int64_t latest_cache_date_modified = -1; - if(num_cache_paths_found > 0){ - for(int path_index=0; path_index<num_cache_paths_found; ++path_index){ - char* curr_path = &abs_cache_paths[kPathSize * path_index]; + if (num_cache_paths_found > 0) { + for (int path_index = 0; path_index < num_cache_paths_found; ++path_index) { + char *curr_path = &abs_cache_paths[kPathSize * path_index]; ModID curr_modsource = cache_modsources[path_index]; int64_t date_modified = GetDateModifiedInt64(curr_path); - if(date_modified > latest_cache_date_modified){ + if (date_modified > latest_cache_date_modified) { latest_cache_date_modified = date_modified; cache_path = curr_path; cache_modsource = curr_modsource; } - } + } } - char* base_path = &abs_base_paths[0]; + char *base_path = &abs_base_paths[0]; int64_t latest_base_date_modified = -1; - if(num_base_paths_found > 0){ - for(int path_index=0; path_index<num_base_paths_found; ++path_index){ - char* curr_path = &abs_base_paths[kPathSize * path_index]; + if (num_base_paths_found > 0) { + for (int path_index = 0; path_index < num_base_paths_found; ++path_index) { + char *curr_path = &abs_base_paths[kPathSize * path_index]; int64_t date_modified = GetDateModifiedInt64(curr_path); - if(date_modified > latest_base_date_modified){ + if (date_modified > latest_base_date_modified) { latest_base_date_modified = date_modified; base_path = curr_path; } - } + } } - if(latest_base_date_modified != -1){ + if (latest_base_date_modified != -1) { *checksum = Checksum(base_path); } else { *checksum = 0; } - if(latest_cache_date_modified != -1){ + if (latest_cache_date_modified != -1) { *load_path = cache_path; *load_modsource = cache_modsource; return true; |