Commit 80620171 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

riched20: Use zero terminated wchar strings.

parent d08852d8
...@@ -627,10 +627,9 @@ void ME_RTFParAttrHook(RTF_Info *info) ...@@ -627,10 +627,9 @@ void ME_RTFParAttrHook(RTF_Info *info)
else else
{ {
ME_Cursor cursor; ME_Cursor cursor;
WCHAR endl = '\r';
cursor = info->editor->pCursors[0]; cursor = info->editor->pCursors[0];
if (cursor.nOffset || cursor.run->nCharOfs) 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 ); tableDef->row_start = table_insert_row_start( info->editor, info->editor->pCursors );
} }
...@@ -1079,8 +1078,6 @@ void ME_RTFSpecialCharHook(RTF_Info *info) ...@@ -1079,8 +1078,6 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
} }
else /* v1.0 - v3.0 */ else /* v1.0 - v3.0 */
{ {
WCHAR endl = '\r';
para = info->editor->pCursors[0].para; para = info->editor->pCursors[0].para;
para->fmt.dxOffset = info->tableDef->gapH; para->fmt.dxOffset = info->tableDef->gapH;
para->fmt.dxStartIndent = info->tableDef->leftEdge; para->fmt.dxStartIndent = info->tableDef->leftEdge;
...@@ -1094,7 +1091,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info) ...@@ -1094,7 +1091,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
} }
para->fmt.cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS); para->fmt.cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS);
if (!tableDef->numCellsDefined) para->fmt.wEffects &= ~PFE_TABLE; 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; tableDef->numCellsInserted = 0;
} }
break; break;
...@@ -2488,8 +2485,6 @@ static BOOL handle_enter(ME_TextEditor *editor) ...@@ -2488,8 +2485,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
if (editor->styleFlags & ES_MULTILINE) if (editor->styleFlags & ES_MULTILINE)
{ {
static const WCHAR endl = '\r';
static const WCHAR endlv10[] = {'\r','\n'};
ME_Cursor cursor = editor->pCursors[0]; ME_Cursor cursor = editor->pCursors[0];
ME_Paragraph *para = cursor.para; ME_Paragraph *para = cursor.para;
int from, to; int from, to;
...@@ -2530,7 +2525,7 @@ static BOOL handle_enter(ME_TextEditor *editor) ...@@ -2530,7 +2525,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
editor->pCursors[0].para = para; editor->pCursors[0].para = para;
editor->pCursors[0].run = para_first_run( para ); editor->pCursors[0].run = para_first_run( para );
editor->pCursors[1] = editor->pCursors[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 );
para = editor_first_para( editor ); para = editor_first_para( editor );
editor_set_default_para_fmt( editor, &para->fmt ); editor_set_default_para_fmt( editor, &para->fmt );
para->nFlags = 0; para->nFlags = 0;
...@@ -2579,7 +2574,7 @@ static BOOL handle_enter(ME_TextEditor *editor) ...@@ -2579,7 +2574,7 @@ static BOOL handle_enter(ME_TextEditor *editor)
} }
editor->pCursors[0].nOffset = 0; editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[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 else
{ {
...@@ -2611,9 +2606,9 @@ static BOOL handle_enter(ME_TextEditor *editor) ...@@ -2611,9 +2606,9 @@ static BOOL handle_enter(ME_TextEditor *editor)
ME_InsertEndRowFromCursor(editor, 0); ME_InsertEndRowFromCursor(editor, 0);
else else
if (!editor->bEmulateVersion10) if (!editor->bEmulateVersion10)
ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style); ME_InsertTextFromCursor(editor, 0, L"\r", 1, eop_style);
else else
ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style); ME_InsertTextFromCursor(editor, 0, L"\r\n", 2, eop_style);
ME_CommitCoalescingUndo(editor); ME_CommitCoalescingUndo(editor);
SetCursor(NULL); SetCursor(NULL);
......
...@@ -1139,11 +1139,9 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream, ...@@ -1139,11 +1139,9 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
if (!editor->bEmulateVersion10 && cursor.run->nFlags & MERF_ENDPARA) if (!editor->bEmulateVersion10 && cursor.run->nFlags & MERF_ENDPARA)
{ {
static const WCHAR szEOL[] = { '\r', '\n' };
/* richedit 2.0 - all line breaks are \r\n */ /* richedit 2.0 - all line breaks are \r\n */
if (dwFormat & SF_UNICODE) 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 else
success = ME_StreamOutMove(pStream, "\r\n", 2); success = ME_StreamOutMove(pStream, "\r\n", 2);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment