diff options
author | Lei Zhang <thestig@chromium.org> | 2017-06-09 11:04:41 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-09 18:33:56 +0000 |
commit | 59c1ac070d1c8ca70e96805b697c5635ccd70cdf (patch) | |
tree | 52ea762d0c694e241ed05f071e4295a47eb29007 /fpdfsdk/fpdfannot.cpp | |
parent | 7e2d1f4cb2af916e0d5eb01bb6b9cb3ffa0736c3 (diff) | |
download | pdfium-59c1ac070d1c8ca70e96805b697c5635ccd70cdf.tar.xz |
Simplify CPDF_Array::RemoveAt(index, size).
Instead of one general RemoveAt() method, split it into:
- RemoveAt(index)
- Truncate(nNewSize)
- Clear()
Update callers, which are now easier to understand.
Update existing unit tests and add new tests.
Change-Id: I38fe40146ce8f2479677b2caadd20a1756678768
Reviewed-on: https://pdfium-review.googlesource.com/6417
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r-- | fpdfsdk/fpdfannot.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp index 941a5fdd80..0c2152a7aa 100644 --- a/fpdfsdk/fpdfannot.cpp +++ b/fpdfsdk/fpdfannot.cpp @@ -184,7 +184,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_SetColor(FPDF_ANNOTATION annot, CFX_ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C"; CPDF_Array* pColor = pAnnotDict->GetArrayFor(key); if (pColor) - pColor->RemoveAt(0, pColor->GetCount()); + pColor->Clear(); else pColor = pAnnotDict->SetNewFor<CPDF_Array>(key); @@ -270,7 +270,7 @@ FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot, CPDF_Dictionary* pAnnotDict = CPDFDictionaryFromFPDFAnnotation(annot); CPDF_Array* pQuadPoints = pAnnotDict->GetArrayFor("QuadPoints"); if (pQuadPoints) - pQuadPoints->RemoveAt(0, pQuadPoints->GetCount()); + pQuadPoints->Clear(); else pQuadPoints = pAnnotDict->SetNewFor<CPDF_Array>("QuadPoints"); @@ -315,7 +315,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFAnnot_SetRect(FPDF_ANNOTATION annot, CPDF_Array* pRect = pAnnotDict->GetArrayFor("Rect"); if (pRect) - pRect->RemoveAt(0, pRect->GetCount()); + pRect->Clear(); else pRect = pAnnotDict->SetNewFor<CPDF_Array>("Rect"); |