Repository navigation
Split NativeGrep::matchFile and the RNP locateKey - #2426
Conversation
Fifth batch for #2157 (lizard CCN 25 and 24). The code and its comments move into file-local helpers: - nativegrep.cpp: decryptForSearch() (read without following a link, capped, gpg on stdin, decoded), previewOfMatch() (the OTP marker, the password mark, a short line, or a window that keeps a field's name) and windowAround() (where that window starts and ends, never half a surrogate pair). - rnpcrypto.cpp: locateExactKey() (a fingerprint or long key ID, and why it cannot be used) and primariesNamedBy() (short key ID, e-mail address, whole then partial user ID); its branches return directly. No behaviour change. matchFile 25 -> 7, locateKey 24 -> 14; every helper is below 15. Part of #2157. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anne Jan Brouwer <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
nogeenhenk
left a comment
There was a problem hiding this comment.
Reviewed at 06ccd66. The fifth refactor for #2157; only the structure changes.
locateKey:locateExactKey()is the old exact-key branch unchanged, andprimariesNamedBy()returns from each branch what the old code assigned (short key ID, address, whole then partial user ID). The "more than one key" check stays inlocateKey.NativeGrep::matchFile:decryptForSearch()returns empty in every case the old code returned early (read failure,rc != 0, empty plaintext), andpreviewOfMatch()/windowAround()give the same result string in each of the oldcontinuebranches, the OTP marker and the password mark included.- No
tr()strings are involved.
One cosmetic nit: the old comment @brief Decrypt one .gpg file and return lines matching rx. now sits above namespace { instead of above NativeGrep::matchFile(). Doxygen does not warn about it, but it describes the function further down.
Generated by Claude Code
Summary
Fifth batch for #2157; the code and comments move into file-local helpers (anonymous namespace, full Doxygen blocks), no behaviour change.
NativeGrep::matchFile(CCN 25 → 7):decryptForSearch(): read without following a link, capped, gpg on stdin, decoded as before;previewOfMatch(): the OTP marker, the password mark, a short line, or a window that keeps a field's name;windowAround(): where that window starts and ends, never half a surrogate pair.locateKeyinrnpcrypto.cpp(CCN 24 → 14):locateExactKey(): a fingerprint or long key ID, and why it cannot be used;primariesNamedBy(): short key ID, e-mail address, whole then partial user ID. Each branch returns directly instead of assigning.Every helper is below CCN 15. No
tr()strings are involved (rnpcrypto.cppreasons are untranslatedQStringLiterals, as before).Test plan
CONFIG+=rnp; fullmake checkin a scratchHOME/GNUPGHOME: 37 suites (tst_rnpcryptoandtst_grepsearchcontrollerincluded), 2,079 passed, 0 faileddoxygen Doxyfileprints no warningsclang-formatcleanPart of #2157.
🤖 Generated with Claude Code
Summary by CodeRabbit