Browse Source

Fix TB_ADDSTRING must be double null terminated

Fix old skin icons for toolbar
import/tags/kmeleon75_1
Dorian 7 years ago
parent
commit
9f49c9fa03
  1. 8
      k-meleon/KmToolbar.cpp
  2. 2
      k-meleon/LangParser.h

8
k-meleon/KmToolbar.cpp

@ -148,7 +148,7 @@ void KmToolbar::AddItem(KmButton& button, int before, UINT w, UINT h)
if (!pbutton->mID) return;
}
int imageIndex = theApp.skin.GetIconIndex(pbutton->mID);
if (imageIndex == I_IMAGENONE && button.mColdImage.GetLength()) {
if (button.mColdImage.GetLength()) {
/*if (button.mColdImage.Left(6).Compare(L"chrome") == 0) {
@ -217,9 +217,9 @@ TBBUTTON KmToolbar::InitButton(KmButton* kbutton, CToolBarEx* hToolbar)
if (kbutton->mID || kbutton->mName.GetLength()>0) {
res.iString = -1;
if (kbutton->mLabel.GetLength() > 0) {
CString strTemp(theApp.lang.Translate(kbutton->mLabel), lstrlen(kbutton->mLabel)+1);
res.iString = (INT_PTR)hToolbar->GetToolBarCtrl().SendMessage(TB_ADDSTRING, 0, (LPARAM)strTemp.GetBuffer());
CString translated = theApp.lang.Translate(kbutton->mLabel);
translated += _T('\0');
res.iString = hToolbar->GetToolBarCtrl().SendMessage(TB_ADDSTRING, 0, (LPARAM)(LPCTSTR)translated);
}
res.iBitmap = kbutton->mImageIndex;
res.idCommand = kbutton->mID;

2
k-meleon/LangParser.h

@ -37,7 +37,7 @@ public:
LPCTSTR Translate(LPCTSTR originalText) {
#if _MSC_VER >= 1300
CMap<CString, LPCTSTR, CString, LPCTSTR>::CPair * p = langMap.PLookup(originalText);
return p ? p->value.GetBuffer(0) : originalText;
return p ? (LPCTSTR)p->value : originalText;
#else
static CString t;
if (langMap.Lookup(originalText, t))

Loading…
Cancel
Save