From 05c989e58aeffcfb59cebaca6797cb69dd25cb1e Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sat, 16 Jun 2012 14:33:30 +0000 Subject: another portion of "#ifdef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/contact.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'plugins/Variables/contact.cpp') diff --git a/plugins/Variables/contact.cpp b/plugins/Variables/contact.cpp index 93c48052ec..c6b7b8f566 100644 --- a/plugins/Variables/contact.cpp +++ b/plugins/Variables/contact.cpp @@ -303,11 +303,9 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact) TCHAR *getContactInfoT(BYTE type, HANDLE hContact, int tchar) { if (tchar) { - #ifdef UNICODE + return getContactInfo((BYTE)(type|CNF_UNICODE), hContact); - #else - return getContactInfo(type, hContact); - #endif + } return getContactInfo(type, hContact); @@ -330,22 +328,16 @@ int getContactFromString( CONTACTSINFO* ci ) return -1; if (ci->flags&CI_UNICODE) { - #ifdef UNICODE + tszContact = NEWTSTR_ALLOCA(ci->tszContact); - #else - char* tmp = u2a(ci->wszContact); - tszContact = NEWTSTR_ALLOCA(tmp); - free( tmp ); - #endif + } else { - #ifdef UNICODE + WCHAR* tmp = a2u(ci->szContact); tszContact = NEWTSTR_ALLOCA(tmp); free(tmp); - #else - tszContact = NEWTSTR_ALLOCA(ci->szContact); - #endif + } if ( (tszContact == NULL) || (_tcslen(tszContact) == 0) ) return -1; @@ -399,11 +391,9 @@ int getContactFromString( CONTACTSINFO* ci ) else { szFind = ( TCHAR* )malloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR)); if (szFind != NULL) { -#ifdef UNICODE + tszProto = a2u(szProto); -#else - tszProto = _strdup(szProto); -#endif + if ( (tszProto != NULL) && (szFind != NULL) ) { wsprintf(szFind, _T("<%s:%s>"), tszProto, cInfo); free(cInfo); @@ -603,11 +593,9 @@ TCHAR *encodeContactToString(HANDLE hContact) if (tszResult == NULL) return NULL; - #ifdef UNICODE + tszProto = a2u(szProto); - #else - tszProto = _strdup(szProto); - #endif + if (tszProto == NULL) return NULL; -- cgit v1.2.3