[nstool] Clear dead commented code.

This commit is contained in:
jakcron 2018-10-06 15:58:09 +08:00
parent 0c4103a620
commit 02d2408ebe
2 changed files with 1 additions and 31 deletions

View file

@ -21,8 +21,6 @@ void AesCtrWrappedIFile::seek(size_t offset)
void AesCtrWrappedIFile::read(byte_t* out, size_t len)
{
//printf("[%x] AesCtrWrappedIFile::read(offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", this, mFileOffset, len);
size_t read_len;
size_t read_pos;
@ -33,8 +31,6 @@ void AesCtrWrappedIFile::read(byte_t* out, size_t len)
read_len = _MIN(len - (i * kCacheSize), kCacheSize);
read_pos = ((mFileOffset >> 4) << 4) + (i * kCacheSize);
//printf("[%x] AesCtrWrappedIFile::read() CACHE READ: readlen=%" PRIx64 "\n", this, read_len);
(*mFile)->seek(read_pos);
(*mFile)->read(mCache.data(), kCacheSizeAllocSize);
@ -65,8 +61,6 @@ void AesCtrWrappedIFile::write(const byte_t* in, size_t len)
write_len = _MIN(len - (i * kCacheSize), kCacheSize);
write_pos = ((mFileOffset >> 4) << 4) + (i * kCacheSize);
//printf("[%x] AesCtrWrappedIFile::read() CACHE READ: readlen=%" PRIx64 "\n", this, read_len);
memcpy(mCache.data() + (mFileOffset & 0xf), in + (i * kCacheSize), write_len);
fnd::aes::AesIncrementCounter(mBaseCtr.iv, write_pos>>4, mCurrentCtr.iv);
@ -77,25 +71,6 @@ void AesCtrWrappedIFile::write(const byte_t* in, size_t len)
}
seek(mFileOffset + len);
/*
for (size_t i = 0; i < (len / kAesCtrScratchSize); i++)
{
memcpy(mScratch.data() + mBlockOffset, out + (i * kAesCtrScratchSize), kAesCtrScratchSize);
fnd::aes::AesCtr(mScratch.data(), kAesCtrScratchAllocSize, mKey.key, mCurrentCtr.iv, mScratch.data());
(*mFile)->write(mScratch.data() + mBlockOffset, kAesCtrScratchSize);
}
if (len % kAesCtrScratchSize)
{
size_t write_len = len % kAesCtrScratchSize;
size_t write_pos = ((len / kAesCtrScratchSize) * kAesCtrScratchSize);
memcpy(mScratch.data() + mBlockOffset, out + write_pos, write_len);
fnd::aes::AesCtr(mScratch.data(), kAesCtrScratchAllocSize, mKey.key, mCurrentCtr.iv, mScratch.data());
(*mFile)->write(mScratch.data() + mBlockOffset, write_len);
}
*/
seek(mFileOffset + len);
}
void AesCtrWrappedIFile::write(const byte_t* in, size_t offset, size_t len)

View file

@ -143,12 +143,9 @@ void LayeredIntegrityWrappedIFile::initialiseDataLayer(const LayeredIntegrityMet
mDataOffset = 0;
mDataBlockSize = hdr.getDataLayer().block_size;
// allocate scratchpad
//mScratch.alloc(mDataBlockSize * 0x10);
// allocate cache
size_t cache_size = align(kDefaultCacheSize, mDataBlockSize);
mCacheBlockNum = cache_size / mDataBlockSize;
//printf("Block Size: 0x%" PRIx64 "\n", mDataBlockSize);
//printf("Cache size: 0x%" PRIx64 ", (block_num: %" PRId64 ")\n", cache_size, mCacheBlockNum);
mCache.alloc(cache_size);
}
@ -180,8 +177,6 @@ void LayeredIntegrityWrappedIFile::readData(size_t block_offset, size_t block_nu
throw fnd::Exception(kModuleName, "Read excessive of cache size");
}
//printf("readlen=0x%" PRIx64 "\n", read_len);
// validate blocks
size_t validate_size;
for (size_t i = 0; i < block_num; i++)