1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Fix formatting in TxCache.cpp

This commit is contained in:
Sergey Lipskiy 2019-11-04 19:49:09 +07:00
parent ad85856ee7
commit f3b83d2c8b

View File

@ -104,8 +104,8 @@ private:
}; };
TxMemoryCache::TxMemoryCache(uint32 & options, TxMemoryCache::TxMemoryCache(uint32 & options,
uint64 cacheLimit, uint64 cacheLimit,
dispInfoFuncExt callback) dispInfoFuncExt callback)
: _options(options) : _options(options)
, _cacheLimit(cacheLimit) , _cacheLimit(cacheLimit)
, _callback(callback) , _callback(callback)
@ -156,8 +156,7 @@ bool TxMemoryCache::add(Checksum checksum, GHQTexInfo *info, int dataSize)
if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) { if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) {
dest = info->data; dest = info->data;
DBG_INFO(80, wst("Error: zlib compression failed!\n")); DBG_INFO(80, wst("Error: zlib compression failed!\n"));
} } else {
else {
DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), (float)dataSize / 1000, (float)destLen / 1000); DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), (float)dataSize / 1000, (float)destLen / 1000);
dataSize = destLen; dataSize = destLen;
format |= GL_TEXFMT_GZ; format |= GL_TEXFMT_GZ;
@ -165,7 +164,7 @@ bool TxMemoryCache::add(Checksum checksum, GHQTexInfo *info, int dataSize)
} }
} }
/* if cache size exceeds limit, remove old cache */ /* if cache size exceeds limit, remove old cache */
if (_cacheLimit != 0) { if (_cacheLimit != 0) {
_totalSize += dataSize; _totalSize += dataSize;
if ((_totalSize > _cacheLimit) && !_cachelist.empty()) { if ((_totalSize > _cacheLimit) && !_cachelist.empty()) {
@ -410,8 +409,7 @@ bool TxMemoryCache::load(const wchar_t *path, const wchar_t *filename, int confi
add(checksum, &tmpInfo, (tmpInfo.format & GL_TEXFMT_GZ) ? dataSize : 0); add(checksum, &tmpInfo, (tmpInfo.format & GL_TEXFMT_GZ) ? dataSize : 0);
free(tmpInfo.data); free(tmpInfo.data);
} } else {
else {
gzseek(gzfp, dataSize, SEEK_CUR); gzseek(gzfp, dataSize, SEEK_CUR);
} }
@ -510,7 +508,7 @@ private:
uint32 _options; uint32 _options;
tx_wstring _cachePath; tx_wstring _cachePath;
tx_wstring _filename; tx_wstring _filename;
std::string _fullPath; std::string _fullPath;
dispInfoFuncExt _callback; dispInfoFuncExt _callback;
uint64 _totalSize = 0; uint64 _totalSize = 0;
@ -522,8 +520,8 @@ private:
uint8 *_gzdest1 = nullptr; uint8 *_gzdest1 = nullptr;
uint32 _gzdestLen = 0; uint32 _gzdestLen = 0;
std::ifstream _infile; std::ifstream _infile;
std::ofstream _outfile; std::ofstream _outfile;
int64 _storagePos = 0; int64 _storagePos = 0;
bool _dirty = false; bool _dirty = false;
static const int _fakeConfig; static const int _fakeConfig;
@ -564,9 +562,9 @@ TxFileStorage::TxFileStorage(uint32 & options,
void TxFileStorage::buildFullPath() void TxFileStorage::buildFullPath()
{ {
char cbuf[MAX_PATH*2]; char cbuf[MAX_PATH * 2];
tx_wstring filename = _cachePath + OSAL_DIR_SEPARATOR_STR + _filename; tx_wstring filename = _cachePath + OSAL_DIR_SEPARATOR_STR + _filename;
wcstombs(cbuf, filename.c_str(), MAX_PATH*2); wcstombs(cbuf, filename.c_str(), MAX_PATH * 2);
_fullPath = cbuf; _fullPath = cbuf;
} }
@ -670,8 +668,7 @@ bool TxFileStorage::readData(GHQTexInfo & info)
info.data = _gzdest1; info.data = _gzdest1;
info.format &= ~GL_TEXFMT_GZ; info.format &= ~GL_TEXFMT_GZ;
DBG_INFO(80, wst("zlib decompressed: %.02gkb->%.02gkb\n"), dataSize / 1024.0, destLen / 1024.0); DBG_INFO(80, wst("zlib decompressed: %.02gkb->%.02gkb\n"), dataSize / 1024.0, destLen / 1024.0);
} } else {
else {
info.data = _gzdest0; info.data = _gzdest0;
} }
@ -713,8 +710,7 @@ bool TxFileStorage::add(Checksum checksum, GHQTexInfo *info, int dataSize)
if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) { if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) {
dest = info->data; dest = info->data;
DBG_INFO(80, wst("Error: zlib compression failed!\n")); DBG_INFO(80, wst("Error: zlib compression failed!\n"));
} } else {
else {
DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), dataSize / 1024.0, destLen / 1024.0); DBG_INFO(80, wst("zlib compressed: %.02fkb->%.02fkb\n"), dataSize / 1024.0, destLen / 1024.0);
dataSize = destLen; dataSize = destLen;
format |= GL_TEXFMT_GZ; format |= GL_TEXFMT_GZ;
@ -825,7 +821,7 @@ bool TxFileStorage::load(const wchar_t *path, const wchar_t *filename, int confi
if (tmpconfig == _fakeConfig) { if (tmpconfig == _fakeConfig) {
if (_storagePos != _initialPos) if (_storagePos != _initialPos)
return false; return false;
} else if (tmpconfig != config && !force) } else if (tmpconfig != config && !force)
return false; return false;
if (_storagePos <= sizeof(config) + sizeof(_storagePos)) if (_storagePos <= sizeof(config) + sizeof(_storagePos))