Skip to content

Commit 23f4ad6

Browse files
committed
Fix comparison between signed and unsigned integer types
Cast `lines_to_find.size()` to `int` in the hunk validation loop to resolve a compiler warning about comparing signed (`hunk_line_number`) and unsigned (`size_t`) integer types. This ensures the loop condition is type-safe without changing the control flow logic. * Plugin/Diff: Type safety improvement in patch application **Generated by CodeLite** Signed-off-by: Eran Ifrah <eran@codelite.org>
1 parent 672c9e4 commit 23f4ad6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Plugin/Diff/clPatchApplier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ clStatusOr<int> PatchApplier::ApplyHunk(ITextArea* ctrl, const wxArrayString& li
201201
}
202202

203203
bool hunk_found{true};
204-
for (int hunk_line_number = 0; hunk_line_number < lines_to_find.size(); ++hunk_line_number) {
204+
for (int hunk_line_number = 0; hunk_line_number < static_cast<int>(lines_to_find.size()); ++hunk_line_number) {
205205
wxString hunk_line = lines_to_find[hunk_line_number];
206206
// These lines must exist and match in the control
207207
if (current_editor_line_number + hunk_line_number >= totalLines) {

0 commit comments

Comments
 (0)