[BUG_FIXED] Fix "finds in all opened files" crash bug.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@615 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
1bab772c37
commit
99042edb28
@ -242,7 +242,7 @@ const wchar_t * WcharMbcsConvertor::char2wchar(const char * mbcs2Convert, UINT c
|
|||||||
int len = MultiByteToWideChar(codepage, 0, mbcs2Convert, -1, _wideCharStr, 0);
|
int len = MultiByteToWideChar(codepage, 0, mbcs2Convert, -1, _wideCharStr, 0);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
if (len > int(_wideCharAllocLen))
|
if ((size_t)len > _wideCharAllocLen)
|
||||||
{
|
{
|
||||||
delete [] _wideCharStr;
|
delete [] _wideCharStr;
|
||||||
_wideCharAllocLen = len;
|
_wideCharAllocLen = len;
|
||||||
@ -276,6 +276,9 @@ const wchar_t * WcharMbcsConvertor::char2wchar(const char * mbcs2Convert, UINT c
|
|||||||
_wideCharStr = new wchar_t[_wideCharAllocLen];
|
_wideCharStr = new wchar_t[_wideCharAllocLen];
|
||||||
}
|
}
|
||||||
len = MultiByteToWideChar(codepage, 0, mbcs2Convert, -1, _wideCharStr, len);
|
len = MultiByteToWideChar(codepage, 0, mbcs2Convert, -1, _wideCharStr, len);
|
||||||
|
|
||||||
|
if ((size_t)*mstart < strlen(mbcs2Convert) && (size_t)*mend < strlen(mbcs2Convert))
|
||||||
|
{
|
||||||
*mstart = MultiByteToWideChar(codepage, 0, mbcs2Convert, *mstart, _wideCharStr, 0);
|
*mstart = MultiByteToWideChar(codepage, 0, mbcs2Convert, *mstart, _wideCharStr, 0);
|
||||||
*mend = MultiByteToWideChar(codepage, 0, mbcs2Convert, *mend, _wideCharStr, 0);
|
*mend = MultiByteToWideChar(codepage, 0, mbcs2Convert, *mend, _wideCharStr, 0);
|
||||||
if (*mstart >= len || *mend >= len)
|
if (*mstart >= len || *mend >= len)
|
||||||
@ -285,6 +288,12 @@ const wchar_t * WcharMbcsConvertor::char2wchar(const char * mbcs2Convert, UINT c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
*mstart = 0;
|
||||||
|
*mend = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_wideCharStr[0] = 0;
|
_wideCharStr[0] = 0;
|
||||||
*mstart = 0;
|
*mstart = 0;
|
||||||
@ -304,7 +313,7 @@ const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UI
|
|||||||
int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL);
|
int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
if (len > int(_multiByteAllocLen))
|
if ((size_t)len > _multiByteAllocLen)
|
||||||
{
|
{
|
||||||
delete [] _multiByteStr;
|
delete [] _multiByteStr;
|
||||||
_multiByteAllocLen = len;
|
_multiByteAllocLen = len;
|
||||||
@ -329,13 +338,16 @@ const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UI
|
|||||||
int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL);
|
int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
if (len > int(_multiByteAllocLen))
|
if ((size_t)len > _multiByteAllocLen)
|
||||||
{
|
{
|
||||||
delete [] _multiByteStr;
|
delete [] _multiByteStr;
|
||||||
_multiByteAllocLen = len;
|
_multiByteAllocLen = len;
|
||||||
_multiByteStr = new char[_multiByteAllocLen];
|
_multiByteStr = new char[_multiByteAllocLen];
|
||||||
}
|
}
|
||||||
len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, len, NULL, NULL); // not needed?
|
len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, len, NULL, NULL); // not needed?
|
||||||
|
|
||||||
|
if ((int)*mstart < lstrlen(wcharStr2Convert) && (int)*mend < lstrlen(wcharStr2Convert))
|
||||||
|
{
|
||||||
*mstart = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mstart, _multiByteStr, 0, NULL, NULL);
|
*mstart = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mstart, _multiByteStr, 0, NULL, NULL);
|
||||||
*mend = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mend, _multiByteStr, 0, NULL, NULL);
|
*mend = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mend, _multiByteStr, 0, NULL, NULL);
|
||||||
if (*mstart >= len || *mend >= len)
|
if (*mstart >= len || *mend >= len)
|
||||||
@ -344,6 +356,12 @@ const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UI
|
|||||||
*mend = 0;
|
*mend = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*mstart = 0;
|
||||||
|
*mend = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_multiByteStr[0] = 0;
|
_multiByteStr[0] = 0;
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||||||
{
|
{
|
||||||
case WM_NCACTIVATE:
|
case WM_NCACTIVATE:
|
||||||
{
|
{
|
||||||
/* activate/deactivate titlebar of toolbars */
|
// activate/deactivate titlebar of toolbars
|
||||||
for (size_t iCont = DOCKCONT_MAX; iCont < _vContainer.size(); iCont++)
|
for (size_t iCont = DOCKCONT_MAX; iCont < _vContainer.size(); iCont++)
|
||||||
{
|
{
|
||||||
::SendMessage(_vContainer[iCont]->getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1);
|
::SendMessage(_vContainer[iCont]->getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1);
|
||||||
@ -258,7 +258,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||||||
if (::GetActiveWindow() != _hParent)
|
if (::GetActiveWindow() != _hParent)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* set respective activate state */
|
// set respective activate state
|
||||||
for (int i = 0; i < DOCKCONT_MAX; i++)
|
for (int i = 0; i < DOCKCONT_MAX; i++)
|
||||||
{
|
{
|
||||||
_vContainer[i]->SetActive(IsChild(_vContainer[i]->getHSelf(), ::GetFocus()));
|
_vContainer[i]->SetActive(IsChild(_vContainer[i]->getHSelf(), ::GetFocus()));
|
||||||
@ -276,7 +276,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
|||||||
|
|
||||||
case DMM_MOVE_SPLITTER:
|
case DMM_MOVE_SPLITTER:
|
||||||
{
|
{
|
||||||
INT offset = (INT)wParam;
|
int offset = wParam;
|
||||||
|
|
||||||
for (int iCont = 0; iCont < DOCKCONT_MAX; iCont++)
|
for (int iCont = 0; iCont < DOCKCONT_MAX; iCont++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user