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

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

Issue 1867183002: Use std::vector as internal storage for CPDF_Array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
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 "core/fpdfdoc/cpvt_generateap.h" 7 #include "core/fpdfdoc/cpvt_generateap.h"
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_parser/include/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 : nullptr; 350 : nullptr;
351 CPDF_Array* pSels = FPDF_GetFieldAttr(pAnnotDict, "I") 351 CPDF_Array* pSels = FPDF_GetFieldAttr(pAnnotDict, "I")
352 ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray() 352 ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray()
353 : nullptr; 353 : nullptr;
354 int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") 354 int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI")
355 ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() 355 ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger()
356 : 0; 356 : 0;
357 CFX_ByteTextBuf sBody; 357 CFX_ByteTextBuf sBody;
358 if (pOpts) { 358 if (pOpts) {
359 FX_FLOAT fy = rcBody.top; 359 FX_FLOAT fy = rcBody.top;
360 for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { 360 for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
Oliver Chang 2016/04/11 21:54:40 It looks like this change is causing this: https:/
Oliver Chang 2016/04/11 22:01:29 Oh, it might be 'WarningLevel': '3',. Let's see wh
361 if (IsFloatSmaller(fy, rcBody.bottom)) 361 if (IsFloatSmaller(fy, rcBody.bottom))
362 break; 362 break;
363 363
364 if (CPDF_Object* pOpt = pOpts->GetDirectObjectAt(i)) { 364 if (CPDF_Object* pOpt = pOpts->GetDirectObjectAt(i)) {
365 CFX_WideString swItem; 365 CFX_WideString swItem;
366 if (pOpt->IsString()) 366 if (pOpt->IsString())
367 swItem = pOpt->GetUnicodeText(); 367 swItem = pOpt->GetUnicodeText();
368 else if (CPDF_Array* pArray = pOpt->AsArray()) 368 else if (CPDF_Array* pArray = pOpt->AsArray())
369 swItem = pArray->GetDirectObjectAt(1)->GetUnicodeText(); 369 swItem = pArray->GetDirectObjectAt(1)->GetUnicodeText();
370 370
371 FX_BOOL bSelected = FALSE; 371 FX_BOOL bSelected = FALSE;
372 if (pSels) { 372 if (pSels) {
373 for (uint32_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) { 373 for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
374 if (i == pSels->GetIntegerAt(s)) { 374 if (i == pSels->GetIntegerAt(s)) {
375 bSelected = TRUE; 375 bSelected = TRUE;
376 break; 376 break;
377 } 377 }
378 } 378 }
379 } 379 }
380 CPDF_VariableText vt; 380 CPDF_VariableText vt;
381 vt.SetProvider(&prd); 381 vt.SetProvider(&prd);
382 vt.SetPlateRect( 382 vt.SetPlateRect(
383 CFX_FloatRect(rcBody.left, 0.0f, rcBody.right, 0.0f)); 383 CFX_FloatRect(rcBody.left, 0.0f, rcBody.right, 0.0f));
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 int32_t nFontIndex, 763 int32_t nFontIndex,
764 FX_FLOAT fFontSize) { 764 FX_FLOAT fFontSize) {
765 CFX_ByteTextBuf sRet; 765 CFX_ByteTextBuf sRet;
766 if (pFontMap) { 766 if (pFontMap) {
767 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); 767 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
768 if (sFontAlias.GetLength() > 0 && fFontSize > 0) 768 if (sFontAlias.GetLength() > 0 && fFontSize > 0)
769 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; 769 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
770 } 770 }
771 return sRet.GetByteString(); 771 return sRet.GetByteString();
772 } 772 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698