diff options
author | tsepez <tsepez@chromium.org> | 2016-04-19 14:11:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-19 14:11:59 -0700 |
commit | 4d31d0c653cf66f72bdef7cebbf7cff45d33f6c6 (patch) | |
tree | 63bd0f15c758b60a5ce577ac1a1f8bb24cb387c8 /core/fpdfdoc/doc_form.cpp | |
parent | e3bbfa29b9d38dbbb77c12692eba3c40a7fb2870 (diff) | |
download | pdfium-4d31d0c653cf66f72bdef7cebbf7cff45d33f6c6.tar.xz |
Remove a few more char* members from structs/classes.
This is a result of looking for the anti-paterns /char\*\sm_/
and /m_.*=.*\.c_str/ which indicate that a class may be using
the contents of a string without extending the lifetime of
the underlying storage.
Along the way, change to uint8_t in fx_dib; this is unrelated but
avoids grep hits (it is binary, not chars anyways).
Also remove two string operators that make it easy to assign in
a manner that does not extend contents lifetime.
Review URL: https://codereview.chromium.org/1902953002
Diffstat (limited to 'core/fpdfdoc/doc_form.cpp')
-rw-r--r-- | core/fpdfdoc/doc_form.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 5062b45452..d356a5c0e1 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -48,11 +48,12 @@ CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, class CFieldNameExtractor { public: - explicit CFieldNameExtractor(const CFX_WideString& full_name) { - m_pStart = full_name.c_str(); - m_pEnd = m_pStart + full_name.GetLength(); - m_pCur = m_pStart; + explicit CFieldNameExtractor(const CFX_WideString& full_name) + : m_FullName(full_name) { + m_pCur = m_FullName.c_str(); + m_pEnd = m_pCur + m_FullName.GetLength(); } + void GetNext(const FX_WCHAR*& pSubName, FX_STRSIZE& size) { pSubName = m_pCur; while (m_pCur < m_pEnd && m_pCur[0] != L'.') { @@ -65,10 +66,11 @@ class CFieldNameExtractor { } protected: - const FX_WCHAR* m_pStart; - const FX_WCHAR* m_pEnd; + CFX_WideString m_FullName; const FX_WCHAR* m_pCur; + const FX_WCHAR* m_pEnd; }; + class CFieldTree { public: struct _Node { |