[cairo-commit] 4 commits - configure.in src/cairo-array.c
src/cairoint.h src/cairo-svg-surface.c
src/cairo-type1-subset.c src/cairo-xlib-surface.c
Carl Worth
cworth at kemper.freedesktop.org
Mon Aug 28 19:00:56 PDT 2006
configure.in | 20 ++++++++++++++++----
src/cairo-array.c | 2 +-
src/cairo-svg-surface.c | 4 ++--
src/cairo-type1-subset.c | 2 +-
src/cairo-xlib-surface.c | 2 +-
src/cairoint.h | 3 +--
6 files changed, 22 insertions(+), 11 deletions(-)
New commits:
diff-tree 06a962886806be5e68061e24223c617980ac8248 (from 7d1399a4bb0d8d74a4294700e6040accccefff2a)
Author: Carl Worth <cworth at cworth.org>
Date: Mon Aug 28 19:00:48 2006 -0700
Eliminate conditions checking for unsigned or enum values less than 0.
diff --git a/src/cairo-array.c b/src/cairo-array.c
index 218f511..9d07f56 100644
--- a/src/cairo-array.c
+++ b/src/cairo-array.c
@@ -203,7 +203,7 @@ _cairo_array_index (cairo_array_t *array
if (index == 0 && array->num_elements == 0)
return NULL;
- assert (0 <= index && index < array->num_elements);
+ assert (index < array->num_elements);
return (void *) &(*array->elements)[index * array->element_size];
}
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index abc1ec3..2b24bf2 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -289,7 +289,7 @@ cairo_svg_surface_restrict_to_version (c
return;
}
- if (version >= 0 && version < CAIRO_SVG_VERSION_LAST)
+ if (version < CAIRO_SVG_VERSION_LAST)
surface->document->svg_version = version;
}
@@ -329,7 +329,7 @@ cairo_svg_get_versions (cairo_svg_versio
const char *
cairo_svg_version_to_string (cairo_svg_version_t version)
{
- if (version < 0 || version >= CAIRO_SVG_VERSION_LAST)
+ if (version >= CAIRO_SVG_VERSION_LAST)
return NULL;
return _cairo_svg_version_strings[version];
diff --git a/src/cairoint.h b/src/cairoint.h
index 4846ac3..119ee26 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1972,8 +1972,7 @@ _cairo_surface_has_device_transform (cai
* to support it (at least cairo_surface_write_to_png and a few spots
* in cairo-xlib-surface.c--again see -Wswitch-enum).
*/
-#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \
- (format) <= CAIRO_FORMAT_A1)
+#define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_A1)
#define CAIRO_CONTENT_VALID(content) ((content) && \
(((content) & ~(CAIRO_CONTENT_COLOR | \
diff-tree 7d1399a4bb0d8d74a4294700e6040accccefff2a (from 1b7ced6614d809262cca08e7c5141b7ce740bfca)
Author: Carl Worth <cworth at cworth.org>
Date: Mon Aug 28 18:58:27 2006 -0700
Put static first to avoid compiler warning.
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index f439c8d..8ee1f40 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -185,7 +185,7 @@ static const unsigned short charstring_k
static cairo_bool_t
is_ps_delimiter(int c)
{
- const static char delimiters[] = "()[]{}<>/% \t\r\n";
+ static const char delimiters[] = "()[]{}<>/% \t\r\n";
return strchr (delimiters, c) != NULL;
}
diff-tree 1b7ced6614d809262cca08e7c5141b7ce740bfca (from 50003615f28862f68b609aa290ebffee24d5d643)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Aug 28 18:47:37 2006 -0700
Bug #7593: Avoid unsigned loop control variable to eliminate infinite, memory-scribbling loop.
Behdad chased this bug down when looking into bug #7593. This
bug is what finally motivated us to figure out how to get -Wextra
(for the "always true" comparisons of unsigned variables against
negative values).
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 4ed29b7..3965c21 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2439,7 +2439,7 @@ _cairo_xlib_surface_add_glyph (Display *
break;
case CAIRO_FORMAT_ARGB32:
if (_native_byte_order_lsb() != (ImageByteOrder (dpy) == LSBFirst)) {
- unsigned int c = glyph_surface->stride * glyph_surface->height;
+ int c = glyph_surface->stride * glyph_surface->height;
unsigned char *d;
unsigned char *new, *n;
diff-tree 50003615f28862f68b609aa290ebffee24d5d643 (from 5492946b0ced9b3e97f94ef097ee745c8a59df42)
Author: Carl Worth <cworth at cworth.org>
Date: Mon Aug 28 18:54:35 2006 -0700
Add -Wextra (as well as -Wno-missing-field-initializers -Wno-unused-parameter)
We'd been wanting some of the warnings in -Wextra for a long time,
but we had failed in tryingto squelch some of the undesired warnings.
We finally figured out how to do this correctly by simply ordering
the warnings correctly.
diff --git a/configure.in b/configure.in
index 7a0484b..94328ae 100644
--- a/configure.in
+++ b/configure.in
@@ -94,7 +94,7 @@ dnl cairo_cache_version should be increa
dnl detection stuff changes in a way that removing the config.cache file may be
dnl needed for correct operation.
dnl
-m4_define(cairo_cache_version, 3)
+m4_define(cairo_cache_version, 4)
dnl ===========================================================================
dnl
@@ -563,13 +563,25 @@ AC_CACHE_CHECK([for supported warning fl
echo
WARN_CFLAGS=""
- # some warnings are not supported by all versions of gcc
- MAYBE_WARN="-Wall -Wsign-compare -Werror-implicit-function-declaration \
+ # Some warning options are not supported by all versions of
+ # gcc, so test all desired options against the current
+ # compiler.
+ #
+ # Note that there are some order dependencies
+ # here. Specifically, an option that disables a warning will
+ # have no net effect if a later option then enables that
+ # warnings, (perhaps implicitly). So we put some grouped
+ # options (-Wall and -Wextra) up front and the -Wno options
+ # last.
+
+ MAYBE_WARN="-Wall -Wextra \
+ -Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum -Wmissing-format-attribute \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
- -Wdeclaration-after-statement -Wold-style-definition"
+ -Wdeclaration-after-statement -Wold-style-definition \
+ -Wno-missing-field-initializers -Wno-unused-parameter"
for W in $MAYBE_WARN; do
CAIRO_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
More information about the cairo-commit
mailing list