Skip to content

Commit 5e77dde

Browse files
Commit
1 parent 8a8708c commit 5e77dde

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

dist/addon.node

0 Bytes
Binary file not shown.

native-src/sync_root_interface/callbacks/FetchData/FetchData.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ napi_value create_response(napi_env env, bool finished)
3030
return result;
3131
}
3232

33-
size_t file_incremental_reading(napi_env env, TransferContext &ctx, bool final_step, float &progress)
33+
size_t file_incremental_reading(napi_env env, TransferContext &ctx, bool final_step)
3434
{
3535
std::ifstream file(ctx.tmpPath, std::ios::in | std::ios::binary);
3636

@@ -42,9 +42,7 @@ size_t file_incremental_reading(napi_env env, TransferContext &ctx, bool final_s
4242
file.clear();
4343
file.seekg(0, std::ios::end);
4444
size_t newSize = static_cast<size_t>(file.tellg());
45-
4645
size_t datasizeAvailableUnread = newSize - ctx.lastReadOffset;
47-
size_t growth = newSize - ctx.lastSize;
4846

4947
try
5048
{
@@ -69,7 +67,6 @@ size_t file_incremental_reading(napi_env env, TransferContext &ctx, bool final_s
6967
ctx.lastReadOffset += chunkBufferSize.QuadPart;
7068

7169
UINT64 totalSize = static_cast<UINT64>(ctx.fileSize.QuadPart);
72-
progress = static_cast<float>(ctx.lastReadOffset) / static_cast<float>(totalSize);
7370
Utilities::ApplyTransferStateToFile(ctx.path, ctx.callbackInfo, totalSize, ctx.lastReadOffset);
7471
}
7572
}
@@ -118,8 +115,7 @@ napi_value response_callback_fn_fetch_data(napi_env env, napi_callback_info info
118115

119116
ctx->tmpPath = tmpPath;
120117

121-
float progress = 0.0f;
122-
ctx->lastReadOffset = file_incremental_reading(env, *ctx, false, progress);
118+
ctx->lastReadOffset = file_incremental_reading(env, *ctx, false);
123119

124120
if (ctx->lastReadOffset == (size_t)ctx->fileSize.QuadPart)
125121
{
@@ -140,7 +136,7 @@ napi_value response_callback_fn_fetch_data(napi_env env, napi_callback_info info
140136
}
141137
}
142138

143-
wprintf(L"Fetch data finished: %d, progress: %.2f\n", ctx->loadFinished, progress);
139+
wprintf(L"Fetch data finished: %d\n", ctx->loadFinished);
144140

145141
return create_response(env, ctx->loadFinished);
146142
}

0 commit comments

Comments
 (0)