Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: core/fpdfdoc/cpdf_interform.cpp

Issue 2331233002: Get rid of memcmp in CFieldTree::Lookup() (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 <vector> 7 #include <vector>
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 delete pNode; 627 delete pNode;
628 } 628 }
629 629
630 CFieldTree::Node* CFieldTree::Lookup(Node* pParent, 630 CFieldTree::Node* CFieldTree::Lookup(Node* pParent,
631 const CFX_WideString& short_name) { 631 const CFX_WideString& short_name) {
632 if (!pParent) 632 if (!pParent)
633 return nullptr; 633 return nullptr;
634 634
635 for (int i = 0; i < pParent->children.GetSize(); i++) { 635 for (int i = 0; i < pParent->children.GetSize(); i++) {
636 Node* pNode = pParent->children[i]; 636 Node* pNode = pParent->children[i];
637 if (pNode->short_name.GetLength() == short_name.GetLength() && 637 if (pNode->short_name == short_name)
638 FXSYS_memcmp(pNode->short_name.c_str(), short_name.c_str(),
639 short_name.GetLength() * sizeof(FX_WCHAR)) == 0) {
640 return pNode; 638 return pNode;
641 }
642 } 639 }
643 return nullptr; 640 return nullptr;
644 } 641 }
645 642
646 void CFieldTree::RemoveAll() { 643 void CFieldTree::RemoveAll() {
647 for (int i = 0; i < m_Root.children.GetSize(); i++) 644 for (int i = 0; i < m_Root.children.GetSize(); i++)
648 RemoveNode(m_Root.children[i]); 645 RemoveNode(m_Root.children[i]);
649 } 646 }
650 647
651 void CFieldTree::SetField(const CFX_WideString& full_name, 648 void CFieldTree::SetField(const CFX_WideString& full_name,
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 FDF_ImportField(pField, L"", bNotify); 1624 FDF_ImportField(pField, L"", bNotify);
1628 } 1625 }
1629 if (bNotify && m_pFormNotify) 1626 if (bNotify && m_pFormNotify)
1630 m_pFormNotify->AfterFormImportData(this); 1627 m_pFormNotify->AfterFormImportData(this);
1631 return TRUE; 1628 return TRUE;
1632 } 1629 }
1633 1630
1634 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { 1631 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) {
1635 m_pFormNotify = pNotify; 1632 m_pFormNotify = pNotify;
1636 } 1633 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698