[TIMEDATE] Remove lpszSyncStatus member entirely (#2383)

And directly pass the formatted string to SetDlgItemTextW(). Addendum to 5a81a5b.
This commit is contained in:
Bișoc George 2020-02-24 16:59:11 +01:00 committed by GitHub
parent fe39760206
commit b77008a709
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View file

@ -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;
}

View file

@ -42,7 +42,6 @@ typedef struct
WCHAR szSyncErr[BUFSIZE];
WCHAR szSyncType[BUFSIZE];
WCHAR szSyncInit[BUFSIZE];
LPWSTR lpszSyncStatus;
} SYNC_STATUS, *PSYNC_STATUS;
extern HINSTANCE hApplet;