[Pixman] [PATCH/RFC 0/4] New option to build pixman as C++ code (--enable-enforced-cplusplus)

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Dec 19 19:35:20 PST 2012


On Wed, 19 Dec 2012 04:09:09 +0200
Siarhei Siamashka <siarhei.siamashka at gmail.com> wrote:

> On Mon, 17 Dec 2012 01:51:26 +0100
> sandmann at cs.au.dk (Søren Sandmann) wrote:
> 
> > Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:
> > 
> > > This is not intended to be immediately pushed to pixman git repository.
> > > At least not until it proves to have some real practical use. Except
> > > maybe for the 'xor'->'filler' variable rename patch, which clearly
> > > should not cause any regressions or inconveniences.
> > 
> > There is a number of things in this series that look like good changes
> > regardless of moving to C++ or not. Some I noticed:
> > 
> > The SIZE_MAX change was requested here:
> > 
> >     http://lists.freedesktop.org/archives/pixman/2012-August/002196.html
> > 
> > and someone recently mailed me privately and pointed out that Solaris 9
> > doesn't have it either.
> > 
> > The xor->filler change should be harmless as you point out, and 'filler'
> > probably is a better name than 'xor'.
> > 
> > The uint32->pixman_format_t in pixman-glyph.c looks good.
> 
> OK, I'll try to split "[PATCH 4/4] Various remaining fixes needed for
> successful compilation with C++" and re-submit a smaller patch with
> only the changes that are not C++ specific, but also useful for C.

From 9c90e4ed1b89f6a6bb289c1d2e0d96bd09cf04e2 Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka at gmail.com>
Date: Thu, 20 Dec 2012 05:00:46 +0200
Subject: [PATCH 1/2] Define SIZE_MAX if it is not provided by the standard C
 headers

C++ compilers do not define SIZE_MAX. It is also not available
if the code is compiled by some C compilers:
    http://lists.freedesktop.org/archives/pixman/2012-August/002196.html
---
 pixman/pixman-compiler.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-compiler.h b/pixman/pixman-compiler.h
index a978acc..2e45dea 100644
--- a/pixman/pixman-compiler.h
+++ b/pixman/pixman-compiler.h
@@ -56,6 +56,10 @@
 # define INT64_MAX              (9223372036854775807)
 #endif
 
+#ifndef SIZE_MAX
+# define SIZE_MAX               ((size_t)-1)
+#endif
+
 
 #ifndef M_PI
 # define M_PI			3.14159265358979323846
-- 
1.7.8.6




From 0477ba7457a705b6b668ab497a9a591fd503759a Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka at gmail.com>
Date: Thu, 20 Dec 2012 05:14:39 +0200
Subject: [PATCH 2/2] Use more appropriate types and remove a magic constant

---
 pixman/pixman-glyph.c  |    2 +-
 pixman/pixman-image.c  |    2 +-
 pixman/pixman-region.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pixman/pixman-glyph.c b/pixman/pixman-glyph.c
index 15b3f1f..6d2c8bb 100644
--- a/pixman/pixman-glyph.c
+++ b/pixman/pixman-glyph.c
@@ -508,7 +508,7 @@ add_glyphs (pixman_glyph_cache_t *cache,
     uint32_t glyph_flags = 0;
     pixman_composite_func_t func = NULL;
     pixman_implementation_t *implementation = NULL;
-    uint32_t dest_format;
+    pixman_format_code_t dest_format;
     uint32_t dest_flags;
     pixman_box32_t dest_box;
     pixman_composite_info_t info;
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 6f076d5..65041b4 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -888,7 +888,7 @@ pixman_image_get_format (pixman_image_t *image)
     if (image->type == BITS)
 	return image->bits.format;
 
-    return 0;
+    return PIXMAN_null;
 }
 
 uint32_t
diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 8955fe7..2d6f157 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -202,7 +202,7 @@ PIXREGION_SZOF (size_t n)
     return size + sizeof(region_data_type_t);
 }
 
-static void *
+static region_data_type_t *
 alloc_data (size_t n)
 {
     size_t sz = PIXREGION_SZOF (n);
-- 
1.7.8.6


More information about the Pixman mailing list