richedit: Avoid comparing padding in cursor structures on memcmp.
Dylan Smith
dylan.ah.smith at gmail.com
Fri Aug 7 00:56:50 CDT 2009
The ME_Cursor structure may contain padding when compiled on a 64-bit
platform which would be uninitialized, which would be compared with a
memcmp. This patch avoids the problem by just comparing the runs and
offsets within the runs.
---
dlls/riched20/caret.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 1cb44bc..33dbdaf 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -1493,7 +1493,8 @@ static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
BOOL ME_IsSelection(ME_TextEditor *editor)
{
- return memcmp(&editor->pCursors[0], &editor->pCursors[1], sizeof(ME_Cursor))!=0;
+ return editor->pCursors[0].pRun != editor->pCursors[1].pRun ||
+ editor->pCursors[0].nOffset != editor->pCursors[1].nOffset;
}
static int ME_GetSelCursor(ME_TextEditor *editor, int dir)
More information about the wine-patches
mailing list