提交 e9f9c0d8 编写于 作者: B Behdad Esfahbod

[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.
上级 1a6b5ac6
......@@ -302,10 +302,10 @@ struct hb_sanitize_context_t :
inline bool check_range (const void *base, unsigned int len) const
{
const char *p = (const char *) base;
bool ok = this->max_ops-- > 0 &&
this->start <= p &&
bool ok = this->start <= p &&
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,
"check_range [%p..%p] (%d bytes) in [%p..%p] -> %s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册