Fix a x64 crash issue on macro recording

This commit is contained in:
Don Ho 2016-09-23 23:58:16 +02:00
parent 517d82a29a
commit 8e9e8c04cd
6 changed files with 18 additions and 15 deletions

View File

@ -805,11 +805,14 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_MACRORECORD:
{
_macro.push_back(recordedMacroStep(
_macro.push_back(
recordedMacroStep(
notification->message,
static_cast<long>(notification->wParam),
static_cast<long>(notification->lParam),
static_cast<int32_t>(_pEditView->execute(SCI_GETCODEPAGE))));
notification->wParam,
notification->lParam,
static_cast<int32_t>(_pEditView->execute(SCI_GETCODEPAGE))
)
);
break;
}

View File

@ -2842,8 +2842,8 @@ void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & mac
const recordedMacroStep & action = macro._macro[i];
actionNode->ToElement()->SetAttribute(TEXT("type"), action._macroType);
actionNode->ToElement()->SetAttribute(TEXT("message"), action._message);
actionNode->ToElement()->SetAttribute(TEXT("wParam"), action._wParameter);
actionNode->ToElement()->SetAttribute(TEXT("lParam"), action._lParameter);
actionNode->ToElement()->SetAttribute(TEXT("wParam"), static_cast<int>(action._wParameter));
actionNode->ToElement()->SetAttribute(TEXT("lParam"), static_cast<int>(action._lParameter));
actionNode->ToElement()->SetAttribute(TEXT("sParam"), action._sParameter.c_str());
}
}

View File

@ -2283,7 +2283,7 @@ void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus
}
}
void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stringValue)
void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, generic_string stringValue)
{
switch(cmd)
{
@ -2306,7 +2306,7 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
_env->_dotMatchesNewline = ((intValue & IDF_REDOTMATCHNL)> 0);
break;
case IDNORMAL:
_env->_searchType = (SearchType)intValue;
_env->_searchType = static_cast<SearchType>(intValue);
break;
case IDREPLACEWITH:
_env->_str4Replace = stringValue;

View File

@ -329,7 +329,7 @@ public :
}
};
void execSavedCommand(int cmd, int intValue, generic_string stringValue);
void execSavedCommand(int cmd, uptr_t intValue, generic_string stringValue);
void setStatusbarMessage(const generic_string & msg, FindStatus staus);
Finder * createFinder();
bool removeFinder(Finder *finder2remove);

View File

@ -616,7 +616,7 @@ void Accelerator::updateMenuItemByCommand(CommandShortcut csc)
::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str());
}
recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam, int codepage)
recordedMacroStep::recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam, int codepage)
: _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(mtUseLParameter)
{
if (_lParameter) {

View File

@ -273,15 +273,15 @@ struct recordedMacroStep {
enum MacroTypeIndex {mtUseLParameter, mtUseSParameter, mtMenuCommand, mtSavedSnR};
int _message = 0;
long _wParameter = 0;
long _lParameter = 0;
uptr_t _wParameter = 0;
uptr_t _lParameter = 0;
generic_string _sParameter;
MacroTypeIndex _macroType = mtMenuCommand;
recordedMacroStep(int iMessage, long wParam, long lParam, int codepage);
recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam, int codepage);
explicit recordedMacroStep(int iCommandID): _wParameter(iCommandID) {};
recordedMacroStep(int iMessage, long wParam, long lParam, const TCHAR *sParam, int type)
recordedMacroStep(int iMessage, uptr_t wParam, uptr_t lParam, const TCHAR *sParam, int type)
: _message(iMessage), _wParameter(wParam), _lParameter(lParam), _macroType(MacroTypeIndex(type)){
_sParameter = (sParam)?generic_string(sParam):TEXT("");
};