From 078c8bcafbdeeb920642ff9326cf46fc72a2efe8 Mon Sep 17 00:00:00 2001 From: Aina Niemetz Date: Tue, 11 Sep 2018 16:26:16 -0700 Subject: [PATCH] Fixe compiler warning in line_buffer.cpp. (#2453) --- src/parser/line_buffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parser/line_buffer.cpp b/src/parser/line_buffer.cpp index 4213eec23..71b913227 100644 --- a/src/parser/line_buffer.cpp +++ b/src/parser/line_buffer.cpp @@ -54,10 +54,12 @@ uint8_t* LineBuffer::getPtrWithOffset(size_t line, size_t pos_in_line, } bool LineBuffer::isPtrBefore(uint8_t* ptr, size_t line, size_t pos_in_line) { - for (ssize_t i = line; i >= 0; i--) { + for (size_t j = 0; j < line; j++) + { // NOTE: std::less is guaranteed to give consistent results when comparing // pointers of different arrays (in contrast to built-in comparison // operators). + size_t i = line - j; uint8_t* end = d_lines[i] + ((i == line) ? pos_in_line : d_sizes[i]); if (std::less()(d_lines[i] - 1, ptr) && std::less()(ptr, end)) { -- 2.30.2