From 04209d6e6d0e33082d82c5ff33bfdb0b3bc40c36 Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Sun, 24 Apr 2011 15:08:20 +0000 Subject: splashscreen: rewritten to Unicode not used mirandaboot.ini, save settings in db support mp3 code optimization version bump added open file dialog filter translation git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@19 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- splashscreen/src/debug.h | 58 +++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'splashscreen/src/debug.h') diff --git a/splashscreen/src/debug.h b/splashscreen/src/debug.h index 3e8ac38..70c44e2 100644 --- a/splashscreen/src/debug.h +++ b/splashscreen/src/debug.h @@ -1,10 +1,8 @@ #ifndef __debug_h__ #define __debug_h__ -#include - #define PlugName "SplashScreen" -extern char szLogFile[MAX_PATH]; +extern TCHAR szLogFile[MAX_PATH]; /* * output a notification message. @@ -13,30 +11,30 @@ extern char szLogFile[MAX_PATH]; * */ -int inline _DebugPopup(HANDLE hContact, const char *fmt, ...) +int inline _DebugPopup(HANDLE hContact, TCHAR *fmt, ...) { - POPUPDATA ppd; - va_list va; - char debug[1024]; - int ibsize = 1023; + POPUPDATAT ppd; + va_list va; + TCHAR debug[1024]; - va_start(va, fmt); - _vsnprintf(debug, ibsize, fmt, va); + va_start(va, fmt); + mir_sntprintf(debug, SIZEOF(debug), fmt, va); - if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) { - ZeroMemory((void *)&ppd, sizeof(ppd)); - ppd.lchContact = hContact; - ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - if(hContact != 0) - strncpy(ppd.lpzContactName, (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0), MAX_CONTACTNAME); - else - strncpy(ppd.lpzContactName, PlugName, MAX_CONTACTNAME); - strncat(ppd.lpzText, debug, MAX_SECONDLINE - 20); - ppd.colorText = RGB(255,255,255); - ppd.colorBack = RGB(255,0,0); - CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0); - } - return 0; + if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) + { + ZeroMemory((void *)&ppd, sizeof(ppd)); + ppd.lchContact = hContact; + ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + if(hContact != 0) + _tcsncpy_s(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR), MAX_CONTACTNAME); + else + _tcsncpy_s(ppd.lptzContactName, _T(PlugName), MAX_CONTACTNAME); + _tcsncpy_s(ppd.lptzText, debug, MAX_SECONDLINE - 20); + ppd.colorText = RGB(255,255,255); + ppd.colorBack = RGB(255,0,0); + CallService(MS_POPUP_ADDPOPUP, (WPARAM)&ppd, 0); + } + return 0; } /* @@ -45,7 +43,7 @@ int inline _DebugPopup(HANDLE hContact, const char *fmt, ...) int inline initLog() { - fclose(fopen(szLogFile,"w")); + fclose(_tfopen(szLogFile, _T("w"))); return 0; } @@ -55,8 +53,8 @@ int inline initLog() void inline logTimeStamp() { - FILE *f = fopen(szLogFile, "a"); - fprintf(f,"Time: %s\n", __TIME__); + FILE *f = _tfopen(szLogFile, _T("a")); + _ftprintf(f, _T("Time:\t\t\t\t%s\n"), _T(__TIME__)); fclose(f); } @@ -64,10 +62,10 @@ void inline logTimeStamp() * logging func */ -void inline logMessage(const char *func, const char *msg) +void inline logMessage(TCHAR *func, TCHAR *msg) { - FILE *f = fopen(szLogFile, "a"); - fprintf(f,"%s:\t\t%s\n", func, msg); + FILE *f = _tfopen(szLogFile, _T("a")); + _ftprintf(f, _T("%s:\t\t%s\n"), func, msg); fclose(f); } -- cgit v1.2.3