From 68bffd2b3bac0e2cecd62ee016cede743c721af4 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 27 Jun 2023 15:36:23 -0400 Subject: Fixed warning and error. --- src/lpm.c | 2 +- src/lpm.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lpm.c b/src/lpm.c index 448b5e4..24ef1c4 100644 --- a/src/lpm.c +++ b/src/lpm.c @@ -434,7 +434,7 @@ static int lpm_fetch(lua_State* L) { fetch_opts.callbacks.certificate_check = lpm_git_transport_certificate_check_cb; if (lua_type(L, 2) == LUA_TFUNCTION) fetch_opts.callbacks.transfer_progress = lpm_git_transfer_progress_cb; - git_strarray array = { &refspec, 1 }; + git_strarray array = { (char**)&refspec, 1 }; if (git_remote_fetch(remote, refspec ? &array : NULL, &fetch_opts, NULL)) { git_remote_free(remote); git_repository_free(repository); diff --git a/src/lpm.lua b/src/lpm.lua index a4a4373..eb61669 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -2116,7 +2116,7 @@ not commonly used publically. last_read = nil return end - if not start_time or total_read < last_read then start_time = system.time() end + if not start_time or not last_read or total_read < last_read then start_time = system.time() end local status_line = string.format("%s [%s/s][%03d%%]: %s", format_bytes(total_read), format_bytes(total_read / (system.time() - start_time)), math.floor((received_objects and (received_objects/total_objects_or_content_length) or (total_read/total_objects_or_content_length) or 0)*100), progress_bar_label) io.stdout:write("\r") io.stdout:write(status_line) -- cgit v1.2.3