Repository navigation
Grepで検索したファイルの合計(KB)が上限を超えるなら足さない - #2846
Merged
berryzplus merged 2 commits intoNov 11, 2026
Merged
Conversation
berryzplus
previously approved these changes
Nov 11, 2026
hpmy-dev
force-pushed
the
fix/grep-searched-size-overflow
branch
from
November 11, 2026 02:29
69a84c2 to
ab9c6bd
Compare
berryzplus
approved these changes
Nov 11, 2026
| } | ||
| if( out.pOutput->IsDrawing() && 10000 < nWork ){ | ||
| nHitCountOld = -100; // 即表示 | ||
| if( !grep::AddFileSizeKB( nWork, nFileSize ) ){ |
Contributor
There was a problem hiding this comment.
書いてから気付いたんですけどね。
「if文くっつけて」のSonarQube指摘が出ると思います。
if( out.pOutput->IsDrawing() &&
L'\0' != pszKey[0] &&
!grep::AddFileSizeKB( nWork, nFileSize ) ){保守性に関する指摘は、スルーで構わない認識です。
(できれば対応したいですが、あんまり重要ではない。)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



リアルタイム表示で早めに出力するために数えている「前回の出力から検索したファイルの合計(KB)」が、
2TB を超えるファイルや合計で負になったり、あふれたりする不具合を直します。
変更内容
grep::AddFileSizeKB()を足しました。ファイルの大きさを 64 ビットのまま KB にし(端数は切り上げ)、合計に足すと上限(10000KB、約 10MB)を超えるなら足さずに、超えることを返します戻り値は
grep::SAddFileSizeResult(足した後の合計と、上限を超えるか)です。explicit operator bool()でif( result )と書けます(apiwrap::SGetTextResultに倣いました)AppendResultIfDue()は、上限を超えるならすぐ出力するようにし、10000 < nWorkの比べはAddFileSizeKB()の中に移しました合計は上限を超えないので
intのままあふれません。10MB 以下のときと、10MB を超えたときに出力する時機は今と同じです。