Browse files

fix various GCC warnings, mostly initialized but otherwise unused var…

…iables
  • Loading branch information...
1 parent ef1c270 commit 98747309573070774d7f2dd43f177fb0ffa39abb @tonycoz committed Jun 14, 2013
Showing with 47 additions and 59 deletions.
  1. +3 −0 Changes
  2. +3 −0 FT2/Changes
  3. +2 −4 FT2/freetyp2.c
  4. +5 −0 GIF/Changes
  5. +1 −1 GIF/GIF.pm
  6. +2 −7 GIF/imgif.c
  7. +6 −5 Imager.xs
  8. +8 −0 TIFF/Changes
  9. +7 −8 TIFF/imtiff.c
  10. +0 −3 datatypes.c
  11. +1 −2 draw.c
  12. +3 −6 filters.im
  13. +1 −5 fontft1.c
  14. +1 −2 image.c
  15. +0 −3 iolayer.c
  16. +1 −2 paste.im
  17. +0 −2 pnm.c
  18. +0 −3 polygon.c
  19. +2 −2 quant.c
  20. +0 −2 rotate.im
  21. +1 −2 rubthru.im
View
3 Changes
@@ -48,6 +48,9 @@ Imager release history. Older releases can be found in Changes.old
the output image instead of gpix/ppix.
https://rt.cpan.org/Ticket/Display.html?id=83478
+ - eliminate various GCC warnings, mostly initialized but otherwise
+ unused variables.
+
Imager 0.96 - 19 May 2013
===========
View
3 FT2/Changes
@@ -8,6 +8,9 @@ Imager-Font-FT2 0.92
output image instead of gpix/ppix.
https://rt.cpan.org/Ticket/Display.html?id=83478
+ - eliminate some initialized but otherwise unused variables detected
+ by GCC.
+
Imager-Font-FT2 0.91
====================
View
6 FT2/freetyp2.c
@@ -586,7 +586,6 @@ int
i_ft2_bbox_r(FT2_Fonthandle *handle, double cheight, double cwidth,
char const *text, size_t len, int vlayout, int utf8, i_img_dim *bbox) {
FT_Error error;
- i_img_dim width;
int index;
int first;
i_img_dim ascent = 0, descent = 0;
@@ -612,7 +611,6 @@ i_ft2_bbox_r(FT2_Fonthandle *handle, double cheight, double cwidth,
}
first = 1;
- width = 0;
while (len) {
unsigned long c;
if (utf8) {
@@ -904,8 +902,8 @@ i_ft2_cp(FT2_Fonthandle *handle, i_img *im, i_img_dim tx, i_img_dim ty, int chan
int aa, int vlayout, int utf8) {
i_img_dim bbox[8];
i_img *work;
- i_color cl, cl2;
- int x, y;
+ i_color cl;
+ int y;
unsigned char *bmp;
mm_log((1, "i_ft2_cp(handle %p, im %p, (tx, ty) (" i_DFp "), channel %d, cheight %f, cwidth %f, text %p, len %u, align %d, aa %d, vlayout %d, utf8 %d)\n",
View
5 GIF/Changes
@@ -1,3 +1,8 @@
+Imager-File-GIF 0.88
+====================
+
+ - eliminate various set but otherwise unused variables caught by GCC.
+
Imager-File-GIF 0.87
====================
View
2 GIF/GIF.pm
@@ -4,7 +4,7 @@ use Imager;
use vars qw($VERSION @ISA);
BEGIN {
- $VERSION = "0.87";
+ $VERSION = "0.88";
require XSLoader;
XSLoader::load('Imager::File::GIF', $VERSION);
View
9 GIF/imgif.c
@@ -173,7 +173,7 @@ i_img *
i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
i_img *im;
int i, j, Size, Row, Col, Width, Height, ExtCode, Count, x;
- int cmapcnt = 0, ImageNum = 0, BackGround = 0, ColorMapSize = 0;
+ int cmapcnt = 0, ImageNum = 0;
ColorMapObject *ColorMap;
GifRecordType RecordType;
@@ -191,11 +191,9 @@ i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
*/
if (colour_table) *colour_table = NULL;
- BackGround = GifFile->SBackGroundColor;
ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap);
if (ColorMap) {
- ColorMapSize = ColorMap->ColorCount;
i_colortable_copy(colour_table, colours, ColorMap);
cmapcnt++;
}
@@ -258,7 +256,6 @@ i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) {
if (( ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap) )) {
mm_log((1, "Adding local colormap\n"));
- ColorMapSize = ColorMap->ColorCount;
if ( cmapcnt == 0) {
i_colortable_copy(colour_table, colours, ColorMap);
cmapcnt++;
@@ -504,7 +501,7 @@ i_img **
i_readgif_multi_low(GifFileType *GifFile, int *count, int page) {
i_img *img;
int i, j, Size, Width, Height, ExtCode, Count;
- int ImageNum = 0, BackGround = 0, ColorMapSize = 0;
+ int ImageNum = 0, ColorMapSize = 0;
ColorMapObject *ColorMap;
GifRecordType RecordType;
@@ -532,8 +529,6 @@ i_readgif_multi_low(GifFileType *GifFile, int *count, int page) {
mm_log((1,"i_readgif_multi_low(GifFile %p, , count %p)\n", GifFile, count));
- BackGround = GifFile->SBackGroundColor;
-
Size = GifFile->SWidth * sizeof(GifPixelType);
GifRow = (GifRowType) mymalloc(Size);
View
11 Imager.xs
@@ -411,7 +411,6 @@ static int io_closer(void *p) {
if (SvOK(cbd->closecb)) {
dSP;
I32 count;
- SV *sv;
ENTER;
SAVETMPS;
@@ -422,8 +421,12 @@ static int io_closer(void *p) {
SPAGAIN;
- sv = POPs;
- success = SvTRUE(sv);
+ if (count) {
+ SV *sv = POPs;
+ success = SvTRUE(sv);
+ }
+ else
+ success = 0;
PUTBACK;
FREETMPS;
@@ -1113,7 +1116,6 @@ io_new_cb(writecb, readcb, seekcb, closecb, maxwrite = CBDATA_BUFSIZE)
SV *readcb;
SV *seekcb;
SV *closecb;
- int maxwrite;
CODE:
RETVAL = do_io_new_cb(aTHX_ writecb, readcb, seekcb, closecb);
OUTPUT:
@@ -2089,7 +2091,6 @@ i_map(im, pmaps_av)
AV *pmaps_av
PREINIT:
unsigned int mask = 0;
- AV *avmain;
AV *avsub;
SV **temp;
int len;
View
8 TIFF/Changes
@@ -15,6 +15,14 @@ Imager-File-TIFF 0.88
https://rt.cpan.org/Ticket/Display.html?id=74540
+ - eliminate some warnings produced by GCC 4.7.2:
+
+ - a set but otherwise unused variable,
+
+ - an incompletely bracketed array of structures initialization, and
+
+ - a format string error (with no security implications)
+
Imager-File-TIFF 0.87
=====================
View
15 TIFF/imtiff.c
@@ -90,10 +90,10 @@ static const int compress_value_count =
static struct tag_name
sample_format_values[] =
{
- "uint", SAMPLEFORMAT_UINT,
- "int", SAMPLEFORMAT_INT,
- "ieeefp", SAMPLEFORMAT_IEEEFP,
- "undefined", SAMPLEFORMAT_VOID,
+ { "uint", SAMPLEFORMAT_UINT },
+ { "int", SAMPLEFORMAT_INT },
+ { "ieeefp", SAMPLEFORMAT_IEEEFP },
+ { "undefined", SAMPLEFORMAT_VOID },
};
static const int sample_format_value_count =
@@ -373,7 +373,7 @@ static i_img *read_one_tiff(TIFF *tif, int allow_incomplete) {
i_img *im;
uint32 width, height;
uint16 samples_per_pixel;
- int tiled, error;
+ int tiled;
float xres, yres;
uint16 resunit;
int gotXres, gotYres;
@@ -393,8 +393,6 @@ static i_img *read_one_tiff(TIFF *tif, int allow_incomplete) {
i_img_dim total_pixels;
int samples_integral;
- error = 0;
-
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &samples_per_pixel);
@@ -922,7 +920,8 @@ i_writetiff_low_faxable(TIFF *tif, i_img *im, int fine) {
TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rc);
mm_log((1, "i_writetiff_wiol_faxable: TIFFGetField rowsperstrip=%d\n", rowsperstrip));
- mm_log((1, "i_writetiff_wiol_faxable: TIFFGetField scanlinesize=%d\n", TIFFScanlineSize(tif) ));
+ mm_log((1, "i_writetiff_wiol_faxable: TIFFGetField scanlinesize=%lu\n",
+ (unsigned long)TIFFScanlineSize(tif) ));
mm_log((1, "i_writetiff_wiol_faxable: TIFFGetField planarconfig=%d == %d\n", rc, PLANARCONFIG_CONTIG));
if (!TIFFSetField(tif, TIFFTAG_XRESOLUTION, (float)204))
View
3 datatypes.c
@@ -232,9 +232,6 @@ llink_destroy(struct llink* l) {
static int
llist_llink_push(struct llist *lst, struct llink *lnk, const void *data) {
- int multip;
- multip = lst->multip;
-
/* fprintf(stderr,"llist_llink_push: data=0x%08X -> 0x%08X\n",data,*(int*)data);
fprintf(stderr,"ssize = %d, multip = %d, fill = %d\n",lst->ssize,lst->multip,lnk->fill); */
if (lnk->fill == lst->multip) return 1;
View
3 draw.c
@@ -176,14 +176,13 @@ i_mmarray_info(i_mmarray *ar) {
static void
i_arc_minmax(i_int_hlines *hlines,i_img_dim x,i_img_dim y, double rad,float d1,float d2) {
i_mmarray dot;
- double f,fx,fy;
+ double f;
i_img_dim x1,y1;
i_mmarray_cr(&dot, hlines->limit_y);
x1=(i_img_dim)(x+0.5+rad*cos(d1*PI/180.0));
y1=(i_img_dim)(y+0.5+rad*sin(d1*PI/180.0));
- fx=(float)x1; fy=(float)y1;
/* printf("x1: %d.\ny1: %d.\n",x1,y1); */
i_arcdraw(x, y, x1, y1, &dot);
View
9 filters.im
@@ -414,7 +414,6 @@ i_bumpmap_complex(i_img *im,
i_color *Is) {
i_img new_im;
- int inflight;
i_img_dim x, y;
int ch;
i_img_dim mx, Mx, my, My;
@@ -462,7 +461,6 @@ i_bumpmap_complex(i_img *im,
L.z = -Lz;
normalize(&L);
} else { /* Light is the position of the light source */
- inflight = 0;
L.x = -0.2;
L.y = -0.4;
L.z = 1;
@@ -1650,7 +1648,6 @@ i_fountain(i_img *im, double xa, double ya, double xb, double yb,
i_fcolor *line = NULL;
i_fcolor *work = NULL;
size_t line_bytes;
- i_fountain_seg *my_segs;
i_fill_combine_f combine_func = NULL;
i_fill_combinef_f combinef_func = NULL;
dIMCTXim(im);
@@ -1673,7 +1670,6 @@ i_fountain(i_img *im, double xa, double ya, double xb, double yb,
fount_init_state(&state, xa, ya, xb, yb, type, repeat, combine,
super_sample, ssample_param, count, segs);
- my_segs = state.segs;
for (y = 0; y < im->ysize; ++y) {
i_glinf(im, 0, im->xsize, y, line);
@@ -2358,8 +2354,9 @@ fill_fountf(i_fill_t *fill, i_img_dim x, i_img_dim y, i_img_dim width,
got_one = f->state.ssfunc(&c, x, y, &f->state);
else
got_one = fount_getat(&c, x, y, &f->state);
-
- *data++ = c;
+
+ if (got_one)
+ *data++ = c;
++x;
}
View
6 fontft1.c
@@ -762,12 +762,10 @@ i_tt_render_glyph( TT_Glyph glyph, TT_Glyph_Metrics* gmetrics, TT_Raster_Map *bi
if ( !smooth ) TT_Get_Glyph_Bitmap( glyph, bit, x_off * 64, y_off * 64);
else {
- TT_F26Dot6 xmin, ymin, xmax, ymax;
+ TT_F26Dot6 xmin, ymin;
xmin = gmetrics->bbox.xMin & -64;
ymin = gmetrics->bbox.yMin & -64;
- xmax = (gmetrics->bbox.xMax + 63) & -64;
- ymax = (gmetrics->bbox.yMax + 63) & -64;
i_tt_clear_raster_map( small_bit );
TT_Get_Glyph_Pixmap( glyph, small_bit, -xmin, -ymin );
@@ -1121,8 +1119,6 @@ i_tt_bbox_inst( TT_Fonthandle *handle, int inst ,const char *txt, size_t len, i_
int rightb = 0;
unsigned long j;
- unsigned char *ustr;
- ustr=(unsigned char*)txt;
mm_log((1,"i_tt_box_inst(handle %p,inst %d,txt '%.*s', len %ld, utf8 %d)\n",
handle, inst, (int)len, txt, (long)len, utf8));
View
3 image.c
@@ -1049,7 +1049,7 @@ i_haar(i_img *im) {
i_img_dim mx,my;
i_img_dim fx,fy;
i_img_dim x,y;
- int ch,c;
+ int ch;
i_img *new_img,*new_img2;
i_color val1,val2,dval1,dval2;
dIMCTXim(im);
@@ -1065,7 +1065,6 @@ i_haar(i_img *im) {
new_img=i_img_empty_ch(NULL,fx*2,fy*2,im->channels);
new_img2=i_img_empty_ch(NULL,fx*2,fy*2,im->channels);
- c=0;
for(y=0;y<my;y++) for(x=0;x<fx;x++) {
i_gpix(im,x*2,y,&val1);
i_gpix(im,x*2+1,y,&val2);
View
3 iolayer.c
@@ -379,7 +379,6 @@ from io_new_bufchain().
size_t
io_slurp(io_glue *ig, unsigned char **c) {
ssize_t rc;
- off_t orgoff;
io_ex_bchain *ieb;
unsigned char *cc;
io_type inn = ig->type;
@@ -392,8 +391,6 @@ io_slurp(io_glue *ig, unsigned char **c) {
ieb = ig->exdata;
cc = *c = mymalloc( ieb->length );
- orgoff = ieb->gpos;
-
bufchain_seek(ig, 0, SEEK_SET);
rc = bufchain_read(ig, cc, ieb->length);
View
3 paste.im
@@ -18,7 +18,7 @@ are swapped.
void
i_copyto(i_img *im, i_img *src, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_dim y2, i_img_dim tx, i_img_dim ty) {
- i_img_dim y, t, ttx, tty;
+ i_img_dim y, t, tty;
if (x2<x1) { t=x1; x1=x2; x2=t; }
if (y2<y1) { t=y1; y1=y2; y2=t; }
@@ -50,7 +50,6 @@ i_copyto(i_img *im, i_img *src, i_img_dim x1, i_img_dim y1, i_img_dim x2, i_img_
IM_COLOR *row = mymalloc(sizeof(IM_COLOR) * (x2-x1));
tty = ty;
for(y=y1; y<y2; y++) {
- ttx = tx;
IM_GLIN(src, x1, x2, y, row);
if (src->channels != im->channels)
IM_ADAPT_COLORS(im->channels, src->channels, row, x2-x1);
View
2 pnm.c
@@ -436,7 +436,6 @@ i_readpnm_wiol( io_glue *ig, int allow_incomplete) {
i_img* im;
int type;
int width, height, maxval, channels;
- int rounder;
int c;
i_clear_error();
@@ -528,7 +527,6 @@ i_readpnm_wiol( io_glue *ig, int allow_incomplete) {
return NULL;
}
} else maxval=1;
- rounder = maxval / 2;
if ((c = i_io_getc(ig)) == EOF || !misspace(c)) {
i_push_error(0, "garbage in header, invalid PNM file");
View
3 polygon.c
@@ -325,7 +325,6 @@ render_slice_scanline(ss_scanline *ss, int y, p_line *l, p_line *r, pcord miny,
pcord lminx, lmaxx; /* left line min/max within y bounds in fine coords */
pcord rminx, rmaxx; /* right line min/max within y bounds in fine coords */
i_img_dim cpix; /* x-coordinate of current pixel */
- int thin; /* boolean for thin/thick segment */
i_img_dim startpix; /* temporary variable for "start of this interval" */
i_img_dim stoppix; /* temporary variable for "end of this interval" */
@@ -350,8 +349,6 @@ render_slice_scanline(ss_scanline *ss, int y, p_line *l, p_line *r, pcord miny,
rminx = i_min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
rmaxx = i_max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
- thin = coarse(lmaxx) >= coarse(rminx);
-
startpix = i_max( coarse(lminx), 0 );
stoppix = i_min( coarse(rmaxx-1), ss->linelen-1 );
View
4 quant.c
@@ -1574,15 +1574,15 @@ static
void
cr_hashindex(cvec clr[256],int cnum,hashbox hb[512]) {
- int bx,mind,cd,cumcnt,bst_idx,i;
+ int bx,mind,cd,cumcnt,i;
/* printf("indexing... \n");*/
cumcnt=0;
for(bx=0; bx<512; bx++) {
mind=196608;
for(i=0; i<cnum; i++) {
cd = maxdist(bx,&clr[i]);
- if (cd < mind) { mind=cd; bst_idx=i; }
+ if (cd < mind) { mind=cd; }
}
hb[bx].cnt=0;
View
2 rotate.im
@@ -309,7 +309,6 @@ i_img *i_matrix_transform_bg(i_img *src, i_img_dim xsize, i_img_dim ysize, const
/* don't interpolate for a palette based image */
i_palidx *vals = mymalloc(xsize * sizeof(i_palidx));
i_palidx back = 0;
- i_color min;
int minval = 256 * 4;
i_img_dim ix, iy;
i_color want_back;
@@ -340,7 +339,6 @@ i_img *i_matrix_transform_bg(i_img *src, i_img_dim xsize, i_img_dim ysize, const
}
if (tempval < minval) {
back = i;
- min = temp;
minval = tempval;
}
}
View
3 rubthru.im
@@ -5,7 +5,7 @@ rubthru_targ_noalpha(i_img *im, i_img *src,
i_img_dim tx, i_img_dim ty,
i_img_dim src_minx, i_img_dim src_miny,
i_img_dim src_maxx, i_img_dim src_maxy) {
- i_img_dim x, y, ttx, tty;
+ i_img_dim x, y, tty;
int alphachan;
int ch;
i_img_dim width = src_maxx - src_minx;
@@ -37,7 +37,6 @@ rubthru_targ_noalpha(i_img *im, i_img *src,
for(y = src_miny; y < src_maxy; y++) {
IM_COLOR *srcp = src_line;
IM_COLOR *destp = dest_line;
- ttx = tx;
IM_GLIN(src, src_minx, src_maxx, y, src_line);
IM_GLIN(im, tx, tx + width, tty, dest_line);
if (src->channels != want_channels)

0 comments on commit 9874730

Please sign in to comment.