From 7be490a67b042afa459c703976894de46e6f0a47 Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:33:18 +1000 Subject: [PATCH] feat(windows): review comment suggestions Co-authored-by: Marc Durdin --- .../kmshell/main/Keyman.System.DownloadUpdate.pas | 13 +++---------- .../Keyman.System.Install.EnginePostInstall.pas | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas b/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas index 9a3a27995b..373ba513e5 100644 --- a/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas +++ b/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas @@ -12,9 +12,6 @@ uses KeymanPaths, OnlineUpdateCheck; -const - DaysBetweenCheckingForUpdates: Integer = 7; // Days between checking for updates - type TDownloadUpdateParams = record TotalSize: Integer; @@ -170,17 +167,13 @@ begin begin // TODO-WINDOWS-UPDATES: #10210 convert to error log. LogMessage('DoDownloadUpdates Failed to download' + Params.InstallURL); - InstallerDownloaded := False; end else begin - InstallerDownloaded := True; - end; - - // If installer has downloaded that is success even - // if zero packages where downloaded. - if InstallerDownloaded then + // If installer has downloaded that is success even + // if zero packages were downloaded. Result := True; + end; end; function TDownloadUpdate.DownloadUpdates: Boolean; diff --git a/windows/src/engine/insthelper/Keyman.System.Install.EnginePostInstall.pas b/windows/src/engine/insthelper/Keyman.System.Install.EnginePostInstall.pas index 4871d93976..56d33c8339 100644 --- a/windows/src/engine/insthelper/Keyman.System.Install.EnginePostInstall.pas +++ b/windows/src/engine/insthelper/Keyman.System.Install.EnginePostInstall.pas @@ -40,7 +40,7 @@ begin if RegCreateKeyEx(HKEY_CURRENT_USER, PChar(SRegKey_KeymanEngine_CU), 0, NULL, KEY_ALL_ACCESS, NULL, &hk, NULL) = ERROR_SUCCESS then begin try - if RegSetValueEx(hk, PChar(SRegValue_Update_State), 0, REG_SZ, PWideChar(UpdateStr), Length(UpdateStr) * SizeOf(Char)) = ERROR_SUCCESS then + if RegSetValueEx(hk, PChar(SRegValue_Update_State), 0, REG_SZ, PChar(UpdateStr), (Length(UpdateStr)+1) * SizeOf(Char)) = ERROR_SUCCESS then begin Result := True; end