From 4aa6229698b946e52ce19018aaf13f8b92fb168e Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 15 Jun 2012 14:13:45 +0000 Subject: another portion of "#ifsef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/dbutils.cpp | 49 ++++++++++----------------------- src/modules/database/profilemanager.cpp | 14 ++-------- 2 files changed, 17 insertions(+), 46 deletions(-) (limited to 'src/modules/database') diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index cd4168884d..6cad16035b 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -206,17 +206,10 @@ static INT_PTR DbEventGetStringT( WPARAM wParam, LPARAM lParam ) DBEVENTINFO* dbei = ( DBEVENTINFO* )wParam; char* string = ( char* )lParam; - #if defined( _UNICODE ) - if ( dbei->flags & DBEF_UTF ) - return ( INT_PTR )Utf8DecodeUcs2( string ); - - return ( INT_PTR )mir_a2t( string ); - #else - char* res = mir_strdup( string ); - if ( dbei->flags & DBEF_UTF ) - Utf8Decode( res, NULL ); - return ( INT_PTR )res; - #endif + if ( dbei->flags & DBEF_UTF ) + return ( INT_PTR )Utf8DecodeUcs2( string ); + + return ( INT_PTR )mir_a2t( string ); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -253,14 +246,10 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam) char* dst = (char*)lParam; - #if defined( _UNICODE ) - char* tmp = mir_t2a( g_profileDir ); - strncpy( dst, tmp, wParam ); - mir_free( tmp ); - #else - strncpy( dst, g_profileDir, wParam ); - #endif - + char* tmp = mir_t2a( g_profileDir ); + strncpy( dst, tmp, wParam ); + mir_free( tmp ); + if (wParam <= _tcslen(g_profileName)) { dst[wParam - 1] = 0; @@ -276,14 +265,10 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) char* dst = (char*)lParam; - #if defined( _UNICODE ) - char* tmp = makeFileName( g_profileName ); - strncpy( dst, tmp, wParam ); - mir_free( tmp ); - #else - strncpy( dst, g_profileName, wParam ); - #endif - + char* tmp = makeFileName( g_profileName ); + strncpy( dst, tmp, wParam ); + mir_free( tmp ); + if (wParam <= _tcslen(g_profileName)) { dst[wParam - 1] = 0; @@ -292,8 +277,6 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) return 0; } -#if defined( _UNICODE ) - static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam) { if (!wParam || !lParam) @@ -321,8 +304,6 @@ static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam) return 0; } -#endif - ///////////////////////////////////////////////////////////////////////////////////////// int InitUtils() @@ -339,10 +320,8 @@ int InitUtils() CreateServiceFunction(MS_DB_GETPROFILEPATH, GetProfilePath); CreateServiceFunction(MS_DB_GETPROFILENAME, GetProfileName); - #if defined( _UNICODE ) - CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW); - CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW); - #endif + CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW); + CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW); return 0; } diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 3ee38c754c..7d362fd554 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -226,24 +226,16 @@ static int DetectDbProvider(const char*, DATABASELINK * dblink, LPARAM lParam) { int error; -#ifdef _UNICODE - char* fullpath = makeFileName(( TCHAR* )lParam ); -#else - char* fullpath = (char*)lParam; -#endif +char* fullpath = makeFileName(( TCHAR* )lParam ); int ret = dblink->grokHeader(fullpath, &error); -#ifdef _UNICODE mir_free( fullpath ); -#endif if ( ret == 0) { -#ifdef _UNICODE + char tmp[ MAX_PATH ]; dblink->getFriendlyName(tmp, SIZEOF(tmp), 1); MultiByteToWideChar(CP_ACP, 0, tmp, -1, (TCHAR*)lParam, MAX_PATH); -#else - dblink->getFriendlyName((TCHAR*)lParam, MAX_PATH, 1); -#endif + return DBPE_HALT; } -- cgit v1.2.3