Lines Matching refs:buffer
218 static void allocate(size_t size, std::vector<uint8_t>* buffer) { in allocate() argument
220 if (size <= buffer->size()) return; in allocate()
221 buffer->resize(size); in allocate()
421 uint8_t buffer[buffer_size]; in receive_brotli_new_data() local
424 uint8_t* next_out = buffer; in receive_brotli_new_data()
440 if (nti->writer->Write(buffer, write_now) != write_now) { in receive_brotli_new_data()
477 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
485 if (!android::base::ReadFully(fd, buffer->data() + p, size)) { in ReadBlocks()
497 static int WriteBlocks(const RangeSet& tgt, const std::vector<uint8_t>& buffer, int fd) { in WriteBlocks() argument
510 if (!android::base::WriteFully(fd, buffer.data() + written, size)) { in WriteBlocks()
540 std::vector<uint8_t> buffer; member
548 const std::vector<uint8_t>& buffer) { in PrintHashForCorruptedSourceBlocks() argument
603 CHECK_LE((buffer_index + 1) * BLOCKSIZE, buffer.size()); in PrintHashForCorruptedSourceBlocks()
606 SHA1(buffer.data() + buffer_index * BLOCKSIZE, BLOCKSIZE, digest); in PrintHashForCorruptedSourceBlocks()
615 const std::vector<uint8_t>& buffer, in PrintHashForCorruptedStashedBlocks() argument
618 CHECK_EQ(src.blocks() * BLOCKSIZE, buffer.size()); in PrintHashForCorruptedStashedBlocks()
624 SHA1(buffer.data() + i * BLOCKSIZE, BLOCKSIZE, digest); in PrintHashForCorruptedStashedBlocks()
640 std::vector<uint8_t> buffer(src.blocks() * BLOCKSIZE); in PrintHashForMissingStashedBlocks() local
641 if (ReadBlocks(src, &buffer, fd) == -1) { in PrintHashForMissingStashedBlocks()
645 PrintHashForCorruptedStashedBlocks(id, buffer, src); in PrintHashForMissingStashedBlocks()
648 static int VerifyBlocks(const std::string& expected, const std::vector<uint8_t>& buffer, in VerifyBlocks() argument
651 const uint8_t* data = buffer.data(); in VerifyBlocks()
731 std::vector<uint8_t>* buffer, bool printnoent) { in LoadStash() argument
737 allocate(src.blocks() * BLOCKSIZE, buffer); in LoadStash()
739 if (ReadBlocks(src, buffer, params.fd) == -1) { in LoadStash()
743 if (VerifyBlocks(id, *buffer, src.blocks(), true) != 0) { in LoadStash()
746 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
779 allocate(sb.st_size, buffer); in LoadStash()
781 if (!android::base::ReadFully(fd, buffer->data(), sb.st_size)) { in LoadStash()
788 if (verify && VerifyBlocks(id, *buffer, blocks, true) != 0) { in LoadStash()
795 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
805 const std::vector<uint8_t>& buffer, bool checkspace, bool* exists) { in WriteStash() argument
849 if (!android::base::WriteFully(fd, buffer.data(), blocks * BLOCKSIZE)) { in WriteStash()
1000 allocate(*src_blocks * BLOCKSIZE, ¶ms.buffer); in LoadSourceBlocks()
1011 if (ReadBlocks(src, ¶ms.buffer, params.fd) == -1) { in LoadSourceBlocks()
1022 MoveRange(params.buffer, locs, params.buffer); in LoadSourceBlocks()
1045 MoveRange(params.buffer, locs, stash); in LoadSourceBlocks()
1126 if (VerifyBlocks(srchash, params.buffer, *src_blocks, true) == 0) { in LoadSrcTgtVersion3()
1134 if (WriteStash(params.stashbase, srchash, *src_blocks, params.buffer, true, in LoadSrcTgtVersion3()
1151 if (overlap && LoadStash(params, srchash, true, ¶ms.buffer, true) == 0) { in LoadSrcTgtVersion3()
1160 PrintHashForCorruptedSourceBlocks(params, params.buffer); in LoadSrcTgtVersion3()
1190 if (WriteBlocks(tgt, params.buffer, params.fd) == -1) { in PerformCommandMove()
1216 if (LoadStash(params, id, true, ¶ms.buffer, false) == 0) { in PerformCommandStash()
1226 allocate(blocks * BLOCKSIZE, ¶ms.buffer); in PerformCommandStash()
1227 if (ReadBlocks(src, ¶ms.buffer, params.fd) == -1) { in PerformCommandStash()
1232 if (VerifyBlocks(id, params.buffer, blocks, true) != 0) { in PerformCommandStash()
1246 int result = WriteStash(params.stashbase, id, blocks, params.buffer, false, nullptr); in PerformCommandStash()
1281 allocate(BLOCKSIZE, ¶ms.buffer); in PerformCommandZero()
1282 memset(params.buffer.data(), 0, BLOCKSIZE); in PerformCommandZero()
1297 if (!android::base::WriteFully(params.fd, params.buffer.data(), BLOCKSIZE)) { in PerformCommandZero()
1395 if (ApplyImagePatch(params.buffer.data(), blocks * BLOCKSIZE, patch_value, in PerformCommandDiff()
1404 if (ApplyBSDiffPatch(params.buffer.data(), blocks * BLOCKSIZE, patch_value, 0, in PerformCommandDiff()
1537 uint8_t buffer[BLOCKSIZE]; in PerformCommandComputeHashTree() local
1544 if (!android::base::ReadFully(params.fd, buffer, BLOCKSIZE)) { in PerformCommandComputeHashTree()
1550 if (!builder.Update(reinterpret_cast<unsigned char*>(buffer), BLOCKSIZE)) { in PerformCommandComputeHashTree()
1914 LOG(INFO) << "max alloc needed was " << params.buffer.size(); in PerformBlockImageUpdate()
2096 std::vector<uint8_t> buffer(BLOCKSIZE); in RangeSha1Fn() local
2105 if (!android::base::ReadFully(fd, buffer.data(), BLOCKSIZE)) { in RangeSha1Fn()
2112 SHA1_Update(&ctx, buffer.data(), BLOCKSIZE); in RangeSha1Fn()
2235 uint8_t buffer[BLOCKSIZE]; in BlockImageRecoverFn() local
2243 if (fh.pread(buffer, BLOCKSIZE, static_cast<off64_t>(j) * BLOCKSIZE) != BLOCKSIZE) { in BlockImageRecoverFn()