riched20: Use zero terminated wchar strings.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-15 23:11:16 +01:00 committed by Alexandre Julliard
parent d08852d835
commit 80620171ec
2 changed files with 7 additions and 14 deletions

View file

@ -627,10 +627,9 @@ void ME_RTFParAttrHook(RTF_Info *info)
else
{
ME_Cursor cursor;
WCHAR endl = '\r';
cursor = info->editor->pCursors[0];
if (cursor.nOffset || cursor.run->nCharOfs)
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
ME_InsertTextFromCursor(info->editor, 0, L"\r", 1, info->style);
tableDef->row_start = table_insert_row_start( info->editor, info->editor->pCursors );
}
@ -1079,8 +1078,6 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
}
else /* v1.0 - v3.0 */
{
WCHAR endl = '\r';
para = info->editor->pCursors[0].para;
para->fmt.dxOffset = info->tableDef->gapH;
para->fmt.dxStartIndent = info->tableDef->leftEdge;
@ -1094,7 +1091,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
}
para->fmt.cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS);
if (!tableDef->numCellsDefined) para->fmt.wEffects &= ~PFE_TABLE;
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
ME_InsertTextFromCursor(info->editor, 0, L"\r", 1, info->style);
tableDef->numCellsInserted = 0;
}
break;
@ -2488,8 +2485,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
if (editor->styleFlags & ES_MULTILINE)
{
static const WCHAR endl = '\r';
static const WCHAR endlv10[] = {'\r','\n'};
ME_Cursor cursor = editor->pCursors[0];
ME_Paragraph *para = cursor.para;
int from, to;
@ -2530,7 +2525,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
editor->pCursors[0].para = para;
editor->pCursors[0].run = para_first_run( para );
editor->pCursors[1] = editor->pCursors[0];
ME_InsertTextFromCursor( editor, 0, &endl, 1, editor->pCursors[0].run->style );
ME_InsertTextFromCursor( editor, 0, L"\r", 1, editor->pCursors[0].run->style );
para = editor_first_para( editor );
editor_set_default_para_fmt( editor, &para->fmt );
para->nFlags = 0;
@ -2579,7 +2574,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
}
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_InsertTextFromCursor( editor, 0, &endl, 1, editor->pCursors[0].run->style );
ME_InsertTextFromCursor( editor, 0, L"\r", 1, editor->pCursors[0].run->style );
}
else
{
@ -2611,9 +2606,9 @@ static BOOL handle_enter(ME_TextEditor *editor)
ME_InsertEndRowFromCursor(editor, 0);
else
if (!editor->bEmulateVersion10)
ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style);
ME_InsertTextFromCursor(editor, 0, L"\r", 1, eop_style);
else
ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style);
ME_InsertTextFromCursor(editor, 0, L"\r\n", 2, eop_style);
ME_CommitCoalescingUndo(editor);
SetCursor(NULL);

View file

@ -1139,11 +1139,9 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
if (!editor->bEmulateVersion10 && cursor.run->nFlags & MERF_ENDPARA)
{
static const WCHAR szEOL[] = { '\r', '\n' };
/* richedit 2.0 - all line breaks are \r\n */
if (dwFormat & SF_UNICODE)
success = ME_StreamOutMove(pStream, (const char *)szEOL, sizeof(szEOL));
success = ME_StreamOutMove(pStream, (const char *)L"\r\n", 2 * sizeof(WCHAR));
else
success = ME_StreamOutMove(pStream, "\r\n", 2);
} else {