[PATCH] riched20: Turn several constants and variables into static constants
Alex Henrie
alexhenrie24 at gmail.com
Fri Nov 30 01:14:17 CST 2018
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/riched20/editor.c | 4 ++--
dlls/riched20/paint.c | 4 ++--
dlls/riched20/para.c | 2 +-
dlls/riched20/run.c | 2 +-
dlls/riched20/table.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 052400c99f..99c87bf61d 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2520,11 +2520,11 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
if (editor->styleFlags & ES_MULTILINE)
{
+ static const WCHAR endl = '\r';
+ static const WCHAR endlv10[] = {'\r','\n'};
ME_Cursor cursor = editor->pCursors[0];
ME_DisplayItem *para = cursor.pPara;
int from, to;
- const WCHAR endl = '\r';
- const WCHAR endlv10[] = {'\r','\n'};
ME_Style *style, *eop_style;
if (editor->styleFlags & ES_READONLY) {
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 44cf3cbe78..e2ccef4fbf 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -989,7 +989,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
}
if (me_debug)
{
- const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
+ static const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
WCHAR buf[128];
POINT pt = c->pt;
wsprintfW(buf, wszRowDebug, no);
@@ -1017,7 +1017,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
c->pt.y + para->pt.y + run->pt.y + baseline, p, para);
if (me_debug)
{
- const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
+ static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
WCHAR buf[2560];
POINT pt;
pt.x = c->pt.x + run->pt.x;
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index c4ddb65d4e..7781ff2dce 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -152,6 +152,7 @@ void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
void ME_MakeFirstParagraph(ME_TextEditor *editor)
{
+ static const WCHAR cr_lf[] = {'\r','\n',0};
ME_Context c;
CHARFORMAT2W cf;
const CHARFORMATW *host_cf;
@@ -162,7 +163,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
ME_DisplayItem *run;
ME_Style *style;
int eol_len;
- WCHAR cr_lf[] = {'\r','\n',0};
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 2cdd3d804a..66c24f88b7 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -612,8 +612,8 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visu
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
int startx, int *pAscent, int *pDescent)
{
+ static const WCHAR spaceW[] = {' ',0};
SIZE size;
- WCHAR spaceW[] = {' ',0};
nLen = min( nLen, run->len );
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index 4cd77eb399..7e8d7ffacb 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -56,6 +56,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
+static const WCHAR cr_lf[] = {'\r', '\n', 0};
+
static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
int nCursor,
const WCHAR *eol_str, int eol_len,
@@ -77,7 +79,6 @@ static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
{
ME_DisplayItem *para;
- WCHAR cr_lf[] = {'\r', '\n', 0};
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWSTART);
return para->member.para.prev_para;
}
@@ -128,7 +129,6 @@ ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor)
ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
{
ME_DisplayItem *para;
- WCHAR cr_lf[] = {'\r', '\n', 0};
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWEND);
return para->member.para.prev_para;
}
--
2.19.2
More information about the wine-devel
mailing list