]> git.imager.perl.org - imager.git/commitdiff
- eliminate many -Wall warnings
authorTony Cook <tony@develop=help.com>
Mon, 30 Jan 2006 04:18:02 +0000 (04:18 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 30 Jan 2006 04:18:02 +0000 (04:18 +0000)
14 files changed:
Changes
Flines/Flines.xs
Imager.xs
MANIFEST
Mandelbrot/mandel.c
draw.c
hlines.c
imager.h
imerror.h [new file with mode: 0644]
imexif.c
iolayer.c
lib/Imager/APIRef.pm
rgb.c
tags.c

diff --git a/Changes b/Changes
index 3a353e1d7a5ca0262ce7ae743809619e1e9323cb..18dbdae26ecea5cc13866171bdeea1b599664e55 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1320,6 +1320,7 @@ Revision history for Perl extension Imager.
 - document register_filter() and add test for it
 - add example to SYNOPSIS of samples/inline_replace_color.pl
 - minor POD fix in Imager::Color::Table
+- eliminate many -Wall warnings
 
 =================================================================
 
index b3cca4e10f9a1c4aad597a6b98a66576e97523d1..7f0a2bb0900cd4cc58f6decb96b3db1235a52789 100644 (file)
@@ -25,9 +25,7 @@ saturate(int in) {
 void
 flines(i_img *im) {
   i_color vl;
-  int i,bytes,x,y;
-  int idx;
-  
+  int x,y;
   
   for(y = 0; y < im->ysize; y ++) {
     for(x = 0; x < im->xsize; x ++ ) {
index fd09d8c703d9e98580f0f3efc507a957970bcbb0..3165973d63c55fb2c199fff076fbae5acdedd7cb 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -1862,7 +1862,7 @@ i_t1_glyph_name(handle, text_sv, utf8 = 0)
             --len;
           }
           EXTEND(SP, 1);
-          if (outsize = i_t1_glyph_name(handle, ch, name, sizeof(name))) {
+          if ((outsize = i_t1_glyph_name(handle, ch, name, sizeof(name))) != 0) {
             PUSHs(sv_2mortal(newSVpv(name, 0)));
           }
           else {
@@ -1901,7 +1901,6 @@ i_tt_text(handle,im,xb,yb,cl,points,str_sv,len_ignored,smooth,utf8,align=1)
      Imager::Color     cl
              float     points
              SV *     str_sv
-              int     len_ignored
               int     smooth
                int     utf8
                int     align
@@ -1929,7 +1928,6 @@ i_tt_cp(handle,im,xb,yb,channel,points,str_sv,len_ignored,smooth,utf8,align=1)
               int     channel
              float     points
              SV *     str_sv
-              int     len_ignored
               int     smooth
                int     utf8
                int     align
@@ -1953,7 +1951,6 @@ i_tt_bbox(handle,point,str_sv,len_ignored, utf8)
   Imager::Font::TT     handle
             float     point
               SV*    str_sv
-              int     len_ignored
                int     utf8
             PREINIT:
               int     cords[BOUNDING_BOX_COUNT],rc;
@@ -2053,7 +2050,7 @@ i_tt_glyph_name(handle, text_sv, utf8 = 0)
             --len;
           }
           EXTEND(SP, 1);
-          if (outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) {
+          if ((outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) != 0) {
             PUSHs(sv_2mortal(newSVpv(name, 0)));
           }
           else {
@@ -4342,8 +4339,8 @@ i_ft2_glyph_name(handle, text_sv, utf8 = 0, reliable_only = 1)
             --len;
           }
           EXTEND(SP, 1);
-          if (outsize = i_ft2_glyph_name(handle, ch, name, sizeof(name), 
-                                         reliable_only)) {
+          if ((outsize = i_ft2_glyph_name(handle, ch, name, sizeof(name), 
+                                         reliable_only)) != 0) {
             PUSHs(sv_2mortal(newSVpv(name, 0)));
           }
           else {
index cdd4da27608376dc88e2a2be30a73fbd87bc0e4b..fa5001c97a03435c108daaf7d777b4e01045a5a2 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -73,6 +73,7 @@ image.c
 imager.h
 imageri.h
 imdatatypes.h
+imerror.h      Error handling functions
 imext.c         Defines the function table
 imext.h         Included by external modules for API access
 imextdef.h
index 299c0844a55d0131a4666eefb41645e729c635d4..09849cd9b85f39648dabed3592cc21a3cad2720f 100644 (file)
@@ -15,7 +15,6 @@ int
 mandel(double x, double y, int max_iter) {
   double xn, yn;
   double xo, yo;
-  double dist;
   int iter = 1;
   /*   Z(n+1) = Z(n) ^2 + c */
 
@@ -37,8 +36,7 @@ mandel(double x, double y, int max_iter) {
 void 
 mandelbrot(i_img *im, double minx, double miny, double maxx, double maxy, int max_iter) {
 
-  i_color vl;
-  int i,bytes,x,y;
+  int i,x,y;
   int idx;
   double divx, divy;
 
diff --git a/draw.c b/draw.c
index 651da3455dcee67c16a99420efa1f26d4573c05d..4b6ba042c5ff475acca6d1f757f531b4c491c742 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -382,9 +382,6 @@ i_arc_aa_cfill(i_img *im, double x, double y, double rad, double d1, double d2,
 
 typedef int frac;
 static  frac float_to_frac(float x) { return (frac)(0.5+x*16.0); }
-static   int frac_sub     (frac x)  { return (x%16); }
-static   int frac_int     (frac x)  { return (x/16); }
-static float frac_to_float(float x) { return (float)x/16.0; }
 
 static 
 void
@@ -393,19 +390,6 @@ polar_to_plane(float cx, float cy, float angle, float radius, frac *x, frac *y)
   *y = float_to_frac(cy+radius*sin(angle));
 }
 
-static
-void
-order_pair(frac *x, frac *y) {
-  frac t = *x;
-  if (t>*y) {
-    *x = *y;
-    *y = t;
-  }
-}
-
-
-
-
 static
 void
 make_minmax_list(i_mmarray *dot, float x, float y, float radius) {
index 8b2ef18a5926f16e93e2a0072dfe9efd64d2bd27..685ed164e4c4c68442e5157e6c30183b23eb6a3b 100644 (file)
--- a/hlines.c
+++ b/hlines.c
@@ -263,7 +263,7 @@ i_int_hlines_fill_fill(im, hlines, fill)
 */
 void
 i_int_hlines_fill_fill(i_img *im, i_int_hlines *hlines, i_fill_t *fill) {
-  int y, i, x;
+  int y, i;
 
   if (im->bits == i_8_bits && fill->fill_with_color) {
     i_color *line = mymalloc(sizeof(i_color) * im->xsize);
index ba69645a4a3952825cccf314c4ee7331451375b7..deefa4595afe86450ac35bbe33cd283c3e1cde04 100644 (file)
--- a/imager.h
+++ b/imager.h
@@ -488,28 +488,7 @@ typedef struct {
 
 } symbol_table_t;
 
-/* error handling 
-   see error.c for documentation
-   the error information is currently global
-*/
-typedef struct {
-  char *msg;
-  int code;
-} i_errmsg;
-
-typedef void (*i_error_cb)(int code, char const *msg);
-typedef void (*i_failed_cb)(i_errmsg *msgs);
-extern i_error_cb i_set_error_cb(i_error_cb);
-extern i_failed_cb i_set_failed_cb(i_failed_cb);
-extern void i_set_argv0(char const *);
-extern int i_set_errors_fatal(int new_fatal);
-extern i_errmsg *i_errors(void);
-
-extern void i_push_error(int code, char const *msg);
-extern void i_push_errorf(int code, char const *fmt, ...);
-extern void i_push_errorvf(int code, char const *fmt, va_list);
-extern void i_clear_error(void);
-extern int i_failed(int code, char const *msg);
+#include "imerror.h"
 
 /* image tag processing */
 extern void i_tags_new(i_img_tags *tags);
diff --git a/imerror.h b/imerror.h
new file mode 100644 (file)
index 0000000..313834f
--- /dev/null
+++ b/imerror.h
@@ -0,0 +1,27 @@
+#ifndef IMAGER_IMERROR_H
+#define IMAGER_IMERROR_H
+
+/* error handling 
+   see error.c for documentation
+   the error information is currently global
+*/
+typedef struct {
+  char *msg;
+  int code;
+} i_errmsg;
+
+typedef void (*i_error_cb)(int code, char const *msg);
+typedef void (*i_failed_cb)(i_errmsg *msgs);
+extern i_error_cb i_set_error_cb(i_error_cb);
+extern i_failed_cb i_set_failed_cb(i_failed_cb);
+extern void i_set_argv0(char const *);
+extern int i_set_errors_fatal(int new_fatal);
+extern i_errmsg *i_errors(void);
+
+extern void i_push_error(int code, char const *msg);
+extern void i_push_errorf(int code, char const *fmt, ...);
+extern void i_push_errorvf(int code, char const *fmt, va_list);
+extern void i_clear_error(void);
+extern int i_failed(int code, char const *msg);
+
+#endif
index 7c182b54f552d3c2067f2df66694ac01fb5588c9..28f3a07678344bd6869d90e670fa676a79971f50 100644 (file)
--- a/imexif.c
+++ b/imexif.c
@@ -353,13 +353,13 @@ Sets *exif_ifd_offset to the offset of the EXIF IFD if found.
 
 static tag_map ifd0_string_tags[] =
   {
-    tag_make, "exif_make",
-    tag_model, "exif_model",
-    tag_copyright, "exif_copyright",
-    tag_software, "exif_software",
-    tag_artist, "exif_artist",
-    tag_date_time, "exif_date_time",
-    tag_image_description, "exif_image_description",
+    { tag_make, "exif_make" },
+    { tag_model, "exif_model" },
+    { tag_copyright, "exif_copyright" },
+    { tag_software, "exif_software" },
+    { tag_artist, "exif_artist" },
+    { tag_date_time, "exif_date_time" },
+    { tag_image_description, "exif_image_description" },
   };
 
 static const int ifd0_string_tag_count = ARRAY_COUNT(ifd0_string_tags);
@@ -393,7 +393,7 @@ static tag_value_map ifd0_values[] =
 static void
 save_ifd0_tags(i_img *im, imtiff *tiff, unsigned long *exif_ifd_offset,
               unsigned long *gps_ifd_offset) {
-  int i, tag_index;
+  int tag_index;
   int work;
   ifd_entry *entry;
 
@@ -681,7 +681,6 @@ static tag_map exif_num_arrays[] =
 static void
 save_exif_ifd_tags(i_img *im, imtiff *tiff) {
   int i, tag_index;
-  int work;
   ifd_entry *entry;
   char *user_comment;
   unsigned long maker_note_offset = 0;
@@ -782,9 +781,9 @@ static tag_map gps_num_arrays[] =
 
 static void
 save_gps_ifd_tags(i_img *im, imtiff *tiff) {
-  int i, tag_index;
+  /* int i, tag_index; 
   int work;
-  ifd_entry *entry;
+  ifd_entry *entry; */
 
   /* for (tag_index = 0, entry = tiff->ifd; 
        tag_index < tiff->ifd_size; ++tag_index, ++entry) {
@@ -985,8 +984,6 @@ This is called by tiff_load_ifd() and tiff_final().
 
 static void
 tiff_clear_ifd(imtiff *tiff) {
-  int i;
   if (tiff->ifd_size && tiff->ifd) {
     myfree(tiff->ifd);
     tiff->ifd_size = 0;
index b98494bc9c208c7781ef847800efd962e049acbc..7dce1d3f0c5c979b0df5ac79601ee082803c9577 100644 (file)
--- a/iolayer.c
+++ b/iolayer.c
@@ -1,5 +1,6 @@
 #include "imio.h"
 #include "iolayer.h"
+#include "imerror.h"
 #include "log.h"
 #include <stdlib.h>
 #include <stdio.h>
@@ -891,6 +892,7 @@ io_glue_commit_types(io_glue *ig) {
       ig->writecb = fd_write;
       ig->seekcb  = fd_seek;
       ig->closecb = fd_close;
+      ig->sizecb  = fd_size;
       break;
     }
   }
index 1abc984cf99984f5797e04b2e4f8d0170a836b80..fe4704790fd283ecce737b60e31eb06c61894b76 100644 (file)
@@ -98,7 +98,7 @@ Outlines the box from (x1,y1) to (x2,y2) inclusive with I<color>.
 
 
 =for comment
-From: Line 531 in draw.c
+From: Line 515 in draw.c
 
 =item i_box_cfill(im, x1, y1, x2, y2, fill)
 
@@ -107,7 +107,7 @@ Fills the box from (x1,y1) to (x2,y2) inclusive with fill.
 
 
 =for comment
-From: Line 574 in draw.c
+From: Line 558 in draw.c
 
 =item i_box_filled(im, x1, y1, x2, y2, color)
 
@@ -116,7 +116,7 @@ Fills the box from (x1,y1) to (x2,y2) inclusive with color.
 
 
 =for comment
-From: Line 556 in draw.c
+From: Line 540 in draw.c
 
 =item i_circle_aa(im, x, y, rad, color)
 
@@ -126,7 +126,7 @@ color.
 
 
 =for comment
-From: Line 477 in draw.c
+From: Line 461 in draw.c
 
 =item i_flood_cfill(im, seedx, seedy, fill)
 
@@ -138,7 +138,7 @@ Returns false if (seedx, seedy) are outside the image.
 
 
 =for comment
-From: Line 1332 in draw.c
+From: Line 1316 in draw.c
 
 =item i_flood_fill(im, seedx, seedy, color)
 
@@ -150,7 +150,7 @@ Returns false if (seedx, seedy) are outside the image.
 
 
 =for comment
-From: Line 1295 in draw.c
+From: Line 1279 in draw.c
 
 =item i_glin(im, l, r, y, colors)
 
@@ -261,7 +261,7 @@ Draw a line to image using bresenhams linedrawing algorithm
 
 
 =for comment
-From: Line 645 in draw.c
+From: Line 629 in draw.c
 
 =item i_line_aa(im, x1, x2, y1, y2, color, endp)
 
@@ -272,7 +272,7 @@ The point (x2, y2) is drawn only if endp is set.
 
 
 =for comment
-From: Line 849 in draw.c
+From: Line 833 in draw.c
 
 =item i_plin(im, l, r, y, colors)
 
diff --git a/rgb.c b/rgb.c
index cb47a8c98d566d9ed389f9c90d8ede4af46c08a5..737b5605f0e9e9c37d7e9d385461e270ff2f66e5 100644 (file)
--- a/rgb.c
+++ b/rgb.c
@@ -143,7 +143,7 @@ destination is compressed.
 static
 int
 rgb_dest_write(rgb_dest *s, unsigned char *buf, size_t pixels) {
-
+  return -1;
 }
 
 
diff --git a/tags.c b/tags.c
index 951d1fe9d42d70c103a55273c8e8046948a24a4b..1892933f464772deca46546811c3a135148d7dae 100644 (file)
--- a/tags.c
+++ b/tags.c
@@ -444,7 +444,7 @@ static int parse_long(char *data, char **end, long *out) {
 
   errno = 0;
   result = strtol(data, &myend, 10);
-  if ((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE
+  if (((result == LONG_MIN || result == LONG_MAX) && errno == ERANGE)
       || myend == data) {
     errno = savederr;
     return 0;