diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-09-25 07:25:45 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-09-25 07:25:45 +0000 |
commit | 576aecf55169a363532f3ff3c1e017f5a160fea4 (patch) | |
tree | ca08bf29ad11d6ae65f6c86dec6857b91763a6af /Build/source/texk/dvipdfm-x | |
parent | e38959e5a4852c628af4a12d236086a299680671 (diff) |
texk/dvipdfm-x: More cleanup (whitespace and long => int or uint32_t)
git-svn-id: svn://tug.org/texlive/trunk@35252 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/bmpimage.c | 76 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/bmpimage.h | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/jp2image.c | 28 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/jp2image.h | 6 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/jpegimage.c | 16 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/jpegimage.h | 8 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pngimage.c | 22 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pngimage.h | 8 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/xbb.c | 12 |
10 files changed, 95 insertions, 92 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 7124fb467f1..b8703be156d 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2014-09-25 Peter Breitenlohner <peb@mppmu.mpg.de> + + * {bmp,jp2,jpeg,png}image.[ch], xbb.c: More cleanup (whitespace + and long => int or uint32_t). + 2014-09-24 Peter Breitenlohner <peb@mppmu.mpg.de> * jp2image.c: Add newline at end of file. diff --git a/Build/source/texk/dvipdfm-x/bmpimage.c b/Build/source/texk/dvipdfm-x/bmpimage.c index 70b3f3f5b02..fd83af0842c 100644 --- a/Build/source/texk/dvipdfm-x/bmpimage.c +++ b/Build/source/texk/dvipdfm-x/bmpimage.c @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -52,22 +52,22 @@ #define DIB_HEADER_SIZE_MAX (DIB_FILE_HEADER_SIZE+DIB_INFO_HEADER_SIZE5) struct hdr_info { - long offset; - long hsize; - long width; - long height; - long compression; + unsigned int offset; + unsigned int hsize; + unsigned int width; + unsigned int height; + int compression; unsigned short bit_count; /* Bits per pix */ - long psize; /* Bytes per palette color: 3 for OS2, 4 for Win */ - unsigned long x_pix_per_meter; - unsigned long y_pix_per_meter; + int psize; /* Bytes per palette color: 3 for OS2, 4 for Win */ + unsigned int x_pix_per_meter; + unsigned int y_pix_per_meter; }; static int read_header (FILE *fp, struct hdr_info *hdr); -static long read_raster_rle8 (unsigned char *data_ptr, - long width, long height, FILE *fp); -static long read_raster_rle4 (unsigned char *data_ptr, - long width, long height, FILE *fp); +static int read_raster_rle8 (unsigned char *data_ptr, + int width, int height, FILE *fp); +static int read_raster_rle4 (unsigned char *data_ptr, + int width, int height, FILE *fp); int check_for_bmp (FILE *fp) @@ -124,7 +124,7 @@ bmp_include_image (pdf_ximage *ximage, FILE *fp) struct hdr_info hdr; int num_palette, flip; int i; - + pdf_ximage_init_image_info(&info); stream = stream_dict = colorspace = NULL; @@ -204,14 +204,14 @@ bmp_include_image (pdf_ximage *ximage, FILE *fp) /* Raster data of BMP is four-byte aligned. */ { - long rowbytes, n; + int rowbytes, n; unsigned char *p, *stream_data_ptr = NULL; rowbytes = (info.width * hdr.bit_count + 7) / 8; seek_absolute(fp, hdr.offset); if (hdr.compression == DIB_COMPRESS_NONE) { - long dib_rowbytes; + int dib_rowbytes; int padding; padding = (rowbytes % 4) ? 4 - (rowbytes % 4) : 0; @@ -228,21 +228,19 @@ bmp_include_image (pdf_ximage *ximage, FILE *fp) } } else if (hdr.compression == DIB_COMPRESS_RLE8) { stream_data_ptr = NEW(rowbytes*info.height, unsigned char); - if (read_raster_rle8(stream_data_ptr, - info.width, info.height, fp) < 0) { - WARN("Reading BMP raster data failed..."); - pdf_release_obj(stream); - RELEASE(stream_data_ptr); - return -1; + if (read_raster_rle8(stream_data_ptr, info.width, info.height, fp) < 0) { + WARN("Reading BMP raster data failed..."); + pdf_release_obj(stream); + RELEASE(stream_data_ptr); + return -1; } } else if (hdr.compression == DIB_COMPRESS_RLE4) { - stream_data_ptr = NEW(rowbytes*info.height, unsigned char); - if (read_raster_rle4(stream_data_ptr, - info.width, info.height, fp) < 0) { - WARN("Reading BMP raster data failed..."); - pdf_release_obj(stream); - RELEASE(stream_data_ptr); - return -1; + stream_data_ptr = NEW(rowbytes*info.height, unsigned char); + if (read_raster_rle4(stream_data_ptr, info.width, info.height, fp) < 0) { + WARN("Reading BMP raster data failed..."); + pdf_release_obj(stream); + RELEASE(stream_data_ptr); + return -1; } } else { WARN("Unknown/Unsupported compression type for BMP image: %ld", hdr.compression); @@ -355,13 +353,13 @@ read_header (FILE *fp, struct hdr_info *hdr) return 0; } -static long +static int read_raster_rle8 (unsigned char *data_ptr, - long width, long height, FILE *fp) + int width, int height, FILE *fp) { - long count = 0; + int count = 0; unsigned char *p, b0, b1; - long h, v, rowbytes; + int h, v, rowbytes; int eol, eoi; p = data_ptr; @@ -435,13 +433,13 @@ read_raster_rle8 (unsigned char *data_ptr, return count; } -static long +static int read_raster_rle4 (unsigned char *data_ptr, - long width, long height, FILE *fp) + int width, int height, FILE *fp) { - long count = 0; + int count = 0; unsigned char *p, b0, b1, b; - long h, v, rowbytes; + int h, v, rowbytes; int eol, eoi, i, nbytes; p = data_ptr; diff --git a/Build/source/texk/dvipdfm-x/bmpimage.h b/Build/source/texk/dvipdfm-x/bmpimage.h index 501ff3ef8c2..7254ec98350 100644 --- a/Build/source/texk/dvipdfm-x/bmpimage.h +++ b/Build/source/texk/dvipdfm-x/bmpimage.h @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. diff --git a/Build/source/texk/dvipdfm-x/jp2image.c b/Build/source/texk/dvipdfm-x/jp2image.c index 9c03dcc90ec..aa601fabebd 100644 --- a/Build/source/texk/dvipdfm-x/jp2image.c +++ b/Build/source/texk/dvipdfm-x/jp2image.c @@ -59,10 +59,10 @@ #define JPX_BOX_LBL_ 0x6c626c20 /* Label */ -static unsigned long -read_box_hdr (FILE *fp, unsigned long *lbox, unsigned long *tbox) +static unsigned int +read_box_hdr (FILE *fp, unsigned int *lbox, unsigned int *tbox) { - unsigned long bytesread = 0; + unsigned int bytesread = 0; *lbox = get_unsigned_quad(fp); *tbox = get_unsigned_quad(fp); @@ -97,10 +97,10 @@ check_jp___box (FILE *fp) } static int -check_ftyp_data (FILE *fp, unsigned long size) +check_ftyp_data (FILE *fp, unsigned int size) { int supported = 0; - unsigned long BR, CLi; + unsigned int BR, CLi; BR = get_unsigned_quad(fp); size -= 4; @@ -132,7 +132,7 @@ check_ftyp_data (FILE *fp, unsigned long size) static void -read_res__data (ximage_info *info, FILE *fp, unsigned long size) +read_res__data (ximage_info *info, FILE *fp, unsigned int size) { unsigned int VR_N, VR_D, HR_N, HR_D; unsigned char VR_E, HR_E; @@ -152,9 +152,9 @@ read_res__data (ximage_info *info, FILE *fp, unsigned long size) } static int -scan_res_ (ximage_info *info, FILE *fp, unsigned long size) +scan_res_ (ximage_info *info, FILE *fp, unsigned int size) { - unsigned long len, lbox, tbox; + unsigned int len, lbox, tbox; int have_resd = 0; while (size > 0) { @@ -186,10 +186,10 @@ scan_res_ (ximage_info *info, FILE *fp, unsigned long size) } static int -scan_jp2h (ximage_info *info, FILE *fp, unsigned long size) +scan_jp2h (ximage_info *info, FILE *fp, unsigned int size) { int error = 0, have_ihdr = 0; - unsigned long len, lbox, tbox; + unsigned int len, lbox, tbox; while (size > 0 && !error) { len = read_box_hdr(fp, &lbox, &tbox); @@ -234,8 +234,8 @@ static int scan_file (ximage_info *info, FILE *fp) { int error = 0, have_jp2h = 0; - long size; - unsigned long len, lbox, tbox; + int size; + unsigned int len, lbox, tbox; size = file_size(fp); @@ -290,7 +290,7 @@ scan_file (ximage_info *info, FILE *fp) int check_for_jp2 (FILE *fp) { - unsigned long len, lbox, tbox; + unsigned int len, lbox, tbox; if (!fp) return 0; @@ -339,7 +339,7 @@ jp2_include_image (pdf_ximage *ximage, FILE *fp) pdf_new_name("Filter"), pdf_new_name("JPXDecode")); /* Read whole file */ { - long nb_read; + size_t nb_read; rewind(fp); while ((nb_read = fread(work_buffer, sizeof(char), WORK_BUFFER_SIZE, fp)) > 0) diff --git a/Build/source/texk/dvipdfm-x/jp2image.h b/Build/source/texk/dvipdfm-x/jp2image.h index cf22adb7895..6df5e743014 100644 --- a/Build/source/texk/dvipdfm-x/jp2image.h +++ b/Build/source/texk/dvipdfm-x/jp2image.h @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Matthias Franz, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. diff --git a/Build/source/texk/dvipdfm-x/jpegimage.c b/Build/source/texk/dvipdfm-x/jpegimage.c index be4f8fca4c9..7ec4dcfda54 100644 --- a/Build/source/texk/dvipdfm-x/jpegimage.c +++ b/Build/source/texk/dvipdfm-x/jpegimage.c @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -541,10 +541,10 @@ read_APP14_Adobe (struct JPEG_info *j_info, FILE *fp) return 7; } -static unsigned long +static unsigned int read_exif_bytes(unsigned char **p, int n, int b) { - unsigned long rval = 0; + unsigned int rval = 0; unsigned char *pp = *p; if (b) { switch (n) { @@ -659,7 +659,7 @@ read_APP1_Exif (struct JPEG_info *j_info, FILE *fp, unsigned short length) } } } - + j_info->xdpi = xres * res_unit; j_info->ydpi = yres * res_unit; @@ -747,7 +747,7 @@ static int JPEG_copy_stream (struct JPEG_info *j_info, pdf_obj *stream, FILE *fp) { JPEG_marker marker; - long length, nb_read; + int length, nb_read; int found_SOFn, count; rewind(fp); @@ -922,7 +922,7 @@ JPEG_scan_file (struct JPEG_info *j_info, FILE *fp) } int -jpeg_get_bbox (FILE *fp, long *width, long *height, +jpeg_get_bbox (FILE *fp, int *width, int *height, double *xdensity, double *ydensity) { struct JPEG_info j_info; diff --git a/Build/source/texk/dvipdfm-x/jpegimage.h b/Build/source/texk/dvipdfm-x/jpegimage.h index 6632f99d83e..de05095ae28 100644 --- a/Build/source/texk/dvipdfm-x/jpegimage.h +++ b/Build/source/texk/dvipdfm-x/jpegimage.h @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -28,7 +28,7 @@ extern int check_for_jpeg (FILE *fp); extern int jpeg_include_image (pdf_ximage *ximage, FILE *fp); -extern int jpeg_get_bbox (FILE *fp, long *width, long *height, +extern int jpeg_get_bbox (FILE *fp, int *width, int *height, double *xdensity, double *ydensity); #endif /* _JPEGIMAGE_H_ */ diff --git a/Build/source/texk/dvipdfm-x/pngimage.c b/Build/source/texk/dvipdfm-x/pngimage.c index 0d193e050f5..46f07d6b656 100644 --- a/Build/source/texk/dvipdfm-x/pngimage.c +++ b/Build/source/texk/dvipdfm-x/pngimage.c @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -30,7 +30,7 @@ * All bitdepth less than 16 is supported. * Supported color types are: PALETTE, RGB, GRAY, RGB_ALPHA, GRAY_ALPHA. * Supported ancillary chunks: tRNS, cHRM + gAMA, (sRGB), (iCCP) - * + * * gAMA support is available only when cHRM exists. cHRM support is not * tested well. CalRGB/CalGray colorspace is used for PNG images that * have cHRM chunk (but not sRGB). @@ -139,7 +139,7 @@ static void read_image_data (png_structp png_ptr, png_uint_32 height, png_uint_32 rowbytes); int -check_for_png (FILE *png_file) +check_for_png (FILE *png_file) { unsigned char sigbytes[4]; @@ -180,7 +180,7 @@ png_include_image (pdf_ximage *ximage, FILE *png_file) rewind (png_file); png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, warn); - if (png_ptr == NULL || + if (png_ptr == NULL || (png_info_ptr = png_create_info_struct (png_ptr)) == NULL) { WARN("%s: Creating Libpng read/info struct failed.", PNG_DEBUG_STR); if (png_ptr) @@ -360,7 +360,7 @@ png_include_image (pdf_ximage *ximage, FILE *png_file) return 0; } -/* +/* * The returned value trans_type is the type of transparency to be used for * this image. Possible values are: * @@ -407,7 +407,7 @@ check_transparency (png_structp png_ptr, png_infop info_ptr) /* Have valid tRNS chunk. */ switch (color_type) { case PNG_COLOR_TYPE_PALETTE: - /* Use color-key mask if possible. */ + /* Use color-key mask if possible. */ trans_type = PDF_TRANS_TYPE_BINARY; while (num_trans-- > 0) { if (trans[num_trans] != 0x00 && trans[num_trans] != 0xff) { @@ -749,7 +749,7 @@ make_param_Cal (png_byte color_type, pdf_add_array(white_point, pdf_new_number(ROUND(Zw, 0.00001))); pdf_add_dict(cal_param, pdf_new_name("WhitePoint"), white_point); - /* Matrix - default: Identity */ + /* Matrix - default: Identity */ if (color_type & PNG_COLOR_MASK_COLOR) { if (G != 1.0) { dev_gamma = pdf_new_array(); @@ -1028,7 +1028,7 @@ read_image_data (png_structp png_ptr, png_bytep dest_ptr, } int -png_get_bbox (FILE *png_file, long *width, long *height, +png_get_bbox (FILE *png_file, uint32_t *width, uint32_t *height, double *xdensity, double *ydensity) { png_structp png_ptr; @@ -1036,7 +1036,7 @@ png_get_bbox (FILE *png_file, long *width, long *height, rewind (png_file); png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, warn); - if (png_ptr == NULL || + if (png_ptr == NULL || (png_info_ptr = png_create_info_struct (png_ptr)) == NULL) { WARN("%s: Creating Libpng read/info struct failed.", PNG_DEBUG_STR); if (png_ptr) diff --git a/Build/source/texk/dvipdfm-x/pngimage.h b/Build/source/texk/dvipdfm-x/pngimage.h index 4e7204f44d7..e6826f2358d 100644 --- a/Build/source/texk/dvipdfm-x/pngimage.h +++ b/Build/source/texk/dvipdfm-x/pngimage.h @@ -2,19 +2,19 @@ Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. - + Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -31,7 +31,7 @@ extern int png_include_image (pdf_ximage *ximage, FILE *file); extern int check_for_png (FILE *file); -extern int png_get_bbox (FILE *fp, long *width, long *height, +extern int png_get_bbox (FILE *fp, uint32_t *width, uint32_t *height, double *xdensity, double *ydensity); #endif diff --git a/Build/source/texk/dvipdfm-x/xbb.c b/Build/source/texk/dvipdfm-x/xbb.c index 91dd02ad348..0a7d2a20728 100644 --- a/Build/source/texk/dvipdfm-x/xbb.c +++ b/Build/source/texk/dvipdfm-x/xbb.c @@ -1,4 +1,4 @@ -/* This is extractbb, a bounding box extraction program. +/* This is extractbb, a bounding box extraction program. Copyright (C) 2008-2014 by Jin-Hwan Cho and Matthias Franz and the dvipdfmx project team. @@ -119,7 +119,7 @@ static char *make_xbb_filename(const char *name) static void write_xbb(char *fname, double bbllx_f, double bblly_f, double bburx_f, double bbury_f, - int pdf_version, long pagecount) + int pdf_version, long pagecount) { char *outname = NULL; FILE *fp = NULL; @@ -188,7 +188,7 @@ static void do_bmp (FILE *fp, char *filename) static void do_jpeg (FILE *fp, char *filename) { - long width, height; + int width, height; double xdensity, ydensity; if (jpeg_get_bbox(fp, &width, &height, &xdensity, &ydensity) < 0) { @@ -217,7 +217,7 @@ static void do_jp2 (FILE *fp, char *filename) #ifdef HAVE_LIBPNG static void do_png (FILE *fp, char *filename) { - long width, height; + uint32_t width, height; double xdensity, ydensity; if (png_get_bbox(fp, &width, &height, &xdensity, &ydensity) < 0) { @@ -256,7 +256,7 @@ static void do_pdf (FILE *fp, char *filename) pdf_file_get_version(pf), count); } -int extractbb (int argc, char *argv[]) +int extractbb (int argc, char *argv[]) { pdf_files_init(); @@ -296,7 +296,7 @@ int extractbb (int argc, char *argv[]) case 'v': verbose = 1; break; - case 'h': + case 'h': show_usage(); exit (0); default: |