diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-03 19:12:34 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-03 19:12:34 +0000 |
commit | 95b0293a29b235c746db0f01c8462ca89d7a814e (patch) | |
tree | ed5e19f83b4e5d0e90bac2c0764175a8ed7a5b8f /xfa/fgas | |
parent | d96fa3b42797332ab53c05b8e6b6357676838e55 (diff) | |
download | pdfium-95b0293a29b235c746db0f01c8462ca89d7a814e.tar.xz |
Use more UnowendPtr<> in cfgas_formatstring.h and cfx_break.h
Move initializers to .h file (proves none missing).
Change-Id: Iff8fe76e46634aa32a32ecd592476594a9d1bafa
Reviewed-on: https://pdfium-review.googlesource.com/36950
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring.h | 3 | ||||
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring_unittest.cpp | 1 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_break.cpp | 22 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_break.h | 41 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_rtfbreak.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.cpp | 2 |
6 files changed, 29 insertions, 42 deletions
diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h index 2cc5d569cd..3cbe6ff65a 100644 --- a/xfa/fgas/crt/cfgas_formatstring.h +++ b/xfa/fgas/crt/cfgas_formatstring.h @@ -10,6 +10,7 @@ #include <vector> #include "core/fxcrt/locale_iface.h" +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" bool FX_DateFromCanonical(const WideString& wsDate, CFX_DateTime* datetime); @@ -67,7 +68,7 @@ class CFGAS_FormatString { WideString* wsDatePattern, WideString* wsTimePattern); - CXFA_LocaleMgr* m_pLocaleMgr; + UnownedPtr<CXFA_LocaleMgr> m_pLocaleMgr; }; #endif // XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_ diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp index 51c001090c..afbd00f068 100644 --- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp +++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp @@ -44,6 +44,7 @@ class CFGAS_FormatStringTest : public testing::Test { // Note, this re-creates the fmt on each call. If you need to multiple // times store it locally. CFGAS_FormatString* fmt(const WideString& locale) { + fmt_.reset(); // Can't outlive |mgr_|. mgr_ = pdfium::MakeUnique<CXFA_LocaleMgr>(nullptr, locale); fmt_ = pdfium::MakeUnique<CFGAS_FormatString>(mgr_.get()); return fmt_.get(); diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp index 889c043ec2..43ef9a3833 100644 --- a/xfa/fgas/layout/cfx_break.cpp +++ b/xfa/fgas/layout/cfx_break.cpp @@ -19,29 +19,11 @@ const int kMinimumTabWidth = 160000; } // namespace CFX_Break::CFX_Break(uint32_t dwLayoutStyles) - : m_eCharType(FX_CHARTYPE_Unknown), - m_bSingleLine(false), - m_bCombText(false), - m_dwIdentity(0), - m_dwLayoutStyles(dwLayoutStyles), - m_iLineStart(0), - m_iLineWidth(2000000), - m_wParagraphBreakChar(L'\n'), - m_iFontSize(240), - m_iTabWidth(720000), - m_iHorizontalScale(100), - m_iVerticalScale(100), - m_iTolerance(0), - m_iCharSpace(0), - m_iDefChar(0), - m_wDefChar(0xFEFF), - m_pFont(nullptr), - m_pCurLine(nullptr), - m_iReadyLineIndex(-1) { + : m_dwLayoutStyles(dwLayoutStyles) { m_pCurLine = &m_Line[0]; } -CFX_Break::~CFX_Break() {} +CFX_Break::~CFX_Break() = default; void CFX_Break::Reset() { m_eCharType = FX_CHARTYPE_Unknown; diff --git a/xfa/fgas/layout/cfx_break.h b/xfa/fgas/layout/cfx_break.h index cc985b7c59..88cef53df1 100644 --- a/xfa/fgas/layout/cfx_break.h +++ b/xfa/fgas/layout/cfx_break.h @@ -10,6 +10,7 @@ #include <stdint.h> #include "core/fxcrt/retain_ptr.h" +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fgas/layout/cfx_breakline.h" class CFGAS_GEFont; @@ -57,7 +58,9 @@ class CFX_Break { void ClearBreakPieces(); CFX_Char* GetLastChar(int32_t index, bool bOmitChar, bool bRichText) const; - const CFX_BreakLine* GetCurrentLineForTesting() const { return m_pCurLine; } + const CFX_BreakLine* GetCurrentLineForTesting() const { + return m_pCurLine.Get(); + } protected: explicit CFX_Break(uint32_t dwLayoutStyles); @@ -66,25 +69,25 @@ class CFX_Break { bool HasLine() const { return m_iReadyLineIndex >= 0; } FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const; - FX_CHARTYPE m_eCharType; - bool m_bSingleLine; - bool m_bCombText; - uint32_t m_dwIdentity; - uint32_t m_dwLayoutStyles; - int32_t m_iLineStart; - int32_t m_iLineWidth; - wchar_t m_wParagraphBreakChar; - int32_t m_iFontSize; - int32_t m_iTabWidth; - int32_t m_iHorizontalScale; - int32_t m_iVerticalScale; - int32_t m_iTolerance; - int32_t m_iCharSpace; - int32_t m_iDefChar; - wchar_t m_wDefChar; + FX_CHARTYPE m_eCharType = FX_CHARTYPE_Unknown; + bool m_bSingleLine = false; + bool m_bCombText = false; + uint32_t m_dwIdentity = 0; + uint32_t m_dwLayoutStyles = 0; + int32_t m_iLineStart = 0; + int32_t m_iLineWidth = 2000000; + wchar_t m_wParagraphBreakChar = L'\n'; + int32_t m_iFontSize = 240; + int32_t m_iTabWidth = 720000; + int32_t m_iHorizontalScale = 100; + int32_t m_iVerticalScale = 100; + int32_t m_iTolerance = 0; + int32_t m_iCharSpace = 0; + int32_t m_iDefChar = 0; + wchar_t m_wDefChar = 0xFEFF; RetainPtr<CFGAS_GEFont> m_pFont; - CFX_BreakLine* m_pCurLine; - int8_t m_iReadyLineIndex; + UnownedPtr<CFX_BreakLine> m_pCurLine; + int8_t m_iReadyLineIndex = -1; CFX_BreakLine m_Line[2]; private: diff --git a/xfa/fgas/layout/cfx_rtfbreak.cpp b/xfa/fgas/layout/cfx_rtfbreak.cpp index de8703fb2d..4dfe8989d1 100644 --- a/xfa/fgas/layout/cfx_rtfbreak.cpp +++ b/xfa/fgas/layout/cfx_rtfbreak.cpp @@ -355,7 +355,7 @@ bool CFX_RTFBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine, case FX_CHARTYPE_Space: break; default: - SplitTextLine(m_pCurLine, pNextLine, !m_bPagination && bAllChars); + SplitTextLine(m_pCurLine.Get(), pNextLine, !m_bPagination && bAllChars); bDone = true; break; } diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index 7633c4c91e..490426a221 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp @@ -293,7 +293,7 @@ bool CFX_TxtBreak::EndBreak_SplitLine(CFX_BreakLine* pNextLine, case FX_CHARTYPE_Space: break; default: - SplitTextLine(m_pCurLine, pNextLine, bAllChars); + SplitTextLine(m_pCurLine.Get(), pNextLine, bAllChars); bDone = true; break; } |