clang-format: Increase column limit from 80 to 120
This commit is contained in:
parent
109f64c446
commit
a1fbf1015f
736 changed files with 22684 additions and 45435 deletions
|
|
@ -54,8 +54,7 @@ constexpr const char *kDeltaMagic = "BOUF//ZSTD//DICT";
|
|||
constexpr int kMagicSize = 16;
|
||||
constexpr int kHeaderSize = kMagicSize + 8; // magic + int64_t delta size
|
||||
|
||||
int ApplyPatch(ZSTD_DCtx *zstdCtx, const std::byte *patch_data,
|
||||
const size_t patch_size, const wchar_t *targetFile)
|
||||
int ApplyPatch(ZSTD_DCtx *zstdCtx, const std::byte *patch_data, const size_t patch_size, const wchar_t *targetFile)
|
||||
try {
|
||||
int64_t newsize;
|
||||
bool success;
|
||||
|
|
@ -65,8 +64,7 @@ try {
|
|||
/* --------------------------------- *
|
||||
* open patch and file to patch */
|
||||
|
||||
hTarget = CreateFile(targetFile, GENERIC_READ, 0, nullptr,
|
||||
OPEN_EXISTING, 0, nullptr);
|
||||
hTarget = CreateFile(targetFile, GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (!hTarget.Valid())
|
||||
throw int(GetLastError());
|
||||
|
||||
|
|
@ -115,10 +113,8 @@ try {
|
|||
/* --------------------------------- *
|
||||
* patch to new file data */
|
||||
|
||||
size_t result = ZSTD_decompress_usingDict(
|
||||
zstdCtx, newData.data(), newData.size(),
|
||||
patch_data + kHeaderSize, patch_size - kHeaderSize,
|
||||
oldData.data(), oldData.size());
|
||||
size_t result = ZSTD_decompress_usingDict(zstdCtx, newData.data(), newData.size(), patch_data + kHeaderSize,
|
||||
patch_size - kHeaderSize, oldData.data(), oldData.size());
|
||||
|
||||
if (result != newsize || ZSTD_isError(result))
|
||||
throw int(-9);
|
||||
|
|
@ -127,15 +123,13 @@ try {
|
|||
* write new file */
|
||||
|
||||
hTarget = nullptr;
|
||||
hTarget = CreateFile(targetFile, GENERIC_WRITE, 0, nullptr,
|
||||
CREATE_ALWAYS, 0, nullptr);
|
||||
hTarget = CreateFile(targetFile, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr);
|
||||
if (!hTarget.Valid())
|
||||
throw int(GetLastError());
|
||||
|
||||
DWORD written;
|
||||
|
||||
success = !!WriteFile(hTarget, newData.data(), (DWORD)newsize, &written,
|
||||
nullptr);
|
||||
success = !!WriteFile(hTarget, newData.data(), (DWORD)newsize, &written, nullptr);
|
||||
if (!success || written != newsize)
|
||||
throw int(GetLastError());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue