Avoid adding std::size() to compute end pointers.

std::end() is cleaner and avoids ptr arithmetic getting flagged.

Change-Id: Ife2c54b973aecbb9a0698a01d5e2cd5d27d6527e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/109670
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index f5a51b2..fb9a798 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -888,10 +888,12 @@
   if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
     return nullptr;
 
-  const auto* pEnd = kJapan1VerticalCIDs + std::size(kJapan1VerticalCIDs);
+  const auto* pBegin = std::begin(kJapan1VerticalCIDs);
+  const auto* pEnd = std::end(kJapan1VerticalCIDs);
   const auto* pTransform = std::lower_bound(
-      kJapan1VerticalCIDs, pEnd, cid,
+      pBegin, pEnd, cid,
       [](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; });
+
   return (pTransform < pEnd && cid == pTransform->cid) ? &pTransform->a
                                                        : nullptr;
 }
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index e8b8876..9cc421c 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -2450,14 +2450,17 @@
 WideString FGAS_FontNameToEnglishName(const WideString& wsLocalName) {
   uint32_t dwLocalNameHash =
       FX_HashCode_GetLoweredW(wsLocalName.AsStringView());
-  const FGAS_FontInfo* pEnd = kXFAFontsMap + std::size(kXFAFontsMap);
+  const FGAS_FontInfo* pBegin = std::begin(kXFAFontsMap);
+  const FGAS_FontInfo* pEnd = std::end(kXFAFontsMap);
   const FGAS_FontInfo* pFontInfo =
-      std::lower_bound(kXFAFontsMap, pEnd, dwLocalNameHash,
+      std::lower_bound(pBegin, pEnd, dwLocalNameHash,
                        [](const FGAS_FontInfo& entry, uint32_t hash) {
                          return entry.dwFontNameHash < hash;
                        });
-  if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
+
+  if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash) {
     return WideString::FromASCII(ByteStringView(pFontInfo->pPsName));
+  }
   return wsLocalName;
 }
 
@@ -2466,13 +2469,16 @@
   wsFontNameTemp.Remove(L' ');
   uint32_t dwCurFontNameHash =
       FX_HashCode_GetLoweredW(wsFontNameTemp.AsStringView());
-  const FGAS_FontInfo* pEnd = kXFAFontsMap + std::size(kXFAFontsMap);
+  const FGAS_FontInfo* pBegin = std::begin(kXFAFontsMap);
+  const FGAS_FontInfo* pEnd = std::end(kXFAFontsMap);
   const FGAS_FontInfo* pFontInfo =
-      std::lower_bound(kXFAFontsMap, pEnd, dwCurFontNameHash,
+      std::lower_bound(pBegin, pEnd, dwCurFontNameHash,
                        [](const FGAS_FontInfo& entry, uint32_t hash) {
                          return entry.dwFontNameHash < hash;
                        });
-  if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwCurFontNameHash)
+
+  if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwCurFontNameHash) {
     return pFontInfo;
+  }
   return nullptr;
 }