about summary refs log tree commit diff
path: root/converter/other/jpeg2000/libjasper/base
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/jpeg2000/libjasper/base')
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_debug.c82
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_getopt.c164
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_image.c1284
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_init.c128
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_malloc.c48
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_seq.c544
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_stream.c1484
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_string.c42
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_tvp.c204
-rw-r--r--converter/other/jpeg2000/libjasper/base/jas_version.c28
10 files changed, 2004 insertions, 2004 deletions
diff --git a/converter/other/jpeg2000/libjasper/base/jas_debug.c b/converter/other/jpeg2000/libjasper/base/jas_debug.c
index 4248178f..1bfdef51 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_debug.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_debug.c
@@ -4,14 +4,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -19,22 +19,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -54,17 +54,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -104,7 +104,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -132,22 +132,22 @@ static int jas_dbglevel = 0;
 /* Set the library debug level. */
 int jas_setdbglevel(int dbglevel)
 {
-	int olddbglevel;
+        int olddbglevel;
 
-	/* Save the old debug level. */
-	olddbglevel = jas_dbglevel;
+        /* Save the old debug level. */
+        olddbglevel = jas_dbglevel;
 
-	/* Change the debug level. */
-	jas_dbglevel = dbglevel;
+        /* Change the debug level. */
+        jas_dbglevel = dbglevel;
 
-	/* Return the old debug level. */
-	return olddbglevel;
+        /* Return the old debug level. */
+        return olddbglevel;
 }
 
 /* Get the library debug level. */
 int jas_getdbglevel()
 {
-	return jas_dbglevel;
+        return jas_dbglevel;
 }
 
 /******************************************************************************\
@@ -157,30 +157,30 @@ int jas_getdbglevel()
 /* Perform formatted output to standard error. */
 int jas_eprintf(const char *fmt, ...)
 {
-	int ret;
-	va_list ap;
+        int ret;
+        va_list ap;
 
-	va_start(ap, fmt);
-	ret = vfprintf(stderr, fmt, ap);
-	va_end(ap);
-	return ret;
+        va_start(ap, fmt);
+        ret = vfprintf(stderr, fmt, ap);
+        va_end(ap);
+        return ret;
 }
 
 /* Dump memory to a stream. */
 int jas_memdump(FILE *out, void *data, size_t len)
 {
-	int i;
-	int j;
-	unsigned char *dp;
-	dp = data;
-	for (i = 0; i < len; i += 16) {
-		fprintf(out, "%04x:", i);
-		for (j = 0; j < 16; ++j) {
-			if (i + j < len) {
-				fprintf(out, " %02x", dp[i + j]);
-			}
-		}
-		fprintf(out, "\n");
-	}
-	return 0;
+        int i;
+        int j;
+        unsigned char *dp;
+        dp = data;
+        for (i = 0; i < len; i += 16) {
+                fprintf(out, "%04x:", i);
+                for (j = 0; j < 16; ++j) {
+                        if (i + j < len) {
+                                fprintf(out, " %02x", dp[i + j]);
+                        }
+                }
+                fprintf(out, "\n");
+        }
+        return 0;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_getopt.c b/converter/other/jpeg2000/libjasper/base/jas_getopt.c
index 7f579b3e..e12340c2 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_getopt.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_getopt.c
@@ -2,18 +2,18 @@
  * Copyright (c) 1999-2000, Image Power, Inc. and the University of
  *   British Columbia.
  * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved. 
+ * All rights reserved.
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -21,22 +21,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -56,17 +56,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -106,7 +106,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -140,78 +140,78 @@ char *jas_optarg = 0;
 
 static jas_opt_t *jas_optlookup(jas_opt_t *opts, char *name)
 {
-	jas_opt_t *opt;
+        jas_opt_t *opt;
 
-	for (opt = opts; opt->id >= 0 && opt->name; ++opt) {
-		if (!strcmp(opt->name, name)) {
-			return opt;
-		}
-	}
-	return 0;
+        for (opt = opts; opt->id >= 0 && opt->name; ++opt) {
+                if (!strcmp(opt->name, name)) {
+                        return opt;
+                }
+        }
+        return 0;
 }
 
 int jas_getopt(int argc, char **argv, jas_opt_t *opts)
 {
-	char *cp;
-	int id;
-	int hasarg;
-	jas_opt_t *opt;
-	char *s;
+        char *cp;
+        int id;
+        int hasarg;
+        jas_opt_t *opt;
+        char *s;
 
-	if (!jas_optind) {
-		jas_optind = JAS_MIN(1, argc);
-	}
-	while (jas_optind < argc) {
-		s = cp = argv[jas_optind];
-		if (*cp == '-') {
-			/* We are processing an option. */
-			++jas_optind;
-			if (*++cp == '-') {
-				/* We are processing a long option. */
-				++cp;
-				if (*cp == '\0') {
-					/* This is the end of the options. */
-					return JAS_GETOPT_EOF;
-				}
-				if (!(opt = jas_optlookup(opts, cp))) {
-					if (jas_opterr) {
-						fprintf(stderr, "unknown long option %s\n", s);
-					}
-					return JAS_GETOPT_ERR;
-				}
-				hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
-				id = opt->id;
-			} else {
-				/* We are processing a short option. */
-				if (strlen(cp) != 1 ||
-				  !(opt = jas_optlookup(opts, cp))) {
-					if (jas_opterr) {
-						fprintf(stderr, "unknown short option %s\n", s);
-					}
-					return JAS_GETOPT_ERR;
-				}
-				hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
-				id = opt->id;
-			}
-			if (hasarg) {
-				/* The option has an argument. */
-				if (jas_optind >= argc) {
-					if (jas_opterr) {
-						fprintf(stderr, "missing argument for option %s\n", s);
-					}
-					return JAS_GETOPT_ERR;
-				}
-				jas_optarg = argv[jas_optind];
-				++jas_optind;
-			} else {
-				/* The option does not have an argument. */
-				jas_optarg = 0;
-			}
-			return id;
-		} else {
-			/* We are not processing an option. */
-			return JAS_GETOPT_EOF;
-		}
-	}
-	return JAS_GETOPT_EOF;
+        if (!jas_optind) {
+                jas_optind = JAS_MIN(1, argc);
+        }
+        while (jas_optind < argc) {
+                s = cp = argv[jas_optind];
+                if (*cp == '-') {
+                        /* We are processing an option. */
+                        ++jas_optind;
+                        if (*++cp == '-') {
+                                /* We are processing a long option. */
+                                ++cp;
+                                if (*cp == '\0') {
+                                        /* This is the end of the options. */
+                                        return JAS_GETOPT_EOF;
+                                }
+                                if (!(opt = jas_optlookup(opts, cp))) {
+                                        if (jas_opterr) {
+                                                fprintf(stderr, "unknown long option %s\n", s);
+                                        }
+                                        return JAS_GETOPT_ERR;
+                                }
+                                hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
+                                id = opt->id;
+                        } else {
+                                /* We are processing a short option. */
+                                if (strlen(cp) != 1 ||
+                                  !(opt = jas_optlookup(opts, cp))) {
+                                        if (jas_opterr) {
+                                                fprintf(stderr, "unknown short option %s\n", s);
+                                        }
+                                        return JAS_GETOPT_ERR;
+                                }
+                                hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
+                                id = opt->id;
+                        }
+                        if (hasarg) {
+                                /* The option has an argument. */
+                                if (jas_optind >= argc) {
+                                        if (jas_opterr) {
+                                                fprintf(stderr, "missing argument for option %s\n", s);
+                                        }
+                                        return JAS_GETOPT_ERR;
+                                }
+                                jas_optarg = argv[jas_optind];
+                                ++jas_optind;
+                        } else {
+                                /* The option does not have an argument. */
+                                jas_optarg = 0;
+                        }
+                        return id;
+                } else {
+                        /* We are not processing an option. */
+                        return JAS_GETOPT_EOF;
+                }
+        }
+        return JAS_GETOPT_EOF;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_image.c b/converter/other/jpeg2000/libjasper/base/jas_image.c
index c6f984c1..49a0db79 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_image.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_image.c
@@ -6,14 +6,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -21,22 +21,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -56,17 +56,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -106,7 +106,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -166,215 +166,215 @@ static jas_image_fmtinfo_t jas_image_fmtinfos[JAS_IMAGE_MAXFMTS];
 jas_image_t *jas_image_create(uint_fast16_t numcmpts, jas_image_cmptparm_t *cmptparms,
   int colorspace)
 {
-	jas_image_t *image;
-	uint_fast32_t rawsize;
-	uint_fast32_t inmem;
-	uint_fast16_t cmptno;
-	jas_image_cmptparm_t *cmptparm;
-
-	if (!(image = jas_image_create0())) {
-		return 0;
-	}
-
-	image->colorspace_ = colorspace;
-	image->maxcmpts_ = numcmpts;
-	image->inmem_ = true;
-
-	/* Allocate memory for the per-component information. */
-	if (!(image->cmpts_ = jas_malloc(image->maxcmpts_ *
-	  sizeof(jas_image_cmpt_t *)))) {
-		jas_image_destroy(image);
-		return 0;
-	}
-	/* Initialize in case of failure. */
-	for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) {
-		image->cmpts_[cmptno] = 0;
-	}
-
-	/* Compute the approximate raw size of the image. */
-	rawsize = 0;
-	for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
-	  ++cmptparm) {
-		rawsize += cmptparm->width * cmptparm->height *
-		  (cmptparm->prec + 7) / 8;
-	}
-	/* Decide whether to buffer the image data in memory, based on the
-	  raw size of the image. */
-	inmem = (rawsize < JAS_IMAGE_INMEMTHRESH);
-
-	/* Create the individual image components. */
-	for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
-	  ++cmptparm) {
-		if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx,
-		  cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
-		  cmptparm->width, cmptparm->height, cmptparm->prec,
-		  cmptparm->sgnd, inmem))) {
-			jas_image_destroy(image);
-			return 0;
-		}
-		++image->numcmpts_;
-	}
-
-	/* Determine the bounding box for all of the components on the
-	  reference grid (i.e., the image area) */
-	jas_image_setbbox(image);
-
-	return image;
+        jas_image_t *image;
+        uint_fast32_t rawsize;
+        uint_fast32_t inmem;
+        uint_fast16_t cmptno;
+        jas_image_cmptparm_t *cmptparm;
+
+        if (!(image = jas_image_create0())) {
+                return 0;
+        }
+
+        image->colorspace_ = colorspace;
+        image->maxcmpts_ = numcmpts;
+        image->inmem_ = true;
+
+        /* Allocate memory for the per-component information. */
+        if (!(image->cmpts_ = jas_malloc(image->maxcmpts_ *
+          sizeof(jas_image_cmpt_t *)))) {
+                jas_image_destroy(image);
+                return 0;
+        }
+        /* Initialize in case of failure. */
+        for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) {
+                image->cmpts_[cmptno] = 0;
+        }
+
+        /* Compute the approximate raw size of the image. */
+        rawsize = 0;
+        for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
+          ++cmptparm) {
+                rawsize += cmptparm->width * cmptparm->height *
+                  (cmptparm->prec + 7) / 8;
+        }
+        /* Decide whether to buffer the image data in memory, based on the
+          raw size of the image. */
+        inmem = (rawsize < JAS_IMAGE_INMEMTHRESH);
+
+        /* Create the individual image components. */
+        for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
+          ++cmptparm) {
+                if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx,
+                  cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
+                  cmptparm->width, cmptparm->height, cmptparm->prec,
+                  cmptparm->sgnd, inmem))) {
+                        jas_image_destroy(image);
+                        return 0;
+                }
+                ++image->numcmpts_;
+        }
+
+        /* Determine the bounding box for all of the components on the
+          reference grid (i.e., the image area) */
+        jas_image_setbbox(image);
+
+        return image;
 }
 
 jas_image_t *jas_image_create0()
 {
-	jas_image_t *image;
+        jas_image_t *image;
 
-	if (!(image = jas_malloc(sizeof(jas_image_t)))) {
-		return 0;
-	}
+        if (!(image = jas_malloc(sizeof(jas_image_t)))) {
+                return 0;
+        }
 
-	image->tlx_ = 0;
-	image->tly_ = 0;
-	image->brx_ = 0;
-	image->bry_ = 0;
-	image->colorspace_ = JAS_IMAGE_CS_UNKNOWN;
-	image->numcmpts_ = 0;
-	image->maxcmpts_ = 0;
-	image->cmpts_ = 0;
-	image->inmem_ = true;
-	image->iccp_ = 0;
-	image->iccplen_ = 0;
+        image->tlx_ = 0;
+        image->tly_ = 0;
+        image->brx_ = 0;
+        image->bry_ = 0;
+        image->colorspace_ = JAS_IMAGE_CS_UNKNOWN;
+        image->numcmpts_ = 0;
+        image->maxcmpts_ = 0;
+        image->cmpts_ = 0;
+        image->inmem_ = true;
+        image->iccp_ = 0;
+        image->iccplen_ = 0;
 
-	return image;
+        return image;
 }
 
 jas_image_t *jas_image_copy(jas_image_t *image)
 {
-	jas_image_t *newimage;
-	int cmptno;
+        jas_image_t *newimage;
+        int cmptno;
 
-	newimage = jas_image_create0();
-	if (jas_image_growcmpts(newimage, image->numcmpts_)) {
-		goto error;
-	}
-	for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
-		if (!(newimage->cmpts_[cmptno] = jas_image_cmpt_copy(image->cmpts_[cmptno]))) {
-			goto error;
-		}
-		++newimage->numcmpts_;
-	}
+        newimage = jas_image_create0();
+        if (jas_image_growcmpts(newimage, image->numcmpts_)) {
+                goto error;
+        }
+        for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
+                if (!(newimage->cmpts_[cmptno] = jas_image_cmpt_copy(image->cmpts_[cmptno]))) {
+                        goto error;
+                }
+                ++newimage->numcmpts_;
+        }
 
-	jas_image_setbbox(newimage);
+        jas_image_setbbox(newimage);
 
-	return newimage;
+        return newimage;
 error:
-	if (newimage) {
-		jas_image_destroy(newimage);
-	}
-	return 0;
+        if (newimage) {
+                jas_image_destroy(newimage);
+        }
+        return 0;
 }
 
 static jas_image_cmpt_t *jas_image_cmpt_create0()
 {
-	jas_image_cmpt_t *cmpt;
-	if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
-		return 0;
-	}
-	memset(cmpt, 0, sizeof(jas_image_cmpt_t));
-	cmpt->type_ = JAS_IMAGE_CT_UNKNOWN;
-	return cmpt;
+        jas_image_cmpt_t *cmpt;
+        if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
+                return 0;
+        }
+        memset(cmpt, 0, sizeof(jas_image_cmpt_t));
+        cmpt->type_ = JAS_IMAGE_CT_UNKNOWN;
+        return cmpt;
 }
 
 static jas_image_cmpt_t *jas_image_cmpt_copy(jas_image_cmpt_t *cmpt)
 {
-	jas_image_cmpt_t *newcmpt;
-
-	if (!(newcmpt = jas_image_cmpt_create0())) {
-		return 0;
-	}
-	newcmpt->tlx_ = cmpt->tlx_;
-	newcmpt->tly_ = cmpt->tly_;
-	newcmpt->hstep_ = cmpt->hstep_;
-	newcmpt->vstep_ = cmpt->vstep_;
-	newcmpt->width_ = cmpt->width_;
-	newcmpt->height_ = cmpt->height_;
-	newcmpt->prec_ = cmpt->prec_;
-	newcmpt->sgnd_ = cmpt->sgnd_;
-	newcmpt->cps_ = cmpt->cps_;
-	newcmpt->type_ = cmpt->type_;
-	if (!(newcmpt->stream_ = jas_stream_memopen(0, 0))) {
-		return 0;
-	}
-	if (jas_stream_seek(cmpt->stream_, 0, SEEK_SET)) {
-		return 0;
-	}
-	if (jas_stream_copy(newcmpt->stream_, cmpt->stream_, -1)) {
-		return 0;
-	}
-	if (jas_stream_seek(newcmpt->stream_, 0, SEEK_SET)) {
-		return 0;
-	}
-	return newcmpt;
+        jas_image_cmpt_t *newcmpt;
+
+        if (!(newcmpt = jas_image_cmpt_create0())) {
+                return 0;
+        }
+        newcmpt->tlx_ = cmpt->tlx_;
+        newcmpt->tly_ = cmpt->tly_;
+        newcmpt->hstep_ = cmpt->hstep_;
+        newcmpt->vstep_ = cmpt->vstep_;
+        newcmpt->width_ = cmpt->width_;
+        newcmpt->height_ = cmpt->height_;
+        newcmpt->prec_ = cmpt->prec_;
+        newcmpt->sgnd_ = cmpt->sgnd_;
+        newcmpt->cps_ = cmpt->cps_;
+        newcmpt->type_ = cmpt->type_;
+        if (!(newcmpt->stream_ = jas_stream_memopen(0, 0))) {
+                return 0;
+        }
+        if (jas_stream_seek(cmpt->stream_, 0, SEEK_SET)) {
+                return 0;
+        }
+        if (jas_stream_copy(newcmpt->stream_, cmpt->stream_, -1)) {
+                return 0;
+        }
+        if (jas_stream_seek(newcmpt->stream_, 0, SEEK_SET)) {
+                return 0;
+        }
+        return newcmpt;
 }
 
 void jas_image_destroy(jas_image_t *image)
 {
-	int i;
+        int i;
 
-	if (image->cmpts_) {
-		for (i = 0; i < image->numcmpts_; ++i) {
-			jas_image_cmpt_destroy(image->cmpts_[i]);
-			image->cmpts_[i] = 0;
-		}
-		jas_free(image->cmpts_);
-	}
-	jas_free(image);
+        if (image->cmpts_) {
+                for (i = 0; i < image->numcmpts_; ++i) {
+                        jas_image_cmpt_destroy(image->cmpts_[i]);
+                        image->cmpts_[i] = 0;
+                }
+                jas_free(image->cmpts_);
+        }
+        jas_free(image);
 }
 
 static jas_image_cmpt_t *jas_image_cmpt_create(uint_fast32_t tlx, uint_fast32_t tly,
   uint_fast32_t hstep, uint_fast32_t vstep, uint_fast32_t width, uint_fast32_t
   height, uint_fast16_t depth, bool sgnd, uint_fast32_t inmem)
 {
-	jas_image_cmpt_t *cmpt;
-	long size;
-
-	if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
-		return 0;
-	}
-
-	cmpt->tlx_ = tlx;
-	cmpt->tly_ = tly;
-	cmpt->hstep_ = hstep;
-	cmpt->vstep_ = vstep;
-	cmpt->width_ = width;
-	cmpt->height_ = height;
-	cmpt->prec_ = depth;
-	cmpt->sgnd_ = sgnd;
-	cmpt->stream_ = 0;
-	cmpt->cps_ = (depth + 7) / 8;
-
-	size = cmpt->width_ * cmpt->height_ * cmpt->cps_;
-	cmpt->stream_ = (inmem) ? jas_stream_memopen(0, size) : jas_stream_tmpfile();
-	if (!cmpt->stream_) {
-		jas_image_cmpt_destroy(cmpt);
-		return 0;
-	}
-
-	/* Zero the component data.  This isn't necessary, but it is
-	convenient for debugging purposes. */
-	if (jas_stream_seek(cmpt->stream_, size - 1, SEEK_SET) < 0 ||
-	  jas_stream_putc(cmpt->stream_, 0) == EOF ||
-	  jas_stream_seek(cmpt->stream_, 0, SEEK_SET) < 0) {
-		jas_image_cmpt_destroy(cmpt);
-		return 0;
-	}
-
-	return cmpt;
+        jas_image_cmpt_t *cmpt;
+        long size;
+
+        if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
+                return 0;
+        }
+
+        cmpt->tlx_ = tlx;
+        cmpt->tly_ = tly;
+        cmpt->hstep_ = hstep;
+        cmpt->vstep_ = vstep;
+        cmpt->width_ = width;
+        cmpt->height_ = height;
+        cmpt->prec_ = depth;
+        cmpt->sgnd_ = sgnd;
+        cmpt->stream_ = 0;
+        cmpt->cps_ = (depth + 7) / 8;
+
+        size = cmpt->width_ * cmpt->height_ * cmpt->cps_;
+        cmpt->stream_ = (inmem) ? jas_stream_memopen(0, size) : jas_stream_tmpfile();
+        if (!cmpt->stream_) {
+                jas_image_cmpt_destroy(cmpt);
+                return 0;
+        }
+
+        /* Zero the component data.  This isn't necessary, but it is
+        convenient for debugging purposes. */
+        if (jas_stream_seek(cmpt->stream_, size - 1, SEEK_SET) < 0 ||
+          jas_stream_putc(cmpt->stream_, 0) == EOF ||
+          jas_stream_seek(cmpt->stream_, 0, SEEK_SET) < 0) {
+                jas_image_cmpt_destroy(cmpt);
+                return 0;
+        }
+
+        return cmpt;
 }
 
 static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt)
 {
-	if (cmpt->stream_) {
-		jas_stream_close(cmpt->stream_);
-	}
-	jas_free(cmpt);
+        if (cmpt->stream_) {
+                jas_stream_close(cmpt->stream_);
+        }
+        jas_free(cmpt);
 }
 
 /*****************************************************************************\
@@ -383,53 +383,53 @@ static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt)
 
 void
 pmjas_image_decode(jas_stream_t * const in,
-				   int            const fmtArg,
-				   const char *   const optstr,
-				   jas_image_t ** const imagePP,
-				   const char **  const errorP) {
+                                   int            const fmtArg,
+                                   const char *   const optstr,
+                                   jas_image_t ** const imagePP,
+                                   const char **  const errorP) {
 /*----------------------------------------------------------------------------
   Create an image from a stream in some specified format
 -----------------------------------------------------------------------------*/
-	jas_image_fmtinfo_t *fmtinfo;
-	int fmt;
-
-	/* If possible, try to determine the format of the input data. */
-	if (fmtArg < 0) {
-		if ((fmt = jas_image_getfmt(in)) < 0) {
-			pm_asprintf(errorP, "jas_image_getfmt failed");
-			return;
-		}
-	} else
-		fmt = fmtArg;
-
-	if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
-		pm_asprintf(errorP, "jas_image_lookupfmtbyid of format %d failed",
-					fmt);
-		return;
-	}
-	{
-		const char * error;
-
-		(*fmtinfo->ops.decode)(in, optstr, imagePP, &error);
-		if (error) {
-			pm_asprintf(errorP, "decoder failed.  %s", error);
-			pm_strfree(error);
-		} else {
-			*errorP = NULL;
-		}
-	}
+        jas_image_fmtinfo_t *fmtinfo;
+        int fmt;
+
+        /* If possible, try to determine the format of the input data. */
+        if (fmtArg < 0) {
+                if ((fmt = jas_image_getfmt(in)) < 0) {
+                        pm_asprintf(errorP, "jas_image_getfmt failed");
+                        return;
+                }
+        } else
+                fmt = fmtArg;
+
+        if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
+                pm_asprintf(errorP, "jas_image_lookupfmtbyid of format %d failed",
+                                        fmt);
+                return;
+        }
+        {
+                const char * error;
+
+                (*fmtinfo->ops.decode)(in, optstr, imagePP, &error);
+                if (error) {
+                        pm_asprintf(errorP, "decoder failed.  %s", error);
+                        pm_strfree(error);
+                } else {
+                        *errorP = NULL;
+                }
+        }
 }
 
 
 
 int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, char *optstr)
 {
-	jas_image_fmtinfo_t *fmtinfo;
-	if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
-		return -1;
-	}
-	return (fmtinfo->ops.encode) ? (*fmtinfo->ops.encode)(image, out,
-	  optstr) : (-1);
+        jas_image_fmtinfo_t *fmtinfo;
+        if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
+                return -1;
+        }
+        return (fmtinfo->ops.encode) ? (*fmtinfo->ops.encode)(image, out,
+          optstr) : (-1);
 }
 
 /******************************************************************************\
@@ -439,137 +439,137 @@ int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, char *optst
 int jas_image_readcmpt(jas_image_t *image, uint_fast16_t cmptno, uint_fast32_t x, uint_fast32_t y, uint_fast32_t width,
   uint_fast32_t height, jas_matrix_t *data)
 {
-	jas_image_cmpt_t *cmpt;
-	uint_fast32_t i;
-	uint_fast32_t j;
-	int k;
-	jas_seqent_t v;
-	int c;
-	jas_seqent_t *dr;
-	jas_seqent_t *d;
-	int drs;
-
-	if (cmptno >= image->numcmpts_) {
-		return -1;
-	}
-
-	cmpt = image->cmpts_[cmptno];
-	if (x >= cmpt->width_ || y >= cmpt->height_ ||
-	  x + width > cmpt->width_ ||
-	  y + height > cmpt->height_) {
-		return -1;
-	}
-
-	if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
-		if (jas_matrix_resize(data, height, width)) {
-			return -1;
-		}
-	}
-
-	dr = jas_matrix_getref(data, 0, 0);
-	drs = jas_matrix_rowstep(data);
-	for (i = 0; i < height; ++i, dr += drs) {
-		d = dr;
-		if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
-		  * cmpt->cps_, SEEK_SET) < 0) {
-			return -1;
-		}
-		for (j = width; j > 0; --j, ++d) {
-			v = 0;
-			for (k = cmpt->cps_; k > 0; --k) {
-				if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
-					return -1;
-				}
-				v = (v << 8) | (c & 0xff);
-			}
-			*d = bitstoint(v, cmpt->prec_, cmpt->sgnd_);
-		}
-	}
-
-	return 0;
+        jas_image_cmpt_t *cmpt;
+        uint_fast32_t i;
+        uint_fast32_t j;
+        int k;
+        jas_seqent_t v;
+        int c;
+        jas_seqent_t *dr;
+        jas_seqent_t *d;
+        int drs;
+
+        if (cmptno >= image->numcmpts_) {
+                return -1;
+        }
+
+        cmpt = image->cmpts_[cmptno];
+        if (x >= cmpt->width_ || y >= cmpt->height_ ||
+          x + width > cmpt->width_ ||
+          y + height > cmpt->height_) {
+                return -1;
+        }
+
+        if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
+                if (jas_matrix_resize(data, height, width)) {
+                        return -1;
+                }
+        }
+
+        dr = jas_matrix_getref(data, 0, 0);
+        drs = jas_matrix_rowstep(data);
+        for (i = 0; i < height; ++i, dr += drs) {
+                d = dr;
+                if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
+                  * cmpt->cps_, SEEK_SET) < 0) {
+                        return -1;
+                }
+                for (j = width; j > 0; --j, ++d) {
+                        v = 0;
+                        for (k = cmpt->cps_; k > 0; --k) {
+                                if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
+                                        return -1;
+                                }
+                                v = (v << 8) | (c & 0xff);
+                        }
+                        *d = bitstoint(v, cmpt->prec_, cmpt->sgnd_);
+                }
+        }
+
+        return 0;
 }
 
 #if 0
 int_fast64_t jas_image_readcmpt1(jas_image_t *image, uint_fast16_t cmptno,
   uint_fast32_t x, uint_fast32_t y)
 {
-	jas_image_cmpt_t *cmpt;
-	int k;
-	int c;
-	int_fast64_t v;
-	cmpt = image->cmpts_[cmptno];
-	if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
-	  SEEK_SET) < 0) {
-		goto error;
-	}
-	v = 0;
-	for (k = cmpt->cps_; k > 0; --k) {
-		if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
-			goto error;
-		}
-		v = (v << 8) | (c & 0xff);
-	}
+        jas_image_cmpt_t *cmpt;
+        int k;
+        int c;
+        int_fast64_t v;
+        cmpt = image->cmpts_[cmptno];
+        if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
+          SEEK_SET) < 0) {
+                goto error;
+        }
+        v = 0;
+        for (k = cmpt->cps_; k > 0; --k) {
+                if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
+                        goto error;
+                }
+                v = (v << 8) | (c & 0xff);
+        }
 if (cmpt->sgnd_) {
-	abort();
+        abort();
 }
 
-	return v;
+        return v;
 
 error:
-	return 0;
+        return 0;
 }
 #endif
 
 int jas_image_writecmpt(jas_image_t *image, uint_fast16_t cmptno, uint_fast32_t x, uint_fast32_t y, uint_fast32_t width,
   uint_fast32_t height, jas_matrix_t *data)
 {
-	jas_image_cmpt_t *cmpt;
-	uint_fast32_t i;
-	uint_fast32_t j;
-	jas_seqent_t *d;
-	jas_seqent_t *dr;
-	int drs;
-	jas_seqent_t v;
-	int k;
-	int c;
-
-	if (cmptno >= image->numcmpts_) {
-		return -1;
-	}
-
-	cmpt = image->cmpts_[cmptno];
-	if (x >= cmpt->width_ || y >= cmpt->height_ ||
-	  x + width > cmpt->width_ ||
-	  y + height > cmpt->height_) {
-		return -1;
-	}
-
-	if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
-		return -1;
-	}
-
-	dr = jas_matrix_getref(data, 0, 0);
-	drs = jas_matrix_rowstep(data);
-	for (i = 0; i < height; ++i, dr += drs) {
-		d = dr;
-		if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
-		  * cmpt->cps_, SEEK_SET) < 0) {
-			return -1;
-		}
-		for (j = width; j > 0; --j, ++d) {
-			v = inttobits(*d, cmpt->prec_, cmpt->sgnd_);
-			for (k = cmpt->cps_; k > 0; --k) {
-				c = (v >> (8 * (cmpt->cps_ - 1))) & 0xff;
-				if (jas_stream_putc(cmpt->stream_,
-				  (unsigned char) c) == EOF) {
-					return -1;
-				}
-				v <<= 8;
-			}
-		}
-	}
-
-	return 0;
+        jas_image_cmpt_t *cmpt;
+        uint_fast32_t i;
+        uint_fast32_t j;
+        jas_seqent_t *d;
+        jas_seqent_t *dr;
+        int drs;
+        jas_seqent_t v;
+        int k;
+        int c;
+
+        if (cmptno >= image->numcmpts_) {
+                return -1;
+        }
+
+        cmpt = image->cmpts_[cmptno];
+        if (x >= cmpt->width_ || y >= cmpt->height_ ||
+          x + width > cmpt->width_ ||
+          y + height > cmpt->height_) {
+                return -1;
+        }
+
+        if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
+                return -1;
+        }
+
+        dr = jas_matrix_getref(data, 0, 0);
+        drs = jas_matrix_rowstep(data);
+        for (i = 0; i < height; ++i, dr += drs) {
+                d = dr;
+                if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
+                  * cmpt->cps_, SEEK_SET) < 0) {
+                        return -1;
+                }
+                for (j = width; j > 0; --j, ++d) {
+                        v = inttobits(*d, cmpt->prec_, cmpt->sgnd_);
+                        for (k = cmpt->cps_; k > 0; --k) {
+                                c = (v >> (8 * (cmpt->cps_ - 1))) & 0xff;
+                                if (jas_stream_putc(cmpt->stream_,
+                                  (unsigned char) c) == EOF) {
+                                        return -1;
+                                }
+                                v <<= 8;
+                        }
+                }
+        }
+
+        return 0;
 }
 
 /******************************************************************************\
@@ -578,112 +578,112 @@ int jas_image_writecmpt(jas_image_t *image, uint_fast16_t cmptno, uint_fast32_t
 
 void jas_image_clearfmts()
 {
-	int i;
-	jas_image_fmtinfo_t *fmtinfo;
-	for (i = 0; i < jas_image_numfmts; ++i) {
-		fmtinfo = &jas_image_fmtinfos[i];
-		if (fmtinfo->name) {
-			jas_free(fmtinfo->name);
-			fmtinfo->name = 0;
-		}
-		if (fmtinfo->ext) {
-			jas_free(fmtinfo->ext);
-			fmtinfo->ext = 0;
-		}
-		if (fmtinfo->desc) {
-			jas_free(fmtinfo->desc);
-			fmtinfo->desc = 0;
-		}
-	}
-	jas_image_numfmts = 0;
-}
-
-int jas_image_addfmt(int id, const char *name, const char *ext, 
+        int i;
+        jas_image_fmtinfo_t *fmtinfo;
+        for (i = 0; i < jas_image_numfmts; ++i) {
+                fmtinfo = &jas_image_fmtinfos[i];
+                if (fmtinfo->name) {
+                        jas_free(fmtinfo->name);
+                        fmtinfo->name = 0;
+                }
+                if (fmtinfo->ext) {
+                        jas_free(fmtinfo->ext);
+                        fmtinfo->ext = 0;
+                }
+                if (fmtinfo->desc) {
+                        jas_free(fmtinfo->desc);
+                        fmtinfo->desc = 0;
+                }
+        }
+        jas_image_numfmts = 0;
+}
+
+int jas_image_addfmt(int id, const char *name, const char *ext,
   const char *desc,
   jas_image_fmtops_t *ops)
 {
-	jas_image_fmtinfo_t *fmtinfo;
-	assert(id >= 0 && name && ext && ops);
-	if (jas_image_numfmts >= JAS_IMAGE_MAXFMTS) {
-		return -1;
-	}
-	fmtinfo = &jas_image_fmtinfos[jas_image_numfmts];
-	fmtinfo->id = id;
-	if (!(fmtinfo->name = jas_strdup(name))) {
-		return -1;
-	}
-	if (!(fmtinfo->ext = jas_strdup(ext))) {
-		jas_free(fmtinfo->name);
-		return -1;
-	}
-	if (!(fmtinfo->desc = jas_strdup(desc))) {
-		jas_free(fmtinfo->name);
-		jas_free(fmtinfo->ext);
-		return -1;
-	}
-	fmtinfo->ops = *ops;
-	++jas_image_numfmts;
-	return 0;
+        jas_image_fmtinfo_t *fmtinfo;
+        assert(id >= 0 && name && ext && ops);
+        if (jas_image_numfmts >= JAS_IMAGE_MAXFMTS) {
+                return -1;
+        }
+        fmtinfo = &jas_image_fmtinfos[jas_image_numfmts];
+        fmtinfo->id = id;
+        if (!(fmtinfo->name = jas_strdup(name))) {
+                return -1;
+        }
+        if (!(fmtinfo->ext = jas_strdup(ext))) {
+                jas_free(fmtinfo->name);
+                return -1;
+        }
+        if (!(fmtinfo->desc = jas_strdup(desc))) {
+                jas_free(fmtinfo->name);
+                jas_free(fmtinfo->ext);
+                return -1;
+        }
+        fmtinfo->ops = *ops;
+        ++jas_image_numfmts;
+        return 0;
 }
 
 int jas_image_strtofmt(char *name)
 {
-	jas_image_fmtinfo_t *fmtinfo;
-	if (!(fmtinfo = jas_image_lookupfmtbyname(name))) {
-		return -1;
-	}
-	return fmtinfo->id;
+        jas_image_fmtinfo_t *fmtinfo;
+        if (!(fmtinfo = jas_image_lookupfmtbyname(name))) {
+                return -1;
+        }
+        return fmtinfo->id;
 }
 
 char *jas_image_fmttostr(int fmt)
 {
-	jas_image_fmtinfo_t *fmtinfo;
-	if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
-		return 0;
-	}
-	return fmtinfo->name;
+        jas_image_fmtinfo_t *fmtinfo;
+        if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
+                return 0;
+        }
+        return fmtinfo->name;
 }
 
 int jas_image_getfmt(jas_stream_t *in)
 {
-	jas_image_fmtinfo_t *fmtinfo;
-	int found;
-	int i;
-
-	/* Check for data in each of the formats we know. */
-	found = 0;
-	for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
-	  ++fmtinfo) {
-		if (fmtinfo->ops.validate) {
-			/* Is the input data valid for this format? */
-			if (!(*fmtinfo->ops.validate)(in)) {
-				found = 1;
-				break;
-			}
-		}
-	}
-	return found ? fmtinfo->id : (-1);
+        jas_image_fmtinfo_t *fmtinfo;
+        int found;
+        int i;
+
+        /* Check for data in each of the formats we know. */
+        found = 0;
+        for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
+          ++fmtinfo) {
+                if (fmtinfo->ops.validate) {
+                        /* Is the input data valid for this format? */
+                        if (!(*fmtinfo->ops.validate)(in)) {
+                                found = 1;
+                                break;
+                        }
+                }
+        }
+        return found ? fmtinfo->id : (-1);
 }
 
 int jas_image_fmtfromname(char *name)
 {
-	int i;
-	char *ext;
-	jas_image_fmtinfo_t *fmtinfo;
-	/* Get the file name extension. */
-	if (!(ext = strrchr(name, '.'))) {
-		return -1;
-	}
-	++ext;
-	/* Try to find a format that uses this extension. */
-	for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
-	  ++fmtinfo) {
-		/* Do we have a match? */
-		if (!strcmp(ext, fmtinfo->ext)) {
-			return fmtinfo->id;
-		}
-	}
-	return -1;
+        int i;
+        char *ext;
+        jas_image_fmtinfo_t *fmtinfo;
+        /* Get the file name extension. */
+        if (!(ext = strrchr(name, '.'))) {
+                return -1;
+        }
+        ++ext;
+        /* Try to find a format that uses this extension. */
+        for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
+          ++fmtinfo) {
+                /* Do we have a match? */
+                if (!strcmp(ext, fmtinfo->ext)) {
+                        return fmtinfo->id;
+                }
+        }
+        return -1;
 }
 
 /*****************************************************************************\
@@ -710,71 +710,71 @@ jas_image_rawsize(jas_image_t * const imageP) {
 
 void jas_image_delcmpt(jas_image_t *image, uint_fast16_t cmptno)
 {
-	if (cmptno >= image->numcmpts_) {
-		return;
-	}
-	jas_image_cmpt_destroy(image->cmpts_[cmptno]);
-	if (cmptno < image->numcmpts_) {
-		memmove(&image->cmpts_[cmptno], &image->cmpts_[cmptno + 1],
-		  (image->numcmpts_ - 1 - cmptno) * sizeof(jas_image_cmpt_t *));
-	}
-	--image->numcmpts_;
+        if (cmptno >= image->numcmpts_) {
+                return;
+        }
+        jas_image_cmpt_destroy(image->cmpts_[cmptno]);
+        if (cmptno < image->numcmpts_) {
+                memmove(&image->cmpts_[cmptno], &image->cmpts_[cmptno + 1],
+                  (image->numcmpts_ - 1 - cmptno) * sizeof(jas_image_cmpt_t *));
+        }
+        --image->numcmpts_;
 
-	jas_image_setbbox(image);
+        jas_image_setbbox(image);
 }
 
 int jas_image_addcmpt(jas_image_t *image, uint_fast16_t cmptno,
   jas_image_cmptparm_t *cmptparm)
 {
-	jas_image_cmpt_t *newcmpt;
-	assert(cmptno <= image->numcmpts_);
-	if (image->numcmpts_ >= image->maxcmpts_) {
-		if (jas_image_growcmpts(image, image->maxcmpts_ + 128)) {
-			return -1;
-		}
-	}
-	if (!(newcmpt = jas_image_cmpt_create(cmptparm->tlx,
-	  cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
-	  cmptparm->width, cmptparm->height, cmptparm->prec,
-	  cmptparm->sgnd, 1))) {
-		return -1;
-	}
-	if (cmptno < image->numcmpts_) {
-		memmove(&image->cmpts_[cmptno + 1], &image->cmpts_[cmptno],
-		  (image->numcmpts_ - cmptno) * sizeof(jas_image_cmpt_t *));
-	}
-	image->cmpts_[cmptno] = newcmpt;
-	++image->numcmpts_;
-
-	jas_image_setbbox(image);
-
-	return 0;
+        jas_image_cmpt_t *newcmpt;
+        assert(cmptno <= image->numcmpts_);
+        if (image->numcmpts_ >= image->maxcmpts_) {
+                if (jas_image_growcmpts(image, image->maxcmpts_ + 128)) {
+                        return -1;
+                }
+        }
+        if (!(newcmpt = jas_image_cmpt_create(cmptparm->tlx,
+          cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
+          cmptparm->width, cmptparm->height, cmptparm->prec,
+          cmptparm->sgnd, 1))) {
+                return -1;
+        }
+        if (cmptno < image->numcmpts_) {
+                memmove(&image->cmpts_[cmptno + 1], &image->cmpts_[cmptno],
+                  (image->numcmpts_ - cmptno) * sizeof(jas_image_cmpt_t *));
+        }
+        image->cmpts_[cmptno] = newcmpt;
+        ++image->numcmpts_;
+
+        jas_image_setbbox(image);
+
+        return 0;
 }
 
 jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id)
 {
-	int i;
-	jas_image_fmtinfo_t *fmtinfo;
+        int i;
+        jas_image_fmtinfo_t *fmtinfo;
 
-	for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
-		if (fmtinfo->id == id) {
-			return fmtinfo;
-		}
-	}
-	return 0;
+        for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
+                if (fmtinfo->id == id) {
+                        return fmtinfo;
+                }
+        }
+        return 0;
 }
 
 jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name)
 {
-	int i;
-	jas_image_fmtinfo_t *fmtinfo;
+        int i;
+        jas_image_fmtinfo_t *fmtinfo;
 
-	for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
-		if (!strcmp(fmtinfo->name, name)) {
-			return fmtinfo;
-		}
-	}
-	return 0;
+        for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
+                if (!strcmp(fmtinfo->name, name)) {
+                        return fmtinfo;
+                }
+        }
+        return 0;
 }
 
 
@@ -783,220 +783,220 @@ jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name)
 
 static uint_fast32_t inttobits(jas_seqent_t v, int prec, bool sgnd)
 {
-	uint_fast32_t ret;
-	ret = ((sgnd && v < 0) ? ((1 << prec) + v) : v) & JAS_ONES(prec);
-	return ret;
+        uint_fast32_t ret;
+        ret = ((sgnd && v < 0) ? ((1 << prec) + v) : v) & JAS_ONES(prec);
+        return ret;
 }
 
 static jas_seqent_t bitstoint(uint_fast32_t v, int prec, bool sgnd)
 {
-	jas_seqent_t ret;
-	v &= JAS_ONES(prec);
-	ret = (sgnd && (v & (1 << (prec - 1)))) ? (v - (1 << prec)) : v;
-	return ret;
+        jas_seqent_t ret;
+        v &= JAS_ONES(prec);
+        ret = (sgnd && (v & (1 << (prec - 1)))) ? (v - (1 << prec)) : v;
+        return ret;
 }
 
 static void jas_image_setbbox(jas_image_t *image)
 {
-	jas_image_cmpt_t *cmpt;
-	int cmptno;
-	int_fast32_t x;
-	int_fast32_t y;
-
-	if (image->numcmpts_ > 0) {
-		/* Determine the bounding box for all of the components on the
-		  reference grid (i.e., the image area) */
-		cmpt = image->cmpts_[0];
-		image->tlx_ = cmpt->tlx_;
-		image->tly_ = cmpt->tly_;
-		image->brx_ = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
-		image->bry_ = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
-		for (cmptno = 1; cmptno < image->numcmpts_; ++cmptno) {
-			cmpt = image->cmpts_[cmptno];
-			if (image->tlx_ > cmpt->tlx_) {
-				image->tlx_ = cmpt->tlx_;
-			}
-			if (image->tly_ > cmpt->tly_) {
-				image->tly_ = cmpt->tly_;
-			}
-			x = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
-			if (image->brx_ < x) {
-				image->brx_ = x;
-			}
-			y = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
-			if (image->bry_ < y) {
-				image->bry_ = y;
-			}
-		}
-	} else {
-		image->tlx_ = 0;
-		image->tly_ = 0;
-		image->brx_ = 0;
-		image->bry_ = 0;
-	}
+        jas_image_cmpt_t *cmpt;
+        int cmptno;
+        int_fast32_t x;
+        int_fast32_t y;
+
+        if (image->numcmpts_ > 0) {
+                /* Determine the bounding box for all of the components on the
+                  reference grid (i.e., the image area) */
+                cmpt = image->cmpts_[0];
+                image->tlx_ = cmpt->tlx_;
+                image->tly_ = cmpt->tly_;
+                image->brx_ = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
+                image->bry_ = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
+                for (cmptno = 1; cmptno < image->numcmpts_; ++cmptno) {
+                        cmpt = image->cmpts_[cmptno];
+                        if (image->tlx_ > cmpt->tlx_) {
+                                image->tlx_ = cmpt->tlx_;
+                        }
+                        if (image->tly_ > cmpt->tly_) {
+                                image->tly_ = cmpt->tly_;
+                        }
+                        x = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
+                        if (image->brx_ < x) {
+                                image->brx_ = x;
+                        }
+                        y = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
+                        if (image->bry_ < y) {
+                                image->bry_ = y;
+                        }
+                }
+        } else {
+                image->tlx_ = 0;
+                image->tly_ = 0;
+                image->brx_ = 0;
+                image->bry_ = 0;
+        }
 }
 
 static int jas_image_growcmpts(jas_image_t *image, int maxcmpts)
 {
-	jas_image_cmpt_t **newcmpts;
-	int cmptno;
+        jas_image_cmpt_t **newcmpts;
+        int cmptno;
 
-	newcmpts = (!image->cmpts_) ? jas_malloc(maxcmpts * sizeof(jas_image_cmpt_t *)) :
-	  jas_realloc(image->cmpts_, maxcmpts * sizeof(jas_image_cmpt_t *));
-	if (!newcmpts) {
-		return -1;
-	}
-	image->cmpts_ = newcmpts;
-	image->maxcmpts_ = maxcmpts;
-	for (cmptno = image->numcmpts_; cmptno < image->maxcmpts_; ++cmptno) {
-		image->cmpts_[cmptno] = 0;
-	}
-	return 0;
+        newcmpts = (!image->cmpts_) ? jas_malloc(maxcmpts * sizeof(jas_image_cmpt_t *)) :
+          jas_realloc(image->cmpts_, maxcmpts * sizeof(jas_image_cmpt_t *));
+        if (!newcmpts) {
+                return -1;
+        }
+        image->cmpts_ = newcmpts;
+        image->maxcmpts_ = maxcmpts;
+        for (cmptno = image->numcmpts_; cmptno < image->maxcmpts_; ++cmptno) {
+                image->cmpts_[cmptno] = 0;
+        }
+        return 0;
 }
 
 int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno, jas_image_t *srcimage,
   int srccmptno)
 {
-	jas_image_cmpt_t *newcmpt;
-	if (dstimage->numcmpts_ >= dstimage->maxcmpts_) {
-		if (jas_image_growcmpts(dstimage, dstimage->maxcmpts_ + 128)) {
-			return -1;
-		}
-	}
-	if (!(newcmpt = jas_image_cmpt_copy(srcimage->cmpts_[srccmptno]))) {
-		return -1;
-	}
-	if (dstcmptno < dstimage->numcmpts_) {
-		memmove(&dstimage->cmpts_[dstcmptno + 1], &dstimage->cmpts_[dstcmptno],
-		  (dstimage->numcmpts_ - dstcmptno) * sizeof(jas_image_cmpt_t *));
-	}
-	dstimage->cmpts_[dstcmptno] = newcmpt;
-	++dstimage->numcmpts_;
-
-	jas_image_setbbox(dstimage);
-	return 0;
+        jas_image_cmpt_t *newcmpt;
+        if (dstimage->numcmpts_ >= dstimage->maxcmpts_) {
+                if (jas_image_growcmpts(dstimage, dstimage->maxcmpts_ + 128)) {
+                        return -1;
+                }
+        }
+        if (!(newcmpt = jas_image_cmpt_copy(srcimage->cmpts_[srccmptno]))) {
+                return -1;
+        }
+        if (dstcmptno < dstimage->numcmpts_) {
+                memmove(&dstimage->cmpts_[dstcmptno + 1], &dstimage->cmpts_[dstcmptno],
+                  (dstimage->numcmpts_ - dstcmptno) * sizeof(jas_image_cmpt_t *));
+        }
+        dstimage->cmpts_[dstcmptno] = newcmpt;
+        ++dstimage->numcmpts_;
+
+        jas_image_setbbox(dstimage);
+        return 0;
 }
 
 void jas_image_dump(jas_image_t *image, FILE *out)
 {
-	int cmptno;
-	jas_seq2d_t *data;
-	jas_image_cmpt_t *cmpt;
-	if (!(data = jas_seq2d_create(0, 0, 1, 1))) {
-		abort();
-	}
-	for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
-		cmpt = image->cmpts_[cmptno];
-		fprintf(out, "prec=%d sgnd=%d\n", (int)cmpt->prec_, cmpt->sgnd_);
-		if (jas_image_readcmpt(image, cmptno, 0, 0, 1, 1, data)) {
-			abort();
-		}
-		fprintf(out, "tlsample %ld\n", (long) jas_seq2d_get(data, 0, 0));
-	}
-	jas_seq2d_destroy(data);
+        int cmptno;
+        jas_seq2d_t *data;
+        jas_image_cmpt_t *cmpt;
+        if (!(data = jas_seq2d_create(0, 0, 1, 1))) {
+                abort();
+        }
+        for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
+                cmpt = image->cmpts_[cmptno];
+                fprintf(out, "prec=%d sgnd=%d\n", (int)cmpt->prec_, cmpt->sgnd_);
+                if (jas_image_readcmpt(image, cmptno, 0, 0, 1, 1, data)) {
+                        abort();
+                }
+                fprintf(out, "tlsample %ld\n", (long) jas_seq2d_get(data, 0, 0));
+        }
+        jas_seq2d_destroy(data);
 }
 
 int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
   int_fast32_t *lutents, int dtype, int newcmptno)
 {
-	jas_image_cmptparm_t cmptparms;
-	int_fast32_t v;
-	int i;
-	int j;
-	jas_image_cmpt_t *cmpt;
-
-	cmpt = image->cmpts_[cmptno];
-	cmptparms.tlx = cmpt->tlx_;
-	cmptparms.tly = cmpt->tly_;
-	cmptparms.hstep = cmpt->hstep_;
-	cmptparms.vstep = cmpt->vstep_;
-	cmptparms.width = cmpt->width_;
-	cmptparms.height = cmpt->height_;
-	cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype);
-	cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype);
-
-	if (numlutents < 1) {
-		return -1;
-	}
-
-	if (jas_image_addcmpt(image, newcmptno, &cmptparms)) {
-		return -1;
-	}
-	if (newcmptno <= cmptno) {
-		++cmptno;
-		cmpt = image->cmpts_[cmptno];
-	}
-
-	for (j = 0; j < cmpt->height_; ++j) {
-		for (i = 0; i < cmpt->width_; ++i) {
-			v = jas_image_readcmptsample(image, cmptno, i, j);
-			if (v < 0) {
-				v = 0;
-			} else if (v >= numlutents) {
-				v = numlutents - 1;
-			}
-			jas_image_writecmptsample(image, newcmptno, i, j,
-			  lutents[v]);
-		}
-	}
-	return 0;
+        jas_image_cmptparm_t cmptparms;
+        int_fast32_t v;
+        int i;
+        int j;
+        jas_image_cmpt_t *cmpt;
+
+        cmpt = image->cmpts_[cmptno];
+        cmptparms.tlx = cmpt->tlx_;
+        cmptparms.tly = cmpt->tly_;
+        cmptparms.hstep = cmpt->hstep_;
+        cmptparms.vstep = cmpt->vstep_;
+        cmptparms.width = cmpt->width_;
+        cmptparms.height = cmpt->height_;
+        cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype);
+        cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype);
+
+        if (numlutents < 1) {
+                return -1;
+        }
+
+        if (jas_image_addcmpt(image, newcmptno, &cmptparms)) {
+                return -1;
+        }
+        if (newcmptno <= cmptno) {
+                ++cmptno;
+                cmpt = image->cmpts_[cmptno];
+        }
+
+        for (j = 0; j < cmpt->height_; ++j) {
+                for (i = 0; i < cmpt->width_; ++i) {
+                        v = jas_image_readcmptsample(image, cmptno, i, j);
+                        if (v < 0) {
+                                v = 0;
+                        } else if (v >= numlutents) {
+                                v = numlutents - 1;
+                        }
+                        jas_image_writecmptsample(image, newcmptno, i, j,
+                          lutents[v]);
+                }
+        }
+        return 0;
 }
 
 int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y)
 {
-	jas_image_cmpt_t *cmpt;
-	uint_fast32_t v;
-	int k;
-	int c;
+        jas_image_cmpt_t *cmpt;
+        uint_fast32_t v;
+        int k;
+        int c;
 
-	cmpt = image->cmpts_[cmptno];
+        cmpt = image->cmpts_[cmptno];
 
-	if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
-	  SEEK_SET) < 0) {
-		return -1;
-	}
-	v = 0;
-	for (k = cmpt->cps_; k > 0; --k) {
-		if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
-			return -1;
-		}
-		v = (v << 8) | (c & 0xff);
-	}
-	return bitstoint(v, cmpt->prec_, cmpt->sgnd_);
+        if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
+          SEEK_SET) < 0) {
+                return -1;
+        }
+        v = 0;
+        for (k = cmpt->cps_; k > 0; --k) {
+                if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
+                        return -1;
+                }
+                v = (v << 8) | (c & 0xff);
+        }
+        return bitstoint(v, cmpt->prec_, cmpt->sgnd_);
 }
 
 void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y,
   int_fast32_t v)
 {
-	jas_image_cmpt_t *cmpt;
-	uint_fast32_t t;
-	int k;
-	int c;
+        jas_image_cmpt_t *cmpt;
+        uint_fast32_t t;
+        int k;
+        int c;
 
-	cmpt = image->cmpts_[cmptno];
+        cmpt = image->cmpts_[cmptno];
 
-	if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
-	  SEEK_SET) < 0) {
-		return;
-	}
-	t = inttobits(v, cmpt->prec_, cmpt->sgnd_);
-	for (k = cmpt->cps_; k > 0; --k) {
-		c = (t >> (8 * (cmpt->cps_ - 1))) & 0xff;
-		if (jas_stream_putc(cmpt->stream_, (unsigned char) c) == EOF) {
-			return;
-		}
-		t <<= 8;
-	}
+        if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
+          SEEK_SET) < 0) {
+                return;
+        }
+        t = inttobits(v, cmpt->prec_, cmpt->sgnd_);
+        for (k = cmpt->cps_; k > 0; --k) {
+                c = (t >> (8 * (cmpt->cps_ - 1))) & 0xff;
+                if (jas_stream_putc(cmpt->stream_, (unsigned char) c) == EOF) {
+                        return;
+                }
+                t <<= 8;
+        }
 }
 
 int jas_image_getcmptbytype(jas_image_t *image, int ctype)
 {
-	int cmptno;
+        int cmptno;
 
-	for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
-		if (image->cmpts_[cmptno]->type_ == ctype) {
-			return cmptno;
-		}
-	}
+        for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
+                if (image->cmpts_[cmptno]->type_ == ctype) {
+                        return cmptno;
+                }
+        }
     return -1;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_init.c b/converter/other/jpeg2000/libjasper/base/jas_init.c
index c1114bf7..8d79a7fe 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_init.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_init.c
@@ -4,14 +4,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -19,22 +19,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -54,17 +54,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -104,7 +104,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -123,78 +123,78 @@
 /* Initialize the image format table. */
 int jas_init()
 {
-	jas_image_fmtops_t fmtops;
-	int fmtid;
+        jas_image_fmtops_t fmtops;
+        int fmtid;
 
-	fmtid = 0;
+        fmtid = 0;
 
 #if !defined(EXCLUDE_MIF_SUPPORT)
-	fmtops.decode = mif_decode;
-	fmtops.encode = mif_encode;
-	fmtops.validate = mif_validate;
-	jas_image_addfmt(fmtid, "mif", "mif", "My Image Format (MIF)", &fmtops);
-	++fmtid;
+        fmtops.decode = mif_decode;
+        fmtops.encode = mif_encode;
+        fmtops.validate = mif_validate;
+        jas_image_addfmt(fmtid, "mif", "mif", "My Image Format (MIF)", &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_PNM_SUPPORT)
-	fmtops.decode = pnm_decode;
-	fmtops.encode = pnm_encode;
-	fmtops.validate = pnm_validate;
-	jas_image_addfmt(fmtid, "pnm", "pnm", "Portable Graymap/Pixmap (PNM)",
-	  &fmtops);
-	jas_image_addfmt(fmtid, "pnm", "pgm", "Portable Graymap/Pixmap (PNM)",
-	  &fmtops);
-	jas_image_addfmt(fmtid, "pnm", "ppm", "Portable Graymap/Pixmap (PNM)",
-	  &fmtops);
-	++fmtid;
+        fmtops.decode = pnm_decode;
+        fmtops.encode = pnm_encode;
+        fmtops.validate = pnm_validate;
+        jas_image_addfmt(fmtid, "pnm", "pnm", "Portable Graymap/Pixmap (PNM)",
+          &fmtops);
+        jas_image_addfmt(fmtid, "pnm", "pgm", "Portable Graymap/Pixmap (PNM)",
+          &fmtops);
+        jas_image_addfmt(fmtid, "pnm", "ppm", "Portable Graymap/Pixmap (PNM)",
+          &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_BMP_SUPPORT)
-	fmtops.decode = bmp_decode;
-	fmtops.encode = bmp_encode;
-	fmtops.validate = bmp_validate;
-	jas_image_addfmt(fmtid, "bmp", "bmp", "Microsoft Bitmap (BMP)", &fmtops);
-	++fmtid;
+        fmtops.decode = bmp_decode;
+        fmtops.encode = bmp_encode;
+        fmtops.validate = bmp_validate;
+        jas_image_addfmt(fmtid, "bmp", "bmp", "Microsoft Bitmap (BMP)", &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_RAS_SUPPORT)
-	fmtops.decode = ras_decode;
-	fmtops.encode = ras_encode;
-	fmtops.validate = ras_validate;
-	jas_image_addfmt(fmtid, "ras", "ras", "Sun Rasterfile (RAS)", &fmtops);
-	++fmtid;
+        fmtops.decode = ras_decode;
+        fmtops.encode = ras_encode;
+        fmtops.validate = ras_validate;
+        jas_image_addfmt(fmtid, "ras", "ras", "Sun Rasterfile (RAS)", &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_JP2_SUPPORT)
-	fmtops.decode = jp2_decode;
-	fmtops.encode = jp2_encode;
-	fmtops.validate = jp2_validate;
-	jas_image_addfmt(fmtid, "jp2", "jp2",
-	  "JPEG-2000 JP2 File Format Syntax (ISO/IEC 15444-1)", &fmtops);
-	++fmtid;
-	fmtops.decode = jpc_decode;
-	fmtops.encode = jpc_encode;
-	fmtops.validate = jpc_validate;
-	jas_image_addfmt(fmtid, "jpc", "jpc",
-	  "JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1)", &fmtops);
-	++fmtid;
+        fmtops.decode = jp2_decode;
+        fmtops.encode = jp2_encode;
+        fmtops.validate = jp2_validate;
+        jas_image_addfmt(fmtid, "jp2", "jp2",
+          "JPEG-2000 JP2 File Format Syntax (ISO/IEC 15444-1)", &fmtops);
+        ++fmtid;
+        fmtops.decode = jpc_decode;
+        fmtops.encode = jpc_encode;
+        fmtops.validate = jpc_validate;
+        jas_image_addfmt(fmtid, "jpc", "jpc",
+          "JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1)", &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_JPG_SUPPORT)
-	fmtops.decode = jpg_decode;
-	fmtops.encode = jpg_encode;
-	fmtops.validate = jpg_validate;
-	jas_image_addfmt(fmtid, "jpg", "jpg", "JPEG (ISO/IEC 10918-1)", &fmtops);
-	++fmtid;
+        fmtops.decode = jpg_decode;
+        fmtops.encode = jpg_encode;
+        fmtops.validate = jpg_validate;
+        jas_image_addfmt(fmtid, "jpg", "jpg", "JPEG (ISO/IEC 10918-1)", &fmtops);
+        ++fmtid;
 #endif
 
 #if !defined(EXCLUDE_PGX_SUPPORT)
-	fmtops.decode = pgx_decode;
-	fmtops.encode = pgx_encode;
-	fmtops.validate = pgx_validate;
-	jas_image_addfmt(fmtid, "pgx", "pgx", "JPEG-2000 VM Format (PGX)", &fmtops);
-	++fmtid;
+        fmtops.decode = pgx_decode;
+        fmtops.encode = pgx_encode;
+        fmtops.validate = pgx_validate;
+        jas_image_addfmt(fmtid, "pgx", "pgx", "JPEG-2000 VM Format (PGX)", &fmtops);
+        ++fmtid;
 #endif
 
-	return 0;
+        return 0;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_malloc.c b/converter/other/jpeg2000/libjasper/base/jas_malloc.c
index 43c4d3cd..a8b85033 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_malloc.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_malloc.c
@@ -6,14 +6,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -21,22 +21,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -56,17 +56,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -106,7 +106,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -139,29 +139,29 @@
 
 void *jas_malloc(size_t size)
 {
-	return malloc(size);
+        return malloc(size);
 }
 
 void jas_free(void *ptr)
 {
-	free(ptr);
+        free(ptr);
 }
 
 void *jas_realloc(void *ptr, size_t size)
 {
-	return realloc(ptr, size);
+        return realloc(ptr, size);
 }
 
 void *jas_calloc(size_t nmemb, size_t size)
 {
-	void *ptr;
-	size_t n;
-	n = nmemb * size;
-	if (!(ptr = jas_malloc(n * sizeof(char)))) {
-		return 0;
-	}
-	memset(ptr, 0, n);
-	return ptr;
+        void *ptr;
+        size_t n;
+        n = nmemb * size;
+        if (!(ptr = jas_malloc(n * sizeof(char)))) {
+                return 0;
+        }
+        memset(ptr, 0, n);
+        return ptr;
 }
 
 #endif
diff --git a/converter/other/jpeg2000/libjasper/base/jas_seq.c b/converter/other/jpeg2000/libjasper/base/jas_seq.c
index 12dc1595..5aa2a75f 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_seq.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_seq.c
@@ -6,14 +6,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -21,22 +21,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -56,17 +56,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -106,7 +106,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -134,108 +134,108 @@
 
 jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend)
 {
-	jas_matrix_t *matrix;
-	assert(xstart <= xend && ystart <= yend);
-	if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) {
-		return 0;
-	}
-	matrix->xstart_ = xstart;
-	matrix->ystart_ = ystart;
-	matrix->xend_ = xend;
-	matrix->yend_ = yend;
-	return matrix;
+        jas_matrix_t *matrix;
+        assert(xstart <= xend && ystart <= yend);
+        if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) {
+                return 0;
+        }
+        matrix->xstart_ = xstart;
+        matrix->ystart_ = ystart;
+        matrix->xend_ = xend;
+        matrix->yend_ = yend;
+        return matrix;
 }
 
 jas_matrix_t *jas_matrix_create(int numrows, int numcols)
 {
-	jas_matrix_t *matrix;
-	int i;
-
-	if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
-		return 0;
-	}
-	matrix->flags_ = 0;
-	matrix->numrows_ = numrows;
-	matrix->numcols_ = numcols;
-	matrix->rows_ = 0;
-	matrix->maxrows_ = numrows;
-	matrix->data_ = 0;
-	matrix->datasize_ = numrows * numcols;
-
-	if (matrix->maxrows_ > 0) {
-		if (!(matrix->rows_ = jas_malloc(matrix->maxrows_ *
-		  sizeof(jas_seqent_t *)))) {
-			jas_matrix_destroy(matrix);
-			return 0;
-		}
-	}
-
-	if (matrix->datasize_ > 0) {
-		if (!(matrix->data_ = jas_malloc(matrix->datasize_ *
-		  sizeof(jas_seqent_t)))) {
-			jas_matrix_destroy(matrix);
-			return 0;
-		}
-	}
-
-	for (i = 0; i < numrows; ++i) {
-		matrix->rows_[i] = &matrix->data_[i * matrix->numcols_];
-	}
-
-	for (i = 0; i < matrix->datasize_; ++i) {
-		matrix->data_[i] = 0;
-	}
-
-	matrix->xstart_ = 0;
-	matrix->ystart_ = 0;
-	matrix->xend_ = matrix->numcols_;
-	matrix->yend_ = matrix->numrows_;
-
-	return matrix;
+        jas_matrix_t *matrix;
+        int i;
+
+        if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
+                return 0;
+        }
+        matrix->flags_ = 0;
+        matrix->numrows_ = numrows;
+        matrix->numcols_ = numcols;
+        matrix->rows_ = 0;
+        matrix->maxrows_ = numrows;
+        matrix->data_ = 0;
+        matrix->datasize_ = numrows * numcols;
+
+        if (matrix->maxrows_ > 0) {
+                if (!(matrix->rows_ = jas_malloc(matrix->maxrows_ *
+                  sizeof(jas_seqent_t *)))) {
+                        jas_matrix_destroy(matrix);
+                        return 0;
+                }
+        }
+
+        if (matrix->datasize_ > 0) {
+                if (!(matrix->data_ = jas_malloc(matrix->datasize_ *
+                  sizeof(jas_seqent_t)))) {
+                        jas_matrix_destroy(matrix);
+                        return 0;
+                }
+        }
+
+        for (i = 0; i < numrows; ++i) {
+                matrix->rows_[i] = &matrix->data_[i * matrix->numcols_];
+        }
+
+        for (i = 0; i < matrix->datasize_; ++i) {
+                matrix->data_[i] = 0;
+        }
+
+        matrix->xstart_ = 0;
+        matrix->ystart_ = 0;
+        matrix->xend_ = matrix->numcols_;
+        matrix->yend_ = matrix->numrows_;
+
+        return matrix;
 }
 
 void jas_matrix_destroy(jas_matrix_t *matrix)
 {
-	if (matrix->data_) {
-		assert(!(matrix->flags_ & JAS_MATRIX_REF));
-		jas_free(matrix->data_);
-		matrix->data_ = 0;
-	}
-	if (matrix->rows_) {
-		jas_free(matrix->rows_);
-		matrix->rows_ = 0;
-	}
-	jas_free(matrix);
+        if (matrix->data_) {
+                assert(!(matrix->flags_ & JAS_MATRIX_REF));
+                jas_free(matrix->data_);
+                matrix->data_ = 0;
+        }
+        if (matrix->rows_) {
+                jas_free(matrix->rows_);
+                matrix->rows_ = 0;
+        }
+        jas_free(matrix);
 }
 
 jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)
 {
-	jas_matrix_t *y;
-	int i;
-	int j;
-	y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x),
-	  jas_seq2d_yend(x));
-	assert(y);
-	for (i = 0; i < x->numrows_; ++i) {
-		for (j = 0; j < x->numcols_; ++j) {
-			*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
-		}
-	}
-	return y;
+        jas_matrix_t *y;
+        int i;
+        int j;
+        y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x),
+          jas_seq2d_yend(x));
+        assert(y);
+        for (i = 0; i < x->numrows_; ++i) {
+                for (j = 0; j < x->numcols_; ++j) {
+                        *jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
+                }
+        }
+        return y;
 }
 
 jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
 {
-	jas_matrix_t *y;
-	int i;
-	int j;
-	y = jas_matrix_create(x->numrows_, x->numcols_);
-	for (i = 0; i < x->numrows_; ++i) {
-		for (j = 0; j < x->numcols_; ++j) {
-			*jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
-		}
-	}
-	return y;
+        jas_matrix_t *y;
+        int i;
+        int j;
+        y = jas_matrix_create(x->numrows_, x->numcols_);
+        for (i = 0; i < x->numrows_; ++i) {
+                for (j = 0; j < x->numcols_; ++j) {
+                        *jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
+                }
+        }
+        return y;
 }
 
 /******************************************************************************\
@@ -245,39 +245,39 @@ jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
 void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart, int ystart,
   int xend, int yend)
 {
-	jas_matrix_bindsub(s, s1, ystart - s1->ystart_, xstart - s1->xstart_,
-	  yend - s1->ystart_ - 1, xend - s1->xstart_ - 1);
+        jas_matrix_bindsub(s, s1, ystart - s1->ystart_, xstart - s1->xstart_,
+          yend - s1->ystart_ - 1, xend - s1->xstart_ - 1);
 }
 
 void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
   int r1, int c1)
 {
-	int i;
-
-	if (mat0->data_) {
-		if (!(mat0->flags_ & JAS_MATRIX_REF)) {
-			jas_free(mat0->data_);
-		}
-		mat0->data_ = 0;
-		mat0->datasize_ = 0;
-	}
-	if (mat0->rows_) {
-		jas_free(mat0->rows_);
-		mat0->rows_ = 0;
-	}
-	mat0->flags_ |= JAS_MATRIX_REF;
-	mat0->numrows_ = r1 - r0 + 1;
-	mat0->numcols_ = c1 - c0 + 1;
-	mat0->maxrows_ = mat0->numrows_;
-	mat0->rows_ = jas_malloc(mat0->maxrows_ * sizeof(jas_seqent_t *));
-	for (i = 0; i < mat0->numrows_; ++i) {
-		mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
-	}
-
-	mat0->xstart_ = mat1->xstart_ + c0;
-	mat0->ystart_ = mat1->ystart_ + r0;
-	mat0->xend_ = mat0->xstart_ + mat0->numcols_;
-	mat0->yend_ = mat0->ystart_ + mat0->numrows_;
+        int i;
+
+        if (mat0->data_) {
+                if (!(mat0->flags_ & JAS_MATRIX_REF)) {
+                        jas_free(mat0->data_);
+                }
+                mat0->data_ = 0;
+                mat0->datasize_ = 0;
+        }
+        if (mat0->rows_) {
+                jas_free(mat0->rows_);
+                mat0->rows_ = 0;
+        }
+        mat0->flags_ |= JAS_MATRIX_REF;
+        mat0->numrows_ = r1 - r0 + 1;
+        mat0->numcols_ = c1 - c0 + 1;
+        mat0->maxrows_ = mat0->numrows_;
+        mat0->rows_ = jas_malloc(mat0->maxrows_ * sizeof(jas_seqent_t *));
+        for (i = 0; i < mat0->numrows_; ++i) {
+                mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
+        }
+
+        mat0->xstart_ = mat1->xstart_ + c0;
+        mat0->ystart_ = mat1->ystart_ + r0;
+        mat0->xend_ = mat0->xstart_ + mat0->numcols_;
+        mat0->yend_ = mat0->ystart_ + mat0->numrows_;
 }
 
 /******************************************************************************\
@@ -286,102 +286,102 @@ void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
 
 int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
 {
-	int i;
-	int j;
-
-	if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
-	  mat1->numcols_) {
-		return 1;
-	}
-	for (i = 0; i < mat0->numrows_; i++) {
-		for (j = 0; j < mat0->numcols_; j++) {
-			if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
-				return 1;
-			}
-		}
-	}
-	return 0;
+        int i;
+        int j;
+
+        if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
+          mat1->numcols_) {
+                return 1;
+        }
+        for (i = 0; i < mat0->numrows_; i++) {
+                for (j = 0; j < mat0->numcols_; j++) {
+                        if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
+                                return 1;
+                        }
+                }
+        }
+        return 0;
 }
 
 void jas_matrix_divpow2(jas_matrix_t *matrix, int n)
 {
-	int i;
-	int j;
-	jas_seqent_t *rowstart;
-	int rowstep;
-	jas_seqent_t *data;
-
-	rowstep = jas_matrix_rowstep(matrix);
-	for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
-	  rowstart += rowstep) {
-		for (j = matrix->numcols_, data = rowstart; j > 0; --j,
-		  ++data) {
-			*data = (*data >= 0) ? ((*data) >> n) :
-			  (-((-(*data)) >> n));
-		}
-	}
+        int i;
+        int j;
+        jas_seqent_t *rowstart;
+        int rowstep;
+        jas_seqent_t *data;
+
+        rowstep = jas_matrix_rowstep(matrix);
+        for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
+          rowstart += rowstep) {
+                for (j = matrix->numcols_, data = rowstart; j > 0; --j,
+                  ++data) {
+                        *data = (*data >= 0) ? ((*data) >> n) :
+                          (-((-(*data)) >> n));
+                }
+        }
 }
 
 void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
 {
-	int i;
-	int j;
-	jas_seqent_t v;
-	jas_seqent_t *rowstart;
-	jas_seqent_t *data;
-	int rowstep;
-
-	rowstep = jas_matrix_rowstep(matrix);
-	for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
-	  rowstart += rowstep) {
-		data = rowstart;
-		for (j = matrix->numcols_, data = rowstart; j > 0; --j,
-		  ++data) {
-			v = *data;
-			if (v < minval) {
-				*data = minval;
-			} else if (v > maxval) {
-				*data = maxval;
-			}
-		}
-	}
+        int i;
+        int j;
+        jas_seqent_t v;
+        jas_seqent_t *rowstart;
+        jas_seqent_t *data;
+        int rowstep;
+
+        rowstep = jas_matrix_rowstep(matrix);
+        for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
+          rowstart += rowstep) {
+                data = rowstart;
+                for (j = matrix->numcols_, data = rowstart; j > 0; --j,
+                  ++data) {
+                        v = *data;
+                        if (v < minval) {
+                                *data = minval;
+                        } else if (v > maxval) {
+                                *data = maxval;
+                        }
+                }
+        }
 }
 
 void jas_matrix_asr(jas_matrix_t *matrix, int n)
 {
-	int i;
-	int j;
-	jas_seqent_t *rowstart;
-	int rowstep;
-	jas_seqent_t *data;
-
-	assert(n >= 0);
-	rowstep = jas_matrix_rowstep(matrix);
-	for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
-	  rowstart += rowstep) {
-		for (j = matrix->numcols_, data = rowstart; j > 0; --j,
-		  ++data) {
-			*data >>= n;
-		}
-	}
+        int i;
+        int j;
+        jas_seqent_t *rowstart;
+        int rowstep;
+        jas_seqent_t *data;
+
+        assert(n >= 0);
+        rowstep = jas_matrix_rowstep(matrix);
+        for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
+          rowstart += rowstep) {
+                for (j = matrix->numcols_, data = rowstart; j > 0; --j,
+                  ++data) {
+                        *data >>= n;
+                }
+        }
 }
 
 void jas_matrix_asl(jas_matrix_t *matrix, int n)
 {
-	int i;
-	int j;
-	jas_seqent_t *rowstart;
-	int rowstep;
-	jas_seqent_t *data;
-
-	rowstep = jas_matrix_rowstep(matrix);
-	for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
-	  rowstart += rowstep) {
-		for (j = matrix->numcols_, data = rowstart; j > 0; --j,
-		  ++data) {
-			*data <<= n;
-		}
-	}
+        int i;
+        int j;
+        jas_seqent_t *rowstart;
+        int rowstep;
+        jas_seqent_t *data;
+
+        rowstep = jas_matrix_rowstep(matrix);
+        for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
+          rowstart += rowstep) {
+                for (j = matrix->numcols_, data = rowstart; j > 0; --j,
+                  ++data) {
+                        *data <<= n;
+                }
+        }
 }
 
 /******************************************************************************\
@@ -390,87 +390,87 @@ void jas_matrix_asl(jas_matrix_t *matrix, int n)
 
 int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols)
 {
-	int size;
-	int i;
+        int size;
+        int i;
 
-	size = numrows * numcols;
-	if (size > matrix->datasize_ || numrows > matrix->maxrows_) {
-		return -1;
-	}
+        size = numrows * numcols;
+        if (size > matrix->datasize_ || numrows > matrix->maxrows_) {
+                return -1;
+        }
 
-	matrix->numrows_ = numrows;
-	matrix->numcols_ = numcols;
+        matrix->numrows_ = numrows;
+        matrix->numcols_ = numcols;
 
-	for (i = 0; i < numrows; ++i) {
-		matrix->rows_[i] = &matrix->data_[numcols * i];
-	}
+        for (i = 0; i < numrows; ++i) {
+                matrix->rows_[i] = &matrix->data_[numcols * i];
+        }
 
-	return 0;
+        return 0;
 }
 
 int jas_matrix_output(jas_matrix_t *matrix, FILE *out)
 {
-	int i;
-	int j;
-	jas_seqent_t x;
+        int i;
+        int j;
+        jas_seqent_t x;
 
-	fprintf(out, "%d %d\n",
+        fprintf(out, "%d %d\n",
             (int)jas_matrix_numrows(matrix), (int)jas_matrix_numcols(matrix));
-	for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
-		for (j = 0; j < jas_matrix_numcols(matrix); ++j) {
-			x = jas_matrix_get(matrix, i, j);
-			fprintf(out, "%ld", JAS_CAST(long, x));
-			if (j < jas_matrix_numcols(matrix) - 1) {
-				fprintf(out, " ");
-			}
-		}
-		fprintf(out, "\n");
-	}
-	return 0;
+        for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
+                for (j = 0; j < jas_matrix_numcols(matrix); ++j) {
+                        x = jas_matrix_get(matrix, i, j);
+                        fprintf(out, "%ld", JAS_CAST(long, x));
+                        if (j < jas_matrix_numcols(matrix) - 1) {
+                                fprintf(out, " ");
+                        }
+                }
+                fprintf(out, "\n");
+        }
+        return 0;
 }
 
 void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
 {
-	int i;
-	int j;
-	jas_seqent_t *rowstart;
-	int rowstep;
-	jas_seqent_t *data;
-
-	rowstep = jas_matrix_rowstep(matrix);
-	for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
-	  rowstart += rowstep) {
-		for (j = matrix->numcols_, data = rowstart; j > 0; --j,
-		  ++data) {
-			*data = val;
-		}
-	}
+        int i;
+        int j;
+        jas_seqent_t *rowstart;
+        int rowstep;
+        jas_seqent_t *data;
+
+        rowstep = jas_matrix_rowstep(matrix);
+        for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
+          rowstart += rowstep) {
+                for (j = matrix->numcols_, data = rowstart; j > 0; --j,
+                  ++data) {
+                        *data = val;
+                }
+        }
 }
 
 jas_matrix_t *jas_matrix_input(FILE *in)
 {
-	jas_matrix_t *matrix;
-	int i;
-	int j;
-	long x;
-	int numrows;
-	int numcols;
-
-	if (fscanf(in, "%d %d", &numrows, &numcols) != 2)
-		return 0;
-	if (!(matrix = jas_matrix_create(numrows, numcols)))
-		return 0;
-
-	/* Get matrix data. */
-	for (i = 0; i < jas_matrix_numrows(matrix); i++) {
-		for (j = 0; j < jas_matrix_numcols(matrix); j++) {
-			if (fscanf(in, "%ld", &x) != 1) {
-				jas_matrix_destroy(matrix);
-				return 0;
-			}
-			jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));
-		}
-	}
-
-	return matrix;
+        jas_matrix_t *matrix;
+        int i;
+        int j;
+        long x;
+        int numrows;
+        int numcols;
+
+        if (fscanf(in, "%d %d", &numrows, &numcols) != 2)
+                return 0;
+        if (!(matrix = jas_matrix_create(numrows, numcols)))
+                return 0;
+
+        /* Get matrix data. */
+        for (i = 0; i < jas_matrix_numrows(matrix); i++) {
+                for (j = 0; j < jas_matrix_numcols(matrix); j++) {
+                        if (fscanf(in, "%ld", &x) != 1) {
+                                jas_matrix_destroy(matrix);
+                                return 0;
+                        }
+                        jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));
+                }
+        }
+
+        return matrix;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_stream.c b/converter/other/jpeg2000/libjasper/base/jas_stream.c
index a4b3a27c..d5ddcff2 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_stream.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_stream.c
@@ -169,24 +169,24 @@ static int file_close(jas_stream_obj_t *obj);
 \******************************************************************************/
 
 static jas_stream_ops_t jas_stream_fileops = {
-	file_read,
-	file_write,
-	file_seek,
-	file_close
+        file_read,
+        file_write,
+        file_seek,
+        file_close
 };
 
 static jas_stream_ops_t jas_stream_sfileops = {
-	sfile_read,
-	sfile_write,
-	sfile_seek,
-	sfile_close
+        sfile_read,
+        sfile_write,
+        sfile_seek,
+        sfile_close
 };
 
 static jas_stream_ops_t jas_stream_memops = {
-	mem_read,
-	mem_write,
-	mem_seek,
-	mem_close
+        mem_read,
+        mem_write,
+        mem_seek,
+        mem_close
 };
 
 /******************************************************************************\
@@ -195,214 +195,214 @@ static jas_stream_ops_t jas_stream_memops = {
 
 static jas_stream_t *jas_stream_create()
 {
-	jas_stream_t *stream;
-
-	if (!(stream = jas_malloc(sizeof(jas_stream_t)))) {
-		return 0;
-	}
-	stream->openmode_ = 0;
-	stream->bufmode_ = 0;
-	stream->flags_ = 0;
-	stream->bufbase_ = 0;
-	stream->bufstart_ = 0;
-	stream->bufsize_ = 0;
-	stream->ptr_ = 0;
-	stream->cnt_ = 0;
-	stream->ops_ = 0;
-	stream->obj_ = 0;
-	stream->rwcnt_ = 0;
-	stream->rwlimit_ = -1;
-
-	return stream;
+        jas_stream_t *stream;
+
+        if (!(stream = jas_malloc(sizeof(jas_stream_t)))) {
+                return 0;
+        }
+        stream->openmode_ = 0;
+        stream->bufmode_ = 0;
+        stream->flags_ = 0;
+        stream->bufbase_ = 0;
+        stream->bufstart_ = 0;
+        stream->bufsize_ = 0;
+        stream->ptr_ = 0;
+        stream->cnt_ = 0;
+        stream->ops_ = 0;
+        stream->obj_ = 0;
+        stream->rwcnt_ = 0;
+        stream->rwlimit_ = -1;
+
+        return stream;
 }
 
 jas_stream_t *jas_stream_memopen(char *buf, int bufsize)
 {
-	jas_stream_t *stream;
-	jas_stream_memobj_t *obj;
-
-	if (!(stream = jas_stream_create())) {
-		return 0;
-	}
-
-	/* A stream associated with a memory buffer is always opened
-	for both reading and writing in binary mode. */
-	stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
-
-	/* Since the stream data is already resident in memory, buffering
-	is not necessary. */
-	/* But... It still may be faster to use buffering anyways. */
-	jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
-	/* Select the operations for a memory stream. */
-	stream->ops_ = &jas_stream_memops;
-
-	/* Allocate memory for the underlying memory stream object. */
-	if (!(obj = jas_malloc(sizeof(jas_stream_memobj_t)))) {
-		jas_stream_destroy(stream);
-		return 0;
-	}
-	stream->obj_ = (void *) obj;
-
-	/* Initialize a few important members of the memory stream object. */
-	obj->myalloc_ = 0;
-	obj->buf_ = 0;
-
-	/* If the buffer size specified is nonpositive, then the buffer
-	is allocated internally and automatically grown as needed. */
-	if (bufsize <= 0) {
-		obj->bufsize_ = 1024;
-		obj->growable_ = 1;
-	} else {
-		obj->bufsize_ = bufsize;
-		obj->growable_ = 0;
-	}
-	if (buf) {
-		obj->buf_ = (unsigned char *) buf;
-	} else {
-		obj->buf_ = jas_malloc(obj->bufsize_ * sizeof(char));
-		obj->myalloc_ = 1;
-	}
-	if (!obj->buf_) {
-		jas_stream_close(stream);
-		return 0;
-	}
-
-	if (bufsize > 0 && buf) {
-		/* If a buffer was supplied by the caller and its length is positive,
-		  make the associated buffer data appear in the stream initially. */
-		obj->len_ = bufsize;
-	} else {
-		/* The stream is initially empty. */
-		obj->len_ = 0;
-	}
-	obj->pos_ = 0;
-
-	return stream;
+        jas_stream_t *stream;
+        jas_stream_memobj_t *obj;
+
+        if (!(stream = jas_stream_create())) {
+                return 0;
+        }
+
+        /* A stream associated with a memory buffer is always opened
+        for both reading and writing in binary mode. */
+        stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
+
+        /* Since the stream data is already resident in memory, buffering
+        is not necessary. */
+        /* But... It still may be faster to use buffering anyways. */
+        jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+
+        /* Select the operations for a memory stream. */
+        stream->ops_ = &jas_stream_memops;
+
+        /* Allocate memory for the underlying memory stream object. */
+        if (!(obj = jas_malloc(sizeof(jas_stream_memobj_t)))) {
+                jas_stream_destroy(stream);
+                return 0;
+        }
+        stream->obj_ = (void *) obj;
+
+        /* Initialize a few important members of the memory stream object. */
+        obj->myalloc_ = 0;
+        obj->buf_ = 0;
+
+        /* If the buffer size specified is nonpositive, then the buffer
+        is allocated internally and automatically grown as needed. */
+        if (bufsize <= 0) {
+                obj->bufsize_ = 1024;
+                obj->growable_ = 1;
+        } else {
+                obj->bufsize_ = bufsize;
+                obj->growable_ = 0;
+        }
+        if (buf) {
+                obj->buf_ = (unsigned char *) buf;
+        } else {
+                obj->buf_ = jas_malloc(obj->bufsize_ * sizeof(char));
+                obj->myalloc_ = 1;
+        }
+        if (!obj->buf_) {
+                jas_stream_close(stream);
+                return 0;
+        }
+
+        if (bufsize > 0 && buf) {
+                /* If a buffer was supplied by the caller and its length is positive,
+                  make the associated buffer data appear in the stream initially. */
+                obj->len_ = bufsize;
+        } else {
+                /* The stream is initially empty. */
+                obj->len_ = 0;
+        }
+        obj->pos_ = 0;
+
+        return stream;
 }
 
 jas_stream_t *jas_stream_fopen(const char *filename, const char *mode)
 {
-	jas_stream_t *stream;
-	int *obj;
-	int openflags;
-
-	/* Allocate a stream object. */
-	if (!(stream = jas_stream_create())) {
-		return 0;
-	}
-
-	/* Parse the mode string. */
-	stream->openmode_ = jas_strtoopenmode(mode);
-
-	/* Determine the correct flags to use for opening the file. */
-	if ((stream->openmode_ & JAS_STREAM_READ) &&
-	  (stream->openmode_ & JAS_STREAM_WRITE)) {
-		openflags = O_RDWR;
-	} else if (stream->openmode_ & JAS_STREAM_READ) {
-		openflags = O_RDONLY;
-	} else if (stream->openmode_ & JAS_STREAM_WRITE) {
-		openflags = O_WRONLY;
-	} else {
-		openflags = 0;
-	}
-	if (stream->openmode_ & JAS_STREAM_APPEND) {
-		openflags |= O_APPEND;
-	}
-	if (stream->openmode_ & JAS_STREAM_BINARY) {
-		openflags |= O_BINARY;
-	}
-	if (stream->openmode_ & JAS_STREAM_CREATE) {
-		openflags |= O_CREAT | O_TRUNC;
-	}
-
-	/* Allocate space for the underlying file stream object. */
-	if (!(obj = jas_malloc(sizeof(int)))) {
-		jas_stream_destroy(stream);
-		return 0;
-	}
-	stream->obj_ = (void *) obj;
-
-	/* Select the operations for a file stream object. */
-	stream->ops_ = &jas_stream_fileops;
-
-	/* Open the underlying file. */
-	if ((*obj = open(filename, openflags, JAS_STREAM_PERMS)) < 0) {
-		jas_stream_destroy(stream);
-		return 0;
-	}
-
-	/* By default, use full buffering for this type of stream. */
-	jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
-	return stream;
+        jas_stream_t *stream;
+        int *obj;
+        int openflags;
+
+        /* Allocate a stream object. */
+        if (!(stream = jas_stream_create())) {
+                return 0;
+        }
+
+        /* Parse the mode string. */
+        stream->openmode_ = jas_strtoopenmode(mode);
+
+        /* Determine the correct flags to use for opening the file. */
+        if ((stream->openmode_ & JAS_STREAM_READ) &&
+          (stream->openmode_ & JAS_STREAM_WRITE)) {
+                openflags = O_RDWR;
+        } else if (stream->openmode_ & JAS_STREAM_READ) {
+                openflags = O_RDONLY;
+        } else if (stream->openmode_ & JAS_STREAM_WRITE) {
+                openflags = O_WRONLY;
+        } else {
+                openflags = 0;
+        }
+        if (stream->openmode_ & JAS_STREAM_APPEND) {
+                openflags |= O_APPEND;
+        }
+        if (stream->openmode_ & JAS_STREAM_BINARY) {
+                openflags |= O_BINARY;
+        }
+        if (stream->openmode_ & JAS_STREAM_CREATE) {
+                openflags |= O_CREAT | O_TRUNC;
+        }
+
+        /* Allocate space for the underlying file stream object. */
+        if (!(obj = jas_malloc(sizeof(int)))) {
+                jas_stream_destroy(stream);
+                return 0;
+        }
+        stream->obj_ = (void *) obj;
+
+        /* Select the operations for a file stream object. */
+        stream->ops_ = &jas_stream_fileops;
+
+        /* Open the underlying file. */
+        if ((*obj = open(filename, openflags, JAS_STREAM_PERMS)) < 0) {
+                jas_stream_destroy(stream);
+                return 0;
+        }
+
+        /* By default, use full buffering for this type of stream. */
+        jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+
+        return stream;
 }
 
 jas_stream_t *jas_stream_freopen(const char *path, const char *mode, FILE *fp)
 {
-	jas_stream_t *stream;
-	int openflags;
-
-	/* Allocate a stream object. */
-	if (!(stream = jas_stream_create())) {
-		return 0;
-	}
-
-	/* Parse the mode string. */
-	stream->openmode_ = jas_strtoopenmode(mode);
-
-	/* Determine the correct flags to use for opening the file. */
-	if ((stream->openmode_ & JAS_STREAM_READ) &&
-	  (stream->openmode_ & JAS_STREAM_WRITE)) {
-		openflags = O_RDWR;
-	} else if (stream->openmode_ & JAS_STREAM_READ) {
-		openflags = O_RDONLY;
-	} else if (stream->openmode_ & JAS_STREAM_WRITE) {
-		openflags = O_WRONLY;
-	} else {
-		openflags = 0;
-	}
-	if (stream->openmode_ & JAS_STREAM_APPEND) {
-		openflags |= O_APPEND;
-	}
-	if (stream->openmode_ & JAS_STREAM_BINARY) {
-		openflags |= O_BINARY;
-	}
-	if (stream->openmode_ & JAS_STREAM_CREATE) {
-		openflags |= O_CREAT | O_TRUNC;
-	}
-
-	stream->obj_ = JAS_CAST(void *, fp);
-
-	/* Select the operations for a file stream object. */
-	stream->ops_ = &jas_stream_sfileops;
-
-	/* By default, use full buffering for this type of stream. */
-	jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
-	return stream;
+        jas_stream_t *stream;
+        int openflags;
+
+        /* Allocate a stream object. */
+        if (!(stream = jas_stream_create())) {
+                return 0;
+        }
+
+        /* Parse the mode string. */
+        stream->openmode_ = jas_strtoopenmode(mode);
+
+        /* Determine the correct flags to use for opening the file. */
+        if ((stream->openmode_ & JAS_STREAM_READ) &&
+          (stream->openmode_ & JAS_STREAM_WRITE)) {
+                openflags = O_RDWR;
+        } else if (stream->openmode_ & JAS_STREAM_READ) {
+                openflags = O_RDONLY;
+        } else if (stream->openmode_ & JAS_STREAM_WRITE) {
+                openflags = O_WRONLY;
+        } else {
+                openflags = 0;
+        }
+        if (stream->openmode_ & JAS_STREAM_APPEND) {
+                openflags |= O_APPEND;
+        }
+        if (stream->openmode_ & JAS_STREAM_BINARY) {
+                openflags |= O_BINARY;
+        }
+        if (stream->openmode_ & JAS_STREAM_CREATE) {
+                openflags |= O_CREAT | O_TRUNC;
+        }
+
+        stream->obj_ = JAS_CAST(void *, fp);
+
+        /* Select the operations for a file stream object. */
+        stream->ops_ = &jas_stream_sfileops;
+
+        /* By default, use full buffering for this type of stream. */
+        jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+
+        return stream;
 }
 
 
 jas_stream_t *jas_stream_tmpfile()
 {
-	jas_stream_t *stream;
-	int *obj;
+        jas_stream_t *stream;
+        int *obj;
 
-	if (!(stream = jas_stream_create())) {
-		return 0;
-	}
+        if (!(stream = jas_stream_create())) {
+                return 0;
+        }
 
-	/* A temporary file stream is always opened for both reading and
-	writing in binary mode. */
-	stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
+        /* A temporary file stream is always opened for both reading and
+        writing in binary mode. */
+        stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
 
-	/* Allocate memory for the underlying temporary file object. */
-	if (!(obj = jas_malloc(sizeof(int)))) {
-		jas_stream_destroy(stream);
-		return 0;
-	}
-	stream->obj_ = obj;
+        /* Allocate memory for the underlying temporary file object. */
+        if (!(obj = jas_malloc(sizeof(int)))) {
+                jas_stream_destroy(stream);
+                return 0;
+        }
+        stream->obj_ = obj;
 
     {
         /* This is a Netpbm enhancement.  Original Jasper library uses
@@ -423,88 +423,88 @@ jas_stream_t *jas_stream_tmpfile()
             return 0;
         }
     }
-	/* Use full buffering. */
-	jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+        /* Use full buffering. */
+        jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
 
-	stream->ops_ = &jas_stream_fileops;
+        stream->ops_ = &jas_stream_fileops;
 
-	return stream;
+        return stream;
 }
 
 jas_stream_t *jas_stream_fdopen(int fd, const char *mode)
 {
-	jas_stream_t *stream;
-	int *obj;
+        jas_stream_t *stream;
+        int *obj;
 
-	/* Allocate a stream object. */
-	if (!(stream = jas_stream_create())) {
-		return 0;
-	}
+        /* Allocate a stream object. */
+        if (!(stream = jas_stream_create())) {
+                return 0;
+        }
 
-	/* Parse the mode string. */
-	stream->openmode_ = jas_strtoopenmode(mode);
+        /* Parse the mode string. */
+        stream->openmode_ = jas_strtoopenmode(mode);
 
 #if defined(HAVE_SETMODE) && defined(O_BINARY)
-	/* Argh!!!  Someone ought to banish text mode (i.e., O_TEXT) to the
-	  greatest depths of purgatory! */
-	/* Ensure that the file descriptor is in binary mode, if the caller
-	  has specified the binary mode flag.  Arguably, the caller ought to
-	  take care of this, but text mode is a ugly wart anyways, so we save
-	  the caller some grief by handling this within the stream library. */
-	/* This ugliness is mainly for the benefit of those who run the
-	  JasPer software under Windows from shells that insist on opening
-	  files in text mode.  For example, in the Cygwin environment,
-	  shells often open files in text mode when I/O redirection is
-	  used.  Grr... */
-	if (stream->openmode_ & JAS_STREAM_BINARY) {
-		setmode(fd, O_BINARY);
-	}
+        /* Argh!!!  Someone ought to banish text mode (i.e., O_TEXT) to the
+          greatest depths of purgatory! */
+        /* Ensure that the file descriptor is in binary mode, if the caller
+          has specified the binary mode flag.  Arguably, the caller ought to
+          take care of this, but text mode is a ugly wart anyways, so we save
+          the caller some grief by handling this within the stream library. */
+        /* This ugliness is mainly for the benefit of those who run the
+          JasPer software under Windows from shells that insist on opening
+          files in text mode.  For example, in the Cygwin environment,
+          shells often open files in text mode when I/O redirection is
+          used.  Grr... */
+        if (stream->openmode_ & JAS_STREAM_BINARY) {
+                setmode(fd, O_BINARY);
+        }
 #endif
 
-	/* Allocate space for the underlying file stream object. */
-	if (!(obj = jas_malloc(sizeof(int)))) {
-		jas_stream_destroy(stream);
-		return 0;
-	}
-	stream->obj_ = (void *) obj;
-	*obj = fd;
+        /* Allocate space for the underlying file stream object. */
+        if (!(obj = jas_malloc(sizeof(int)))) {
+                jas_stream_destroy(stream);
+                return 0;
+        }
+        stream->obj_ = (void *) obj;
+        *obj = fd;
 
-	/* By default, use full buffering for this type of stream. */
-	jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
+        /* By default, use full buffering for this type of stream. */
+        jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
 
-	/* Select the operations for a file stream object. */
-	stream->ops_ = &jas_stream_fileops;
+        /* Select the operations for a file stream object. */
+        stream->ops_ = &jas_stream_fileops;
 
 /* Do not close the underlying file descriptor when the stream is closed. */
-	stream->openmode_ |= JAS_STREAM_NOCLOSE;
+        stream->openmode_ |= JAS_STREAM_NOCLOSE;
 
-	return stream;
+        return stream;
 }
 
 static void jas_stream_destroy(jas_stream_t *stream)
 {
-	/* If the memory for the buffer was allocated with malloc, free
-	this memory. */
-	if ((stream->bufmode_ & JAS_STREAM_FREEBUF) && stream->bufbase_) {
-		jas_free(stream->bufbase_);
-		stream->bufbase_ = 0;
-	}
-	jas_free(stream);
+        /* If the memory for the buffer was allocated with malloc, free
+        this memory. */
+        if ((stream->bufmode_ & JAS_STREAM_FREEBUF) && stream->bufbase_) {
+                jas_free(stream->bufbase_);
+                stream->bufbase_ = 0;
+        }
+        jas_free(stream);
 }
 
 int jas_stream_close(jas_stream_t *stream)
 {
-	/* Flush buffer if necessary. */
-	jas_stream_flush(stream);
+        /* Flush buffer if necessary. */
+        jas_stream_flush(stream);
 
-	/* Close the underlying stream object. */
-	if (!(stream->openmode_ & JAS_STREAM_NOCLOSE)) {
-		(*stream->ops_->close_)(stream->obj_);
-	}
+        /* Close the underlying stream object. */
+        if (!(stream->openmode_ & JAS_STREAM_NOCLOSE)) {
+                (*stream->ops_->close_)(stream->obj_);
+        }
 
-	jas_stream_destroy(stream);
+        jas_stream_destroy(stream);
 
-	return 0;
+        return 0;
 }
 
 /******************************************************************************\
@@ -513,71 +513,71 @@ int jas_stream_close(jas_stream_t *stream)
 
 int jas_stream_getc_func(jas_stream_t *stream)
 {
-	assert(stream->ptr_ - stream->bufbase_ <= stream->bufsize_ +
-	  JAS_STREAM_MAXPUTBACK);
-	return jas_stream_getc_macro(stream);
+        assert(stream->ptr_ - stream->bufbase_ <= stream->bufsize_ +
+          JAS_STREAM_MAXPUTBACK);
+        return jas_stream_getc_macro(stream);
 }
 
 int jas_stream_putc_func(jas_stream_t *stream, int c)
 {
-	assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
-	return jas_stream_putc_macro(stream, c);
+        assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
+        return jas_stream_putc_macro(stream, c);
 }
 
 int jas_stream_ungetc(jas_stream_t *stream, int c)
 {
-	if (!stream->ptr_ || stream->ptr_ == stream->bufbase_) {
-		return -1;
-	}
-
-	/* Reset the EOF indicator (since we now have at least one character
-	  to read). */
-	stream->flags_ &= ~JAS_STREAM_EOF;
-
-	--stream->rwcnt_;
-	--stream->ptr_;
-	++stream->cnt_;
-	*stream->ptr_ = c;
-	return 0;
+        if (!stream->ptr_ || stream->ptr_ == stream->bufbase_) {
+                return -1;
+        }
+
+        /* Reset the EOF indicator (since we now have at least one character
+          to read). */
+        stream->flags_ &= ~JAS_STREAM_EOF;
+
+        --stream->rwcnt_;
+        --stream->ptr_;
+        ++stream->cnt_;
+        *stream->ptr_ = c;
+        return 0;
 }
 
 int jas_stream_read(jas_stream_t *stream, void *buf, int cnt)
 {
-	int n;
-	int c;
-	char *bufptr;
-
-	bufptr = buf;
-
-	n = 0;
-	while (n < cnt) {
-		if ((c = jas_stream_getc(stream)) == EOF) {
-			return n;
-		}
-		*bufptr++ = c;
-		++n;
-	}
-
-	return n;
+        int n;
+        int c;
+        char *bufptr;
+
+        bufptr = buf;
+
+        n = 0;
+        while (n < cnt) {
+                if ((c = jas_stream_getc(stream)) == EOF) {
+                        return n;
+                }
+                *bufptr++ = c;
+                ++n;
+        }
+
+        return n;
 }
 
 int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt)
 {
-	int n;
-	const char *bufptr;
-
-	bufptr = buf;
-
-	n = 0;
-	while (n < cnt) {
-		if (jas_stream_putc(stream, *bufptr) == EOF) {
-			return n;
-		}
-		++bufptr;
-		++n;
-	}
+        int n;
+        const char *bufptr;
+
+        bufptr = buf;
+
+        n = 0;
+        while (n < cnt) {
+                if (jas_stream_putc(stream, *bufptr) == EOF) {
+                        return n;
+                }
+                ++bufptr;
+                ++n;
+        }
 
-	return n;
+        return n;
 }
 
 /* Note: This function uses a fixed size buffer.  Therefore, it cannot
@@ -585,59 +585,59 @@ int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt)
   by the buffer. */
 int jas_stream_printf(jas_stream_t *stream, const char *fmt, ...)
 {
-	va_list ap;
-	char buf[4096];
-	int ret;
-
-	va_start(ap, fmt);
-	ret = vsprintf(buf, fmt, ap);
-	jas_stream_puts(stream, buf);
-	va_end(ap);
-	return ret;
+        va_list ap;
+        char buf[4096];
+        int ret;
+
+        va_start(ap, fmt);
+        ret = vsprintf(buf, fmt, ap);
+        jas_stream_puts(stream, buf);
+        va_end(ap);
+        return ret;
 }
 
 int jas_stream_puts(jas_stream_t *stream, const char *s)
 {
-	while (*s != '\0') {
-		if (jas_stream_putc_macro(stream, *s) == EOF) {
-			return -1;
-		}
-		++s;
-	}
-	return 0;
+        while (*s != '\0') {
+                if (jas_stream_putc_macro(stream, *s) == EOF) {
+                        return -1;
+                }
+                ++s;
+        }
+        return 0;
 }
 
 char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize)
 {
-	int c;
-	char *bufptr;
-	assert(bufsize > 0);
-
-	bufptr = buf;
-	while (bufsize > 1) {
-		if ((c = jas_stream_getc(stream)) == EOF) {
-			break;
-		}
-		*bufptr++ = c;
-		--bufsize;
-		if (c == '\n') {
-			break;
-		}
-	}
-	*bufptr = '\0';
-	return buf;
+        int c;
+        char *bufptr;
+        assert(bufsize > 0);
+
+        bufptr = buf;
+        while (bufsize > 1) {
+                if ((c = jas_stream_getc(stream)) == EOF) {
+                        break;
+                }
+                *bufptr++ = c;
+                --bufsize;
+                if (c == '\n') {
+                        break;
+                }
+        }
+        *bufptr = '\0';
+        return buf;
 }
 
 int jas_stream_gobble(jas_stream_t *stream, int n)
 {
-	int m;
-	m = n;
-	for (m = n; m > 0; --m) {
-		if (jas_stream_getc(stream) == EOF) {
-			return n - m;
-		}
-	}
-	return n;
+        int m;
+        m = n;
+        for (m = n; m > 0; --m) {
+                if (jas_stream_getc(stream) == EOF) {
+                        return n - m;
+                }
+        }
+        return n;
 }
 
 /******************************************************************************\
@@ -646,73 +646,73 @@ int jas_stream_gobble(jas_stream_t *stream, int n)
 
 int jas_stream_isseekable(jas_stream_t *stream)
 {
-	if (stream->ops_ == &jas_stream_memops) {
-		return 1;
-	} else if (stream->ops_ == &jas_stream_fileops) {
-		if ((*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR) < 0) {
-			return 0;
-		}
-		return 1;
-	} else {
-		return 0;
-	}
+        if (stream->ops_ == &jas_stream_memops) {
+                return 1;
+        } else if (stream->ops_ == &jas_stream_fileops) {
+                if ((*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR) < 0) {
+                        return 0;
+                }
+                return 1;
+        } else {
+                return 0;
+        }
 }
 
 int jas_stream_rewind(jas_stream_t *stream)
 {
-	return jas_stream_seek(stream, 0, SEEK_SET);
+        return jas_stream_seek(stream, 0, SEEK_SET);
 }
 
 long jas_stream_seek(jas_stream_t *stream, long offset, int origin)
 {
-	long newpos;
-
-	/* The buffer cannot be in use for both reading and writing. */
-	assert(!((stream->bufmode_ & JAS_STREAM_RDBUF) && (stream->bufmode_ &
-	  JAS_STREAM_WRBUF)));
-
-	/* Reset the EOF indicator (since we may not be at the EOF anymore). */
-	stream->flags_ &= ~JAS_STREAM_EOF;
-
-	if (stream->bufmode_ & JAS_STREAM_RDBUF) {
-		if (origin == SEEK_CUR) {
-			offset -= stream->cnt_;
-		}
-	} else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
-		if (jas_stream_flush(stream)) {
-			return -1;
-		}
-	}
-	stream->cnt_ = 0;
-	stream->ptr_ = stream->bufstart_;
-	stream->bufmode_ &= ~(JAS_STREAM_RDBUF | JAS_STREAM_WRBUF);
-
-	if ((newpos = (*stream->ops_->seek_)(stream->obj_, offset, origin))
-	  < 0) {
-		return -1;
-	}
-
-	return newpos;
+        long newpos;
+
+        /* The buffer cannot be in use for both reading and writing. */
+        assert(!((stream->bufmode_ & JAS_STREAM_RDBUF) && (stream->bufmode_ &
+          JAS_STREAM_WRBUF)));
+
+        /* Reset the EOF indicator (since we may not be at the EOF anymore). */
+        stream->flags_ &= ~JAS_STREAM_EOF;
+
+        if (stream->bufmode_ & JAS_STREAM_RDBUF) {
+                if (origin == SEEK_CUR) {
+                        offset -= stream->cnt_;
+                }
+        } else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
+                if (jas_stream_flush(stream)) {
+                        return -1;
+                }
+        }
+        stream->cnt_ = 0;
+        stream->ptr_ = stream->bufstart_;
+        stream->bufmode_ &= ~(JAS_STREAM_RDBUF | JAS_STREAM_WRBUF);
+
+        if ((newpos = (*stream->ops_->seek_)(stream->obj_, offset, origin))
+          < 0) {
+                return -1;
+        }
+
+        return newpos;
 }
 
 long jas_stream_tell(jas_stream_t *stream)
 {
-	int adjust;
-	int offset;
-
-	if (stream->bufmode_ & JAS_STREAM_RDBUF) {
-		adjust = -stream->cnt_;
-	} else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
-		adjust = stream->ptr_ - stream->bufstart_;
-	} else {
-		adjust = 0;
-	}
-
-	if ((offset = (*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR)) < 0) {
-		return -1;
-	}
-
-	return offset + adjust;
+        int adjust;
+        int offset;
+
+        if (stream->bufmode_ & JAS_STREAM_RDBUF) {
+                adjust = -stream->cnt_;
+        } else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
+                adjust = stream->ptr_ - stream->bufstart_;
+        } else {
+                adjust = 0;
+        }
+
+        if ((offset = (*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR)) < 0) {
+                return -1;
+        }
+
+        return offset + adjust;
 }
 
 /******************************************************************************\
@@ -722,45 +722,45 @@ long jas_stream_tell(jas_stream_t *stream)
 static void jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,
   int bufsize)
 {
-	/* If this function is being called, the buffer should not have been
-	  initialized yet. */
-	assert(!stream->bufbase_);
-
-	if (bufmode != JAS_STREAM_UNBUF) {
-		/* The full- or line-buffered mode is being employed. */
-		if (!buf) {
-			/* The caller has not specified a buffer to employ, so allocate
-			  one. */
-			if ((stream->bufbase_ = jas_malloc(JAS_STREAM_BUFSIZE +
-			  JAS_STREAM_MAXPUTBACK))) {
-				stream->bufmode_ |= JAS_STREAM_FREEBUF;
-				stream->bufsize_ = JAS_STREAM_BUFSIZE;
-			} else {
-				/* The buffer allocation has failed.  Resort to unbuffered
-				  operation. */
-				stream->bufbase_ = stream->tinybuf_;
-				stream->bufsize_ = 1;
-			}
-		} else {
-			/* The caller has specified a buffer to employ. */
-			/* The buffer must be large enough to accommodate maximum
-			  putback. */
-			assert(bufsize > JAS_STREAM_MAXPUTBACK);
-			stream->bufbase_ = JAS_CAST(unsigned char *, buf);
-			stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;
-		}
-	} else {
-		/* The unbuffered mode is being employed. */
-		/* A buffer should not have been supplied by the caller. */
-		assert(!buf);
-		/* Use a trivial one-character buffer. */
-		stream->bufbase_ = stream->tinybuf_;
-		stream->bufsize_ = 1;
-	}
-	stream->bufstart_ = &stream->bufbase_[JAS_STREAM_MAXPUTBACK];
-	stream->ptr_ = stream->bufstart_;
-	stream->cnt_ = 0;
-	stream->bufmode_ |= bufmode & JAS_STREAM_BUFMODEMASK;
+        /* If this function is being called, the buffer should not have been
+          initialized yet. */
+        assert(!stream->bufbase_);
+
+        if (bufmode != JAS_STREAM_UNBUF) {
+                /* The full- or line-buffered mode is being employed. */
+                if (!buf) {
+                        /* The caller has not specified a buffer to employ, so allocate
+                          one. */
+                        if ((stream->bufbase_ = jas_malloc(JAS_STREAM_BUFSIZE +
+                          JAS_STREAM_MAXPUTBACK))) {
+                                stream->bufmode_ |= JAS_STREAM_FREEBUF;
+                                stream->bufsize_ = JAS_STREAM_BUFSIZE;
+                        } else {
+                                /* The buffer allocation has failed.  Resort to unbuffered
+                                  operation. */
+                                stream->bufbase_ = stream->tinybuf_;
+                                stream->bufsize_ = 1;
+                        }
+                } else {
+                        /* The caller has specified a buffer to employ. */
+                        /* The buffer must be large enough to accommodate maximum
+                          putback. */
+                        assert(bufsize > JAS_STREAM_MAXPUTBACK);
+                        stream->bufbase_ = JAS_CAST(unsigned char *, buf);
+                        stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;
+                }
+        } else {
+                /* The unbuffered mode is being employed. */
+                /* A buffer should not have been supplied by the caller. */
+                assert(!buf);
+                /* Use a trivial one-character buffer. */
+                stream->bufbase_ = stream->tinybuf_;
+                stream->bufsize_ = 1;
+        }
+        stream->bufstart_ = &stream->bufbase_[JAS_STREAM_MAXPUTBACK];
+        stream->ptr_ = stream->bufstart_;
+        stream->cnt_ = 0;
+        stream->bufmode_ |= bufmode & JAS_STREAM_BUFMODEMASK;
 }
 
 /******************************************************************************\
@@ -769,97 +769,97 @@ static void jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,
 
 int jas_stream_flush(jas_stream_t *stream)
 {
-	if (stream->bufmode_ & JAS_STREAM_RDBUF) {
-		return 0;
-	}
-	return jas_stream_flushbuf(stream, EOF);
+        if (stream->bufmode_ & JAS_STREAM_RDBUF) {
+                return 0;
+        }
+        return jas_stream_flushbuf(stream, EOF);
 }
 
 int jas_stream_fillbuf(jas_stream_t *stream, int getflag)
 {
-	int c;
-
-	/* The stream must not be in an error or EOF state. */
-	if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
-		return EOF;
-	}
-
-	/* The stream must be open for reading. */
-	if ((stream->openmode_ & JAS_STREAM_READ) == 0) {
-		return EOF;
-	}
-
-	/* Make a half-hearted attempt to confirm that the buffer is not
-	currently being used for writing.  This check is not intended
-	to be foolproof! */
-	assert((stream->bufmode_ & JAS_STREAM_WRBUF) == 0);
-
-	assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
-
-	/* Mark the buffer as being used for reading. */
-	stream->bufmode_ |= JAS_STREAM_RDBUF;
-
-	/* Read new data into the buffer. */
-	stream->ptr_ = stream->bufstart_;
-	if ((stream->cnt_ = (*stream->ops_->read_)(stream->obj_,
-	  (char *) stream->bufstart_, stream->bufsize_)) <= 0) {
-		if (stream->cnt_ < 0) {
-			stream->flags_ |= JAS_STREAM_ERR;
-		} else {
-			stream->flags_ |= JAS_STREAM_EOF;
-		}
-		stream->cnt_ = 0;
-		return EOF;
-	}
-
-	assert(stream->cnt_ > 0);
-	/* Get or peek at the first character in the buffer. */
-	c = (getflag) ? jas_stream_getc2(stream) : (*stream->ptr_);
-
-	return c;
+        int c;
+
+        /* The stream must not be in an error or EOF state. */
+        if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
+                return EOF;
+        }
+
+        /* The stream must be open for reading. */
+        if ((stream->openmode_ & JAS_STREAM_READ) == 0) {
+                return EOF;
+        }
+
+        /* Make a half-hearted attempt to confirm that the buffer is not
+        currently being used for writing.  This check is not intended
+        to be foolproof! */
+        assert((stream->bufmode_ & JAS_STREAM_WRBUF) == 0);
+
+        assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
+
+        /* Mark the buffer as being used for reading. */
+        stream->bufmode_ |= JAS_STREAM_RDBUF;
+
+        /* Read new data into the buffer. */
+        stream->ptr_ = stream->bufstart_;
+        if ((stream->cnt_ = (*stream->ops_->read_)(stream->obj_,
+          (char *) stream->bufstart_, stream->bufsize_)) <= 0) {
+                if (stream->cnt_ < 0) {
+                        stream->flags_ |= JAS_STREAM_ERR;
+                } else {
+                        stream->flags_ |= JAS_STREAM_EOF;
+                }
+                stream->cnt_ = 0;
+                return EOF;
+        }
+
+        assert(stream->cnt_ > 0);
+        /* Get or peek at the first character in the buffer. */
+        c = (getflag) ? jas_stream_getc2(stream) : (*stream->ptr_);
+
+        return c;
 }
 
 int jas_stream_flushbuf(jas_stream_t *stream, int c)
 {
-	int len;
-	int n;
-
-	/* The stream should not be in an error or EOF state. */
-	if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
-		return EOF;
-	}
-
-	/* The stream must be open for writing. */
-	if ((stream->openmode_ & (JAS_STREAM_WRITE | JAS_STREAM_APPEND)) == 0) {
-		return EOF;
-	}
-
-	/* The buffer should not currently be in use for reading. */
-	assert(!(stream->bufmode_ & JAS_STREAM_RDBUF));
-
-	/* Note: Do not use the quantity stream->cnt to determine the number
-	of characters in the buffer!  Depending on how this function was
-	called, the stream->cnt value may be "off-by-one". */
-	len = stream->ptr_ - stream->bufstart_;
-	if (len > 0) {
-		n = (*stream->ops_->write_)(stream->obj_, (char *)
-		  stream->bufstart_, len);
-		if (n != len) {
-			stream->flags_ |= JAS_STREAM_ERR;
-			return EOF;
-		}
-	}
-	stream->cnt_ = stream->bufsize_;
-	stream->ptr_ = stream->bufstart_;
-
-	stream->bufmode_ |= JAS_STREAM_WRBUF;
-
-	if (c != EOF) {
-		assert(stream->cnt_ > 0);
-		jas_stream_putc2(stream, c);
-	}
-
-	return 0;
+        int len;
+        int n;
+
+        /* The stream should not be in an error or EOF state. */
+        if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
+                return EOF;
+        }
+
+        /* The stream must be open for writing. */
+        if ((stream->openmode_ & (JAS_STREAM_WRITE | JAS_STREAM_APPEND)) == 0) {
+                return EOF;
+        }
+
+        /* The buffer should not currently be in use for reading. */
+        assert(!(stream->bufmode_ & JAS_STREAM_RDBUF));
+
+        /* Note: Do not use the quantity stream->cnt to determine the number
+        of characters in the buffer!  Depending on how this function was
+        called, the stream->cnt value may be "off-by-one". */
+        len = stream->ptr_ - stream->bufstart_;
+        if (len > 0) {
+                n = (*stream->ops_->write_)(stream->obj_, (char *)
+                  stream->bufstart_, len);
+                if (n != len) {
+                        stream->flags_ |= JAS_STREAM_ERR;
+                        return EOF;
+                }
+        }
+        stream->cnt_ = stream->bufsize_;
+        stream->ptr_ = stream->bufstart_;
+
+        stream->bufmode_ |= JAS_STREAM_WRBUF;
+
+        if (c != EOF) {
+                assert(stream->cnt_ > 0);
+                jas_stream_putc2(stream, c);
+        }
+
+        return 0;
 }
 
 /******************************************************************************\
@@ -868,134 +868,134 @@ int jas_stream_flushbuf(jas_stream_t *stream, int c)
 
 static int jas_strtoopenmode(const char *s)
 {
-	int openmode = 0;
-	while (*s != '\0') {
-		switch (*s) {
-		case 'r':
-			openmode |= JAS_STREAM_READ;
-			break;
-		case 'w':
-			openmode |= JAS_STREAM_WRITE | JAS_STREAM_CREATE;
-			break;
-		case 'b':
-			openmode |= JAS_STREAM_BINARY;
-			break;
-		case 'a':
-			openmode |= JAS_STREAM_APPEND;
-			break;
-		case '+':
-			openmode |= JAS_STREAM_READ | JAS_STREAM_WRITE;
-			break;
-		default:
-			break;
-		}
-		++s;
-	}
-	return openmode;
+        int openmode = 0;
+        while (*s != '\0') {
+                switch (*s) {
+                case 'r':
+                        openmode |= JAS_STREAM_READ;
+                        break;
+                case 'w':
+                        openmode |= JAS_STREAM_WRITE | JAS_STREAM_CREATE;
+                        break;
+                case 'b':
+                        openmode |= JAS_STREAM_BINARY;
+                        break;
+                case 'a':
+                        openmode |= JAS_STREAM_APPEND;
+                        break;
+                case '+':
+                        openmode |= JAS_STREAM_READ | JAS_STREAM_WRITE;
+                        break;
+                default:
+                        break;
+                }
+                ++s;
+        }
+        return openmode;
 }
 
 int jas_stream_copy(jas_stream_t *out, jas_stream_t *in, int n)
 {
-	int all;
-	int c;
-	int m;
-
-	all = (n < 0) ? 1 : 0;
-
-	m = n;
-	while (all || m > 0) {
-		if ((c = jas_stream_getc_macro(in)) == EOF) {
-			/* The next character of input could not be read. */
-			/* Return with an error if an I/O error occurred
-			  (not including EOF) or if an explicit copy count
-			  was specified. */
-			return (!all || jas_stream_error(in)) ? (-1) : 0;
-		}
-		if (jas_stream_putc_macro(out, c) == EOF) {
-			return -1;
-		}
-		--m;
-	}
-	return 0;
+        int all;
+        int c;
+        int m;
+
+        all = (n < 0) ? 1 : 0;
+
+        m = n;
+        while (all || m > 0) {
+                if ((c = jas_stream_getc_macro(in)) == EOF) {
+                        /* The next character of input could not be read. */
+                        /* Return with an error if an I/O error occurred
+                          (not including EOF) or if an explicit copy count
+                          was specified. */
+                        return (!all || jas_stream_error(in)) ? (-1) : 0;
+                }
+                if (jas_stream_putc_macro(out, c) == EOF) {
+                        return -1;
+                }
+                --m;
+        }
+        return 0;
 }
 
 long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt)
 {
-	int old;
+        int old;
 
-	old = stream->rwcnt_;
-	stream->rwcnt_ = rwcnt;
-	return old;
+        old = stream->rwcnt_;
+        stream->rwcnt_ = rwcnt;
+        return old;
 }
 
 int jas_stream_display(jas_stream_t *stream, FILE *fp, int n)
 {
-	unsigned char buf[16];
-	int i;
-	int j;
-	int m;
-	int c;
-	int display;
-	int cnt;
-
-	cnt = n - (n % 16);
-	display = 1;
-
-	for (i = 0; i < n; i += 16) {
-		if (n > 16 && i > 0) {
-			display = (i >= cnt) ? 1 : 0;
-		}
-		if (display) {
-			fprintf(fp, "%08x:", i);
-		}
-		m = JAS_MIN(n - i, 16);
-		for (j = 0; j < m; ++j) {
-			if ((c = jas_stream_getc(stream)) == EOF) {
-				abort();
-				return -1;
-			}
-			buf[j] = c;
-		}
-		if (display) {
-			for (j = 0; j < m; ++j) {
-				fprintf(fp, " %02x", buf[j]);
-			}
-			fputc(' ', fp);
-			for (; j < 16; ++j) {
-				fprintf(fp, "   ");
-			}
-			for (j = 0; j < m; ++j) {
-				if (isprint(buf[j])) {
-					fputc(buf[j], fp);
-				} else {
-					fputc(' ', fp);
-				}
-			}
-			fprintf(fp, "\n");
-		}
-
-
-	}
-	return 0;
+        unsigned char buf[16];
+        int i;
+        int j;
+        int m;
+        int c;
+        int display;
+        int cnt;
+
+        cnt = n - (n % 16);
+        display = 1;
+
+        for (i = 0; i < n; i += 16) {
+                if (n > 16 && i > 0) {
+                        display = (i >= cnt) ? 1 : 0;
+                }
+                if (display) {
+                        fprintf(fp, "%08x:", i);
+                }
+                m = JAS_MIN(n - i, 16);
+                for (j = 0; j < m; ++j) {
+                        if ((c = jas_stream_getc(stream)) == EOF) {
+                                abort();
+                                return -1;
+                        }
+                        buf[j] = c;
+                }
+                if (display) {
+                        for (j = 0; j < m; ++j) {
+                                fprintf(fp, " %02x", buf[j]);
+                        }
+                        fputc(' ', fp);
+                        for (; j < 16; ++j) {
+                                fprintf(fp, "   ");
+                        }
+                        for (j = 0; j < m; ++j) {
+                                if (isprint(buf[j])) {
+                                        fputc(buf[j], fp);
+                                } else {
+                                        fputc(' ', fp);
+                                }
+                        }
+                        fprintf(fp, "\n");
+                }
+
+
+        }
+        return 0;
 }
 
 long jas_stream_length(jas_stream_t *stream)
 {
-	long oldpos;
-	long pos;
-	if ((oldpos = jas_stream_tell(stream)) < 0) {
-		return -1;
-	}
-	if (jas_stream_seek(stream, 0, SEEK_END) < 0) {
-		return -1;
-	}
-	if ((pos = jas_stream_tell(stream)) < 0) {
-		return -1;
-	}
-	if (jas_stream_seek(stream, oldpos, SEEK_SET) < 0) {
-		return -1;
-	}
-	return pos;
+        long oldpos;
+        long pos;
+        if ((oldpos = jas_stream_tell(stream)) < 0) {
+                return -1;
+        }
+        if (jas_stream_seek(stream, 0, SEEK_END) < 0) {
+                return -1;
+        }
+        if ((pos = jas_stream_tell(stream)) < 0) {
+                return -1;
+        }
+        if (jas_stream_seek(stream, oldpos, SEEK_SET) < 0) {
+                return -1;
+        }
+        return pos;
 }
 
 /******************************************************************************\
@@ -1004,109 +1004,109 @@ long jas_stream_length(jas_stream_t *stream)
 
 static int mem_read(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	int n;
-	jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
-	n = m->len_ - m->pos_;
-	cnt = JAS_MIN(n, cnt);
-	memcpy(buf, &m->buf_[m->pos_], cnt);
-	m->pos_ += cnt;
-	return cnt;
+        int n;
+        jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
+        n = m->len_ - m->pos_;
+        cnt = JAS_MIN(n, cnt);
+        memcpy(buf, &m->buf_[m->pos_], cnt);
+        m->pos_ += cnt;
+        return cnt;
 }
 
 static int mem_resize(jas_stream_memobj_t *m, int bufsize)
 {
-	unsigned char *buf;
-
-	assert(m->buf_);
-	if (!(buf = jas_realloc(m->buf_, bufsize * sizeof(unsigned char)))) {
-		return -1;
-	}
-	m->buf_ = buf;
-	m->bufsize_ = bufsize;
-	return 0;
+        unsigned char *buf;
+
+        assert(m->buf_);
+        if (!(buf = jas_realloc(m->buf_, bufsize * sizeof(unsigned char)))) {
+                return -1;
+        }
+        m->buf_ = buf;
+        m->bufsize_ = bufsize;
+        return 0;
 }
 
 static int mem_write(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	int n;
-	int ret;
-	jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
-	long newbufsize;
-	long newpos;
-
-	newpos = m->pos_ + cnt;
-	if (newpos > m->bufsize_ && m->growable_) {
-		newbufsize = m->bufsize_;
-		while (newbufsize < newpos) {
-			newbufsize <<= 1;
-			assert(newbufsize >= 0);
-		}
-		if (mem_resize(m, newbufsize)) {
-			return -1;
-		}
-	}
-	if (m->pos_ > m->len_) {
-		/* The current position is beyond the end of the file, so
-		  pad the file to the current position with zeros. */
-		n = JAS_MIN(m->pos_, m->bufsize_) - m->len_;
-		if (n > 0) {
-			memset(&m->buf_[m->len_], 0, n);
-			m->len_ += n;
-		}
-		if (m->pos_ != m->len_) {
-			/* The buffer is not big enough. */
-			return 0;
-		}
-	}
-	n = m->bufsize_ - m->pos_;
-	ret = JAS_MIN(n, cnt);
-	if (ret > 0) {
-		memcpy(&m->buf_[m->pos_], buf, ret);
-		m->pos_ += ret;
-	}
-	if (m->pos_ > m->len_) {
-		m->len_ = m->pos_;
-	}
+        int n;
+        int ret;
+        jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
+        long newbufsize;
+        long newpos;
+
+        newpos = m->pos_ + cnt;
+        if (newpos > m->bufsize_ && m->growable_) {
+                newbufsize = m->bufsize_;
+                while (newbufsize < newpos) {
+                        newbufsize <<= 1;
+                        assert(newbufsize >= 0);
+                }
+                if (mem_resize(m, newbufsize)) {
+                        return -1;
+                }
+        }
+        if (m->pos_ > m->len_) {
+                /* The current position is beyond the end of the file, so
+                  pad the file to the current position with zeros. */
+                n = JAS_MIN(m->pos_, m->bufsize_) - m->len_;
+                if (n > 0) {
+                        memset(&m->buf_[m->len_], 0, n);
+                        m->len_ += n;
+                }
+                if (m->pos_ != m->len_) {
+                        /* The buffer is not big enough. */
+                        return 0;
+                }
+        }
+        n = m->bufsize_ - m->pos_;
+        ret = JAS_MIN(n, cnt);
+        if (ret > 0) {
+                memcpy(&m->buf_[m->pos_], buf, ret);
+                m->pos_ += ret;
+        }
+        if (m->pos_ > m->len_) {
+                m->len_ = m->pos_;
+        }
 assert(ret == cnt);
-	return ret;
+        return ret;
 }
 
 static long mem_seek(jas_stream_obj_t *obj, long offset, int origin)
 {
-	jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
-	long newpos;
-
-	switch (origin) {
-	case SEEK_SET:
-		newpos = offset;
-		break;
-	case SEEK_END:
-		newpos = m->len_ - offset;
-		break;
-	case SEEK_CUR:
-		newpos = m->pos_ + offset;
-		break;
-	default:
-		abort();
-		break;
-	}
-	if (newpos < 0) {
-		return -1;
-	}
-	m->pos_ = newpos;
-
-	return m->pos_;
+        jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
+        long newpos;
+
+        switch (origin) {
+        case SEEK_SET:
+                newpos = offset;
+                break;
+        case SEEK_END:
+                newpos = m->len_ - offset;
+                break;
+        case SEEK_CUR:
+                newpos = m->pos_ + offset;
+                break;
+        default:
+                abort();
+                break;
+        }
+        if (newpos < 0) {
+                return -1;
+        }
+        m->pos_ = newpos;
+
+        return m->pos_;
 }
 
 static int mem_close(jas_stream_obj_t *obj)
 {
-	jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
-	if (m->myalloc_ && m->buf_) {
-		jas_free(m->buf_);
-		m->buf_ = 0;
-	}
-	jas_free(obj);
-	return 0;
+        jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
+        if (m->myalloc_ && m->buf_) {
+                jas_free(m->buf_);
+                m->buf_ = 0;
+        }
+        jas_free(obj);
+        return 0;
 }
 
 /******************************************************************************\
@@ -1115,31 +1115,31 @@ static int mem_close(jas_stream_obj_t *obj)
 
 static int file_read(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	int fd;
-	fd = *((int *)obj);
-	return read(fd, buf, cnt);
+        int fd;
+        fd = *((int *)obj);
+        return read(fd, buf, cnt);
 }
 
 static int file_write(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	int fd;
-	fd = *((int *)obj);
-	return write(fd, buf, cnt);
+        int fd;
+        fd = *((int *)obj);
+        return write(fd, buf, cnt);
 }
 
 static long file_seek(jas_stream_obj_t *obj, long offset, int origin)
 {
-	int fd;
-	fd = *((int *)obj);
-	return lseek(fd, offset, origin);
+        int fd;
+        fd = *((int *)obj);
+        return lseek(fd, offset, origin);
 }
 
 static int file_close(jas_stream_obj_t *obj)
 {
-	int fd;
-	fd = *((int *)obj);
-	jas_free(obj);
-	return close(fd);
+        int fd;
+        fd = *((int *)obj);
+        jas_free(obj);
+        return close(fd);
 }
 
 /******************************************************************************\
@@ -1148,28 +1148,28 @@ static int file_close(jas_stream_obj_t *obj)
 
 static int sfile_read(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	FILE *fp;
-	fp = JAS_CAST(FILE *, obj);
-	return fread(buf, 1, cnt, fp);
+        FILE *fp;
+        fp = JAS_CAST(FILE *, obj);
+        return fread(buf, 1, cnt, fp);
 }
 
 static int sfile_write(jas_stream_obj_t *obj, char *buf, int cnt)
 {
-	FILE *fp;
-	fp = JAS_CAST(FILE *, obj);
-	return fwrite(buf, 1, cnt, fp);
+        FILE *fp;
+        fp = JAS_CAST(FILE *, obj);
+        return fwrite(buf, 1, cnt, fp);
 }
 
 static long sfile_seek(jas_stream_obj_t *obj, long offset, int origin)
 {
-	FILE *fp;
-	fp = JAS_CAST(FILE *, obj);
-	return fseek(fp, offset, origin);
+        FILE *fp;
+        fp = JAS_CAST(FILE *, obj);
+        return fseek(fp, offset, origin);
 }
 
 static int sfile_close(jas_stream_obj_t *obj)
 {
-	FILE *fp;
-	fp = JAS_CAST(FILE *, obj);
-	return fclose(fp);
+        FILE *fp;
+        fp = JAS_CAST(FILE *, obj);
+        return fclose(fp);
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_string.c b/converter/other/jpeg2000/libjasper/base/jas_string.c
index 945731a1..b3c45b78 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_string.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_string.c
@@ -6,14 +6,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -21,22 +21,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -56,17 +56,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -106,7 +106,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -134,12 +134,12 @@
 
 char *jas_strdup(const char *s)
 {
-	int n;
-	char *p;
-	n = strlen(s) + 1;
-	if (!(p = jas_malloc(n * sizeof(char)))) {
-		return 0;
-	}
-	strcpy(p, s);
-	return p;
+        int n;
+        char *p;
+        n = strlen(s) + 1;
+        if (!(p = jas_malloc(n * sizeof(char)))) {
+                return 0;
+        }
+        strcpy(p, s);
+        return p;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_tvp.c b/converter/other/jpeg2000/libjasper/base/jas_tvp.c
index aab12703..43b2fd41 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_tvp.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_tvp.c
@@ -4,14 +4,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -19,22 +19,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -54,17 +54,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -104,7 +104,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -132,8 +132,8 @@
 \******************************************************************************/
 
 /* Is the specified character valid for a tag name? */
-#define	JAS_TVP_ISTAG(x) \
-	(isalpha(x) || (x) == '_' || isdigit(x))
+#define JAS_TVP_ISTAG(x) \
+        (isalpha(x) || (x) == '_' || isdigit(x))
 
 /******************************************************************************\
 * Code for creating and destroying a tag-value parser.
@@ -141,26 +141,26 @@
 
 jas_tvparser_t *jas_tvparser_create(const char *s)
 {
-	jas_tvparser_t *tvp;
-	if (!(tvp = jas_malloc(sizeof(jas_tvparser_t)))) {
-		return 0;
-	}
-	if (!(tvp->buf = jas_strdup(s))) {
-		jas_tvparser_destroy(tvp);
-		return 0;
-	}
-	tvp->pos = tvp->buf;
-	tvp->tag = 0;
-	tvp->val = 0;
-	return tvp;
+        jas_tvparser_t *tvp;
+        if (!(tvp = jas_malloc(sizeof(jas_tvparser_t)))) {
+                return 0;
+        }
+        if (!(tvp->buf = jas_strdup(s))) {
+                jas_tvparser_destroy(tvp);
+                return 0;
+        }
+        tvp->pos = tvp->buf;
+        tvp->tag = 0;
+        tvp->val = 0;
+        return tvp;
 }
 
 void jas_tvparser_destroy(jas_tvparser_t *tvp)
 {
-	if (tvp->buf) {
-		jas_free(tvp->buf);
-	}
-	jas_free(tvp);
+        if (tvp->buf) {
+                jas_free(tvp->buf);
+        }
+        jas_free(tvp);
 }
 
 /******************************************************************************\
@@ -170,73 +170,73 @@ void jas_tvparser_destroy(jas_tvparser_t *tvp)
 /* Get the next tag-value pair. */
 int jas_tvparser_next(jas_tvparser_t *tvp)
 {
-	char *p;
-	char *tag;
-	const char *val;
+        char *p;
+        char *tag;
+        const char *val;
 
-	/* Skip any leading whitespace. */
-	p = tvp->pos;
-	while (*p != '\0' && isspace(*p)) {
-		++p;
-	}
+        /* Skip any leading whitespace. */
+        p = tvp->pos;
+        while (*p != '\0' && isspace(*p)) {
+                ++p;
+        }
 
-	/* Has the end of the input data been reached? */
-	if (*p == '\0') {
-		/* No more tags are present. */
-		tvp->pos = p;
-		return 1;
-	}
+        /* Has the end of the input data been reached? */
+        if (*p == '\0') {
+                /* No more tags are present. */
+                tvp->pos = p;
+                return 1;
+        }
 
-	/* Does the tag name begin with a valid character? */
-	if (!JAS_TVP_ISTAG(*p)) {
-		return -1;
-	}
+        /* Does the tag name begin with a valid character? */
+        if (!JAS_TVP_ISTAG(*p)) {
+                return -1;
+        }
 
-	/* Remember where the tag name begins. */
-	tag = p;
+        /* Remember where the tag name begins. */
+        tag = p;
 
-	/* Find the end of the tag name. */
-	while (*p != '\0' && JAS_TVP_ISTAG(*p)) {
-		++p;
-	}
+        /* Find the end of the tag name. */
+        while (*p != '\0' && JAS_TVP_ISTAG(*p)) {
+                ++p;
+        }
 
-	/* Has the end of the input data been reached? */
-	if (*p == '\0') {
-		/* The value field is empty. */
-		tvp->tag = tag;
-		tvp->val = "";
-		tvp->pos = p;
-		return 0;
-	}
+        /* Has the end of the input data been reached? */
+        if (*p == '\0') {
+                /* The value field is empty. */
+                tvp->tag = tag;
+                tvp->val = "";
+                tvp->pos = p;
+                return 0;
+        }
 
-	/* Is a value field not present? */
-	if (*p != '=') {
-		if (*p != '\0' && !isspace(*p)) {
-			return -1;
-		}
-		*p++ = '\0';
-		tvp->tag = tag;
-		tvp->val = "";
-		tvp->pos = p;
-		return 0;
-	}
+        /* Is a value field not present? */
+        if (*p != '=') {
+                if (*p != '\0' && !isspace(*p)) {
+                        return -1;
+                }
+                *p++ = '\0';
+                tvp->tag = tag;
+                tvp->val = "";
+                tvp->pos = p;
+                return 0;
+        }
 
-	*p++ = '\0';
+        *p++ = '\0';
 
-	val = p;
-	while (*p != '\0' && !isspace(*p)) {
-		++p;
-	}
+        val = p;
+        while (*p != '\0' && !isspace(*p)) {
+                ++p;
+        }
 
-	if (*p != '\0') {
-		*p++ = '\0';
-	}
+        if (*p != '\0') {
+                *p++ = '\0';
+        }
 
-	tvp->pos = p;
-	tvp->tag = tag;
-	tvp->val = val;
+        tvp->pos = p;
+        tvp->tag = tag;
+        tvp->val = val;
 
-	return 0;
+        return 0;
 }
 
 /******************************************************************************\
@@ -246,13 +246,13 @@ int jas_tvparser_next(jas_tvparser_t *tvp)
 /* Get the current tag. */
 char *jas_tvparser_gettag(jas_tvparser_t *tvp)
 {
-	return tvp->tag;
+        return tvp->tag;
 }
 
 /* Get the current value. */
 const char *jas_tvparser_getval(jas_tvparser_t *tvp)
 {
-	return tvp->val;
+        return tvp->val;
 }
 
 /******************************************************************************\
@@ -262,15 +262,15 @@ const char *jas_tvparser_getval(jas_tvparser_t *tvp)
 /* Lookup a tag by name. */
 jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
 {
-	jas_taginfo_t *taginfo;
-	taginfo = taginfos;
-	while (taginfo->id >= 0) {
-		if (!strcmp(taginfo->name, name)) {
-			return taginfo;
-		}
-		++taginfo;
-	}
-	return 0;
+        jas_taginfo_t *taginfo;
+        taginfo = taginfos;
+        while (taginfo->id >= 0) {
+                if (!strcmp(taginfo->name, name)) {
+                        return taginfo;
+                }
+                ++taginfo;
+        }
+        return 0;
 }
 
 /* This function is simply for convenience. */
@@ -278,9 +278,9 @@ jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
   using this function.   This function never returns a null pointer.  */
 jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo)
 {
-	static jas_taginfo_t invalidtaginfo = {
-		-1, 0
-	};
-	
-	return taginfo ? taginfo : &invalidtaginfo;
+        static jas_taginfo_t invalidtaginfo = {
+                -1, 0
+        };
+       
+        return taginfo ? taginfo : &invalidtaginfo;
 }
diff --git a/converter/other/jpeg2000/libjasper/base/jas_version.c b/converter/other/jpeg2000/libjasper/base/jas_version.c
index 5608c4d4..675a3883 100644
--- a/converter/other/jpeg2000/libjasper/base/jas_version.c
+++ b/converter/other/jpeg2000/libjasper/base/jas_version.c
@@ -4,14 +4,14 @@
  */
 
 /* __START_OF_JASPER_LICENSE__
- * 
+ *
  * JasPer Software License
- * 
+ *
  * IMAGE POWER JPEG-2000 PUBLIC LICENSE
  * ************************************
- * 
+ *
  * GRANT:
- * 
+ *
  * Permission is hereby granted, free of charge, to any person (the "User")
  * obtaining a copy of this software and associated documentation, to deal
  * in the JasPer Software without restriction, including without limitation
@@ -19,22 +19,22 @@
  * and/or sell copies of the JasPer Software (in source and binary forms),
  * and to permit persons to whom the JasPer Software is furnished to do so,
  * provided further that the License Conditions below are met.
- * 
+ *
  * License Conditions
  * ******************
- * 
+ *
  * A.  Redistributions of source code must retain the above copyright notice,
  * and this list of conditions, and the following disclaimer.
- * 
+ *
  * B.  Redistributions in binary form must reproduce the above copyright
  * notice, and this list of conditions, and the following disclaimer in
  * the documentation and/or other materials provided with the distribution.
- * 
+ *
  * C.  Neither the name of Image Power, Inc. nor any other contributor
  * (including, but not limited to, the University of British Columbia and
  * Michael David Adams) may be used to endorse or promote products derived
  * from this software without specific prior written permission.
- * 
+ *
  * D.  User agrees that it shall not commence any action against Image Power,
  * Inc., the University of British Columbia, Michael David Adams, or any
  * other contributors (collectively "Licensors") for infringement of any
@@ -54,17 +54,17 @@
  * trade dress, or service mark rights); and (v) divisions, continuations,
  * renewals, reissues and extensions of the foregoing (as and to the extent
  * applicable) now existing, hereafter filed, issued or acquired.
- * 
+ *
  * E.  If User commences an infringement action against any Licensor(s) then
  * such Licensor(s) shall have the right to terminate User's license and
  * all sublicenses that have been granted hereunder by User to other parties.
- * 
+ *
  * F.  This software is for use only in hardware or software products that
  * are compliant with ISO/IEC 15444-1 (i.e., JPEG-2000 Part 1).  No license
  * or right to this Software is granted for products that do not comply
  * with ISO/IEC 15444-1.  The JPEG-2000 Part 1 standard can be purchased
  * from the ISO.
- * 
+ *
  * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
  * NO USE OF THE JASPER SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  * THIS DISCLAIMER.  THE JASPER SOFTWARE IS PROVIDED BY THE LICENSORS AND
@@ -104,7 +104,7 @@
  * TECHNOLOGY OR PRODUCTS FOR HIGH RISK ACTIVITIES AND WILL ENSURE THAT ITS
  * CUSTOMERS AND END-USERS OF ITS PRODUCTS ARE PROVIDED WITH A COPY OF THE
  * NOTICE SPECIFIED IN THIS SECTION.
- * 
+ *
  * __END_OF_JASPER_LICENSE__
  */
 
@@ -112,5 +112,5 @@
 
 const char *jas_getversion()
 {
-	return JAS_VERSION;
+        return JAS_VERSION;
 }