From 9d244ddb26eb8521510a01271e61f9c37e74827e Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 11 Feb 2001 04:56:58 +0000
Subject: [PATCH] Cleanup of source.

---
 src/interfaces/libpq/fe-misc.c     |  12 +--
 src/interfaces/odbc/convert.c      |   3 +
 src/interfaces/odbc/dlg_specific.c |   2 +
 src/interfaces/odbc/drvconn.c      |   1 +
 src/interfaces/odbc/execute.c      |   1 +
 src/interfaces/odbc/info.c         |   3 +-
 src/interfaces/odbc/isql.h         |  18 ++---
 src/interfaces/odbc/options.c      |   1 +
 src/interfaces/odbc/qresult.c      |   2 +
 src/interfaces/odbc/resource.h     | 113 +++++++++++++++--------------
 src/interfaces/odbc/setup.c        |   1 +
 src/interfaces/odbc/socket.c       |   4 +-
 src/interfaces/odbc/statement.c    |   1 +
 src/interfaces/odbc/tuplelist.c    |   3 +
 14 files changed, 91 insertions(+), 74 deletions(-)

diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 910f705f6e3..ce3a8fef113 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -25,7 +25,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.44 2001/02/10 02:31:30 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.45 2001/02/11 04:56:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -645,9 +645,9 @@ pqFlush(PGconn *conn)
 				case ECONNRESET:
 #endif
 					printfPQExpBuffer(&conn->errorMessage,
-									  "pqFlush() -- backend closed the channel unexpectedly.\n"
-									  "\tThis probably means the backend terminated abnormally"
-						   " before or while processing the request.\n");
+						"pqFlush() -- backend closed the channel unexpectedly.\n"
+						"\tThis probably means the backend terminated abnormally"
+						" before or while processing the request.\n");
 
 					/*
 					 * We used to close the socket here, but that's a bad
@@ -661,8 +661,8 @@ pqFlush(PGconn *conn)
 
 				default:
 					printfPQExpBuffer(&conn->errorMessage,
-					  "pqFlush() --  couldn't send data: errno=%d\n%s\n",
-									  errno, strerror(errno));
+						"pqFlush() --  couldn't send data: errno=%d\n%s\n",
+						errno, strerror(errno));
 					/* We don't assume it's a fatal error... */
 					return EOF;
 			}
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 719ff43be03..d992090274b 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -233,6 +233,7 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
 	*********************************************************************/
 	switch (field_type)
 	{
+
 			/*
 			 * $$$ need to add parsing for date/time/timestamp strings in
 			 * PG_TYPE_CHAR,VARCHAR $$$
@@ -462,6 +463,7 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
 	}
 	else
 	{
+
 		/*
 		 * for SQL_C_CHAR, it's probably ok to leave currency symbols in.
 		 * But to convert to numeric types, it is necessary to get rid of
@@ -1228,6 +1230,7 @@ convert_escape(char *value)
 	}
 	else if (strcmp(key, "fn") == 0)
 	{
+
 		/*
 		 * Function invocation Separate off the func name, skipping
 		 * trailing whitespace.
diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c
index 7c8f699b2bf..64bf0e76c4d 100644
--- a/src/interfaces/odbc/dlg_specific.c
+++ b/src/interfaces/odbc/dlg_specific.c
@@ -49,6 +49,7 @@ extern GLOBAL_VALUES globals;
 void
 SetDlgStuff(HWND hdlg, ConnInfo * ci)
 {
+
 	/*
 	 * If driver attribute NOT present, then set the datasource name and
 	 * description
@@ -773,6 +774,7 @@ getGlobalDefaults(char *section, char *filename, char override)
 	/* Dont allow override of an override! */
 	if (!override)
 	{
+
 		/*
 		 * ConnSettings is stored in the driver section and per datasource
 		 * for override
diff --git a/src/interfaces/odbc/drvconn.c b/src/interfaces/odbc/drvconn.c
index 52fff3e5afc..97d7279237a 100644
--- a/src/interfaces/odbc/drvconn.c
+++ b/src/interfaces/odbc/drvconn.c
@@ -215,6 +215,7 @@ dialog:
 
 	if (szConnStrOut)
 	{
+
 		/*
 		 * Return the completed string to the caller. The correct method
 		 * is to only construct the connect string if a dialog was put up,
diff --git a/src/interfaces/odbc/execute.c b/src/interfaces/odbc/execute.c
index 69db860d3b4..0174cdede93 100644
--- a/src/interfaces/odbc/execute.c
+++ b/src/interfaces/odbc/execute.c
@@ -437,6 +437,7 @@ SQLCancel(
 	 */
 	if (stmt->data_at_exec < 0)
 	{
+
 		/*
 		 * MAJOR HACK for Windows to reset the driver manager's cursor
 		 * state: Because of what seems like a bug in the Odbc driver
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 7c22f0b3ed9..c67ac0a4bd0 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -201,7 +201,7 @@ SQLGetInfo(
 
 			/*
 			 * The ODBC spec wants ##.##.#### ...whatever... so prepend
-			 * the driver version number to the dbms version string 
+			 * the driver version number to the dbms version string
 			 */
 			sprintf(tmp, "%s %s", POSTGRESDRIVERVERSION, conn->pg_version);
 			p = tmp;
@@ -1324,6 +1324,7 @@ SQLTables(
 	result = SQLFetch(htbl_stmt);
 	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
 	{
+
 		/*
 		 * Determine if this table name is a system table. If treating
 		 * system tables as regular tables, then no need to do this test.
diff --git a/src/interfaces/odbc/isql.h b/src/interfaces/odbc/isql.h
index de50b892487..6df798a5f1d 100644
--- a/src/interfaces/odbc/isql.h
+++ b/src/interfaces/odbc/isql.h
@@ -204,26 +204,20 @@ extern		"C"
 												 SWORD cbCursorMax,
 												 SWORD FAR * pcbCursor);
 
-	RETCODE SQL_API SQLNumResultCols(HSTMT hstmt,
-												 SWORD FAR * pccol);
+	RETCODE SQL_API SQLNumResultCols(HSTMT hstmt, SWORD FAR * pccol);
 
-	RETCODE SQL_API SQLPrepare(HSTMT hstmt,
-										   UCHAR FAR * szSqlStr,
+	RETCODE SQL_API SQLPrepare(HSTMT hstmt, UCHAR FAR * szSqlStr,
 										   SDWORD cbSqlStr);
 
-	RETCODE SQL_API SQLRowCount(HSTMT hstmt,
-											SDWORD FAR * pcrow);
+	RETCODE SQL_API SQLRowCount(HSTMT hstmt, SDWORD FAR * pcrow);
 
-	RETCODE SQL_API SQLSetCursorName(HSTMT hstmt,
-												 UCHAR FAR * szCursor,
+	RETCODE SQL_API SQLSetCursorName(HSTMT hstmt, UCHAR FAR * szCursor,
 												 SWORD cbCursor);
 
-	RETCODE SQL_API SQLTransact(HENV henv,
-											HDBC hdbc,
+	RETCODE SQL_API SQLTransact(HENV henv, HDBC hdbc,
 											UWORD fType);
 
-	RETCODE SQL_API SQLSetParam(HSTMT hstmt,
-											UWORD ipar,
+	RETCODE SQL_API SQLSetParam(HSTMT hstmt, UWORD ipar,
 											SWORD fCType,
 											SWORD fSqlType,
 											UDWORD cbColDef,
diff --git a/src/interfaces/odbc/options.c b/src/interfaces/odbc/options.c
index 2ea3d6e2f61..f4797e546e2 100644
--- a/src/interfaces/odbc/options.c
+++ b/src/interfaces/odbc/options.c
@@ -307,6 +307,7 @@ SQLSetConnectOption(
 
 	switch (fOption)
 	{
+
 			/*
 			 * Statement Options (apply to all stmts on the connection and
 			 * become defaults for new stmts)
diff --git a/src/interfaces/odbc/qresult.c b/src/interfaces/odbc/qresult.c
index ff9f6a06446..66a509dd744 100644
--- a/src/interfaces/odbc/qresult.c
+++ b/src/interfaces/odbc/qresult.c
@@ -384,6 +384,7 @@ QR_next_tuple(QResultClass * self)
 	}
 	else
 	{
+
 		/*
 		 * See if we need to fetch another group of rows. We may be being
 		 * called from send_query(), and if so, don't send another fetch,
@@ -616,6 +617,7 @@ QR_read_tuple(QResultClass * self, char binary)
 		}
 		else
 		{
+
 			/*
 			 * NO, the field is not null. so get at first the length of
 			 * the field (four bytes)
diff --git a/src/interfaces/odbc/resource.h b/src/interfaces/odbc/resource.h
index 66687c44efa..a442c85149d 100644
--- a/src/interfaces/odbc/resource.h
+++ b/src/interfaces/odbc/resource.h
@@ -1,60 +1,67 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+//
+{
+	{
+		NO_DEPENDENCIES
+	}
+}
+
+//Microsoft Developer Studio generated include file.
 // Used by psqlodbc.rc
 //
-#define IDS_BADDSN                      1
-#define IDS_MSGTITLE                    2
-#define DLG_OPTIONS_DRV                 102
-#define DLG_OPTIONS_DS                  103
-#define IDC_DSNAME                      400
-#define IDC_DSNAMETEXT                  401
-#define IDC_DESC                        404
-#define IDC_SERVER                      407
-#define IDC_DATABASE                    408
-#define DLG_CONFIG                      1001
-#define IDC_PORT                        1002
-#define IDC_USER                        1006
-#define IDC_PASSWORD                    1009
-#define DS_READONLY                     1011
-#define DS_SHOWOIDCOLUMN                1012
-#define DS_FAKEOIDINDEX                 1013
-#define DRV_COMMLOG                     1014
-#define IDC_DATASOURCE                  1018
-#define DRV_OPTIMIZER                   1019
-#define DS_CONNSETTINGS                 1020
-#define IDC_DRIVER                      1021
-#define DRV_CONNSETTINGS                1031
-#define DRV_UNIQUEINDEX                 1032
-#define DRV_UNKNOWN_MAX                 1035
-#define DRV_UNKNOWN_DONTKNOW            1036
-#define DRV_READONLY                    1037
-#define IDC_DESCTEXT                    1039
-#define DRV_MSG_LABEL                   1040
-#define DRV_UNKNOWN_LONGEST             1041
-#define DRV_TEXT_LONGVARCHAR            1043
-#define DRV_UNKNOWNS_LONGVARCHAR        1044
-#define DRV_CACHE_SIZE                  1045
-#define DRV_VARCHAR_SIZE                1046
-#define DRV_LONGVARCHAR_SIZE            1047
-#define IDDEFAULTS                      1048
-#define DRV_USEDECLAREFETCH             1049
-#define DRV_BOOLS_CHAR                  1050
-#define DS_SHOWSYSTEMTABLES             1051
-#define DRV_EXTRASYSTABLEPREFIXES       1051
-#define DS_ROWVERSIONING                1052
-#define DRV_PARSE                       1052
-#define DRV_CANCELASFREESTMT            1053
-#define IDC_OPTIONS                     1054
-#define DRV_KSQO                        1055
-#define DS_PG64                         1057
+#define IDS_BADDSN						1
+#define IDS_MSGTITLE					2
+#define DLG_OPTIONS_DRV					102
+#define DLG_OPTIONS_DS					103
+#define IDC_DSNAME						400
+#define IDC_DSNAMETEXT					401
+#define IDC_DESC						404
+#define IDC_SERVER						407
+#define IDC_DATABASE					408
+#define DLG_CONFIG						1001
+#define IDC_PORT						1002
+#define IDC_USER						1006
+#define IDC_PASSWORD					1009
+#define DS_READONLY						1011
+#define DS_SHOWOIDCOLUMN				1012
+#define DS_FAKEOIDINDEX					1013
+#define DRV_COMMLOG						1014
+#define IDC_DATASOURCE					1018
+#define DRV_OPTIMIZER					1019
+#define DS_CONNSETTINGS					1020
+#define IDC_DRIVER						1021
+#define DRV_CONNSETTINGS				1031
+#define DRV_UNIQUEINDEX					1032
+#define DRV_UNKNOWN_MAX					1035
+#define DRV_UNKNOWN_DONTKNOW			1036
+#define DRV_READONLY					1037
+#define IDC_DESCTEXT					1039
+#define DRV_MSG_LABEL					1040
+#define DRV_UNKNOWN_LONGEST				1041
+#define DRV_TEXT_LONGVARCHAR			1043
+#define DRV_UNKNOWNS_LONGVARCHAR		1044
+#define DRV_CACHE_SIZE					1045
+#define DRV_VARCHAR_SIZE				1046
+#define DRV_LONGVARCHAR_SIZE			1047
+#define IDDEFAULTS						1048
+#define DRV_USEDECLAREFETCH				1049
+#define DRV_BOOLS_CHAR					1050
+#define DS_SHOWSYSTEMTABLES				1051
+#define DRV_EXTRASYSTABLEPREFIXES		1051
+#define DS_ROWVERSIONING				1052
+#define DRV_PARSE						1052
+#define DRV_CANCELASFREESTMT			1053
+#define IDC_OPTIONS						1054
+#define DRV_KSQO						1055
+#define DS_PG64							1057
 
-// Next default values for new objects
-// 
+//Next default values for new
+	objects
+		//
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        104
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1060
-#define _APS_NEXT_SYMED_VALUE           101
+#define _APS_NEXT_RESOURCE_VALUE		104
+#define _APS_NEXT_COMMAND_VALUE			40001
+#define _APS_NEXT_CONTROL_VALUE			1060
+#define _APS_NEXT_SYMED_VALUE			101
 #endif
 #endif
diff --git a/src/interfaces/odbc/setup.c b/src/interfaces/odbc/setup.c
index 220d563cbce..ca9d5c4b2ff 100644
--- a/src/interfaces/odbc/setup.c
+++ b/src/interfaces/odbc/setup.c
@@ -264,6 +264,7 @@ ConfigDlgProc(HWND hdlg,
 
 			switch (GET_WM_COMMAND_ID(wParam, lParam))
 			{
+
 					/*
 					 * Ensure the OK button is enabled only when a data
 					 * source name
diff --git a/src/interfaces/odbc/socket.c b/src/interfaces/odbc/socket.c
index d062ba56930..fbd8491e563 100644
--- a/src/interfaces/odbc/socket.c
+++ b/src/interfaces/odbc/socket.c
@@ -91,7 +91,8 @@ SOCK_Destructor(SocketClass * self)
 		free(self->buffer_in);
 
 	if (self->buffer_out)
-		free(self->buffer_out);
+		SOCK_put_n_char(self, (char *) &rv, 2);
+	free(self->buffer_out);
 
 	free(self);
 }
@@ -256,7 +257,6 @@ SOCK_put_int(SocketClass * self, int value, short len)
 	{
 		case 2:
 			rv = self->reverse ? value : htons((unsigned short) value);
-			SOCK_put_n_char(self, (char *) &rv, 2);
 			return;
 
 		case 4:
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c
index b473e2d5299..b2a1eb0ceba 100644
--- a/src/interfaces/odbc/statement.c
+++ b/src/interfaces/odbc/statement.c
@@ -681,6 +681,7 @@ SC_fetch(StatementClass * self)
 		if (self->currTuple >= QR_get_num_tuples(res) - 1 ||
 			(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1))
 		{
+
 			/*
 			 * if at the end of the tuples, return "no data found" and set
 			 * the cursor past the end of the result set
diff --git a/src/interfaces/odbc/tuplelist.c b/src/interfaces/odbc/tuplelist.c
index 7d879c04d12..519222f051f 100644
--- a/src/interfaces/odbc/tuplelist.c
+++ b/src/interfaces/odbc/tuplelist.c
@@ -133,6 +133,7 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
 	}
 	else if (start_is_closer)
 	{
+
 		/*
 		 * the shortest way is to start the search from the head of the
 		 * list
@@ -179,6 +180,7 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
 char
 TL_add_tuple(TupleListClass * self, TupleNode * new_field)
 {
+
 	/*
 	 * we append the tuple at the end of the doubly linked list of the
 	 * tuples we have already read in
@@ -197,6 +199,7 @@ TL_add_tuple(TupleListClass * self, TupleNode * new_field)
 	}
 	else
 	{
+
 		/*
 		 * there is already an element in the list, so add the new one at
 		 * the end of the list
-- 
GitLab