From: Tony Cook Date: Tue, 30 Jan 2007 08:58:39 +0000 (+0000) Subject: change C to C to match the tag name X-Git-Tag: Imager-0.56~22 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/d87dc9a439267f2f014ca9a1b00a518706105998 change C to C to match the tag name --- diff --git a/Imager.pm b/Imager.pm index bde12587..0279c6c5 100644 --- a/Imager.pm +++ b/Imager.pm @@ -1269,13 +1269,13 @@ sub read { return $self; } - my $allow_partial = $input{allow_partial}; - defined $allow_partial or $allow_partial = 0; + my $allow_incomplete = $input{allow_incomplete}; + defined $allow_incomplete or $allow_incomplete = 0; if ( $input{'type'} eq 'tiff' ) { my $page = $input{'page'}; defined $page or $page = 0; - $self->{IMG}=i_readtiff_wiol( $IO, $allow_partial, $page ); + $self->{IMG}=i_readtiff_wiol( $IO, $allow_incomplete, $page ); if ( !defined($self->{IMG}) ) { $self->{ERRSTR}=$self->_error_as_msg(); return undef; } @@ -1284,7 +1284,7 @@ sub read { } if ( $input{'type'} eq 'pnm' ) { - $self->{IMG}=i_readpnm_wiol( $IO, $allow_partial ); + $self->{IMG}=i_readpnm_wiol( $IO, $allow_incomplete ); if ( !defined($self->{IMG}) ) { $self->{ERRSTR}='unable to read pnm image: '._error_as_msg(); return undef; @@ -1303,7 +1303,7 @@ sub read { } if ( $input{'type'} eq 'bmp' ) { - $self->{IMG}=i_readbmp_wiol( $IO, $allow_partial ); + $self->{IMG}=i_readbmp_wiol( $IO, $allow_incomplete ); if ( !defined($self->{IMG}) ) { $self->{ERRSTR}=$self->_error_as_msg(); return undef; diff --git a/Imager.xs b/Imager.xs index 3997a1e5..32abacc9 100644 --- a/Imager.xs +++ b/Imager.xs @@ -2252,9 +2252,9 @@ i_test_format_probe(ig, length) #ifdef HAVE_LIBTIFF Imager::ImgRaw -i_readtiff_wiol(ig, allow_partial, page=0) +i_readtiff_wiol(ig, allow_incomplete, page=0) Imager::IO ig - int allow_partial + int allow_incomplete int page void @@ -2883,9 +2883,9 @@ i_readgif_multi_wiol(ig) Imager::ImgRaw -i_readpnm_wiol(ig, allow_partial) +i_readpnm_wiol(ig, allow_incomplete) Imager::IO ig - int allow_partial + int allow_incomplete undef_int @@ -2914,9 +2914,9 @@ i_writebmp_wiol(im,ig) Imager::IO ig Imager::ImgRaw -i_readbmp_wiol(ig, allow_partial=0) +i_readbmp_wiol(ig, allow_incomplete=0) Imager::IO ig - int allow_partial + int allow_incomplete undef_int diff --git a/bmp.c b/bmp.c index 94fe6ffb..3fb250ff 100644 --- a/bmp.c +++ b/bmp.c @@ -45,14 +45,14 @@ static int write_8bit_data(io_glue *ig, i_img *im); static int write_24bit_data(io_glue *ig, i_img *im); static int read_bmp_pal(io_glue *ig, i_img *im, int count); static i_img *read_1bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial); + int compression, long offbits, int allow_incomplete); static i_img *read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial); + int compression, long offbits, int allow_incomplete); static i_img *read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial); + int compression, long offbits, int allow_incomplete); static i_img *read_direct_bmp(io_glue *ig, int xsize, int ysize, int bit_count, int clr_used, int compression, - long offbits, int allow_partial); + long offbits, int allow_incomplete); /* =item i_writebmp_wiol(im, io_glue) @@ -102,7 +102,7 @@ BI_BITFIELDS images too, but I need a test image. */ i_img * -i_readbmp_wiol(io_glue *ig, int allow_partial) { +i_readbmp_wiol(io_glue *ig, int allow_incomplete) { int b_magic, m_magic, filesize, res1, res2, infohead_size; int xsize, ysize, planes, bit_count, compression, size_image, xres, yres; int clr_used, clr_important, offbits; @@ -118,7 +118,7 @@ i_readbmp_wiol(io_glue *ig, int allow_partial) { &xsize, &ysize, &planes, &bit_count, &compression, &size_image, &xres, &yres, &clr_used, &clr_important)) { - i_push_error(0, "file too short"); + i_push_error(0, "file too short to be a BMP file"); return 0; } if (b_magic != 'B' || m_magic != 'M' || infohead_size != INFOHEAD_SIZE @@ -141,24 +141,24 @@ i_readbmp_wiol(io_glue *ig, int allow_partial) { switch (bit_count) { case 1: im = read_1bit_bmp(ig, xsize, ysize, clr_used, compression, offbits, - allow_partial); + allow_incomplete); break; case 4: im = read_4bit_bmp(ig, xsize, ysize, clr_used, compression, offbits, - allow_partial); + allow_incomplete); break; case 8: im = read_8bit_bmp(ig, xsize, ysize, clr_used, compression, offbits, - allow_partial); + allow_incomplete); break; case 32: case 24: case 16: im = read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, - offbits, allow_partial); + offbits, allow_incomplete); break; default: @@ -666,7 +666,7 @@ Returns the image or NULL. */ static i_img * read_1bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial) { + int compression, long offbits, int allow_incomplete) { i_img *im; int x, y, lasty, yinc, start_y; i_palidx *line, *p; @@ -748,7 +748,7 @@ read_1bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, if (ig->readcb(ig, packed, line_size) != line_size) { myfree(packed); myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(start_y - y)); return im; @@ -793,7 +793,7 @@ point. */ static i_img * read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial) { + int compression, long offbits, int allow_incomplete) { i_img *im; int x, y, lasty, yinc; i_palidx *line, *p; @@ -869,7 +869,7 @@ read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, if (ig->readcb(ig, packed, line_size) != line_size) { myfree(packed); myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(y - starty)); return im; @@ -904,7 +904,7 @@ read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, if (ig->readcb(ig, packed, 2) != 2) { myfree(packed); myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(y - starty)); return im; @@ -941,7 +941,7 @@ read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, if (ig->readcb(ig, packed, 2) != 2) { myfree(packed); myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(y - starty)); return im; @@ -963,7 +963,7 @@ read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, if (ig->readcb(ig, packed, read_size) != read_size) { myfree(packed); myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(y - starty)); return im; @@ -997,7 +997,7 @@ read_4bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, } /* -=item read_8bit_bmp(ig, xsize, ysize, clr_used, compression, allow_partial) +=item read_8bit_bmp(ig, xsize, ysize, clr_used, compression, allow_incomplete) Reads in the palette and image data for a 8-bit/pixel image. @@ -1007,7 +1007,7 @@ Returns the image or NULL. */ static i_img * read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, - int compression, long offbits, int allow_partial) { + int compression, long offbits, int allow_incomplete) { i_img *im; int x, y, lasty, yinc, start_y; i_palidx *line; @@ -1074,7 +1074,7 @@ read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, while (y != lasty) { if (ig->readcb(ig, line, line_size) != line_size) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(start_y - y)); return im; @@ -1101,7 +1101,7 @@ read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, /* there's always at least 2 bytes in a sequence */ if (ig->readcb(ig, packed, 2) != 2) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y)); return im; @@ -1130,7 +1130,7 @@ read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, case BMPRLE_DELTA: if (ig->readcb(ig, packed, 2) != 2) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y)); return im; @@ -1150,7 +1150,7 @@ read_8bit_bmp(io_glue *ig, int xsize, int ysize, int clr_used, read_size = (count+1) / 2 * 2; if (ig->readcb(ig, line, read_size) != read_size) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", abs(start_y-y)); return im; @@ -1199,7 +1199,7 @@ static struct bm_masks std_masks[] = }; /* -=item read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, allow_partial) +=item read_direct_bmp(ig, xsize, ysize, bit_count, clr_used, compression, allow_incomplete) Skips the palette and reads in the image data for a direct colour image. @@ -1210,7 +1210,7 @@ Returns the image or NULL. static i_img * read_direct_bmp(io_glue *ig, int xsize, int ysize, int bit_count, int clr_used, int compression, long offbits, - int allow_partial) { + int allow_incomplete) { i_img *im; int x, y, lasty, yinc; i_color *line, *p; @@ -1316,7 +1316,7 @@ read_direct_bmp(io_glue *ig, int xsize, int ysize, int bit_count, unsigned pixel; if (!read_packed(ig, unpack_code, &pixel)) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", lasty - y); return im; diff --git a/imager.h b/imager.h index 5608411f..b9c6c03e 100644 --- a/imager.h +++ b/imager.h @@ -364,7 +364,7 @@ undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor); #endif /* HAVE_LIBJPEG */ #ifdef HAVE_LIBTIFF -i_img * i_readtiff_wiol(io_glue *ig, int allow_partial, int page); +i_img * i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page); i_img ** i_readtiff_multi_wiol(io_glue *ig, int length, int *count); undef_int i_writetiff_wiol(i_img *im, io_glue *ig); undef_int i_writetiff_multi_wiol(io_glue *ig, i_img **imgs, int count); @@ -402,11 +402,11 @@ void i_qdist(i_img *im); i_img * i_readraw_wiol(io_glue *ig, int x, int y, int datachannels, int storechannels, int intrl); undef_int i_writeraw_wiol(i_img* im, io_glue *ig); -i_img * i_readpnm_wiol(io_glue *ig, int allow_partial); +i_img * i_readpnm_wiol(io_glue *ig, int allow_incomplete); undef_int i_writeppm_wiol(i_img *im, io_glue *ig); extern int i_writebmp_wiol(i_img *im, io_glue *ig); -extern i_img *i_readbmp_wiol(io_glue *ig, int allow_partial); +extern i_img *i_readbmp_wiol(io_glue *ig, int allow_incomplete); int tga_header_verify(unsigned char headbuf[18]); diff --git a/pnm.c b/pnm.c index d777e21d..3c96a56f 100644 --- a/pnm.c +++ b/pnm.c @@ -238,7 +238,7 @@ gnum(mbuf *mb, int *i) { static i_img * read_pgm_ppm_bin8(mbuf *mb, i_img *im, int width, int height, - int channels, int maxval, int allow_partial) { + int channels, int maxval, int allow_incomplete) { i_color *line, *linep; int read_size; unsigned char *read_buf, *readp; @@ -254,7 +254,7 @@ read_pgm_ppm_bin8(mbuf *mb, i_img *im, int width, int height, if (gread(mb, read_buf, read_size) != read_size) { myfree(line); myfree(read_buf); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", y); return im; @@ -296,7 +296,7 @@ read_pgm_ppm_bin8(mbuf *mb, i_img *im, int width, int height, static i_img * read_pgm_ppm_bin16(mbuf *mb, i_img *im, int width, int height, - int channels, int maxval, int allow_partial) { + int channels, int maxval, int allow_incomplete) { i_fcolor *line, *linep; int read_size; unsigned char *read_buf, *readp; @@ -312,7 +312,7 @@ read_pgm_ppm_bin16(mbuf *mb, i_img *im, int width, int height, if (gread(mb, read_buf, read_size) != read_size) { myfree(line); myfree(read_buf); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", y); return im; @@ -343,7 +343,7 @@ read_pgm_ppm_bin16(mbuf *mb, i_img *im, int width, int height, static i_img * -read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_partial) { +read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_incomplete) { i_palidx *line, *linep; int read_size; unsigned char *read_buf, *readp; @@ -357,7 +357,7 @@ read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_partial) { if (gread(mb, read_buf, read_size) != read_size) { myfree(line); myfree(read_buf); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", y); return im; @@ -393,7 +393,7 @@ read_pbm_bin(mbuf *mb, i_img *im, int width, int height, int allow_partial) { */ static i_img * -read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_partial) { +read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_incomplete) { i_palidx *line, *linep; int x, y; @@ -405,7 +405,7 @@ read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_partial) { skip_spaces(mb); if (!(cp = gnext(mb)) || (*cp != '0' && *cp != '1')) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", y); return im; @@ -431,7 +431,7 @@ read_pbm_ascii(mbuf *mb, i_img *im, int width, int height, int allow_partial) { static i_img * read_pgm_ppm_ascii(mbuf *mb, i_img *im, int width, int height, int channels, - int maxval, int allow_partial) { + int maxval, int allow_incomplete) { i_color *line, *linep; int x, y, ch; int rounder = maxval / 2; @@ -445,7 +445,7 @@ read_pgm_ppm_ascii(mbuf *mb, i_img *im, int width, int height, int channels, if (!gnum(mb, &sample)) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_incomplete", 1); i_tags_setn(&im->tags, "i_lines_read", 1); return im; @@ -475,7 +475,7 @@ read_pgm_ppm_ascii(mbuf *mb, i_img *im, int width, int height, int channels, static i_img * read_pgm_ppm_ascii_16(mbuf *mb, i_img *im, int width, int height, - int channels, int maxval, int allow_partial) { + int channels, int maxval, int allow_incomplete) { i_fcolor *line, *linep; int x, y, ch; double maxvalf = maxval; @@ -489,7 +489,10 @@ read_pgm_ppm_ascii_16(mbuf *mb, i_img *im, int width, int height, if (!gnum(mb, &sample)) { myfree(line); - if (allow_partial) { + if (allow_incomplete) { + i_tags_setn(&im->tags, "i_incomplete", 1); + i_tags_setn(&im->tags, "i_lines_read", y); + return im; } else { if (gpeek(mb)) @@ -514,19 +517,19 @@ read_pgm_ppm_ascii_16(mbuf *mb, i_img *im, int width, int height, } /* -=item i_readpnm_wiol(ig, allow_partial) +=item i_readpnm_wiol(ig, allow_incomplete) Retrieve an image and stores in the iolayer object. Returns NULL on fatal error. ig - io_glue object - allow_partial - allows a partial file to be read successfully + allow_incomplete - allows a partial file to be read successfully =cut */ i_img * -i_readpnm_wiol(io_glue *ig, int allow_partial) { +i_readpnm_wiol(io_glue *ig, int allow_incomplete) { i_img* im; int type; int width, height, maxval, channels, pcount; @@ -535,7 +538,7 @@ i_readpnm_wiol(io_glue *ig, int allow_partial) { mbuf buf; i_clear_error(); - mm_log((1,"i_readpnm(ig %p, allow_partial %d)\n", ig, allow_partial)); + mm_log((1,"i_readpnm(ig %p, allow_incomplete %d)\n", ig, allow_incomplete)); io_glue_commit_types(ig); init_buf(&buf, ig); @@ -661,27 +664,27 @@ i_readpnm_wiol(io_glue *ig, int allow_partial) { switch (type) { case 1: /* Ascii types */ - im = read_pbm_ascii(&buf, im, width, height, allow_partial); + im = read_pbm_ascii(&buf, im, width, height, allow_incomplete); break; case 2: case 3: if (maxval > 255) - im = read_pgm_ppm_ascii_16(&buf, im, width, height, channels, maxval, allow_partial); + im = read_pgm_ppm_ascii_16(&buf, im, width, height, channels, maxval, allow_incomplete); else - im = read_pgm_ppm_ascii(&buf, im, width, height, channels, maxval, allow_partial); + im = read_pgm_ppm_ascii(&buf, im, width, height, channels, maxval, allow_incomplete); break; case 4: /* binary pbm */ - im = read_pbm_bin(&buf, im, width, height, allow_partial); + im = read_pbm_bin(&buf, im, width, height, allow_incomplete); break; case 5: /* binary pgm */ case 6: /* binary ppm */ if (maxval > 255) - im = read_pgm_ppm_bin16(&buf, im, width, height, channels, maxval, allow_partial); + im = read_pgm_ppm_bin16(&buf, im, width, height, channels, maxval, allow_incomplete); else - im = read_pgm_ppm_bin8(&buf, im, width, height, channels, maxval, allow_partial); + im = read_pgm_ppm_bin8(&buf, im, width, height, channels, maxval, allow_incomplete); break; default: diff --git a/tiff.c b/tiff.c index ccbcd554..8406ca6b 100644 --- a/tiff.c +++ b/tiff.c @@ -151,7 +151,7 @@ comp_munmap(thandle_t h, tdata_t p, toff_t off) { /* do nothing */ } -static i_img *read_one_tiff(TIFF *tif, int allow_partial) { +static i_img *read_one_tiff(TIFF *tif, int allow_incomplete) { i_img *im; uint32 width, height; uint16 channels; @@ -296,7 +296,7 @@ static i_img *read_one_tiff(TIFF *tif, int allow_partial) { ++row; } if (row < height) { - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_lines_read", row); } else { @@ -390,7 +390,7 @@ static i_img *read_one_tiff(TIFF *tif, int allow_partial) { uint32 newrows, i_row; if (!TIFFReadRGBAStrip(tif, row, raster)) { - if (allow_partial) { + if (allow_incomplete) { i_tags_setn(&im->tags, "i_lines_read", row); error++; break; @@ -437,7 +437,7 @@ static i_img *read_one_tiff(TIFF *tif, int allow_partial) { =cut */ i_img* -i_readtiff_wiol(io_glue *ig, int allow_partial, int page) { +i_readtiff_wiol(io_glue *ig, int allow_incomplete, int page) { TIFF* tif; TIFFErrorHandler old_handler; TIFFErrorHandler old_warn_handler; @@ -453,7 +453,7 @@ i_readtiff_wiol(io_glue *ig, int allow_partial, int page) { /* Also add code to check for mmapped code */ io_glue_commit_types(ig); - mm_log((1, "i_readtiff_wiol(ig %p, allow_partial %d, page %d)\n", ig, allow_partial, page)); + mm_log((1, "i_readtiff_wiol(ig %p, allow_incomplete %d, page %d)\n", ig, allow_incomplete, page)); tif = TIFFClientOpen("(Iolayer)", "rm", @@ -485,7 +485,7 @@ i_readtiff_wiol(io_glue *ig, int allow_partial, int page) { } } - im = read_one_tiff(tif, allow_partial); + im = read_one_tiff(tif, allow_incomplete); if (TIFFLastDirectory(tif)) mm_log((1, "Last directory of tiff file\n")); TIFFSetErrorHandler(old_handler);