[Pixman] 'SIZE_MAX' undeclared on Solaris 9 without including <limits.h>, sqrtf() missing

Mojca Miklavec mojca.miklavec.lists at gmail.com
Wed Mar 20 09:02:20 PDT 2013


Hello,

We are using pixman in TeX (TeX Live) and on Solaris there are two
tiny problems that prevent compilation on Solaris 9:

1.) ../../../source/libs/pixman/pixman-0.28.0/pixman/pixman-utils.c:36:17:
 error: 'SIZE_MAX' undeclared (first use in this function)

One possible solution is adding
    #include <limits.h>
to pixman-utils.c, but I'm not sure how to include this properly
without interfering with other compilers. (I guess that simply adding
limits.h unconditionally should work, but I don't know for sure.
) Here's an example from a different project:
    http://opensource.apple.com/source/gm4/gm4-12/m4/lib/size_max.h?txt
that uses

/* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
# include <limits.h>
/* Get SIZE_MAX declaration on systems like glibc 2.  */
# if HAVE_STDINT_H
#  include <stdint.h>
# endif
/* On systems where these include files don't define it, SIZE_MAX is defined
   in config.h.  */



Developer of LuaTeX/MetaPost used another trick as a patch:

--- pixman-0.28.0.orig/pixman/pixman-utils.c
+++ pixman-0.28.0/pixman/pixman-utils.c
@@ -33,7 +33,7 @@
 pixman_bool_t
 _pixman_multiply_overflows_size (size_t a, size_t b)
 {
-    return a >= SIZE_MAX / b;
+    return a >= ((size_t)-1) / b;
 }

 pixman_bool_t



2.) "sqrtf" function is missing, see also:

http://www.gnu.org/software/gnulib/manual/html_node/sqrtf.html
http://www.winehq.org/pipermail/wine-patches/2003-February/005427.html

One can use double sqrt(...) instead, but again, I'm not sure what the
best patch should be.

(Developers of OpenSource projects can get access to a solaris build
farm, so testing itself shouldn't be a problem.)


If I patch these two items, everything else works, so I would be
grateful if someone could look into these tiny issues.

Thank you,
    Mojca


More information about the Pixman mailing list