miscellaneous math fixes
These are just some general fixes found by running a static analyzer on the codebase. Specifically, this fixes the following:
-
In
cairo-array.c
, we were comparing signed and unsigned integers in places where no negative values are possible (loop counters that start at 0 and array lengths), commit8f7d039801f4dd0013fa8735aec82af44389ce8a
makes them unsigned so no conversions need to occur. -
In
cairo-array.c
andcairo-ft-font.c
, there were a couple cases where we were performing multiplication on unsigned ints before they were immediately casted to a wider type likesize_t
before use. Since this can potentially overflow the smaller type but not the larger one, this can cause hard to find bugs (commitb5ad5db0e918d461c423ecbb6302980bd014eaba
). -
In
cairoint.h
, there were a couple times where we castedint
variables toint
, which isn't necessary. This isn't a bug, but definitely seems unintentional (commit8f97daca422418ff4ec79f908dc7295e3c3c83b3
).