Remove a memset() in CFDE_TextEditEngine::RebuildPieces().
The struct being cleared with memset() gets properly initialized
right afterwards. Rearrange the code to initialized the variables in the
struct in order.
Change-Id: Idaa2b53831b2ed0f5c3e1dfe6b758afb42899334
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/59870
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fde/cfde_texteditengine.cpp b/xfa/fde/cfde_texteditengine.cpp
index e67b7d7..ca40913 100644
--- a/xfa/fde/cfde_texteditengine.cpp
+++ b/xfa/fde/cfde_texteditengine.cpp
@@ -1116,19 +1116,17 @@
const CFX_BreakPiece* piece = text_break_.GetBreakPieceUnstable(i);
FDE_TEXTEDITPIECE txtEdtPiece;
- memset(&txtEdtPiece, 0, sizeof(FDE_TEXTEDITPIECE));
-
- txtEdtPiece.nBidiLevel = piece->m_iBidiLevel;
- txtEdtPiece.nCount = piece->GetLength();
- txtEdtPiece.nStart = current_piece_start;
- txtEdtPiece.dwCharStyles = piece->m_dwCharStyles;
- if (FX_IsOdd(piece->m_iBidiLevel))
- txtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
-
txtEdtPiece.rtPiece.left = piece->m_iStartPos / 20000.0f;
txtEdtPiece.rtPiece.top = current_line_start;
txtEdtPiece.rtPiece.width = piece->m_iWidth / 20000.0f;
txtEdtPiece.rtPiece.height = line_spacing_;
+ txtEdtPiece.nStart = current_piece_start;
+ txtEdtPiece.nCount = piece->GetLength();
+ txtEdtPiece.nBidiLevel = piece->m_iBidiLevel;
+ txtEdtPiece.dwCharStyles = piece->m_dwCharStyles;
+ if (FX_IsOdd(piece->m_iBidiLevel))
+ txtEdtPiece.dwCharStyles |= FX_TXTCHARSTYLE_OddBidiLevel;
+
text_piece_info_.push_back(txtEdtPiece);
if (initialized_bounding_box) {