From 87e6c8808ddda005f96fb9244ccf04adf72f46f4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 24 Jun 2012 19:23:21 +0000 Subject: fix for the perverted genmenu logic git-svn-id: http://svn.miranda-ng.org/main/trunk@611 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenu.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/modules/clist/genmenu.cpp') diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index f61921b4e1..b6f78c80ef 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -822,18 +822,17 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l if (p != NULL && fType != MFT_SEPARATOR) { if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) { //but might be supposed to be after the next one instead - if (uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR) + if ( !(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR)) InsertSeparator(hMenu, uItem); - uItem++; - } } } + } } } //check for separator after if (uItem < GetMenuItemCount(hMenu)) { UINT fType = GetMenuItemTypeData(hMenu, uItem, p); if (p != NULL && fType != MFT_SEPARATOR) if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) - InsertSeparator(hMenu, uItem); + InsertSeparator(hMenu, uItem); } // create local copy *lpmii so we can change some flags @@ -888,11 +887,8 @@ void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize { if (pMenuItem->UniqName) mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->UniqName); - else if (pMenuItem->mi.flags & CMIF_UNICODE) { - char* name = mir_t2a(pMenuItem->mi.ptszName); - mir_snprintf(pszDest, cbDestSize, "{%s}", name); - mir_free(name); - } + else if (pMenuItem->mi.flags & CMIF_UNICODE) + mir_snprintf(pszDest, cbDestSize, "{%s}", (char*)_T2A(pMenuItem->mi.ptszName)); else mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.pszName); } -- cgit v1.2.3