Chromium Code Reviews

Side by Side Diff: core/src/fpdfdoc/doc_form.cpp

Issue 1101933003: Reduce usage of operator LPCWSTR from CFX_WideString(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore operator. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 #include "../../include/fxcrt/fx_xml.h" 8 #include "../../include/fxcrt/fx_xml.h"
9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); 9 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict);
10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu ment* pDocument); 10 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Docu ment* pDocument);
(...skipping 16 matching lines...)
27 FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFi eldName); 27 FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFi eldName);
28 FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, i nt nLevel = 0); 28 FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, i nt nLevel = 0);
29 void EncodeFieldName(const CFX_WideString& csName, CFX_ByteSt ring& csT); 29 void EncodeFieldName(const CFX_WideString& csName, CFX_ByteSt ring& csT);
30 void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int n Level = 0); 30 void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int n Level = 0);
31 const int nMaxRecursion = 32; 31 const int nMaxRecursion = 32;
32 class _CFieldNameExtractor 32 class _CFieldNameExtractor
33 { 33 {
34 public: 34 public:
35 _CFieldNameExtractor(const CFX_WideString& full_name) 35 _CFieldNameExtractor(const CFX_WideString& full_name)
36 { 36 {
37 m_pStart = full_name; 37 m_pStart = full_name.c_str();
38 m_pEnd = m_pStart + full_name.GetLength(); 38 m_pEnd = m_pStart + full_name.GetLength();
39 m_pCur = m_pStart; 39 m_pCur = m_pStart;
40 } 40 }
41 void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size) 41 void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size)
42 { 42 {
43 pSubName = m_pCur; 43 pSubName = m_pCur;
44 while (m_pCur < m_pEnd && m_pCur[0] != L'.') { 44 while (m_pCur < m_pEnd && m_pCur[0] != L'.') {
45 m_pCur++; 45 m_pCur++;
46 } 46 }
47 size = (FX_STRSIZE)(m_pCur - pSubName); 47 size = (FX_STRSIZE)(m_pCur - pSubName);
(...skipping 678 matching lines...)
726 if (i == name2.GetLength()) { 726 if (i == name2.GetLength()) {
727 return 3; 727 return 3;
728 } 728 }
729 return 0; 729 return 0;
730 } else { 730 } else {
731 return name1 == name2 ? 1 : 0; 731 return name1 == name2 ? 1 : 0;
732 } 732 }
733 } 733 }
734 int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_Wide String& name2) 734 int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_Wide String& name2)
735 { 735 {
736 FX_LPCWSTR ptr1 = name1, ptr2 = name2; 736 FX_LPCWSTR ptr1 = name1.c_str();
737 FX_LPCWSTR ptr2 = name2.c_str();
737 if (name1.GetLength() != name2.GetLength()) { 738 if (name1.GetLength() != name2.GetLength()) {
738 int i = 0; 739 int i = 0;
739 while (ptr1[i] == ptr2[i]) { 740 while (ptr1[i] == ptr2[i]) {
740 i ++; 741 i ++;
741 } 742 }
742 if (i == name1.GetLength()) { 743 if (i == name1.GetLength()) {
743 return 2; 744 return 2;
744 } 745 }
745 if (i == name2.GetLength()) { 746 if (i == name2.GetLength()) {
746 return 3; 747 return 3;
(...skipping 902 matching lines...)
1649 continue; 1650 continue;
1650 } 1651 }
1651 CPDF_FormControl* pControl = NULL; 1652 CPDF_FormControl* pControl = NULL;
1652 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { 1653 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) {
1653 return iNewPage; 1654 return iNewPage;
1654 } 1655 }
1655 } 1656 }
1656 } while (TRUE); 1657 } while (TRUE);
1657 return -1; 1658 return -1;
1658 } 1659 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine