[HarfBuzz] compiler warning: "comparison between signed and unsigned"

Behdad Esfahbod behdad at behdad.org
Mon Feb 25 20:59:01 PST 2013


Thanks.  Pushed.

There's more size_t, ssize_t, and ptrdiff_t work to be done, some in the
hb-blob.h API even...  I gather those three types are universally-enough
available that I may as well go ahead and use them?

behdad

On 02/25/2013 02:03 PM, Jonathan Kew wrote:
> Hi Behdad,
> 
> Just a small nit: I've noticed that our logs show a lot of "warning:
> comparison between signed and unsigned integer expressions" messages while
> compiling harfbuzz, originating from the comparison in allocate_size. Would
> you mind adding a typecast (or perhaps making the parameter a signed integer?)
> so as to make the compiler happier?
> 
> Thanks,
> 
> JK
> 
> diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
> index 090f3fc..571fd91 100644
> --- a/src/hb-open-type-private.hh
> +++ b/src/hb-open-type-private.hh
> @@ -404,7 +404,7 @@ struct hb_serialize_context_t
>    template <typename Type>
>    inline Type *allocate_size (unsigned int size)
>    {
> -    if (unlikely (this->ran_out_of_room || this->end - this->head < size)) {
> +    if (unlikely (this->ran_out_of_room || this->end - this->head <
> ptrdiff_t(size))) {
>        this->ran_out_of_room = true;
>        return NULL;
>      }
> 

-- 
behdad
http://behdad.org/



More information about the HarfBuzz mailing list