libtiff: Reformatting in libtiff/ using 'pre-commit run'

From 42173d6ace476b5228d866640b5355f74e5a108d Mon Sep 17 00:00:00 2001
From: pre-commit run by Even Rouault <[EMAIL REDACTED]>
Date: Thu, 8 Dec 2022 19:18:55 +0100
Subject: [PATCH] Reformatting in libtiff/ using 'pre-commit run'

---
 libtiff/mkg3states.c    |   484 +-
 libtiff/mkspans.c       |    87 +-
 libtiff/t4.h            |   457 +-
 libtiff/tif_aux.c       |   648 +-
 libtiff/tif_close.c     |   163 +-
 libtiff/tif_codec.c     |   129 +-
 libtiff/tif_color.c     |   378 +-
 libtiff/tif_compress.c  |   401 +-
 libtiff/tif_dir.c       |  3784 ++++++-----
 libtiff/tif_dir.h       |   455 +-
 libtiff/tif_dirinfo.c   |  2491 +++----
 libtiff/tif_dirread.c   | 13566 ++++++++++++++++++++------------------
 libtiff/tif_dirwrite.c  |  5300 ++++++++-------
 libtiff/tif_dumpmode.c  |   144 +-
 libtiff/tif_error.c     |   149 +-
 libtiff/tif_extension.c |    53 +-
 libtiff/tif_fax3.c      |  2734 ++++----
 libtiff/tif_fax3.h      |   891 +--
 libtiff/tif_flush.c     |   122 +-
 libtiff/tif_getimage.c  |  4766 ++++++-------
 libtiff/tif_jbig.c      |   324 +-
 libtiff/tif_jpeg.c      |  4128 ++++++------
 libtiff/tif_jpeg_12.c   |    43 +-
 libtiff/tif_lerc.c      |  1711 +++--
 libtiff/tif_luv.c       |  2743 ++++----
 libtiff/tif_lzma.c      |   797 +--
 libtiff/tif_lzw.c       |  2256 ++++---
 libtiff/tif_next.c      |   292 +-
 libtiff/tif_ojpeg.c     |  4838 +++++++-------
 libtiff/tif_open.c      |  1202 ++--
 libtiff/tif_packbits.c  |   501 +-
 libtiff/tif_pixarlog.c  |  2567 ++++----
 libtiff/tif_predict.c   |  1538 +++--
 libtiff/tif_predict.h   |    46 +-
 libtiff/tif_print.c     |  1321 ++--
 libtiff/tif_read.c      |  2434 +++----
 libtiff/tif_stream.cxx  |   634 +-
 libtiff/tif_strip.c     |   473 +-
 libtiff/tif_swab.c      |   436 +-
 libtiff/tif_thunder.c   |   272 +-
 libtiff/tif_tile.c      |   406 +-
 libtiff/tif_unix.c      |   444 +-
 libtiff/tif_version.c   |    22 +-
 libtiff/tif_warning.c   |   130 +-
 libtiff/tif_webp.c      |  1293 ++--
 libtiff/tif_win32.c     |   595 +-
 libtiff/tif_write.c     |  1310 ++--
 libtiff/tif_zip.c       |  1036 +--
 libtiff/tif_zstd.c      |   687 +-
 libtiff/tiff.h          |  1413 ++--
 libtiff/tiffio.h        |   879 +--
 libtiff/tiffio.hxx      |    24 +-
 libtiff/tiffiop.h       |   629 +-
 libtiff/tiffvers.h      |     4 +-
 libtiff/uvcode.h        |   262 +-
 55 files changed, 38996 insertions(+), 35896 deletions(-)

diff --git a/libtiff/mkg3states.c b/libtiff/mkg3states.c
index ca5b328b..f32113a3 100644
--- a/libtiff/mkg3states.c
+++ b/libtiff/mkg3states.c
@@ -2,23 +2,23 @@
  * Copyright (c) 1991-1997 Sam Leffler
  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  *
- * Permission to use, copy, modify, distribute, and sell this software and 
+ * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation for any purpose is hereby granted without fee, provided
  * that (i) the above copyright notices and this permission notice appear in
  * all copies of the software and related documentation, and (ii) the names of
  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  * publicity relating to the software without the specific, prior written
  * permission of Sam Leffler and Silicon Graphics.
- * 
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
- * 
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  */
 
@@ -27,390 +27,214 @@
  * in Frank Cringle's viewfax program;
  *      Copyright (C) 1990, 1995  Frank D. Cringle.
  */
-#include "tif_config.h"
 #include "libport.h"
+#include "tif_config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #ifdef HAVE_UNISTD_H
-# include <unistd.h>
+#include <unistd.h>
 #endif
 
 #include "tif_fax3.h"
 
-#define	streq(a,b)	(strcmp(a,b) == 0)
+#define streq(a, b) (strcmp(a, b) == 0)
 
 /* NB: can't use names in tif_fax3.h 'cuz they are declared const */
 TIFFFaxTabEnt MainTable[128];
 TIFFFaxTabEnt WhiteTable[4096];
 TIFFFaxTabEnt BlackTable[8192];
 
-struct proto {
-    uint16_t code;		/* right justified, lsb-first, zero filled */
-    uint16_t val;		/* (pixel count)<<4 + code width  */
+struct proto
+{
+    uint16_t code; /* right justified, lsb-first, zero filled */
+    uint16_t val;  /* (pixel count)<<4 + code width  */
 };
 
-static struct proto Pass[] = {
-{ 0x0008, 4 },
-{ 0, 0 }
-};
+static struct proto Pass[] = {{0x0008, 4}, {0, 0}};
 
-static struct proto Horiz[]  = {
-{ 0x0004, 3 },
-{ 0, 0 }
-};
+static struct proto Horiz[] = {{0x0004, 3}, {0, 0}};
 
-static struct proto V0[]  = {
-{ 0x0001, 1 },
-{ 0, 0 }
-};
+static struct proto V0[] = {{0x0001, 1}, {0, 0}};
 
-static struct proto VR[]  = {
-{ 0x0006, (1<<4)+3 },
-{ 0x0030, (2<<4)+6 },
-{ 0x0060, (3<<4)+7 },
-{ 0, 0 }
-};
+static struct proto VR[] = {{0x0006, (1 << 4) + 3},
+                            {0x0030, (2 << 4) + 6},
+                            {0x0060, (3 << 4) + 7},
+                            {0, 0}};
 
-static struct proto VL[]  = {
-{ 0x0002, (1<<4)+3 },
-{ 0x0010, (2<<4)+6 },
-{ 0x0020, (3<<4)+7 },
-{ 0, 0 }
-};
+static struct proto VL[] = {{0x0002, (1 << 4) + 3},
+                            {0x0010, (2 << 4) + 6},
+                            {0x0020, (3 << 4) + 7},
+                            {0, 0}};
 
-static struct proto Ext[]  = {
-{ 0x0040, 7 },
-{ 0, 0 }
-};
+static struct proto Ext[] = {{0x0040, 7}, {0, 0}};
 
-static struct proto EOLV[]  = {
-{ 0x0000, 7 },
-{ 0, 0 }
-};
+static struct proto EOLV[] = {{0x0000, 7}, {0, 0}};
 
 static struct proto MakeUpW[] = {
-{ 0x001b, 1029 },
-{ 0x0009, 2053 },
-{ 0x003a, 3078 },
-{ 0x0076, 4103 },
-{ 0x006c, 5128 },
-{ 0x00ec, 6152 },
-{ 0x0026, 7176 },
-{ 0x00a6, 8200 },
-{ 0x0016, 9224 },
-{ 0x00e6, 10248 },
-{ 0x0066, 11273 },
-{ 0x0166, 12297 },
-{ 0x0096, 13321 },
-{ 0x0196, 14345 },
-{ 0x0056, 15369 },
-{ 0x0156, 16393 },
-{ 0x00d6, 17417 },
-{ 0x01d6, 18441 },
-{ 0x0036, 19465 },
-{ 0x0136, 20489 },
-{ 0x00b6, 21513 },
-{ 0x01b6, 22537 },
-{ 0x0032, 23561 },
-{ 0x0132, 24585 },
-{ 0x00b2, 25609 },
-{ 0x0006, 26630 },
-{ 0x01b2, 27657 },
-{ 0, 0 }
-};
+    {0x001b, 1029},  {0x0009, 2053},  {0x003a, 3078},  {0x0076, 4103},
+    {0x006c, 5128},  {0x00ec, 6152},  {0x0026, 7176},  {0x00a6, 8200},
+    {0x0016, 9224},  {0x00e6, 10248}, {0x0066, 11273}, {0x0166, 12297},
+    {0x0096, 13321}, {0x0196, 14345}, {0x0056, 15369}, {0x0156, 16393},
+    {0x00d6, 17417}, {0x01d6, 18441}, {0x0036, 19465}, {0x0136, 20489},
+    {0x00b6, 21513}, {0x01b6, 22537}, {0x0032, 23561}, {0x0132, 24585},
+    {0x00b2, 25609}, {0x0006, 26630}, {0x01b2, 27657}, {0, 0}};
 
 static struct proto MakeUpB[] = {
-{ 0x03c0, 1034 },
-{ 0x0130, 2060 },
-{ 0x0930, 3084 },
-{ 0x0da0, 4108 },
-{ 0x0cc0, 5132 },
-{ 0x02c0, 6156 },
-{ 0x0ac0, 7180 },
-{ 0x06c0, 8205 },
-{ 0x16c0, 9229 },
-{ 0x0a40, 10253 },
-{ 0x1a40, 11277 },
-{ 0x0640, 12301 },
-{ 0x1640, 13325 },
-{ 0x09c0, 14349 },
-{ 0x19c0, 15373 },
-{ 0x05c0, 16397 },
-{ 0x15c0, 17421 },
-{ 0x0dc0, 18445 },
-{ 0x1dc0, 19469 },
-{ 0x0940, 20493 },
-{ 0x1940, 21517 },
-{ 0x0540, 22541 },
-{ 0x1540, 23565 },
-{ 0x0b40, 24589 },
-{ 0x1b40, 25613 },
-{ 0x04c0, 26637 },
-{ 0x14c0, 27661 },
-{ 0, 0 }
-};
+    {0x03c0, 1034},  {0x0130, 2060},  {0x0930, 3084},  {0x0da0, 4108},
+    {0x0cc0, 5132},  {0x02c0, 6156},  {0x0ac0, 7180},  {0x06c0, 8205},
+    {0x16c0, 9229},  {0x0a40, 10253}, {0x1a40, 11277}, {0x0640, 12301},
+    {0x1640, 13325}, {0x09c0, 14349}, {0x19c0, 15373}, {0x05c0, 16397},
+    {0x15c0, 17421}, {0x0dc0, 18445}, {0x1dc0, 19469}, {0x0940, 20493},
+    {0x1940, 21517}, {0x0540, 22541}, {0x1540, 23565}, {0x0b40, 24589},
+    {0x1b40, 25613}, {0x04c0, 26637}, {0x14c0, 27661}, {0, 0}};
 
 static struct proto MakeUp[] = {
-{ 0x0080, 28683 },
-{ 0x0180, 29707 },
-{ 0x0580, 30731 },
-{ 0x0480, 31756 },
-{ 0x0c80, 32780 },
-{ 0x0280, 33804 },
-{ 0x0a80, 34828 },
-{ 0x0680, 35852 },
-{ 0x0e80, 36876 },
-{ 0x0380, 37900 },
-{ 0x0b80, 38924 },
-{ 0x0780, 39948 },
-{ 0x0f80, 40972 },
-{ 0, 0 }
-};
+    {0x0080, 28683}, {0x0180, 29707}, {0x0580, 30731}, {0x0480, 31756},
+    {0x0c80, 32780}, {0x0280, 33804}, {0x0a80, 34828}, {0x0680, 35852},
+    {0x0e80, 36876}, {0x0380, 37900}, {0x0b80, 38924}, {0x0780, 39948},
+    {0x0f80, 40972}, {0, 0}};
 
 static struct proto TermW[] = {
-{ 0x00ac, 8 },
-{ 0x0038, 22 },
-{ 0x000e, 36 },
-{ 0x0001, 52 },
-{ 0x000d, 68 },
-{ 0x0003, 84 },
-{ 0x0007, 100 },
-{ 0x000f, 116 },
-{ 0x0019, 133 },
-{ 0x0005, 149 },
-{ 0x001c, 165 },
-{ 0x0002, 181 },
-{ 0x0004, 198 },
-{ 0x0030, 214 },
-{ 0x000b, 230 },
-{ 0x002b, 246 },
-{ 0x0015, 262 },
-{ 0x0035, 278 },
-{ 0x0072, 295 },
-{ 0x0018, 311 },
-{ 0x0008, 327 },
-{ 0x0074, 343 },
-{ 0x0060, 359 },
-{ 0x0010, 375 },
-{ 0x000a, 391 },
-{ 0x006a, 407 },
-{ 0x0064, 423 },
-{ 0x0012, 439 },
-{ 0x000c, 455 },
-{ 0x0040, 472 },
-{ 0x00c0, 488 },
-{ 0x0058, 504 },
-{ 0x00d8, 520 },
-{ 0x0048, 536 },
-{ 0x00c8, 552 },
-{ 0x0028, 568 },
-{ 0x00a8, 584 },
-{ 0x0068, 600 },
-{ 0x00e8, 616 },
-{ 0x0014, 632 },
-{ 0x0094, 648 },
-{ 0x0054, 664 },
-{ 0x00d4, 680 },
-{ 0x0034, 696 },
-{ 0x00b4, 712 },
-{ 0x0020, 728 },
-{ 0x00a0, 744 },
-{ 0x0050, 760 },
-{ 0x00d0, 776 },
-{ 0x004a, 792 },
-{ 0x00ca, 808 },
-{ 0x002a, 824 },
-{ 0x00aa, 840 },
-{ 0x0024, 856 },
-{ 0x00a4, 872 },
-{ 0x001a, 888 },
-{ 0x009a, 904 },
-{ 0x005a, 920 },
-{ 0x00da, 936 },
-{ 0x0052, 952 },
-{ 0x00d2, 968 },
-{ 0x004c, 984 },
-{ 0x00cc, 1000 },
-{ 0x002c, 1016 },
-{ 0, 0 }
-};
+    {0x00ac, 8},   {0x0038, 22},  {0x000e, 36},   {0x0001, 52},   {0x000d, 68},
+    {0x0003, 84},  {0x0007, 100}, {0x000f, 116},  {0x0019, 133},  {0x0005, 149},
+    {0x001c, 165}, {0x0002, 181}, {0x0004, 198},  {0x0030, 214},  {0x000b, 230},
+    {0x002b, 246}, {0x0015, 262}, {0x0035, 278},  {0x0072, 295},  {0x0018, 311},
+    {0x0008, 327}, {0x0074, 343}, {0x0060, 359},  {0x0010, 375},  {0x000a, 391},
+    {0x006a, 407}, {0x0064, 423}, {0x0012, 439},  {0x000c, 455},  {0x0040, 472},
+    {0x00c0, 488}, {0x0058, 504}, {0x00d8, 520},  {0x0048, 536},  {0x00c8, 552},
+    {0x0028, 568}, {0x00a8, 584}, {0x0068, 600},  {0x00e8, 616},  {0x0014, 632},
+    {0x0094, 648}, {0x0054, 664}, {0x00d4, 680},  {0x0034, 696},  {0x00b4, 712},
+    {0x0020, 728}, {0x00a0, 744}, {0x0050, 760},  {0x00d0, 776},  {0x004a, 792},
+    {0x00ca, 808}, {0x002a, 824}, {0x00aa, 840},  {0x0024, 856},  {0x00a4, 872},
+    {0x001a, 888}, {0x009a, 904}, {0x005a, 920},  {0x00da, 936},  {0x0052, 952},
+    {0x00d2, 968}, {0x004c, 984}, {0x00cc, 1000}, {0x002c, 1016}, {0, 0}};
 
 static struct proto TermB[] = {
-{ 0x03b0, 10 },
-{ 0x0002, 19 },
-{ 0x0003, 34 },
-{ 0x0001, 50 },
-{ 0x0006, 67 },
-{ 0x000c, 84 },
-{ 0x0004, 100 },
-{ 0x0018, 117 },
-{ 0x0028, 134 },
-{ 0x0008, 150 },
-{ 0x0010, 167 },
-{ 0x0050, 183 },
-{ 0x0070, 199 },
-{ 0x0020, 216 },
-{ 0x00e0, 232 },
-{ 0x0030, 249 },
-{ 0x03a0, 266 },
-{ 0x0060, 282 },
-{ 0x0040, 298 },
-{ 0x0730, 315 },
-{ 0x00b0, 331 },
-{ 0x01b0, 347 },
-{ 0x0760, 363 },
-{ 0x00a0, 379 },
-{ 0x0740, 395 },
-{ 0x00c0, 411 },
-{ 0x0530, 428 },
-{ 0x0d30, 444 },
-{ 0x0330, 460 },
-{ 0x0b30, 476 },
-{ 0x0160, 492 },
-{ 0x0960, 508 },
-{ 0x0560, 524 },
-{ 0x0d60, 540 },
-{ 0x04b0, 556 },
-{ 0x0cb0, 572 },
-{ 0x02b0, 588 },
-{ 0x0ab0, 604 },
-{ 0x06b0, 620 },
-{ 0x0eb0, 636 },
-{ 0x0360, 652 },
-{ 0x0b60, 668 },
-{ 0x05b0, 684 },
-{ 0x0db0, 700 },
-{ 0x02a0, 716 },
-{ 0x0aa0, 732 },
-{ 0x06a0, 748 },
-{ 0x0ea0, 764 },
-{ 0x0260, 780 },
-{ 0x0a60, 796 },
-{ 0x04a0, 812 },
-{ 0x0ca0, 828 },
-{ 0x0240, 844 },
-{ 0x0ec0, 860 },
-{ 0x01c0, 876 },
-{ 0x0e40, 892 },
-{ 0x0140, 908 },
-{ 0x01a0, 924 },
-{ 0x09a0, 940 },
-{ 0x0d40, 956 },
-{ 0x0340, 972 },
-{ 0x05a0, 988 },
-{ 0x0660, 1004 },
-{ 0x0e60, 1020 },
-{ 0, 0 }
-};
+    {0x03b0, 10},  {0x0002, 19},  {0x0003, 34},   {0x0001, 50},   {0x0006, 67},
+    {0x000c, 84},  {0x0004, 100}, {0x0018, 117},  {0x0028, 134},  {0x0008, 150},
+    {0x0010, 167}, {0x0050, 183}, {0x0070, 199},  {0x0020, 216},  {0x00e0, 232},
+    {0x0030, 249}, {0x03a0, 266}, {0x0060, 282},  {0x0040, 298},  {0x0730, 315},
+    {0x00b0, 331}, {0x01b0, 347}, {0x0760, 363},  {0x00a0, 379},  {0x0740, 395},
+    {0x00c0, 411}, {0x0530, 428}, {0x0d30, 444},  {0x0330, 460},  {0x0b30, 476},
+    {0x0160, 492}, {0x0960, 508}, {0x0560, 524},  {0x0d60, 540},  {0x04b0, 556},
+    {0x0cb0, 572}, {0x02b0, 588}, {0x0ab0, 604},  {0x06b0, 620},  {0x0eb0, 636},
+    {0x0360, 652}, {0x0b60, 668}, {0x05b0, 684},  {0x0db0, 700},  {0x02a0, 716},
+    {0x0aa0, 732}, {0x06a0, 748}, {0x0ea0, 764},  {0x0260, 780},  {0x0a60, 796},
+    {0x04a0, 812}, {0x0ca0, 828}, {0x0240, 844},  {0x0ec0, 860},  {0x01c0, 876},
+    {0x0e40, 892}, {0x0140, 908}, {0x01a0, 924},  {0x09a0, 940},  {0x0d40, 956},
+    {0x0340, 972}, {0x05a0, 988}, {0x0660, 1004}, {0x0e60, 1020}, {0, 0}};
 
-static struct proto EOLH[] = {
-{ 0x0000, 11 },
-{ 0, 0 }
-};
+static struct proto EOLH[] = {{0x0000, 11}, {0, 0}};
 
-static void
-FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
+static void FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
 {
     int limit = 1 << Size;
 
-    while (P->val) {
-	int width = P->val & 15;
-	int param = P->val >> 4;
-	int incr = 1 << width;
-	int code;
-	for (code = P->code; code < limit; code += incr) {
-	    TIFFFaxTabEnt *E = T+code;
-	    E->State = State;
-	    E->Width = width;
-	    E->Param = param;
-	}
-	P++;
+    while (P->val)
+    {
+        int width = P->val & 15;
+        int param = P->val >> 4;
+        int incr = 1 << width;
+        int code;
+        for (code = P->code; code < limit; code += incr)
+        {
+            TIFFFaxTabEnt *E = T + code;
+            E->State = State;
+            E->Width = width;
+            E->Param = param;
+        }
+        P++;
     }
 }
 
-static	char* storage_class = "";
-static	char* const_class = "";
-static	int packoutput = 1;
-static	char* prebrace = "";
-static	char* postbrace = "";
+static char *storage_class = "";
+static char *const_class = "";
+static int packoutput = 1;
+static char *prebrace = "";
+static char *postbrace = "";
 
-void
-WriteTable(FILE* fd, const TIFFFaxTabEnt* T, int Size, const char* name)
+void WriteTable(FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
 {
     int i;
-    char* sep;
+    char *sep;
 
-    fprintf(fd, "%s %s TIFFFaxTabEnt %s[%d] = {",
-	storage_class, const_class, name, Size);
-    if (packoutput) {
-	sep = "\n";
-	for (i = 0; i < Size; i++) {
-	    fprintf(fd, "%s%s%d,%d,%d%s",
-		sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
-	    if (((i+1) % 10) == 0)
-		    sep = ",\n";
-	    else
-		    sep = ",";
-	    T++;
-	}
-    } else {
-	sep = "\n ";
-	for (i = 0; i < Size; i++) {
-	    fprintf(fd, "%s%s%3d,%3d,%4d%s",
-		sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
-	    if (((i+1) % 6) == 0)
-		    sep = ",\n ";
-	    else
-		    sep = ",";
-	    T++;
-	}
+    fprintf(fd, "%s %s TIFFFaxTabEnt %s[%d] = {", storage_class, const_class,
+            name, Size);
+    if (packoutput)
+    {
+        sep = "\n";
+        for (i = 0; i < Size; i++)
+        {
+            fprintf(fd, "%s%s%d,%d,%d%s", sep, prebrace, T->State, T->Width,
+                    (int)T->Param, postbrace);
+            if (((i + 1) % 10) == 0)
+                sep = ",\n";
+            else
+                sep = ",";
+            T++;
+        }
+    }
+    else
+    {
+        sep = "\n ";
+        for (i = 0; i < Size; i++)
+        {
+            fprintf(fd, "%s%s%3d,%3d,%4d%s", sep, prebrace, T->State, T->Width,
+                    (int)T->Param, postbrace);
+            if (((i + 1) % 6) == 0)
+                sep = ",\n ";
+            else
+                sep = ",";
+            T++;
+        }
     }
     fprintf(fd, "\n};\n");
 }
 
 /* initialise the huffman code tables */
-int
-main(int argc, char* argv[])
+int main(int argc, char *argv[])
 {
-    FILE* fd;
-    char* outputfile;
+    FILE *fd;
+    char *outputfile;
     int c;
 
 #if !HAVE_DECL_OPTARG
     extern int optind;
-    extern char* optarg;
+    extern char *optarg;
 #endif
 
     while ((c = getopt(argc, argv, "c:s:bp")) != -1)
-	switch (c) {
-	case 'c':
-	    const_class = optarg;
-	    break;
-	case 's':
-	    storage_class = optarg;
-	    break;
-	case 'p':
-	    packoutput = 0;
-	    break;
-	case 'b':
-	    prebrace = "{";
-	    postbrace = "}";
-	    break;
-	case '?':
-	    fprintf(stderr,
-		"usage: %s [-c const] [-s storage] [-p] [-b] file\n",
-		argv[0]);
-	    return (-1);
-	}
+        switch (c)
+        {
+            case 'c':
+                const_class = optarg;
+                break;
+            case 's':
+                storage_class = optarg;
+                break;
+            case 'p':
+                packoutput = 0;
+                break;
+            case 'b':
+                prebrace = "{";
+                postbrace = "}";
+                break;
+            case '?':
+                fprintf(stderr,
+                        "usage: %s [-c const] [-s storage] [-p] [-b] file\n",
+                        argv[0]);
+                return (-1);
+        }
     outputfile = optind < argc ? argv[optind] : "g3states.h";
     fd = fopen(outputfile, "w");
-    if (fd == NULL) {
-	fprintf(stderr, "%s: %s: Cannot create output file.\n",
-	    argv[0], outputfile);
-	return (-2);
+    if (fd == NULL)
+    {
+        fprintf(stderr, "%s: %s: Cannot create output file.\n", argv[0],
+                outputfile);
+        return (-2);
     }
     FillTable(MainTable, 7, Pass, S_Pass);
     FillTable(MainTable, 7, Horiz, S_Horiz);
diff --git a/libtiff/mkspans.c b/libtiff/mkspans.c
index b82db8bc..24c63ab7 100644
--- a/libtiff/mkspans.c
+++ b/libtiff/mkspans.c
@@ -2,70 +2,75 @@
  * Copyright (c) 1991-1997 Sam Leffler
  * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  *
- * Permission to use, copy, modify, distribute, and sell this software and 
+ * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation for any purpose is hereby granted without fee, provided
  * that (i) the above copyright notices and this permission notice appear in
  * all copies of the software and related documentation, and (ii) the names of
  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  * publicity relating to the software without the specific, prior written
  * permission of Sam Leffler and Silicon Graphics.
- * 
- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
- * 
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  */
 
-#include <string.h>
 #include <stdio.h>
+#include <string.h>
 
 /*
  * Hack program to construct tables used to find
  * runs of zeros and ones in Group 3 Fax encoding.
  */
 
-dumparray(name, runs)
-	char *name;
-	unsigned char runs[256];
+dumparray(name, runs) char *name;
+unsigned char runs[256];
 {
-	int i;
-	char *sep;
-	printf("static unsigned char %s[256] = {\n", name);
-	sep = "    ";
-	for (i = 0; i < 256; i++) {
-		printf("%s%d", sep, runs[i]);
-		if (((i + 1) % 16) == 0) {
-			printf(",	/* 0x%02x - 0x%02x */\n", i-15, i);
-			sep = "    ";
-		} else
-			sep = ", ";
-	}
-	printf("\n};\n");
+    int i;
+    char *sep;
+    printf("static unsigned char %s[256] = {\n", name);
+    sep = "    ";
+    for (i = 0; i < 256; i++)
+    {
+        printf("%s%d", sep, runs[i]);
+        if (((i + 1) % 16) == 0)
+        {
+            printf(",	/* 0x%02x - 0x%02x */\n", i - 15, i);
+            sep = "    ";
+        }
+        else
+            sep = ", ";
+    }
+    printf("\n};\n");
 }
 
 main()
 {
-	unsigned char runs[2][256];
+    unsigned char runs[2][256];
 
-	memset(runs[0], 0, 256*sizeof (char));
-	memset(runs[1], 0, 256*sizeof (char));
-	{ register int run, runlen, i;
-	  runlen = 1;
-	  for (run = 0x80; run != 0xff; run = (run>>1)|0x80) {
-		for (i = run-1; i >= 0; i--) {
-			runs[1][run|i] = runlen;
-			runs[0][(~(run|i)) & 0xff] = runlen;
-		}
-		runlen++;
-	  }
-	  runs[1][0xff] = runs[0][0] = 8;
-	}
-	dumparray("bruns", runs[0]);
-	dumparray("wruns", runs[1]);
+    memset(runs[0], 0, 256 * sizeof(char));
+    memset(runs[1], 0, 256 * sizeof(char));
+    {
+        register int run, runlen, i;
+        runlen = 1;
+        for (run = 0x80; run != 0xff; run = (run >> 1) | 0x80)
+        {
+            for (i = run - 1; i >= 0; i--)
+            {
+                runs[1][run | i] = runlen;
+                runs[0][(~(run | i)) & 0xff] = runlen;
+            }
+            runlen++;
+        }
+        runs[1][0xff] = runs[0][0] = 8;
+    }
+    dumparray("bruns", runs[0]);
+    dumparray("wruns", runs[1]);
 }
diff --git a/libtiff/t4.h b/libtiff/t4.h
index ff4e3f45..f933d4a3 100644
--- a/libtiff/t4.h
+++ b/libtiff/t4.h
@@ -23,26 +23,27 @@
  */
 
 #ifndef _T4_
-#define	_T4_
+#define _T4_
 /*
  * CCITT T.4 1D Huffman runlength codes and
  * related definitions.  Given the small sizes
  * of these tables it does not seem
  * worthwhile to make code & length 8 bits.
  */
-typedef struct tableentry {
-    unsigned short length;  /* bit length of g3 code */
-    unsigned short code;    /* g3 code */
-    short runlen;           /* run length in bits */
+typedef struct tableentry
+{
+    unsigned short length; /* bit length of g3 code */
+    unsigned short code;   /* g3 code */
+    short runlen;          /* run length in bits */
 } tableentry;
 
-#define EOL	0x001	/* EOL code value - 0000 0000 0000 1 */
+#define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */
 
 /* status values returned instead of a run length */
-#define G3CODE_EOL	-1	/* NB: ACT_EOL - ACT_WRUNT */
-#define G3CODE_INVALID	-2	/* NB: ACT_INVALID - ACT_WRUNT */
-#define G3CODE_EOF	-3	/* end of input data */
-#define G3CODE_INCOMP	-4	/* incomplete run code */
+#define G3CODE_EOL -1     /* NB: ACT_EOL - ACT_WRUNT */
+#define G3CODE_INVALID -2 /* NB: ACT_INVALID - ACT_WRUNT */
+#define G3CODE_EOF -3     /* end of input data */
+#define G3CODE_INCOMP -4  /* incomplete run code */
 
 /*
  * Note that these tables are ordered such that the
@@ -54,227 +55,227 @@ typedef struct tableentry {
  */
 #ifdef G3CODES
 const tableentry TIFFFaxWhiteCodes[] = {
-    { 8, 0x35, 0 },	/* 0011 0101 */
-    { 6, 0x7, 1 },	/* 0001 11 */
-    { 4, 0x7, 2 },	/* 0111 */
-    { 4, 0x8, 3 },	/* 1000 */
-    { 4, 0xB, 4 },	/* 1011 */
-    { 4, 0xC, 5 },	/* 1100 */
-    { 4, 0xE, 6 },	/* 1110 */
-    { 4, 0xF, 7 },	/* 1111 */
-    { 5, 0x13, 8 },	/* 1001 1 */
-    { 5, 0x14, 9 },	/* 1010 0 */
-    { 5, 0x7, 10 },	/* 0011 1 */
-    { 5, 0x8, 11 },	/* 0100 0 */
-    { 6, 0x8, 12 },	/* 0010 00 */
-    { 6, 0x3, 13 },	/* 0000 11 */
-    { 6, 0x34, 14 },	/* 1101 00 */
-    { 6, 0x35, 15 },	/* 1101 01 */
-    { 6, 0x2A, 16 },	/* 1010 10 */
-    { 6, 0x2B, 17 },	/* 1010 11 */
-    { 7, 0x27, 18 },	/* 0100 111 */
-    { 7, 0xC, 19 },	/* 0001 100 */
-    { 7, 0x8, 20 },	/* 0001 000 */
-    { 7, 0x17, 21 },	/* 0010 111 */
-    { 7, 0x3, 22 },	/* 0000 011 */
-    { 7, 0x4, 23 },	/* 0000 100 */
-    { 7, 0x28, 24 },	/* 0101 000 */
-    { 7, 0x2B, 25 },	/* 0101 011 */
-    { 7, 0x13, 26 },	/* 0010 011 */
-    { 7, 0x24, 27 },	/* 0100 100 */
-    { 7, 0x18, 28 },	/* 0011 000 */
-    { 8, 0x2, 29 },	/* 0000 0010 */
-    { 8, 0x3, 30 },	/* 0000 0011 */
-    { 8, 0x1A, 31 },	/* 0001 1010 */
-    { 8, 0x1B, 32 },	/* 0001 1011 */
-    { 8, 0x12, 33 },	/* 0001 0010 */
-    { 8, 0x13, 34 },	/* 0001 0011 */
-    { 8, 0x14, 35 },	/* 0001 0100 */
-    { 8, 0x15, 36 },	/* 0001 0101 */
-    { 8, 0x16, 37 },	/* 0001 0110 */
-    { 8, 0x17, 38 },	/* 0001 0111 */
-    { 8, 0x28, 39 },	/* 0010 1000 */
-    { 8, 0x29, 40 },	/* 0010 1001 */
-    { 8, 0x2A, 41 },	/* 0010 1010 */
-    { 8, 0x2B, 42 },	/* 0010 1011 */
-    { 8, 0x2C, 43 },	/* 0010 1100 */
-    { 8, 0x2D, 44 },	/* 0010 1101 */
-    { 8, 0x4, 45 },	/* 0000 0100 */
-    { 8, 0x5, 46 },	/* 0000 0101 */
-    { 8, 0xA, 47 },	/* 0000 1010 */
-    { 8, 0xB, 48 },	/* 0000 1011 */
-    { 8, 0x52, 49 },	/* 0101 0010 */
-    { 8, 0x53, 50 },	/* 0101 0011 */
-    { 8, 0x54, 51 },	/* 0101 0100 */
-    { 8, 0x55, 52 },	/* 0101 0101 */
-    { 8, 0x24, 53 },	/* 0010 0100 */
-    { 8, 0x25, 54 },	/* 0010 0101 */
-    { 8, 0x58, 55 },	/* 0101 1000 */
-    { 8, 0x59, 56 },	/* 0101 1001 */
-    { 8, 0x5A, 57 },	/* 0101 1010 */
-    { 8, 0x5B, 58 },	/* 0101 1011 */
-    { 8, 0x4A, 59 },	/* 0100 1010 */
-    { 8, 0x4B, 60 },	/* 0100 1011 */
-    { 8, 0x32, 61 },	/* 0011 0010 */
-    { 8, 0x33, 62 },	/* 0011 0011 */
-    { 8, 0x34, 63 },	/* 0011 0100 */
-    { 5, 0x1B, 64 },	/* 1101 1 */
-    { 5, 0x12, 128 },	/* 1001 0 */
-    { 6, 0x17, 192 },	/* 0101 11 */
-    { 7, 0x37, 256 },	/* 0110 111 */
-    { 8, 0x36, 320 },	/* 0011 0110 */
-    { 8, 0x37, 384 },	/* 0011 0111 */
-    { 8, 0x64, 448 },	/* 0110 0100 */
-    { 8, 0x65, 512 },	/* 0110 0101 */
-    { 8, 0x68, 576 },	/* 0110 1000 */
-    { 8, 0x67, 640 },	/* 0110 0111 */
-    { 9, 0xCC, 704 },	/* 0110 0110 0 */
-    { 9, 0xCD, 768 },	/* 0110 0110 1 */
-    { 9, 0xD2, 832 },	/* 0110 1001 0 */
-    { 9, 0xD3, 896 },	/* 0110 1001 1 */
-    { 9, 0xD4, 960 },	/* 0110 1010 0 */
-    { 9, 0xD5, 1024 },	/* 0110 1010 1 */
-    { 9, 0xD6, 1088 },	/* 0110 1011 0 */
-    { 9, 0xD7, 1152 },	/* 0110 1011 1 */
-    { 9, 0xD8, 1216 },	/* 0110 1100 0 */
-    { 9, 0xD9, 1280 },	/* 0110 1100 1 */
-    { 9, 0xDA, 1344 },	/* 0110 1101 0 */
-    { 9, 0xDB, 1408 },	/* 0110 1101 1 */
-    { 9, 0x98, 1472 },	/* 0100 1100 0 */
-    { 9, 0x99, 1536 },	/* 0100 1100 1 */
-    { 9, 0x9A, 1600 },	/* 0100 1101 0 */
-    { 6, 0x18, 1664 },	/* 0110 00 */
-    { 9, 0x9B, 1728 },	/* 0100 1101 1 */
-    { 11, 0x8, 1792 },	/* 0000 0001 000 */
-    { 11, 0xC, 1856 },	/* 0000 0001 100 */
-    { 11, 0xD, 1920 },	/* 0000 0001 101 */
-    { 12, 0x12, 1984 },	/* 0000 0001 0010 */
-    { 12, 0x13, 2048 },	/* 0000 0001 0011 */
-    { 12, 0x14, 2112 },	/* 0000 0001 0100 */
-    { 12, 0x15, 2176 },	/* 0000 0001 0101 */
-    { 12, 0x16, 2240 },	/* 0000 0001 0110 */
-    { 12, 0x17, 2304 },	/* 0000 0001 0111 */
-    { 12, 0x1C, 2368 },	/* 0000 0001 1100 */
-    { 12, 0x1D, 2432 },	/* 0000 0001 1101 */
-    { 12, 0x1E, 2496 },	/* 0000 0001 1110 */
-    { 12, 0x1F, 2560 },	/* 0000 0001 1111 */
-    { 12, 0x1, G3CODE_EOL },	/* 0000 0000 0001 */
-    { 9, 0x1, G3CODE_INVALID },	/* 0000 0000 1 */
-    { 10, 0x1, G3CODE_INVALID },	/* 0000 0000 01 */
-    { 11, 0x1, G3CODE_INVALID },	/* 0000 0000 001 */
-    { 12, 0x0, G3CODE_INVALID },	/* 0000 0000 0000 */
+    {8, 0x35, 0},              /* 0011 0101 */
+    {6, 0x7, 1},               /* 0001 11 */
+    {4, 0x7, 2},               /* 0111 */
+    {4, 0x8, 3},               /* 1000 */
+    {4, 0xB, 4},               /* 1011 */
+    {4, 0xC, 5},               /* 1100 */
+    {4, 0xE, 6},               /* 1110 */
+    {4, 0xF, 7},               /* 1111 */
+    {5, 0x13, 8},              /* 1001 1 */
+    {5, 0x14, 9},              /* 1010 0 */
+    {5, 0x7, 10},              /* 0011 1 */
+    {5, 0x8, 11},              /* 0100 0 */
+    {6, 0x8, 12},              /* 0010 00 */
+    {6, 0x3, 13},              /* 0000 11 */
+    {6, 0x34, 14},             /* 1101 00 */
+    {6, 0x35, 15},             /* 1101 01 */
+    {6, 0x2A, 16},             /* 1010 10 */
+    {6, 0x2B, 17},             /* 1010 11 */
+    {7, 0x27, 18},             /* 0100 111 */
+    {7, 0xC, 19},              /* 0001 100 */
+    {7, 0x8, 20},              /* 0001 000 */
+    {7, 0x17, 21},             /* 0010 111 */
+    {7, 0x3, 22},              /* 0000 011 */
+    {7, 0x4, 23},              /* 0000 100 */
+    {7, 0x28, 24},             /* 0101 000 */
+    {7, 0x2B, 25},             /* 0101 011 */
+    {7, 0x13, 26},             /* 0010 011 */
+    {7, 0x24, 27},             /* 0100 100 */
+    {7, 0x18, 28},             /* 0011 000 */
+    {8, 0x2, 29},              /* 0000 0010 */
+    {8, 0x3, 30},              /* 0000 0011 */
+    {8, 0x1A, 31},             /* 0001 1010 */
+    {8, 0x1B, 32},             /* 0001 1011 */
+    {8, 0x12, 33},             /* 0001 0010 */
+    {8, 0x13, 34},             /* 0001 0011 */
+    {8, 0x14, 35},             /* 0001 0100 */
+    {8, 0x15, 36},             /* 0001 0101 */
+    {8, 0x16, 37},             /* 0001 0110 */
+    {8, 0x17, 38},             /* 0001 0111 */
+    {8, 0x28, 39},             /* 0010 1000 */
+    {8, 0x29, 40},             /* 0010 1001 */
+    {8, 0x2A, 41},             /* 0010 1010 */
+    {8, 0x2B, 42},             /* 0010 1011 */
+    {8, 0x2C, 43},             /* 0010 1100 */
+    {8, 0x2D, 44},             /* 0010 1101 */
+    {8, 0x4, 45},              /* 0000 0100 */
+    {8, 0x5, 46},              /* 0000 0101 */
+    {8, 0xA, 47},              /* 0000 1010 */
+    {8, 0xB, 48},              /* 0000 1011 */
+    {8, 0x52, 49},             /* 0101 0010 */
+    {8, 0x53, 50},             /* 0101 0011 */
+    {8, 0x54, 51},             /* 0101 0100 */
+    {8, 0x55, 52},             /* 0101 0101 */
+    {8, 0x24, 53},             /* 0010 0100 */
+    {8, 0x25, 54},             /* 0010 0101 */
+    {8, 0x58, 55},             /* 0101 1000 */
+    {8, 0x59, 56},             /* 0101 1001 */
+    {8, 0x5A, 57},             /* 0101 1010 */
+    {8, 0x5B, 58},             /* 0101 1011 */
+    {8, 0x4A, 59},             /* 0100 1010 */
+    {8, 0x4B, 60},             /* 0100 1011 */
+    {8, 0x32, 61},             /* 0011 0010 */
+    {8, 0x33, 62},             /* 0011 0011 */
+    {8, 0x34, 63},             /* 0011 0100 */
+    {5, 0x1B, 64},             /* 1101 1 */
+    {5, 0x12, 128},            /* 1001 0 */
+    {6, 0x17, 192},            /* 0101 11 */
+    {7, 0x37, 256},            /* 0110 111 */
+    {8, 0x36, 320},            /* 0011 0110 */
+    {8, 0x37, 384},            /* 0011 0111 */
+    {8, 0x64, 448},            /* 0110 0100 */
+    {8, 0x65, 512},            /* 0110 0101 */
+    {8, 0x68, 576},            /* 0110 1000 */
+    {8, 0x67, 640},            /* 0110 0111 */
+    {9, 0xCC, 704},            /* 0110 0110 0 */
+    {9, 0xCD, 768},            /* 0110 0110 1 */
+    {9, 0xD2, 832},            /* 0110 1001 0 */
+    {9

(Patch may be truncated, please check the link at the top of this post.)