summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-09-24 07:32:23 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-09-24 07:32:23 +0000
commitb6cb826a8d5edf82e16adf164bea852ebc88cf97 (patch)
treee9feb331b026e3785344702f865654cd9b0e2fd0 /Build/source
parent1348e9cec8e6e3d5ef2a6f2e384fac4100b5689c (diff)
texk/dvipdfm-x: Minor bug fix and cleanup
git-svn-id: svn://tug.org/texlive/trunk@35246 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog11
-rw-r--r--Build/source/texk/dvipdfm-x/bmpimage.c2
-rw-r--r--Build/source/texk/dvipdfm-x/bmpimage.h2
-rw-r--r--Build/source/texk/dvipdfm-x/jp2image.c38
-rw-r--r--Build/source/texk/dvipdfm-x/jp2image.h2
-rw-r--r--Build/source/texk/dvipdfm-x/xbb.c4
6 files changed, 35 insertions, 24 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 677be28e07c..7124fb467f1 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,14 @@
+2014-09-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * jp2image.c: Add newline at end of file.
+ (read_box_hdr): Correctly handle 8byte lbox value.
+ (read_res__data): Change result type 'unsigned long' => 'void'.
+ (scan_res_): Reindent.
+
+ No reason to use 'long' for 32-bit integers.
+ * bmpimage.[ch], jp2image.[ch], xbb.c: Change bmp_get_bbox() and
+ jp2_get_bbox() args 'long *' => 'int *'.
+
2014-09-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* spc_pdfm.c: If input string is UTF16BE with BOM, do nothing in
diff --git a/Build/source/texk/dvipdfm-x/bmpimage.c b/Build/source/texk/dvipdfm-x/bmpimage.c
index 0e5ec092f55..70b3f3f5b02 100644
--- a/Build/source/texk/dvipdfm-x/bmpimage.c
+++ b/Build/source/texk/dvipdfm-x/bmpimage.c
@@ -99,7 +99,7 @@ get_density (double *xdensity, double *ydensity, struct hdr_info *hdr)
}
int
-bmp_get_bbox (FILE *fp, long *width, long *height,
+bmp_get_bbox (FILE *fp, int *width, int *height,
double *xdensity, double *ydensity)
{
int r;
diff --git a/Build/source/texk/dvipdfm-x/bmpimage.h b/Build/source/texk/dvipdfm-x/bmpimage.h
index 111c04eee1f..501ff3ef8c2 100644
--- a/Build/source/texk/dvipdfm-x/bmpimage.h
+++ b/Build/source/texk/dvipdfm-x/bmpimage.h
@@ -29,7 +29,7 @@
extern int bmp_include_image (pdf_ximage *ximage, FILE *file);
extern int check_for_bmp (FILE *file);
-extern int bmp_get_bbox (FILE *file, long *width, long *height,
+extern int bmp_get_bbox (FILE *file, int *width, int *height,
double *xdensity, double *ydensity);
#endif /* _BMPIMAGE_H_ */
diff --git a/Build/source/texk/dvipdfm-x/jp2image.c b/Build/source/texk/dvipdfm-x/jp2image.c
index 9086fce620c..9c03dcc90ec 100644
--- a/Build/source/texk/dvipdfm-x/jp2image.c
+++ b/Build/source/texk/dvipdfm-x/jp2image.c
@@ -68,8 +68,10 @@ read_box_hdr (FILE *fp, unsigned long *lbox, unsigned long *tbox)
*tbox = get_unsigned_quad(fp);
bytesread += 8;
if (*lbox == 1) {
+ if (get_unsigned_quad(fp) != 0)
+ ERROR("LBox value in JP2 file >32 bits.\nI can't handle this!");
*lbox = get_unsigned_quad(fp);
- bytesread += 4;
+ bytesread += 8;
} else if (*lbox > 1 && *lbox < 8) {
WARN("Unknown LBox value %lu in JP2 file!", lbox);
}
@@ -129,7 +131,7 @@ check_ftyp_data (FILE *fp, unsigned long size)
}
-static unsigned long
+static void
read_res__data (ximage_info *info, FILE *fp, unsigned long size)
{
unsigned int VR_N, VR_D, HR_N, HR_D;
@@ -147,8 +149,6 @@ read_res__data (ximage_info *info, FILE *fp, unsigned long size)
info->xdensity = 72.0/(((double) HR_N / HR_D) * pow(10.0, HR_E) * 0.0254);
info->ydensity = 72.0/(((double) VR_N / VR_D) * pow(10.0, VR_E) * 0.0254);
}
-
- return 10;
}
static int
@@ -157,30 +157,30 @@ scan_res_ (ximage_info *info, FILE *fp, unsigned long size)
unsigned long len, lbox, tbox;
int have_resd = 0;
- while (size > 0) {
+ while (size > 0) {
len = read_box_hdr(fp, &lbox, &tbox);
if (lbox == 0) {
WARN("Unexpected lbox value 0 in JP2 Resolution box.");
break;
}
- switch (tbox) {
- case JP2_BOX_RESC:
- if (!have_resd) {
- read_res__data(info, fp, lbox - len);
- } else {
+ switch (tbox) {
+ case JP2_BOX_RESC:
+ if (!have_resd) {
+ read_res__data(info, fp, lbox - len);
+ } else {
seek_relative(fp, lbox - len);
}
- break;
- case JP2_BOX_RESD:
- read_res__data(info, fp, lbox - len);
+ break;
+ case JP2_BOX_RESD:
+ read_res__data(info, fp, lbox - len);
have_resd = 1;
- break;
- default:
+ break;
+ default:
WARN("Unknown JPEG 2000 box type in Resolution box.");
seek_relative(fp, lbox - len);
- }
- size -= lbox;
}
+ size -= lbox;
+ }
return size == 0 ? 0 : -1;
}
@@ -352,7 +352,7 @@ jp2_include_image (pdf_ximage *ximage, FILE *fp)
}
int
-jp2_get_bbox (FILE *fp, long *width, long *height,
+jp2_get_bbox (FILE *fp, int *width, int *height,
double *xdensity, double *ydensity)
{
int r;
@@ -369,4 +369,4 @@ jp2_get_bbox (FILE *fp, long *width, long *height,
*ydensity = info.ydensity;
return r;
-} \ No newline at end of file
+}
diff --git a/Build/source/texk/dvipdfm-x/jp2image.h b/Build/source/texk/dvipdfm-x/jp2image.h
index 0809d9bbaac..cf22adb7895 100644
--- a/Build/source/texk/dvipdfm-x/jp2image.h
+++ b/Build/source/texk/dvipdfm-x/jp2image.h
@@ -28,7 +28,7 @@
extern int check_for_jp2 (FILE *fp);
extern int jp2_include_image (pdf_ximage *ximage, FILE *fp);
-extern int jp2_get_bbox (FILE *fp, long *width, long *height,
+extern int jp2_get_bbox (FILE *fp, int *width, int *height,
double *xdensity, double *ydensity);
#endif /* _JP2IMAGE_H_ */
diff --git a/Build/source/texk/dvipdfm-x/xbb.c b/Build/source/texk/dvipdfm-x/xbb.c
index 98fec810056..91dd02ad348 100644
--- a/Build/source/texk/dvipdfm-x/xbb.c
+++ b/Build/source/texk/dvipdfm-x/xbb.c
@@ -174,7 +174,7 @@ static void write_xbb(char *fname,
static void do_bmp (FILE *fp, char *filename)
{
- long width, height;
+ int width, height;
double xdensity, ydensity;
if (bmp_get_bbox(fp, &width, &height, &xdensity, &ydensity) < 0) {
@@ -202,7 +202,7 @@ static void do_jpeg (FILE *fp, char *filename)
static void do_jp2 (FILE *fp, char *filename)
{
- long width, height;
+ int width, height;
double xdensity, ydensity;
if (jp2_get_bbox(fp, &width, &height, &xdensity, &ydensity) < 0) {