Commit 34a4f922 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

richedit: Assign equivalent structures instead of copying them.

parent a64c22c8
......@@ -68,8 +68,8 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
fmt.dwMask = PFM_ALIGNMENT | PFM_OFFSET | PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_TABSTOPS;
fmt.wAlignment = PFA_LEFT;
CopyMemory(para->member.para.pFmt, &fmt, sizeof(PARAFORMAT2));
*para->member.para.pFmt = fmt;
style = ME_MakeStyle(&cf);
text->pDefaultStyle = style;
......@@ -148,7 +148,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME
new_para->member.para.nFlags = MEPF_REWRAP; /* FIXME copy flags (if applicable) */
/* FIXME initialize format style and call ME_SetParaFormat blah blah */
CopyMemory(new_para->member.para.pFmt, run_para->member.para.pFmt, sizeof(PARAFORMAT2));
*new_para->member.para.pFmt = *run_para->member.para.pFmt;
new_para->member.para.bTable = run_para->member.para.bTable;
......@@ -226,7 +226,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp)
{
undo->nStart = pNext->member.para.nCharOfs - end_len;
assert(pNext->member.para.pFmt->cbSize == sizeof(PARAFORMAT2));
CopyMemory(undo->di.member.para.pFmt, pNext->member.para.pFmt, sizeof(PARAFORMAT2));
*undo->di.member.para.pFmt = *pNext->member.para.pFmt;
}
shift = pNext->member.para.nCharOfs - tp->member.para.nCharOfs - end_len;
......@@ -352,7 +352,7 @@ void ME_SetParaFormat(ME_TextEditor *editor, ME_DisplayItem *para, const PARAFOR
assert(sizeof(*para->member.para.pFmt) == sizeof(PARAFORMAT2));
ME_AddUndoItem(editor, diUndoSetParagraphFormat, para);
CopyMemory(&copy, para->member.para.pFmt, sizeof(PARAFORMAT2));
copy = *para->member.para.pFmt;
#define COPY_FIELD(m, f) \
if (pFmt->dwMask & (m)) { \
......@@ -447,7 +447,7 @@ void ME_GetParaFormat(ME_TextEditor *editor, const ME_DisplayItem *para, PARAFOR
{
if (pFmt->cbSize >= sizeof(PARAFORMAT2))
{
CopyMemory(pFmt, para->member.para.pFmt, sizeof(PARAFORMAT2));
*pFmt = *para->member.para.pFmt;
return;
}
CopyMemory(pFmt, para->member.para.pFmt, pFmt->cbSize);
......
......@@ -74,7 +74,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
void ME_CopyToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
{
if (ME_ToCF2W(to, from) == from)
CopyMemory(to, from, sizeof(*from));
*to = *from;
}
CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
......@@ -154,7 +154,7 @@ ME_Style *ME_MakeStyle(CHARFORMAT2W *style) {
if (style->cbSize <= sizeof(CHARFORMAT2W))
CopyMemory(&s->fmt, style, style->cbSize);
else
CopyMemory(&s->fmt, style, sizeof(CHARFORMAT2W));
s->fmt = *style;
s->fmt.cbSize = sizeof(CHARFORMAT2W);
s->nSequence = -2;
......@@ -229,7 +229,7 @@ void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc)
/* using this with non-2W structs is forbidden */
assert(pSrc->cbSize == sizeof(CHARFORMAT2W));
assert(pDest->cbSize == sizeof(CHARFORMAT2W));
CopyMemory(pDest, pSrc, sizeof(CHARFORMAT2W));
*pDest = *pSrc;
}
static void ME_DumpStyleEffect(char **p, const char *name, const CHARFORMAT2W *fmt, int mask)
......
......@@ -62,13 +62,13 @@ ME_UndoItem *ME_AddUndoItem(ME_TextEditor *editor, ME_DIType type, const ME_Disp
break;
case diUndoSetParagraphFormat:
assert(pdi);
CopyMemory(&pItem->member.para, &pdi->member.para, sizeof(ME_Paragraph));
pItem->member.para = pdi->member.para;
pItem->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2);
CopyMemory(pItem->member.para.pFmt, pdi->member.para.pFmt, sizeof(PARAFORMAT2));
*pItem->member.para.pFmt = *pdi->member.para.pFmt;
break;
case diUndoInsertRun:
assert(pdi);
CopyMemory(&pItem->member.run, &pdi->member.run, sizeof(ME_Run));
pItem->member.run = pdi->member.run;
pItem->member.run.strText = ME_StrDup(pItem->member.run.strText);
ME_AddRefStyle(pItem->member.run.style);
if (pdi->member.run.ole_obj)
......@@ -227,7 +227,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, ME_DisplayItem *pItem)
tmp.pRun = ME_SplitRunSimple(editor, tmp.pRun, tmp.nOffset);
new_para = ME_SplitParagraph(editor, tmp.pRun, tmp.pRun->member.run.style);
assert(pItem->member.para.pFmt->cbSize == sizeof(PARAFORMAT2));
CopyMemory(new_para->member.para.pFmt, pItem->member.para.pFmt, sizeof(PARAFORMAT2));
*new_para->member.para.pFmt = *pItem->member.para.pFmt;
break;
}
default:
......
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