From 380664004b21439985f148faaec988b0f28dc489 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Dec 2012 18:24:23 +0000 Subject: - crash fix for Win64 builds; - some unneeded Unicode stuff wiped out git-svn-id: http://svn.miranda-ng.org/main/trunk@2762 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/main.cpp | 90 +++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 54 deletions(-) (limited to 'plugins/DbEditorPP/src/main.cpp') diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index beb025d7d3..0fd4440ec8 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -249,19 +249,15 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) if (DBGetContactSettingByte(NULL,modname,"WarnOnDelete",-1) == -1) DBWriteContactSettingByte(NULL,modname,"WarnOnDelete",1); - cgs.szModule=modname; - cgs.szSetting="WarnOnDelete"; - cgs.pValue=&dbv; + cgs.szModule = modname; + cgs.szSetting = "WarnOnDelete"; + cgs.pValue = &dbv; if (!CallService(MS_DB_CONTACT_GETSETTING_STR, 0,(LPARAM)&cgs)) if (dbv.type == DBVT_BYTE) UDB = TRUE; } - // check OS support for unicode - // useless if DB doesnt not support unicode - UOS = (UDB && IsCP_UTF8() && IsWinVerNT()); - hTTBHook = HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); if ( bServiceMode ) @@ -429,17 +425,6 @@ int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) { switch(dbv.type) { - case DBVT_UTF8: - if (UOS) - { - int len = (int)strlen(dbv.pszVal)+1; - char *sz = (char*)_alloca(len*3); - WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); - WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL); - strncpy(Value, sz, length); - break; - }// else fall through case DBVT_ASCIIZ: strncpy(Value, dbv.pszVal, length); break; @@ -452,6 +437,14 @@ int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* case DBVT_WORD: _itoa(dbv.wVal,Value,10); break; + case DBVT_UTF8: + int len = (int)strlen(dbv.pszVal)+1; + char *sz = (char*)_alloca(len*3); + WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); + WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL); + strncpy(Value, sz, length); + break; } DBFreeVariant(&dbv); @@ -577,51 +570,41 @@ WCHAR *GetContactName(HANDLE hContact, const char *szProto, int unicode) char name[256]; if (hContact && !proto) - { if (GetValue(hContact,"Protocol","p",name,SIZEOF(name))) proto = name; - } - if (proto) - { - - for(i=0;i