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

Jonathan Kew jfkthame at googlemail.com
Mon Feb 25 11:03:15 PST 2013


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;
      }



More information about the HarfBuzz mailing list