From 2b287020f4c48601bf4a4a9cadc2aed5d771d97d Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Tue, 22 Oct 2002 19:15:23 +0000
Subject: [PATCH] Allow 8-byte off_t to properly pg_dump, from Philip Warner
 with mods by Bruce.

---
 src/bin/pg_dump/pg_backup_archiver.c | 114 +++++++++++++++++++++++++--
 src/bin/pg_dump/pg_backup_archiver.h |  16 +++-
 src/bin/pg_dump/pg_backup_custom.c   |  79 +++++++------------
 src/bin/pg_dump/pg_backup_db.c       |  11 +--
 src/bin/pg_dump/pg_backup_files.c    |   6 +-
 src/bin/pg_dump/pg_backup_tar.c      |  10 +--
 src/bin/pg_dump/pg_dump.c            |   5 +-
 7 files changed, 154 insertions(+), 87 deletions(-)

diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 92d83dd39c8..d56ebdcd06c 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.58 2002/10/16 05:46:54 momjian Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.59 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -671,9 +671,11 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
 	}
 
 	ahprintf(AH, ";     Dump Version: %d.%d-%d\n", AH->vmaj, AH->vmin, AH->vrev);
-	ahprintf(AH, ";     Format: %s\n;\n", fmtName);
+	ahprintf(AH, ";     Format: %s\n", fmtName);
+	ahprintf(AH, ";     Integer: %d bytes\n", AH->intSize);
+	ahprintf(AH, ";     Offset: %d bytes\n", AH->offSize);
 
-	ahprintf(AH, ";\n; Selected TOC Entries:\n;\n");
+	ahprintf(AH, ";\n;\n; Selected TOC Entries:\n;\n");
 
 	while (te != AH->toc)
 	{
@@ -1368,6 +1370,87 @@ TocIDRequired(ArchiveHandle *AH, int id, RestoreOptions *ropt)
 	return _tocEntryRequired(te, ropt);
 }
 
+size_t
+WriteOffset(ArchiveHandle *AH, off_t o, int wasSet)
+{
+	int 			off;
+
+	/* Save the flag */
+	(*AH->WriteBytePtr) (AH, wasSet);
+
+	/* Write out off_t smallest byte first, prevents endian mismatch */
+	for (off = 0; off < sizeof(off_t); off++)
+	{
+	    (*AH->WriteBytePtr) (AH, o & 0xFF);
+		o >>= 8;
+	}
+	return sizeof(off_t) + 1;
+}
+
+int
+ReadOffset(ArchiveHandle *AH, off_t *o)
+{
+	int				i;
+	int 			off;
+	int				offsetFlg;
+
+	/* Initialize to zero */
+	*o = 0;
+
+	/* Check for old version */
+	if (AH->version < K_VERS_1_7)
+	{
+		/* Prior versions wrote offsets using WriteInt */
+		i = ReadInt(AH);
+		/* -1 means not set */
+		if (i < 0)
+		    return K_OFFSET_POS_NOT_SET;
+		else if (i == 0)
+		    return K_OFFSET_NO_DATA;
+
+		/* Cast to off_t because it was written as an int. */
+		*o = (off_t)i;
+		return K_OFFSET_POS_SET;
+	}
+
+	/*
+	 * Read the flag indicating the state of the data pointer.
+	 * Check if valid and die if not.
+	 *
+	 * This used to be handled by a negative or zero pointer,
+	 * now we use an extra byte specifically for the state.
+	 */
+	offsetFlg = (*AH->ReadBytePtr) (AH) & 0xFF;
+
+	switch (offsetFlg)
+	{
+		case K_OFFSET_POS_NOT_SET:
+		case K_OFFSET_NO_DATA:
+		case K_OFFSET_POS_SET:
+
+				break;
+
+		default:
+				die_horribly(AH, modulename, "Unexpected data offset flag %d\n", offsetFlg);
+	}
+
+	/*
+	 * Read the bytes
+	 */
+	for (off = 0; off < AH->offSize; off++)
+	{
+		if (off < sizeof(off_t))
+			*o |= ((*AH->ReadBytePtr) (AH)) << (off * 8);
+		else
+		{
+			if ((*AH->ReadBytePtr) (AH) != 0)
+	    	    die_horribly(AH, modulename, "file offset in dump file is too large\n");
+		}
+	}
+
+	return offsetFlg;
+}
+
 size_t
 WriteInt(ArchiveHandle *AH, int i)
 {
@@ -1528,14 +1611,22 @@ _discoverArchiveFormat(ArchiveHandle *AH)
 		else
 			AH->vrev = 0;
 
+		/* Make a convenient integer <maj><min><rev>00 */
+		AH->version = ((AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev) * 256 + 0;
+
 		AH->intSize = fgetc(fh);
 		AH->lookahead[AH->lookaheadLen++] = AH->intSize;
 
+		if (AH->version >= K_VERS_1_7)
+		{
+			AH->offSize = fgetc(fh);
+			AH->lookahead[AH->lookaheadLen++] = AH->offSize;
+		}
+		else
+			AH->offSize = AH->intSize;
+
 		AH->format = fgetc(fh);
 		AH->lookahead[AH->lookaheadLen++] = AH->format;
-
-		/* Make a convenient integer <maj><min><rev>00 */
-		AH->version = ((AH->vmaj * 256 + AH->vmin) * 256 + AH->vrev) * 256 + 0;
 	}
 	else
 	{
@@ -1599,6 +1690,8 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
 	if (!AH)
 		die_horribly(AH, modulename, "out of memory\n");
 
+	/* AH->debugLevel = 100; */
+
 	AH->vmaj = K_VERS_MAJOR;
 	AH->vmin = K_VERS_MINOR;
 	AH->vrev = K_VERS_REV;
@@ -1606,6 +1699,7 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
 	AH->createDate = time(NULL);
 
 	AH->intSize = sizeof(int);
+	AH->offSize = sizeof(off_t);
 	AH->lastID = 0;
 	if (FileSpec)
 	{
@@ -1784,7 +1878,7 @@ ReadToc(ArchiveHandle *AH)
 
 		/* Sanity check */
 		if (te->id <= 0 || te->id > AH->tocCount)
-			die_horribly(AH, modulename, "entry id out of range - perhaps a corrupt TOC\n");
+			die_horribly(AH, modulename, "entry id %d out of range - perhaps a corrupt TOC\n", te->id);
 
 		te->hadDumper = ReadInt(AH);
 		te->oid = ReadStr(AH);
@@ -2133,6 +2227,7 @@ WriteHead(ArchiveHandle *AH)
 	(*AH->WriteBytePtr) (AH, AH->vmin);
 	(*AH->WriteBytePtr) (AH, AH->vrev);
 	(*AH->WriteBytePtr) (AH, AH->intSize);
+	(*AH->WriteBytePtr) (AH, AH->offSize);
 	(*AH->WriteBytePtr) (AH, AH->format);
 
 #ifndef HAVE_LIBZ
@@ -2195,6 +2290,11 @@ ReadHead(ArchiveHandle *AH)
 		if (AH->intSize > sizeof(int))
 			write_msg(modulename, "WARNING: archive was made on a machine with larger integers, some operations may fail\n");
 
+		if (AH->version >= K_VERS_1_7)
+		    AH->offSize = (*AH->ReadBytePtr) (AH);
+		else
+		    AH->offSize = AH->intSize;
+
 		fmt = (*AH->ReadBytePtr) (AH);
 
 		if (AH->format != fmt)
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 3572dd11031..980d262e93d 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -17,7 +17,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.47 2002/09/04 20:31:34 momjian Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.48 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ typedef z_stream *z_streamp;
 #include "libpq-fe.h"
 
 #define K_VERS_MAJOR 1
-#define K_VERS_MINOR 6
+#define K_VERS_MINOR 7
 #define K_VERS_REV 0
 
 /* Data block types */
@@ -73,11 +73,17 @@ typedef z_stream *z_streamp;
 #define K_VERS_1_4 (( (1 * 256 + 4) * 256 + 0) * 256 + 0)		/* Date & name in header */
 #define K_VERS_1_5 (( (1 * 256 + 5) * 256 + 0) * 256 + 0)		/* Handle dependencies */
 #define K_VERS_1_6 (( (1 * 256 + 6) * 256 + 0) * 256 + 0)		/* Schema field in TOCs */
-#define K_VERS_MAX (( (1 * 256 + 6) * 256 + 255) * 256 + 0)
+#define K_VERS_1_7 (( (1 * 256 + 7) * 256 + 0) * 256 + 0)		/* File Offset size in header */
+#define K_VERS_MAX (( (1 * 256 + 7) * 256 + 255) * 256 + 0)
 
 /* No of BLOBs to restore in 1 TX */
 #define BLOB_BATCH_SIZE 100
 
+/* Flags to indicate disposition of offsets stored in files */
+#define K_OFFSET_POS_NOT_SET 1
+#define K_OFFSET_POS_SET 2
+#define K_OFFSET_NO_DATA 3
+
 struct _archiveHandle;
 struct _tocEntry;
 struct _restoreList;
@@ -148,6 +154,7 @@ typedef struct _archiveHandle
 	int			debugLevel;		/* Used for logging (currently only by
 								 * --verbose) */
 	size_t		intSize;		/* Size of an integer in the archive */
+	size_t		offSize;		/* Size of a file offset in the archive - Added V1.7 */
 	ArchiveFormat format;		/* Archive format */
 
 	sqlparseInfo sqlparse;
@@ -287,6 +294,9 @@ extern int	ReadInt(ArchiveHandle *AH);
 extern char *ReadStr(ArchiveHandle *AH);
 extern size_t WriteStr(ArchiveHandle *AH, const char *s);
 
+int ReadOffset(ArchiveHandle*, off_t*);
+size_t WriteOffset(ArchiveHandle*, off_t, int);
+
 extern void StartRestoreBlobs(ArchiveHandle *AH);
 extern void StartRestoreBlob(ArchiveHandle *AH, Oid oid);
 extern void EndRestoreBlob(ArchiveHandle *AH, Oid oid);
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c
index 37597f7b064..873bfb59ce8 100644
--- a/src/bin/pg_dump/pg_backup_custom.c
+++ b/src/bin/pg_dump/pg_backup_custom.c
@@ -19,7 +19,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.21 2002/09/04 20:31:34 momjian Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.22 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,8 +79,8 @@ typedef struct
 
 typedef struct
 {
+	int			dataState;
 	off_t		dataPos;
-	size_t		dataLen;
 } lclTocEntry;
 
 
@@ -171,7 +171,6 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
 	 */
 	if (AH->mode == archModeWrite)
 	{
-
 		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_W);
 		else
@@ -181,11 +180,9 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
 			die_horribly(AH, modulename, "could not open archive file %s: %s\n", AH->fSpec, strerror(errno));
 
 		ctx->hasSeek = (fseeko(AH->FH, 0, SEEK_CUR) == 0);
-
 	}
 	else
 	{
-
 		if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
 			AH->FH = fopen(AH->fSpec, PG_BINARY_R);
 		else
@@ -216,12 +213,11 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
 
 	ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry));
 	if (te->dataDumper)
-		ctx->dataPos = -1;
+		ctx->dataState = K_OFFSET_POS_NOT_SET;
 	else
-		ctx->dataPos = 0;
-	ctx->dataLen = 0;
-	te->formatData = (void *) ctx;
+		ctx->dataState = K_OFFSET_NO_DATA;
 
+	te->formatData = (void *) ctx;
 }
 
 /*
@@ -238,8 +234,7 @@ _WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
 	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-	WriteInt(AH, ctx->dataPos);
-	WriteInt(AH, ctx->dataLen);
+	WriteOffset(AH, ctx->dataPos, ctx->dataState);
 }
 
 /*
@@ -253,6 +248,7 @@ _WriteExtraToc(ArchiveHandle *AH, TocEntry *te)
 static void
 _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
+	int	junk;
 	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
 	if (ctx == NULL)
@@ -261,8 +257,14 @@ _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
 		te->formatData = (void *) ctx;
 	}
 
-	ctx->dataPos = ReadInt(AH);
-	ctx->dataLen = ReadInt(AH);
+	ctx->dataState = ReadOffset(AH, &(ctx->dataPos) );
+
+	/*
+	 * Prior to V1.7 (pg7.3), we dumped the data size as an int
+	 * now we don't dump it at all.
+	 */
+	if (AH->version < K_VERS_1_7)
+		junk = ReadInt(AH);
 }
 
 /*
@@ -277,8 +279,8 @@ _PrintExtraToc(ArchiveHandle *AH, TocEntry *te)
 {
 	lclTocEntry *ctx = (lclTocEntry *) te->formatData;
 
-	ahprintf(AH, "-- Data Pos: " INT64_FORMAT " (Length %lu)\n",
-			 (int64) ctx->dataPos, (unsigned long) ctx->dataLen);
+	ahprintf(AH, "-- Data Pos: " INT64_FORMAT "\n",
+			 (int64) ctx->dataPos);
 }
 
 /*
@@ -298,12 +300,12 @@ _StartData(ArchiveHandle *AH, TocEntry *te)
 	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
 	tctx->dataPos = _getFilePos(AH, ctx);
+	tctx->dataState = K_OFFSET_POS_SET;
 
 	_WriteByte(AH, BLK_DATA);	/* Block type */
 	WriteInt(AH, te->id);		/* For sanity check */
 
 	_StartDataCompressor(AH, te);
-
 }
 
 /*
@@ -343,12 +345,10 @@ _WriteData(ArchiveHandle *AH, const void *data, size_t dLen)
 static void
 _EndData(ArchiveHandle *AH, TocEntry *te)
 {
-	lclContext *ctx = (lclContext *) AH->formatData;
-	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
+/*	lclContext *ctx = (lclContext *) AH->formatData; */
+/*	lclTocEntry *tctx = (lclTocEntry *) te->formatData; */
 
 	_EndDataCompressor(AH, te);
-
-	tctx->dataLen = _getFilePos(AH, ctx) - tctx->dataPos;
 }
 
 /*
@@ -368,10 +368,10 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
 	lclTocEntry *tctx = (lclTocEntry *) te->formatData;
 
 	tctx->dataPos = _getFilePos(AH, ctx);
+	tctx->dataState = K_OFFSET_POS_SET;
 
 	_WriteByte(AH, BLK_BLOBS);	/* Block type */
 	WriteInt(AH, te->id);		/* For sanity check */
-
 }
 
 /*
@@ -428,12 +428,11 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 	int			blkType;
 	int			found = 0;
 
-	if (tctx->dataPos == 0)
+	if (tctx->dataState == K_OFFSET_NO_DATA)
 		return;
 
-	if (!ctx->hasSeek || tctx->dataPos < 0)
+	if (!ctx->hasSeek || tctx->dataState == K_OFFSET_POS_NOT_SET)
 	{
-
 		/* Skip over unnecessary blocks until we get the one we want. */
 
 		found = 0;
@@ -442,7 +441,6 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 
 		while (id != te->id)
 		{
-
 			if ((TocIDRequired(AH, id, ropt) & 2) != 0)
 				die_horribly(AH, modulename,
 							 "Dumping a specific TOC data block out of order is not supported"
@@ -450,40 +448,30 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 
 			switch (blkType)
 			{
-
 				case BLK_DATA:
-
 					_skipData(AH);
 					break;
 
 				case BLK_BLOBS:
-
 					_skipBlobs(AH);
 					break;
 
 				default:		/* Always have a default */
-
 					die_horribly(AH, modulename,
 								 "unrecognized data block type (%d) while searching archive\n",
 								 blkType);
 					break;
 			}
-
 			_readBlockHeader(AH, &blkType, &id);
-
 		}
-
 	}
 	else
 	{
-
 		/* Grab it */
-
 		if (fseeko(AH->FH, tctx->dataPos, SEEK_SET) != 0)
 			die_horribly(AH, modulename, "error during file seek: %s\n", strerror(errno));
 
 		_readBlockHeader(AH, &blkType, &id);
-
 	}
 
 	/* Are we sane? */
@@ -493,14 +481,11 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 
 	switch (blkType)
 	{
-
 		case BLK_DATA:
-
 			_PrintData(AH);
 			break;
 
 		case BLK_BLOBS:
-
 			if (!AH->connection)
 				die_horribly(AH, modulename, "large objects cannot be loaded without a database connection\n");
 
@@ -508,7 +493,6 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
 			break;
 
 		default:				/* Always have a default */
-
 			die_horribly(AH, modulename, "unrecognized data block type %d while restoring archive\n",
 						 blkType);
 			break;
@@ -579,7 +563,6 @@ _PrintData(ArchiveHandle *AH)
 
 		if (AH->compression != 0)
 		{
-
 			while (zp->avail_in != 0)
 			{
 				zp->next_out = out;
@@ -602,9 +585,7 @@ _PrintData(ArchiveHandle *AH)
 #ifdef HAVE_LIBZ
 		}
 #endif
-
 		blkLen = ReadInt(AH);
-
 	}
 
 #ifdef HAVE_LIBZ
@@ -627,7 +608,6 @@ _PrintData(ArchiveHandle *AH)
 			die_horribly(AH, modulename, "could not close compression library: %s\n", zp->msg);
 	}
 #endif
-
 }
 
 static void
@@ -647,7 +627,6 @@ _LoadBlobs(ArchiveHandle *AH)
 	}
 
 	EndRestoreBlobs(AH);
-
 }
 
 /*
@@ -702,7 +681,6 @@ _skipData(ArchiveHandle *AH)
 
 		blkLen = ReadInt(AH);
 	}
-
 }
 
 /*
@@ -862,8 +840,12 @@ _getFilePos(ArchiveHandle *AH, lclContext *ctx)
 		pos = ftello(AH->FH);
 		if (pos != ctx->filePos)
 		{
-			write_msg(modulename, "WARNING: ftell mismatch with expected position -- ftell ignored\n");
-			pos = ctx->filePos;
+			write_msg(modulename, "WARNING: ftell mismatch with expected position -- ftell used\n");
+			/*
+			 * Prior to 1.7 (pg7.3) we relied on the internally maintained pointer.
+			 * Now we rely on off_t always.
+			 * pos = ctx->filePos;
+			 */
 		}
 	}
 	else
@@ -986,8 +968,6 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
 				res = Z_STREAM_END;
 #endif
 		}
-
-
 	}
 
 #ifdef HAVE_LIBZ
@@ -995,7 +975,6 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
 #else
 	return 1;
 #endif
-
 }
 
 /*
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index 1075c06053d..93a8137431f 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -5,7 +5,7 @@
  *	Implements the basic DB functions used by the archiver.
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.42 2002/10/16 05:46:54 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.43 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,7 +65,7 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
 	 *	Autocommit could be off.  We turn it off later but we have to check
 	 *	the database version first.
 	 */
-	
+
 	res = PQexec(conn, "BEGIN;SELECT version();");
 	if (!res ||
 		PQresultStatus(res) != PGRES_TUPLES_OK ||
@@ -208,7 +208,6 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser)
 				die_horribly(AH, modulename, "could not reconnect to database: %s",
 							 PQerrorMessage(newConn));
 		}
-
 	} while (need_pass);
 
 	if (password)
@@ -469,7 +468,6 @@ _sendSQLLine(ArchiveHandle *AH, char *qry, char *eos)
 		{
 
 			case SQL_SCAN:		/* Default state == 0, set in _allocAH */
-
 				if (qry[pos] == ';' && AH->sqlparse.braceDepth == 0)
 				{
 					/* Send It & reset the buffer */
@@ -512,23 +510,19 @@ _sendSQLLine(ArchiveHandle *AH, char *qry, char *eos)
 
 					AH->sqlparse.lastChar = qry[pos];
 				}
-
 				break;
 
 			case SQL_IN_SQL_COMMENT:
-
 				if (qry[pos] == '\n')
 					AH->sqlparse.state = SQL_SCAN;
 				break;
 
 			case SQL_IN_EXT_COMMENT:
-
 				if (AH->sqlparse.lastChar == '*' && qry[pos] == '/')
 					AH->sqlparse.state = SQL_SCAN;
 				break;
 
 			case SQL_IN_QUOTE:
-
 				if (!AH->sqlparse.backSlash && AH->sqlparse.quoteChar == qry[pos])
 				{
 					/* fprintf(stderr,"[endquote]\n"); */
@@ -559,7 +553,6 @@ _sendSQLLine(ArchiveHandle *AH, char *qry, char *eos)
 	 * stmt
 	 */
 	return eos;
-
 }
 
 
diff --git a/src/bin/pg_dump/pg_backup_files.c b/src/bin/pg_dump/pg_backup_files.c
index 4bbc915e2e5..1bcb16ca002 100644
--- a/src/bin/pg_dump/pg_backup_files.c
+++ b/src/bin/pg_dump/pg_backup_files.c
@@ -20,7 +20,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.19 2002/09/10 18:25:13 tgl Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.20 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -155,7 +155,6 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
 		if (fclose(AH->FH) != 0)
 			die_horribly(AH, modulename, "could not close TOC file: %s\n", strerror(errno));
 	}
-
 }
 
 /*
@@ -244,7 +243,6 @@ _StartData(ArchiveHandle *AH, TocEntry *te)
 
 	if (tctx->FH == NULL)
 		die_horribly(AH, modulename, "could not open data file for output\n");
-
 }
 
 static size_t
@@ -298,7 +296,6 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
 
 	if (GZCLOSE(AH->FH) != 0)
 		die_horribly(AH, modulename, "could not close data file after reading\n");
-
 }
 
 
@@ -473,7 +470,6 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
 	if (ctx->blobToc == NULL)
 		die_horribly(AH, modulename,
 					 "could not open large object TOC for output: %s\n", strerror(errno));
-
 }
 
 /*
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 42cac59c329..fdfcc95d4b1 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.30 2002/09/10 18:22:20 tgl Exp $
+ *		$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.31 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -240,7 +240,6 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
 		ReadToc(AH);
 		tarClose(AH, ctx->FH);	/* Nothing else in the file... */
 	}
-
 }
 
 /*
@@ -354,7 +353,6 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
 		/* tm->zFH = gzdopen(dup(fileno(ctx->tarFH)), "rb"); */
 
 #else
-
 		tm->nFH = ctx->tarFH;
 #endif
 
@@ -708,9 +706,7 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
 
 		th = tarOpen(AH, NULL, 'r');
 	}
-
 	EndRestoreBlobs(AH);
-
 }
 
 
@@ -832,7 +828,6 @@ _CloseArchive(ArchiveHandle *AH)
 				die_horribly(AH, modulename,
 				   "could not write null block at end of tar archive\n");
 		}
-
 	}
 
 	AH->FH = NULL;
@@ -868,7 +863,6 @@ _StartBlobs(ArchiveHandle *AH, TocEntry *te)
 
 	sprintf(fname, "blobs.toc");
 	ctx->blobToc = tarOpen(AH, fname, 'w');
-
 }
 
 /*
@@ -899,7 +893,6 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
 	tarPrintf(AH, ctx->blobToc, "%u %s\n", oid, fname);
 
 	tctx->TH = tarOpen(AH, fname, 'w');
-
 }
 
 /*
@@ -931,7 +924,6 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te)
 	/* WriteInt(AH, 0); */
 
 	tarClose(AH, ctx->blobToc);
-
 }
 
 
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 0a28eeacae4..0b9a1e8b7a2 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.304 2002/10/18 22:05:35 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.305 2002/10/22 19:15:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -292,7 +292,6 @@ main(int argc, char **argv)
 				break;
 
 			case 'C':			/* Create DB */
-
 				outputCreate = 1;
 				break;
 
@@ -326,7 +325,6 @@ main(int argc, char **argv)
 				oids = true;
 				break;
 
-
 			case 'O':			/* Don't reconnect to match owner */
 				outputNoOwner = 1;
 				break;
@@ -1093,7 +1091,6 @@ dumpClasses_dumpData(Archive *fout, char *oid, void *dctxv)
 			}
 			archprintf(fout, ");\n");
 		}
-
 	} while (PQntuples(res) > 0);
 
 	archprintf(fout, "\n\n");
-- 
GitLab