Convert some PDFium string indexing by [0] to Front() [pdfium : main]

0 views
Skip to first unread message

Tom Sepez (Gerrit)

unread,
Apr 8, 2026, 5:42:54 PM (3 days ago) Apr 8
to Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com
Attention needed from Lei Zhang

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Lei Zhang
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
Gerrit-Change-Number: 145790
Gerrit-PatchSet: 6
Gerrit-Owner: Tom Sepez <tse...@chromium.org>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Apr 2026 21:42:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Lei Zhang (Gerrit)

unread,
Apr 8, 2026, 5:55:28 PM (3 days ago) Apr 8
to Tom Sepez, Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com
Attention needed from Tom Sepez

Lei Zhang added 4 comments

File core/fpdfdoc/cpdf_generateap.cpp
Line 143, Patchset 6 (Latest): if (border_style_string.GetLength()) {
Lei Zhang . unresolved

No longer needed?

File fpdfsdk/cpdfsdk_appstream.cpp
Line 1137, Patchset 6 (Latest): if (caption.IsEmpty()) {
Lei Zhang . unresolved

No longer needed?

File fxjs/xfa/cfxjse_resolveprocessor.cpp
Line 50, Patchset 6 (Latest): if (rnd.name_.GetLength()) {
Lei Zhang . unresolved

No longer needed?

Line 51, Patchset 6 (Latest): wchar_t wch = rnd.name_.Front();
Lei Zhang . unresolved

Pre-existing: local var not needed.

Open in Gerrit

Related details

Attention is currently required from:
  • Tom Sepez
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: pdfium
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
    Gerrit-Change-Number: 145790
    Gerrit-PatchSet: 6
    Gerrit-Owner: Tom Sepez <tse...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
    Gerrit-Attention: Tom Sepez <tse...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Apr 2026 21:55:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Lei Zhang (Gerrit)

    unread,
    Apr 8, 2026, 6:00:26 PM (3 days ago) Apr 8
    to Tom Sepez, Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com
    Attention needed from Tom Sepez

    Lei Zhang added 5 comments

    File fxjs/cjs_publicmethods.cpp
    Line 1522, Patchset 6 (Latest): if (str.GetLength() > 0 && IsDigitSeparatorOrDecimalMark(str.Front())) {
    Lei Zhang . unresolved

    No longer needed?

    File xfa/fxfa/formcalc/cxfa_fmexpression.cpp
    Line 79, Patchset 6 (Latest): if (ident.IsEmpty() || ident.Front() != L'!') {
    Lei Zhang . unresolved

    No longer needed?

    File xfa/fxfa/parser/cxfa_node.cpp
    Line 1897, Patchset 6 (Latest): if (wsInstName.GetLength() > 0 && wsInstName.Front() == '_' &&
    Lei Zhang . unresolved

    No longer needed?

    Line 1990, Patchset 6 (Latest): if (wsInstName.GetLength() < 1 || wsInstName.Front() != '_' ||
    Lei Zhang . unresolved

    No longer needed?

    Line 2024, Patchset 6 (Latest): if (wsInstName.GetLength() < 1 || wsInstName.Front() != '_' ||
    Lei Zhang . unresolved

    No longer needed?

    Related details

    Attention is currently required from:
    • Tom Sepez
    Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: pdfium
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
    Gerrit-Change-Number: 145790
    Gerrit-PatchSet: 6
    Gerrit-Owner: Tom Sepez <tse...@chromium.org>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
    Gerrit-Attention: Tom Sepez <tse...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Apr 2026 22:00:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tom Sepez (Gerrit)

    unread,
    Apr 8, 2026, 6:12:47 PM (3 days ago) Apr 8
    to Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com
    Attention needed from Lei Zhang

    Tom Sepez voted and added 9 comments

    Votes added by Tom Sepez

    Commit-Queue+1

    9 comments

    File core/fpdfdoc/cpdf_generateap.cpp
    Line 143, Patchset 6: if (border_style_string.GetLength()) {
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Done

    File fpdfsdk/cpdfsdk_appstream.cpp
    Line 1137, Patchset 6: if (caption.IsEmpty()) {
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Done

    File fxjs/cjs_publicmethods.cpp
    Line 1522, Patchset 6: if (str.GetLength() > 0 && IsDigitSeparatorOrDecimalMark(str.Front())) {
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Done

    File fxjs/xfa/cfxjse_resolveprocessor.cpp
    Line 50, Patchset 6: if (rnd.name_.GetLength()) {
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Done

    Line 51, Patchset 6: wchar_t wch = rnd.name_.Front();
    Lei Zhang . resolved

    Pre-existing: local var not needed.

    Tom Sepez

    Done

    File xfa/fxfa/formcalc/cxfa_fmexpression.cpp
    Line 79, Patchset 6: if (ident.IsEmpty() || ident.Front() != L'!') {
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Empty check helps with substr bounds elision later, typically.

    File xfa/fxfa/parser/cxfa_node.cpp
    Line 1897, Patchset 6: if (wsInstName.GetLength() > 0 && wsInstName.Front() == '_' &&
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Length check helpful for substr().

    Line 1990, Patchset 6: if (wsInstName.GetLength() < 1 || wsInstName.Front() != '_' ||
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    Length check may help elide bounds check in substr().

    Line 2024, Patchset 6: if (wsInstName.GetLength() < 1 || wsInstName.Front() != '_' ||
    Lei Zhang . resolved

    No longer needed?

    Tom Sepez

    ditto

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Lei Zhang
    Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
      Gerrit-Change-Number: 145790
      Gerrit-PatchSet: 8
      Gerrit-Owner: Tom Sepez <tse...@chromium.org>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      Gerrit-Attention: Lei Zhang <the...@chromium.org>
      Gerrit-Comment-Date: Wed, 08 Apr 2026 22:12:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Lei Zhang <the...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Lei Zhang (Gerrit)

      unread,
      Apr 8, 2026, 7:48:59 PM (3 days ago) Apr 8
      to Tom Sepez, Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com
      Attention needed from Tom Sepez

      Lei Zhang voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Tom Sepez
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
      Gerrit-Change-Number: 145790
      Gerrit-PatchSet: 8
      Gerrit-Owner: Tom Sepez <tse...@chromium.org>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      Gerrit-Attention: Tom Sepez <tse...@chromium.org>
      Gerrit-Comment-Date: Wed, 08 Apr 2026 23:48:56 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Tom Sepez (Gerrit)

      unread,
      Apr 9, 2026, 1:49:05 PM (2 days ago) Apr 9
      to Lei Zhang, Pdfium LUCI CQ, pdfium-...@googlegroups.com

      Tom Sepez voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
      Gerrit-Change-Number: 145790
      Gerrit-PatchSet: 8
      Gerrit-Owner: Tom Sepez <tse...@chromium.org>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      Gerrit-Comment-Date: Thu, 09 Apr 2026 17:49:02 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Pdfium LUCI CQ (Gerrit)

      unread,
      Apr 9, 2026, 1:55:36 PM (2 days ago) Apr 9
      to Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com

      Pdfium LUCI CQ submitted the change

      Change information

      Commit message:
      Convert some PDFium string indexing by [0] to Front()

      Indexing {Byte,Wide}Strings (as opposed to {Byte,Wide}StringViews)
      usually indicates an iteration pattern that can restrict the optimizer.

      To avoid looking at instances while reading the code where there isn't
      any iteration, remove indexing by the constant 0. This theoretically
      avoids some CHECKS() while not requiring new branches that can't be
      optimized away.
      Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
      Commit-Queue: Tom Sepez <tse...@chromium.org>
      Reviewed-by: Lei Zhang <the...@chromium.org>
      Files:
      • M core/fpdfapi/edit/cpdf_fontsubsetter.cpp
      • M core/fpdfapi/font/cpdf_cidfont.cpp
      • M core/fpdfapi/font/cpdf_font.cpp
      • M core/fpdfapi/font/cpdf_tounicodemap.cpp
      • M core/fpdfapi/font/cpdf_truetypefont.cpp
      • M core/fpdfapi/page/cpdf_textobject.cpp
      • M core/fpdfapi/parser/cpdf_syntax_parser.cpp
      • M core/fpdfdoc/cpdf_generateap.cpp
      • M core/fpdftext/cpdf_textpage.cpp
      • M core/fxcrt/xml/cfx_xmlparser.cpp
      • M fpdfsdk/cpdfsdk_appstream.cpp
      • M fxjs/cjs_field.cpp
      • M fxjs/cjs_publicmethods.cpp
      • M fxjs/xfa/cfxjse_nodehelper.cpp
      • M fxjs/xfa/cfxjse_resolveprocessor.cpp
      • M fxjs/xfa/cjx_object.cpp
      • M fxjs/xfa/cjx_subform.cpp
      • M xfa/fgas/crt/cfgas_stringformatter.cpp
      • M xfa/fxfa/cxfa_ffpasswordedit.cpp
      • M xfa/fxfa/cxfa_textparser.cpp
      • M xfa/fxfa/formcalc/cxfa_fmexpression.cpp
      • M xfa/fxfa/layout/cxfa_viewlayoutprocessor.cpp
      • M xfa/fxfa/parser/cxfa_barcode.cpp
      • M xfa/fxfa/parser/cxfa_document.cpp
      • M xfa/fxfa/parser/cxfa_node.cpp
      Change size: M
      Delta: 25 files changed, 78 insertions(+), 99 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Lei Zhang
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: Ie01b387fd5b6b460b58245cf89ec14630a5c0e28
      Gerrit-Change-Number: 145790
      Gerrit-PatchSet: 9
      Gerrit-Owner: Tom Sepez <tse...@chromium.org>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages