summaryrefslogtreecommitdiff
path: root/plugins/Ping/src/log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Ping/src/log.cpp')
-rw-r--r--plugins/Ping/src/log.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp
index ce4d90d752..65695872b9 100644
--- a/plugins/Ping/src/log.cpp
+++ b/plugins/Ping/src/log.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-INT_PTR Log(WPARAM wParam, LPARAM lParam) {
+INT_PTR Log(WPARAM wParam, LPARAM) {
TCHAR buf[1024], tbuf[512], dbuf[512];
CallService(PLUG "/GetLogFilename", (WPARAM)1024, (LPARAM)buf);
@@ -13,14 +13,14 @@ INT_PTR Log(WPARAM wParam, LPARAM lParam) {
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, tbuf, 512);
GetDateFormat(LOCALE_USER_DEFAULT, 0, &systime, 0, dbuf, 512);
- char *line = (char *)wParam;
+ TCHAR *line = (TCHAR *)wParam;
FILE *f = _tfopen(buf, _T("a+"));
if(f) {
if(options.log_csv) {
- fprintf(f, "%s, %s, %s\n", dbuf, tbuf, line);
+ _ftprintf(f, _T("%s, %s, %s\n"), dbuf, tbuf, line);
} else {
- fprintf(f, "%s, %s: %s\n", dbuf, tbuf, line);
+ _ftprintf(f, _T("%s, %s: %s\n"), dbuf, tbuf, line);
}
fclose(f);
}
@@ -30,28 +30,27 @@ INT_PTR Log(WPARAM wParam, LPARAM lParam) {
INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) {
DBVARIANT dbv;
- char *filename = (char *)lParam;
- if(db_get(0, PLUG, "LogFilename", &dbv)) {
- CallService(MS_DB_GETPROFILEPATH, (WPARAM)wParam, (LPARAM)filename);
- strcat(filename, "\\");
- strcat(filename, "ping_log.txt");
+ TCHAR *filename = (TCHAR *)lParam;
+ if(db_get_ts(0, PLUG, "LogFilename", &dbv)) {
+ CallService(MS_DB_GETPROFILEPATHT, wParam, (LPARAM)filename);
+ _tcsncat(filename, _T("\\ping_log.txt"),wParam);
} else {
- strncpy(filename, dbv.pszVal, wParam);
+ _tcsncpy(filename, dbv.ptszVal, wParam);
db_free(&dbv);
}
- ((char *)lParam)[wParam - 1] = 0;
+ ((TCHAR *)lParam)[wParam - 1] = 0;
return 0;
}
-INT_PTR SetLogFilename(WPARAM wParam, LPARAM lParam) {
- db_set_s(0, PLUG, "LogFilename", (char *)lParam);
+INT_PTR SetLogFilename(WPARAM, LPARAM lParam) {
+ db_set_ts(0, PLUG, "LogFilename", (TCHAR *)lParam);
return 0;
}
-INT_PTR ViewLogData(WPARAM wParam, LPARAM lParam) {
- char buf[1024];
+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);
}