From b77008a7096b8359f942640cab1f8c7f60c9dee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bi=C8=99oc=20George?= Date: Mon, 24 Feb 2020 16:59:11 +0100 Subject: [PATCH] [TIMEDATE] Remove lpszSyncStatus member entirely (#2383) And directly pass the formatted string to SetDlgItemTextW(). Addendum to 5a81a5b. --- dll/cpl/timedate/internettime.c | 15 +++++---------- dll/cpl/timedate/timedate.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dll/cpl/timedate/internettime.c b/dll/cpl/timedate/internettime.c index c1ee0294b0f..7e85fa1ffce 100644 --- a/dll/cpl/timedate/internettime.c +++ b/dll/cpl/timedate/internettime.c @@ -112,8 +112,7 @@ SetNTPServer(HWND hwnd, BOOL bBeginUpdate) { /* Inform the user that the synchronization is about to begin (depending on how reachable the NTP server is) */ StringCchPrintfW(szFormat, _countof(szFormat), SyncStatus.szSyncWait, buffer); - SyncStatus.lpszSyncStatus = szFormat; - SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.lpszSyncStatus); + SetDlgItemTextW(hwnd, IDC_SUCSYNC, szFormat); } /* If there is new data entered then save it in the registry @@ -203,8 +202,7 @@ SyncNTPStatusInit(HWND hwnd) * displaying the last time and date of the said sync. I have no idea how does timedate.cpl remember its last * successful sync so for the time being, we will only load the initial remark string. */ - SyncStatus.lpszSyncStatus = SyncStatus.szSyncInit; - SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.lpszSyncStatus); + SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.szSyncInit); } static VOID @@ -244,16 +242,14 @@ UpdateNTPStatus(HWND hwnd, DWORD dwReason) /* Format the resource sting with the given NTP server name and the current time data */ StringCchPrintfW(szFormat, _countof(szFormat), SyncStatus.szSyncSuc, szNtpServerName, szLocalDate, szLocalTime); - SyncStatus.lpszSyncStatus = szFormat; - SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.lpszSyncStatus); + SetDlgItemTextW(hwnd, IDC_SUCSYNC, szFormat); break; } /* Empty field data has been caught -- simply tell the user to write the NTP name to continue */ case ERROR_INVALID_DATA: { - SyncStatus.lpszSyncStatus = SyncStatus.szSyncType; - SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.lpszSyncStatus); + SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.szSyncType); DPRINT("UpdateNTPStatus(): The user didn't submit any NTP server name!\n"); break; } @@ -262,8 +258,7 @@ UpdateNTPStatus(HWND hwnd, DWORD dwReason) default: { StringCchPrintfW(szFormat, _countof(szFormat), SyncStatus.szSyncErr, szNtpServerName); - SyncStatus.lpszSyncStatus = szFormat; - SetDlgItemTextW(hwnd, IDC_SUCSYNC, SyncStatus.lpszSyncStatus); + SetDlgItemTextW(hwnd, IDC_SUCSYNC, szFormat); DPRINT("UpdateNTPStatus(): Failed to synchronize the time! (Error: %lu).\n", dwReason); break; } diff --git a/dll/cpl/timedate/timedate.h b/dll/cpl/timedate/timedate.h index 306889fe159..9110ca7c8c2 100644 --- a/dll/cpl/timedate/timedate.h +++ b/dll/cpl/timedate/timedate.h @@ -42,7 +42,6 @@ typedef struct WCHAR szSyncErr[BUFSIZE]; WCHAR szSyncType[BUFSIZE]; WCHAR szSyncInit[BUFSIZE]; - LPWSTR lpszSyncStatus; } SYNC_STATUS, *PSYNC_STATUS; extern HINSTANCE hApplet;