Fixe compiler warning in line_buffer.cpp. (#2453)
authorAina Niemetz <aina.niemetz@gmail.com>
Tue, 11 Sep 2018 23:26:16 +0000 (16:26 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Sep 2018 23:26:16 +0000 (16:26 -0700)
src/parser/line_buffer.cpp

index 4213eec239e7af800794406ad9104535b37dc0f4..71b913227b178b535eb9e135585fc068e2ed7994 100644 (file)
@@ -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<uint8_t*>()(d_lines[i] - 1, ptr) &&
         std::less<uint8_t*>()(ptr, end)) {