From f9467ec1ea6c0dac2ea513b7dfe58d0349788e02 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Thu, 31 Aug 2017 23:30:35 +0200 Subject: Fix signed and unsigned comparisons The first in my quest to make Godot 3.x compile with -Werror on GCC7 --- modules/regex/regex.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/regex') diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index 8afd01e20b..00e8ce0f54 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -309,7 +309,7 @@ Ref RegEx::search(const String &p_subject, int p_offset, int p_end) _pattern_info(PCRE2_INFO_NAMETABLE, &table); _pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &entry_size); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { CharType id = table[i * entry_size]; if (result->data[id].start == -1) @@ -338,7 +338,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a PCRE2_SIZE olength = output.length(); PCRE2_SIZE length = p_subject.length(); - if (p_end >= 0 && p_end < length) + if (p_end >= 0 && (uint32_t)p_end < length) length = p_end; if (sizeof(CharType) == 2) { @@ -430,7 +430,7 @@ Array RegEx::get_names() const { _pattern_info(PCRE2_INFO_NAMETABLE, &table); _pattern_info(PCRE2_INFO_NAMEENTRYSIZE, &entry_size); - for (int i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { String name = &table[i * entry_size + 1]; if (result.find(name) < 0) { -- cgit v1.2.3