Lines Matching refs:buffer
223 static void allocate(size_t size, std::vector<uint8_t>* buffer) { in allocate() argument
225 if (size <= buffer->size()) return; in allocate()
226 buffer->resize(size); in allocate()
426 uint8_t buffer[buffer_size]; in receive_brotli_new_data() local
429 uint8_t* next_out = buffer; in receive_brotli_new_data()
445 if (nti->writer->Write(buffer, write_now) != write_now) { in receive_brotli_new_data()
482 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
490 if (!android::base::ReadFully(fd, buffer->data() + p, size)) { in ReadBlocks()
502 static int WriteBlocks(const RangeSet& tgt, const std::vector<uint8_t>& buffer, int fd) { in WriteBlocks() argument
515 if (!android::base::WriteFully(fd, buffer.data() + written, size)) { in WriteBlocks()
545 std::vector<uint8_t> buffer; member
553 const std::vector<uint8_t>& buffer) { in PrintHashForCorruptedSourceBlocks() argument
608 CHECK_LE((buffer_index + 1) * BLOCKSIZE, buffer.size()); in PrintHashForCorruptedSourceBlocks()
611 SHA1(buffer.data() + buffer_index * BLOCKSIZE, BLOCKSIZE, digest); in PrintHashForCorruptedSourceBlocks()
620 const std::vector<uint8_t>& buffer, in PrintHashForCorruptedStashedBlocks() argument
623 CHECK_EQ(src.blocks() * BLOCKSIZE, buffer.size()); in PrintHashForCorruptedStashedBlocks()
629 SHA1(buffer.data() + i * BLOCKSIZE, BLOCKSIZE, digest); in PrintHashForCorruptedStashedBlocks()
645 std::vector<uint8_t> buffer(src.blocks() * BLOCKSIZE); in PrintHashForMissingStashedBlocks() local
646 if (ReadBlocks(src, &buffer, fd) == -1) { in PrintHashForMissingStashedBlocks()
650 PrintHashForCorruptedStashedBlocks(id, buffer, src); in PrintHashForMissingStashedBlocks()
653 static int VerifyBlocks(const std::string& expected, const std::vector<uint8_t>& buffer, in VerifyBlocks() argument
656 const uint8_t* data = buffer.data(); in VerifyBlocks()
736 std::vector<uint8_t>* buffer, bool printnoent) { in LoadStash() argument
742 allocate(src.blocks() * BLOCKSIZE, buffer); in LoadStash()
744 if (ReadBlocks(src, buffer, params.fd) == -1) { in LoadStash()
748 if (VerifyBlocks(id, *buffer, src.blocks(), true) != 0) { in LoadStash()
751 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
784 allocate(sb.st_size, buffer); in LoadStash()
786 if (!android::base::ReadFully(fd, buffer->data(), sb.st_size)) { in LoadStash()
793 if (verify && VerifyBlocks(id, *buffer, blocks, true) != 0) { in LoadStash()
800 PrintHashForCorruptedStashedBlocks(id, *buffer, src); in LoadStash()
810 const std::vector<uint8_t>& buffer, bool checkspace, bool* exists) { in WriteStash() argument
854 if (!android::base::WriteFully(fd, buffer.data(), blocks * BLOCKSIZE)) { in WriteStash()
1005 allocate(*src_blocks * BLOCKSIZE, ¶ms.buffer); in LoadSourceBlocks()
1016 if (ReadBlocks(src, ¶ms.buffer, params.fd) == -1) { in LoadSourceBlocks()
1027 MoveRange(params.buffer, locs, params.buffer); in LoadSourceBlocks()
1050 MoveRange(params.buffer, locs, stash); in LoadSourceBlocks()
1131 if (VerifyBlocks(srchash, params.buffer, *src_blocks, true) == 0) { in LoadSrcTgtVersion3()
1139 if (WriteStash(params.stashbase, srchash, *src_blocks, params.buffer, true, in LoadSrcTgtVersion3()
1156 if (overlap && LoadStash(params, srchash, true, ¶ms.buffer, true) == 0) { in LoadSrcTgtVersion3()
1165 PrintHashForCorruptedSourceBlocks(params, params.buffer); in LoadSrcTgtVersion3()
1195 if (WriteBlocks(tgt, params.buffer, params.fd) == -1) { in PerformCommandMove()
1221 if (LoadStash(params, id, true, ¶ms.buffer, false) == 0) { in PerformCommandStash()
1231 allocate(blocks * BLOCKSIZE, ¶ms.buffer); in PerformCommandStash()
1232 if (ReadBlocks(src, ¶ms.buffer, params.fd) == -1) { in PerformCommandStash()
1237 if (VerifyBlocks(id, params.buffer, blocks, true) != 0) { in PerformCommandStash()
1251 int result = WriteStash(params.stashbase, id, blocks, params.buffer, false, nullptr); in PerformCommandStash()
1286 allocate(BLOCKSIZE, ¶ms.buffer); in PerformCommandZero()
1287 memset(params.buffer.data(), 0, BLOCKSIZE); in PerformCommandZero()
1302 if (!android::base::WriteFully(params.fd, params.buffer.data(), BLOCKSIZE)) { in PerformCommandZero()
1400 if (ApplyImagePatch(params.buffer.data(), blocks * BLOCKSIZE, patch_value, in PerformCommandDiff()
1409 if (ApplyBSDiffPatch(params.buffer.data(), blocks * BLOCKSIZE, patch_value, 0, in PerformCommandDiff()
1542 uint8_t buffer[BLOCKSIZE]; in PerformCommandComputeHashTree() local
1549 if (!android::base::ReadFully(params.fd, buffer, BLOCKSIZE)) { in PerformCommandComputeHashTree()
1555 if (!builder.Update(reinterpret_cast<unsigned char*>(buffer), BLOCKSIZE)) { in PerformCommandComputeHashTree()
1921 LOG(INFO) << "max alloc needed was " << params.buffer.size(); in PerformBlockImageUpdate()
2112 std::vector<uint8_t> buffer(BLOCKSIZE); in RangeSha1Fn() local
2121 if (!android::base::ReadFully(fd, buffer.data(), BLOCKSIZE)) { in RangeSha1Fn()
2128 SHA1_Update(&ctx, buffer.data(), BLOCKSIZE); in RangeSha1Fn()
2267 uint8_t buffer[BLOCKSIZE]; in BlockImageRecoverFn() local
2275 if (fh.pread(buffer, BLOCKSIZE, static_cast<off64_t>(j) * BLOCKSIZE) != BLOCKSIZE) { in BlockImageRecoverFn()