diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/client/filecache.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/client/filecache.cpp')
-rw-r--r-- | src/client/filecache.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/client/filecache.cpp b/src/client/filecache.cpp index 0c8f06198..46bbe4059 100644 --- a/src/client/filecache.cpp +++ b/src/client/filecache.cpp @@ -32,28 +32,28 @@ bool FileCache::loadByPath(const std::string &path, std::ostream &os) { std::ifstream fis(path.c_str(), std::ios_base::binary); - if (!fis.good()) { - verbosestream << "FileCache: File not found in cache: " << path - << std::endl; + if(!fis.good()){ + verbosestream<<"FileCache: File not found in cache: " + <<path<<std::endl; return false; } bool bad = false; - for (;;) { + for(;;){ char buf[1024]; fis.read(buf, 1024); std::streamsize len = fis.gcount(); os.write(buf, len); - if (fis.eof()) + if(fis.eof()) break; - if (!fis.good()) { + if(!fis.good()){ bad = true; break; } } - if (bad) { - errorstream << "FileCache: Failed to read file from cache: \"" << path - << "\"" << std::endl; + if(bad){ + errorstream<<"FileCache: Failed to read file from cache: \"" + <<path<<"\""<<std::endl; } return !bad; @@ -61,10 +61,13 @@ bool FileCache::loadByPath(const std::string &path, std::ostream &os) bool FileCache::updateByPath(const std::string &path, const std::string &data) { - std::ofstream file(path.c_str(), std::ios_base::binary | std::ios_base::trunc); + std::ofstream file(path.c_str(), std::ios_base::binary | + std::ios_base::trunc); - if (!file.good()) { - errorstream << "FileCache: Can't write to file at " << path << std::endl; + if(!file.good()) + { + errorstream<<"FileCache: Can't write to file at " + <<path<<std::endl; return false; } |