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

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

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | « core/fpdfdoc/cpdf_filespec_unittest.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.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 "core/fpdfdoc/cpdf_formfield.h" 7 #include "core/fpdfdoc/cpdf_formfield.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 } else { 569 } else {
570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); 570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
571 if (pValue) { 571 if (pValue) {
572 if (GetType() == ListBox) { 572 if (GetType() == ListBox) {
573 SelectOption(index, false); 573 SelectOption(index, false);
574 if (pValue->IsString()) { 574 if (pValue->IsString()) {
575 if (pValue->GetUnicodeText() == opt_value) 575 if (pValue->GetUnicodeText() == opt_value)
576 m_pDict->RemoveFor("V"); 576 m_pDict->RemoveFor("V");
577 } else if (pValue->IsArray()) { 577 } else if (pValue->IsArray()) {
578 std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( 578 std::unique_ptr<CPDF_Array> pArray(new CPDF_Array);
579 new CPDF_Array);
580 for (int i = 0; i < CountOptions(); i++) { 579 for (int i = 0; i < CountOptions(); i++) {
581 if (i != index && IsItemSelected(i)) { 580 if (i != index && IsItemSelected(i)) {
582 opt_value = GetOptionValue(i); 581 opt_value = GetOptionValue(i);
583 pArray->AddString(PDF_EncodeText(opt_value)); 582 pArray->AddString(PDF_EncodeText(opt_value));
584 } 583 }
585 } 584 }
586 if (pArray->GetCount() > 0) 585 if (pArray->GetCount() > 0)
587 m_pDict->SetFor("V", pArray.release()); // std::move someday 586 m_pDict->SetFor("V", pArray.release()); // std::move someday
588 } 587 }
589 } else { 588 } else {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 case ListBox: 989 case ListBox:
991 NotifyAfterSelectionChange(); 990 NotifyAfterSelectionChange();
992 break; 991 break;
993 case ComboBox: 992 case ComboBox:
994 NotifyAfterValueChange(); 993 NotifyAfterValueChange();
995 break; 994 break;
996 default: 995 default:
997 break; 996 break;
998 } 997 }
999 } 998 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_filespec_unittest.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698