diff options
Diffstat (limited to 'plugins/Ping/src/log.cpp')
-rw-r--r-- | plugins/Ping/src/log.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index 65695872b9..cc9a166947 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -7,7 +7,7 @@ INT_PTR Log(WPARAM wParam, LPARAM) { //char TBcapt[255];
SYSTEMTIME systime;
-
+
GetLocalTime(&systime);
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, tbuf, 512);
@@ -16,10 +16,11 @@ INT_PTR Log(WPARAM wParam, LPARAM) { TCHAR *line = (TCHAR *)wParam;
FILE *f = _tfopen(buf, _T("a+"));
- if(f) {
- if(options.log_csv) {
+ if (f) {
+ if (options.log_csv) {
_ftprintf(f, _T("%s, %s, %s\n"), dbuf, tbuf, line);
- } else {
+ }
+ else {
_ftprintf(f, _T("%s, %s: %s\n"), dbuf, tbuf, line);
}
fclose(f);
@@ -31,11 +32,12 @@ INT_PTR Log(WPARAM wParam, LPARAM) { INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
TCHAR *filename = (TCHAR *)lParam;
- if(db_get_ts(0, PLUG, "LogFilename", &dbv)) {
+ if (db_get_ts(0, PLUG, "LogFilename", &dbv)) {
CallService(MS_DB_GETPROFILEPATHT, wParam, (LPARAM)filename);
- _tcsncat(filename, _T("\\ping_log.txt"),wParam);
- } else {
- _tcsncpy(filename, dbv.ptszVal, wParam);
+ mir_tstrncat(filename, _T("\\ping_log.txt"), _TRUNCATE);
+ }
+ else {
+ mir_tstrncpy(filename, dbv.ptszVal, wParam);
db_free(&dbv);
}
@@ -52,6 +54,6 @@ INT_PTR SetLogFilename(WPARAM, LPARAM lParam) { INT_PTR ViewLogData(WPARAM wParam, LPARAM) {
TCHAR buf[MAX_PATH];
CallService(PLUG "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)buf);
- return (INT_PTR)ShellExecute((HWND)wParam, _T("edit"), buf, _T(""), _T(""), SW_SHOW);
+ return (INT_PTR)ShellExecute((HWND)wParam, _T("edit"), buf, _T(""), _T(""), SW_SHOW);
}
|