[sanitize] Reorder condition to silence bogus gcc warning

Was givin a dozen of:

../../src/hb-machinery.hh: In member function ‘bool AAT::ankr::sanitize(hb_sanitize_context_t*) const’:
../../src/hb-machinery.hh:307:23: warning: missed loop optimization, the loop counter may overflow [-Wunsafe-loop-optimizations]
     bool ok = --this->max_ops > 0 &&
               ~~~~~~~~~~~~~~~~~~~~~~
        this->start <= p &&
        ~~~~~~~~~~~~~~~~~~~
        p <= this->end &&
        ~~~~~~~~~~~~~~~^~
        (unsigned int) (this->end - p) >= len;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I believe those are bogus, but this silences them and does not introduce
logic issues I believe.
This commit is contained in:
Behdad Esfahbod 2018-10-11 21:37:45 -04:00
parent 1a6b5ac6c3
commit e9f9c0d81c
1 changed files with 3 additions and 3 deletions

View File

@ -302,10 +302,10 @@ struct hb_sanitize_context_t :
inline bool check_range (const void *base, unsigned int len) const inline bool check_range (const void *base, unsigned int len) const
{ {
const char *p = (const char *) base; const char *p = (const char *) base;
bool ok = this->max_ops-- > 0 && bool ok = this->start <= p &&
this->start <= p &&
p <= this->end && p <= this->end &&
(unsigned int) (this->end - p) >= len; (unsigned int) (this->end - p) >= len &&
this->max_ops-- > 0;
DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0, DEBUG_MSG_LEVEL (SANITIZE, p, this->debug_depth+1, 0,
"check_range [%p..%p] (%d bytes) in [%p..%p] -> %s", "check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",