From 63a643f7f42ecd0c2625a5f5704b5b9647349e7b Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 2 Feb 2022 07:58:07 +0000 Subject: [PATCH] riched20: Use correct integral type. Signed-off-by: Eric Pouech Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/caret.c | 8 ++++---- dlls/riched20/editor.c | 33 +++++++++++++++++++-------------- dlls/riched20/editor.h | 2 +- dlls/riched20/editstr.h | 2 +- dlls/riched20/paint.c | 4 ++-- dlls/riched20/richole.c | 6 ++++-- dlls/riched20/writer.c | 2 +- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index ebc137ebf85..cc5ce90ea42 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -39,14 +39,14 @@ static void ME_SetCursorToEnd(ME_TextEditor *editor, ME_Cursor *cursor, BOOL fin } -int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to) +int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to) { *from = ME_GetCursorOfs(&editor->pCursors[0]); *to = ME_GetCursorOfs(&editor->pCursors[1]); if (*from > *to) { - int tmp = *from; + LONG tmp = *from; *from = *to; *to = tmp; return 1; @@ -160,7 +160,7 @@ int set_selection_cursors(ME_TextEditor *editor, int from, int to) /* deselected and caret moved to end of the current selection */ if (from < 0) { - int start, end; + LONG start, end; ME_GetSelectionOfs(editor, &start, &end); if (start != end) { @@ -1353,7 +1353,7 @@ BOOL ME_IsSelection(ME_TextEditor *editor) void ME_DeleteSelection(ME_TextEditor *editor) { - int from, to; + LONG from, to; int nStartCursor = ME_GetSelectionOfs(editor, &from, &to); int nEndCursor = nStartCursor ^ 1; ME_DeleteTextAtCursor(editor, nStartCursor, to - from); diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 429f023ebe4..ddf619870f1 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1567,7 +1567,8 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre { RTF_Info parser; ME_Style *style; - int from, to, nUndoMode; + LONG from, to; + int nUndoMode; int nEventMask = editor->nEventMask; ME_InStream inStream; BOOL invalidRTF = FALSE; @@ -2087,7 +2088,7 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText) if (ex->flags & GT_SELECTION) { - int from, to; + LONG from, to; int nStartCur = ME_GetSelectionOfs(editor, &from, &to); start = editor->pCursors[nStartCur]; nChars = to - from; @@ -2366,7 +2367,7 @@ HRESULT editor_copy_or_cut( ME_TextEditor *editor, BOOL cut, ME_Cursor *start, i static BOOL copy_or_cut( ME_TextEditor *editor, BOOL cut ) { HRESULT hr; - int offs, count; + LONG offs, count; int start_cursor = ME_GetSelectionOfs( editor, &offs, &count ); ME_Cursor *sel_start = &editor->pCursors[start_cursor]; @@ -2412,7 +2413,7 @@ static BOOL handle_enter(ME_TextEditor *editor) { ME_Cursor cursor = editor->pCursors[0]; ME_Paragraph *para = cursor.para; - int from, to; + LONG from, to; ME_Style *style, *eop_style; if (editor->props & TXTBIT_READONLY) @@ -2689,7 +2690,7 @@ static LRESULT handle_wm_char( ME_TextEditor *editor, WCHAR wstr, LPARAM flags ) { ME_Cursor cursor = editor->pCursors[0]; ME_Paragraph *para = cursor.para; - int from, to; + LONG from, to; BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000; ME_GetSelectionOfs(editor, &from, &to); if (wstr == '\t' && @@ -2845,7 +2846,8 @@ void editor_set_cursor( ME_TextEditor *editor, int x, int y ) else if (ME_IsSelection( editor )) { - int start, end, offset = ME_GetCursorOfs( &pos ); + LONG start, end; + int offset = ME_GetCursorOfs( &pos ); ME_GetSelectionOfs( editor, &start, &end ); if (start <= offset && end >= offset) cursor = cursor_arrow; @@ -3144,7 +3146,8 @@ void link_notify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam) void ME_ReplaceSel(ME_TextEditor *editor, BOOL can_undo, const WCHAR *str, int len) { - int from, to, nStartCursor; + LONG from, to; + int nStartCursor; ME_Style *style; nStartCursor = ME_GetSelectionOfs(editor, &from, &to); @@ -3279,10 +3282,10 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, case EM_GETSEL: { /* Note: wParam/lParam can be NULL */ - UINT from, to; - PUINT pfrom = wParam ? (PUINT)wParam : &from; - PUINT pto = lParam ? (PUINT)lParam : &to; - ME_GetSelectionOfs(editor, (int *)pfrom, (int *)pto); + LONG from, to; + LONG *pfrom = wParam ? (LONG *)wParam : &from; + LONG *pto = lParam ? (LONG *)lParam : &to; + ME_GetSelectionOfs(editor, pfrom, pto); if ((*pfrom|*pto) & 0xFFFF0000) return -1; return MAKELONG(*pfrom,*pto); @@ -3388,7 +3391,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, { LPWSTR wszText; SETTEXTEX *pStruct = (SETTEXTEX *)wParam; - int from, to, len; + LONG from, to; + int len; ME_Style *style; BOOL bRtf, bUnicode, bSelection, bUTF8; int oldModify = editor->nModifyStep; @@ -3545,7 +3549,7 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, } case WM_CLEAR: { - int from, to; + LONG from, to; int nStartCursor = ME_GetSelectionOfs(editor, &from, &to); ME_InternalDeleteText(editor, &editor->pCursors[nStartCursor], to-from, FALSE); ME_CommitUndo(editor); @@ -3660,7 +3664,8 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam); case EM_GETSELTEXT: { - int nFrom, nTo, nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo); + LONG nFrom, nTo; + int nStartCur = ME_GetSelectionOfs(editor, &nFrom, &nTo); ME_Cursor *from = &editor->pCursors[nStartCur]; return get_text_range( editor, (WCHAR *)lParam, from, nTo - nFrom ); } diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 8a46e942581..e0df63ae92d 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -182,7 +182,7 @@ int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BO BOOL ME_ArrowKey(ME_TextEditor *ed, int nVKey, BOOL extend, BOOL ctrl) DECLSPEC_HIDDEN; int ME_GetCursorOfs(const ME_Cursor *cursor) DECLSPEC_HIDDEN; -int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to) DECLSPEC_HIDDEN; +int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to) DECLSPEC_HIDDEN; int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to) DECLSPEC_HIDDEN; BOOL ME_IsSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_DeleteSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 22cfd74722c..889795de189 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -401,7 +401,7 @@ typedef struct tagME_TextEditor int nUndoLimit; ME_UndoMode nUndoMode; int nParagraphs; - int nLastSelStart, nLastSelEnd; + LONG nLastSelStart, nLastSelEnd; ME_Paragraph *last_sel_start_para, *last_sel_end_para; ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]; int nZoomNumerator, nZoomDenominator; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 6ab7e4de76b..245afff77dc 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -459,7 +459,7 @@ static void draw_run( ME_Context *c, int x, int y, ME_Cursor *cursor ) ME_Row *row; ME_Run *run = cursor->run; int runofs = run_char_ofs( run, cursor->nOffset ); - int nSelFrom, nSelTo; + LONG nSelFrom, nSelTo; if (run->nFlags & MERF_HIDDEN) return; @@ -1248,7 +1248,7 @@ ME_InvalidateSelection(ME_TextEditor *editor) { ME_Paragraph *sel_start, *sel_end; ME_Paragraph *repaint_start = NULL, *repaint_end = NULL; - int nStart, nEnd; + LONG nStart, nEnd; int len = ME_GetTextLength(editor); ME_GetSelectionOfs(editor, &nStart, &nEnd); diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index 03572511ff7..47194096bdc 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -1254,7 +1254,8 @@ IRichEditOle_fnGetClipboardData(IRichEditOle *iface, CHARRANGE *lpchrg, return E_INVALIDARG; if(!lpchrg) { - int nFrom, nTo, nStartCur = ME_GetSelectionOfs( services->editor, &nFrom, &nTo ); + LONG nFrom, nTo; + int nStartCur = ME_GetSelectionOfs( services->editor, &nFrom, &nTo ); start = services->editor->pCursors[nStartCur]; nChars = nTo - nFrom; } @@ -4661,7 +4662,8 @@ static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR str) { struct text_selection *This = impl_from_ITextSelection(me); ME_TextEditor *editor; - int len, to, from; + int len; + LONG to, from; TRACE("(%p)->(%s)\n", This, debugstr_w(str)); diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index d6c687daab9..c4f79ce6f5b 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -1198,7 +1198,7 @@ ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream) int nChars; if (dwFormat & SFF_SELECTION) { - int nStart, nTo; + LONG nStart, nTo; start = editor->pCursors[ME_GetSelectionOfs(editor, &nStart, &nTo)]; nChars = nTo - nStart; } else {