From 33805cc811c722a0c5cd439cff419de252cd39c9 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 27 Jul 2017 16:28:44 -0400 Subject: Remove single param Mid() method from string classes This support is being removed from CFX_ByteString, CFX_ByteStringC, CFX_WideString, and CFX_WideStringC. This standardizes all of these classes to only have one Mid method that takes in 2 params, offset and count. Count now must be positive. The old behaviour of calculating the length for the user if -1 is passed in for the count has been removed. This work is in preperation for converting these classes to not accept negative lengths anywhere and thus make the underlying size type unsigned. BUG=pdfium:828 Change-Id: I5f15e7b7b00b264231817f143e2da88ee6f69e7b Reviewed-on: https://pdfium-review.googlesource.com/9430 Reviewed-by: (OOO Jul 28 - Aug 8) dsinclair Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fpdfdoc/cpvt_generateap.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core/fpdfdoc/cpvt_generateap.cpp') diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index eb874b3352..83c1f65587 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -65,15 +65,17 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, if (!pDRFontDict) return false; - CPDF_Dictionary* pFontDict = pDRFontDict->GetDictFor(sFontName.Mid(1)); + CPDF_Dictionary* pFontDict = + pDRFontDict->GetDictFor(sFontName.Mid(1, sFontName.GetLength() - 1)); if (!pFontDict) { pFontDict = pDoc->NewIndirect(); pFontDict->SetNewFor("Type", "Font"); pFontDict->SetNewFor("Subtype", "Type1"); pFontDict->SetNewFor("BaseFont", "Helvetica"); pFontDict->SetNewFor("Encoding", "WinAnsiEncoding"); - pDRFontDict->SetNewFor(sFontName.Mid(1), pDoc, - pFontDict->GetObjNum()); + pDRFontDict->SetNewFor( + sFontName.Mid(1, sFontName.GetLength() - 1), pDoc, + pFontDict->GetObjNum()); } CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); if (!pDefFont) -- cgit v1.2.3