diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
commit | 5975b2d0903bd5df128d55e20cd27d7c13b4e46c (patch) | |
tree | 6696492511c591fa8bf3b65a64864245caa3e7c2 /plugins/Svc_crshdmp | |
parent | 8617d7e00546f892c9084f7c382648b23d8bbb63 (diff) |
another portion of "#ifdef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@448 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Svc_crshdmp')
-rw-r--r-- | plugins/Svc_crshdmp/crshdmp.cpp | 5 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/dumper.cpp | 37 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/sdkstuff.h | 4 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/utils.cpp | 13 | ||||
-rw-r--r-- | plugins/Svc_crshdmp/utils.h | 8 |
5 files changed, 20 insertions, 47 deletions
diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 4869ed7182..2bd26df7f0 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -301,10 +301,7 @@ static int ModulesLoaded(WPARAM, LPARAM) FoldersPathChanged(0, 0);
-#ifndef _UNICODE
- if (_tcsstr(vertxt, TEXT("Unicode")) != NULL)
- ShowMessage(2, TEXT("Please update Crash Dumper to Unicode Version"));
-#endif
+
hHooks[2] = HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
if (hHooks[3] == NULL) hHooks[3] = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded);
diff --git a/plugins/Svc_crshdmp/dumper.cpp b/plugins/Svc_crshdmp/dumper.cpp index 21c90cd33e..bce015016b 100644 --- a/plugins/Svc_crshdmp/dumper.cpp +++ b/plugins/Svc_crshdmp/dumper.cpp @@ -116,11 +116,9 @@ void GetLinkedModulesInfo(TCHAR *moduleName, bkstring &buffer) LPVOID dllAddr = MapViewOfFile(hDllMapping, FILE_MAP_READ, 0, 0, 0);
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT(" Plugin statically linked to missing module: %S\r\n");
-#else
- static const TCHAR format[] = TEXT(" Plugin statically linked to missing module: %s\r\n");
-#endif
+
__try
{
@@ -198,11 +196,9 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags) bkstring ubuffer;
ListItem* dlllist = NULL;
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT("%c %s v.%s%d.%d.%d.%d%s [%s] - %S %s\r\n");
-#else
- static const TCHAR format[] = TEXT("%c %s v.%s%d.%d.%d.%d%s [%s] - %s %s\r\n");
-#endif
+
do
{
@@ -435,11 +431,9 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags) TCHAR timebuf[30] = TEXT("");
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT(" %s v.%s%S%s [%s] - %S\r\n");
-#else
- static const TCHAR format[] = TEXT(" %s v.%s%s%s [%s] - $s\r\n");
-#endif
+
buffer.appendfmt(format, FindFileData.cFileName,
(flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""),
ver,
@@ -711,11 +705,9 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA PLUGININFO *pi = GetMirInfo(hModule);
if (pi != NULL)
{
-#ifdef _UNICODE
+
static const TCHAR formatc[] = TEXT("\r\nLikely cause of the crash plugin: %S\r\n\r\n");
-#else
- static const TCHAR formatc[] = TEXT("\r\nLikely cause of the crash plugin: %s\r\n\r\n");
-#endif
+
if (pi->shortName)
{
bkstring crashcause;
@@ -726,11 +718,9 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA }
}
-#ifdef _UNICODE
+
static const TCHAR formatd[] = TEXT("%p (%S %p): %S (%d): %S\r\n");
-#else
- static const TCHAR formatd[] = TEXT("%p (%s %p): %s (%d): %s\r\n");
-#endif
+
buffer.appendfmt(formatd,
(LPVOID)frame.AddrPC.Offset, moduleName, (LPVOID)Module.BaseOfImage,
lineFileName, Line.LineNumber, name);
@@ -740,7 +730,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA PrintVersionInfo(buffer, VI_FLAG_PRNDLL);
-#ifdef _UNICODE
+
int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, NULL, 0, NULL, NULL);
char* dst = (char*)(len > 8192 ? malloc(len) : alloca(len));
WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, NULL, NULL);
@@ -748,10 +738,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA WriteUtfFile(hDumpFile, dst);
if (len > 8192) free(dst);
-#else
- DWORD bytes;
- WriteFile(hDumpFile, buffer.c_str(), buffer.sizebytes(), &bytes, NULL);
-#endif
+
if (msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES)
StoreStringToClip(buffer);
diff --git a/plugins/Svc_crshdmp/sdkstuff.h b/plugins/Svc_crshdmp/sdkstuff.h index fdef4729e5..536a00bc40 100644 --- a/plugins/Svc_crshdmp/sdkstuff.h +++ b/plugins/Svc_crshdmp/sdkstuff.h @@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <windows.h>
-//#ifdef _UNICODE
+
//#define DBGHELP_TRANSLATE_TCHAR
-//#endif
+
#ifndef __in_bcount_opt
#define __in_bcount_opt(x)
diff --git a/plugins/Svc_crshdmp/utils.cpp b/plugins/Svc_crshdmp/utils.cpp index f1448f184b..e60893ecf5 100644 --- a/plugins/Svc_crshdmp/utils.cpp +++ b/plugins/Svc_crshdmp/utils.cpp @@ -29,11 +29,9 @@ tGetSystemDefaultUILanguage pGetSystemDefaultUILanguage = (tGetSystemDefaultUILa tIsWow64Process pIsWow64Process = (tIsWow64Process) GetProcAddress(hKernel, "IsWow64Process");
tIsProcessorFeaturePresent pIsProcessorFeaturePresent = (tIsProcessorFeaturePresent) GetProcAddress(hKernel, "IsProcessorFeaturePresent");
-#ifdef _UNICODE
+
tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExW");
-#else
-tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExA");
-#endif
+
void CheckForOtherCrashReportingPlugins(void)
@@ -824,12 +822,9 @@ void StoreStringToClip(bkstring& buffer) OpenClipboard(NULL);
EmptyClipboard();
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hData);
-#else
- SetClipboardData(CF_TEXT, hData);
-#endif
- CloseClipboard();
+
}
bool IsPluginEnabled(TCHAR* filename)
diff --git a/plugins/Svc_crshdmp/utils.h b/plugins/Svc_crshdmp/utils.h index b63e9f893a..6c03552db7 100644 --- a/plugins/Svc_crshdmp/utils.h +++ b/plugins/Svc_crshdmp/utils.h @@ -77,19 +77,13 @@ int crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...); MultiByteToWideChar(CP_ACP, 0, src, -1, dst, cbLen); \
}
-#ifdef _UNICODE
+
#define crsi_t2a(d,s) crsi_u2a(d,s)
#define crsi_a2t(d,s) crsi_a2u(d,s,alloca)
#define crs_a2t(d,s) crsi_a2u(d,s,mir_alloc)
-#else
-
-#define crsi_t2a(d,s) (d=s)
-#define crsi_a2t(d,s) (d=s)
-#define crs_a2t(d,s) (d=mir_strdup(s))
-#endif
#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
|