From 26dd9ff89c617734e4f7959f1967fb98d7f3478f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 14 Oct 2012 20:06:14 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1940 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/dbutils.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/modules') diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index cca96a763c..fe0ba20b34 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -123,13 +123,13 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (egt->datatype == DBVT_WCHAR) { WCHAR* msg = NULL; - if (dbei->flags & DBEF_UTF) { - char* str = (char*)alloca(dbei->cbBlob + 1); - if (str == NULL) return NULL; - memcpy(str, dbei->pBlob, dbei->cbBlob); - str[dbei->cbBlob] = 0; + if (dbei->flags & DBEF_UTF) { + char* str = (char*)alloca(dbei->cbBlob + 1); + if (str == NULL) return NULL; + memcpy(str, dbei->pBlob, dbei->cbBlob); + str[dbei->cbBlob] = 0; Utf8DecodeCP(str, egt->codepage, &msg); - } + } else { size_t msglen = strlen((char*)dbei->pBlob) + 1, msglenW = 0; if (msglen != dbei->cbBlob) { @@ -154,7 +154,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (dbei->flags & DBEF_UTF) Utf8DecodeCP(msg, egt->codepage, NULL); - return (INT_PTR)msg; + return (INT_PTR)msg; } return 0; } @@ -195,10 +195,7 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) } } - if (wParam & LR_SHARED) - return (INT_PTR)icon; - else - return (INT_PTR)CopyIcon(icon); + return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon)); } static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam) -- cgit v1.2.3