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

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

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « core/src/fpdfdoc/doc_formcontrol.cpp ('k') | core/src/fpdfdoc/doc_metadata.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 "doc_utils.h" 8 #include "doc_utils.h"
9 9
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField) 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField)
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 int CPDF_FormField::GetSelectedIndex(int index) 466 int CPDF_FormField::GetSelectedIndex(int index)
467 { 467 {
468 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); 468 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
469 if (pValue == NULL) { 469 if (pValue == NULL) {
470 pValue = FPDF_GetFieldAttr(m_pDict, "I"); 470 pValue = FPDF_GetFieldAttr(m_pDict, "I");
471 if (pValue == NULL) { 471 if (pValue == NULL) {
472 return -1; 472 return -1;
473 } 473 }
474 } 474 }
475 if (pValue->GetType() == PDFOBJ_NUMBER) {
476 return pValue->GetInteger();
477 }
475 CFX_WideString sel_value; 478 CFX_WideString sel_value;
476 if (pValue->GetType() == PDFOBJ_STRING) { 479 if (pValue->GetType() == PDFOBJ_STRING) {
477 if (index != 0) { 480 if (index != 0) {
478 return -1; 481 return -1;
479 } 482 }
480 sel_value = pValue->GetUnicodeText(); 483 sel_value = pValue->GetUnicodeText();
481 } else if (pValue->GetType() == PDFOBJ_NUMBER) {
482 return pValue->GetInteger();
483 } else { 484 } else {
484 if (pValue->GetType() != PDFOBJ_ARRAY) { 485 if (pValue->GetType() != PDFOBJ_ARRAY) {
485 return -1; 486 return -1;
486 } 487 }
487 if (index < 0) { 488 if (index < 0) {
488 return -1; 489 return -1;
489 } 490 }
490 CPDF_Object* elementValue = ((CPDF_Array*)pValue)->GetElementValue(index ); 491 CPDF_Object* elementValue = ((CPDF_Array*)pValue)->GetElementValue(index );
491 sel_value = elementValue ? elementValue->GetUnicodeText() : CFX_WideStri ng(); 492 sel_value = elementValue ? elementValue->GetUnicodeText() : CFX_WideStri ng();
492 } 493 }
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && 1097 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") &&
1097 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) 1098 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") )
1098 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name); 1099 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo nt_name);
1099 1100
1100 if (pFontDict == NULL) { 1101 if (pFontDict == NULL) {
1101 return; 1102 return;
1102 } 1103 }
1103 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1104 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1104 m_FontSize = FX_atof(syntax.GetWord()); 1105 m_FontSize = FX_atof(syntax.GetWord());
1105 } 1106 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_formcontrol.cpp ('k') | core/src/fpdfdoc/doc_metadata.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698