From 1670e38652d9cc5d683c853e43d6f8502097b2b7 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 5 Nov 2001 17:46:39 +0000 Subject: [PATCH] New pgindent run with fixes suggested by Tom. Patch manually reviewed, initdb/regression tests pass. --- bind.h | 2 +- connection.c | 8 +-- connection.h | 2 +- convert.c | 130 +++++++++++++++++++++++++++---------------------- convert.h | 2 +- dlg_specific.c | 10 ++-- dlg_specific.h | 2 +- drvconn.c | 4 +- environ.c | 2 +- gpps.c | 4 +- info.c | 38 +++++++-------- iodbc.h | 4 +- isql.h | 8 +-- isqlext.h | 2 +- odbcapi30.c | 4 +- parse.c | 2 +- pgapifunc.h | 2 +- pgtypes.c | 17 ++++--- pgtypes.h | 4 +- psqlodbc.c | 4 +- psqlodbc.h | 30 ++++++------ resource.h | 4 +- results.c | 10 ++-- setup.c | 2 +- statement.c | 15 +++--- 25 files changed, 165 insertions(+), 147 deletions(-) diff --git a/bind.h b/bind.h index 363abb0..34b9e1d 100644 --- a/bind.h +++ b/bind.h @@ -22,7 +22,7 @@ struct BindInfoClass_ char *buffer; /* pointer to the buffer */ Int4 *used; /* used space in the buffer (for strings * not counting the '\0') */ - char *ttlbuf; /* to save the large result */ + char *ttlbuf; /* to save the large result */ Int4 ttlbuflen; /* the buffer length */ Int2 returntype; /* kind of conversion to be applied when * returning (SQL_C_DEFAULT, diff --git a/connection.c b/connection.c index c5aac61..a8abb12 100644 --- a/connection.c +++ b/connection.c @@ -251,7 +251,7 @@ CC_Constructor() memset(&rv->connInfo, 0, sizeof(ConnInfo)); #ifdef DRIVER_CURSOR_IMPLEMENT rv->connInfo.updatable_cursors = 1; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ memcpy(&(rv->connInfo.drivers), &globals, sizeof(globals)); rv->sock = SOCK_Constructor(rv); if (!rv->sock) @@ -282,7 +282,7 @@ CC_Constructor() #ifdef MULTIBYTE rv->client_encoding = NULL; rv->server_encoding = NULL; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* Initialize statement options to defaults */ @@ -313,7 +313,7 @@ CC_Destructor(ConnectionClass *self) free(self->client_encoding); if (self->server_encoding) free(self->server_encoding); -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* Free up statement holders */ if (self->stmts) { @@ -525,7 +525,7 @@ CC_connect(ConnectionClass *self, char do_password) #ifdef MULTIBYTE char *encoding; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ mylog("%s: entering...\n", func); diff --git a/connection.h b/connection.h index f2c2160..a80c31b 100644 --- a/connection.h +++ b/connection.h @@ -269,7 +269,7 @@ struct ConnectionClass_ #ifdef MULTIBYTE char *client_encoding; char *server_encoding; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ }; diff --git a/convert.c b/convert.c index f284b16..59dab20 100644 --- a/convert.c +++ b/convert.c @@ -39,9 +39,9 @@ #include "pgapifunc.h" #ifdef __CYGWIN__ -#define TIMEZONE_GLOBAL _timezone +#define TIMEZONE_GLOBAL _timezone #elif defined(WIN32) || defined(HAVE_INT_TIMEZONE) -#define TIMEZONE_GLOBAL timezone +#define TIMEZONE_GLOBAL timezone #endif /* @@ -141,17 +141,20 @@ static char *conv_to_octal(unsigned char val); -/* +/* * TIMESTAMP <-----> SIMPLE_TIME * precision support since 7.2. * time zone support is unavailable(the stuff is unreliable) */ -static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int *zone) +static BOOL +timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone) { - char rest[64], *ptr; - int scnt, i; + char rest[64], + *ptr; + int scnt, + i; long timediff; - BOOL withZone = *bZone; + BOOL withZone = *bZone; *bZone = FALSE; *zone = 0; @@ -194,7 +197,7 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int st->fr = atoi(&rest[1]); break; default: - return TRUE; + return TRUE; } if (!withZone || !*bZone || st->y < 1970) return TRUE; @@ -205,11 +208,12 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int return TRUE; } timediff = TIMEZONE_GLOBAL + (*zone) * 3600; - if (!daylight && timediff == 0) /* the same timezone */ + if (!daylight && timediff == 0) /* the same timezone */ return TRUE; else { - struct tm tm, *tm2; + struct tm tm, + *tm2; time_t time0; *bZone = FALSE; @@ -225,7 +229,7 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int return TRUE; if (tm.tm_isdst > 0) timediff -= 3600; - if (timediff == 0) /* the same time zone */ + if (timediff == 0) /* the same time zone */ return TRUE; time0 -= timediff; if (time0 >= 0 && (tm2 = localtime(&time0)) != NULL) @@ -233,20 +237,22 @@ static BOOL timestamp2stime(const char * str, SIMPLE_TIME *st, BOOL *bZone, int st->y = tm2->tm_year + 1900; st->m = tm2->tm_mon + 1; st->d = tm2->tm_mday; - st->hh= tm2->tm_hour; - st->mm= tm2->tm_min; - st->ss= tm2->tm_sec; + st->hh = tm2->tm_hour; + st->mm = tm2->tm_min; + st->ss = tm2->tm_sec; *bZone = TRUE; } } -#endif /* WIN32 */ - return TRUE; +#endif /* WIN32 */ + return TRUE; } -static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL precision) +static BOOL +stime2timestamp(const SIMPLE_TIME *st, char *str, BOOL bZone, BOOL precision) { - char precstr[16], zonestr[16]; - int i; + char precstr[16], + zonestr[16]; + int i; precstr[0] = '\0'; if (precision && st->fr) @@ -263,13 +269,13 @@ static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL #if defined(WIN32) || defined(HAVE_INT_TIMEZONE) if (bZone && tzname[0] && tzname[0][0] && st->y >= 1970) { - long zoneint; + long zoneint; struct tm tm; time_t time0; zoneint = TIMEZONE_GLOBAL; - if (daylight && st->y >=1900) - { + if (daylight && st->y >= 1900) + { tm.tm_year = st->y - 1900; tm.tm_mon = st->m - 1; tm.tm_mday = st->d; @@ -282,13 +288,13 @@ static BOOL stime2timestamp(const SIMPLE_TIME *st, char * str, BOOL bZone, BOOL zoneint -= 3600; } if (zoneint > 0) - sprintf(zonestr, "-%02d", (int)zoneint / 3600); + sprintf(zonestr, "-%02d", (int) zoneint / 3600); else - sprintf(zonestr, "+%02d", -(int)zoneint / 3600); + sprintf(zonestr, "+%02d", -(int) zoneint / 3600); } -#endif /* WIN32 */ +#endif /* WIN32 */ sprintf(str, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d%s%s", st->y, st->m, st->d, st->hh, st->mm, st->ss, precstr, zonestr); - return TRUE; + return TRUE; } /* This is called by SQLFetch() */ @@ -323,14 +329,15 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 const char *neut_str = value; char midtemp[2][32]; int mtemp_cnt = 0; - static BindInfoClass sbic; - BindInfoClass *pbic; + static BindInfoClass sbic; + BindInfoClass *pbic; if (stmt->current_col >= 0) { pbic = &stmt->bindings[stmt->current_col]; if (pbic->data_left == -2) - pbic->data_left = (cbValueMax > 0) ? 0 : -1; /* This seems to be * needed for ADO ? */ + pbic->data_left = (cbValueMax > 0) ? 0 : -1; /* This seems to be * + * needed for ADO ? */ if (pbic->data_left == 0) { if (pbic->ttlbuf != NULL) @@ -339,8 +346,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 pbic->ttlbuf = NULL; pbic->ttlbuflen = 0; } - pbic->data_left = -2; /* needed by ADO ? */ - return COPY_NO_DATA_FOUND; + pbic->data_left = -2; /* needed by ADO ? */ + return COPY_NO_DATA_FOUND; } } /*--------- @@ -416,10 +423,14 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 st.fr = 0; if (strnicmp(value, "invalid", 7) != 0) { - BOOL bZone = (field_type != PG_TYPE_TIMESTAMP_NO_TMZONE && PG_VERSION_GE(SC_get_conn(stmt), 7.2)); - int zone; - /*sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);*/ - bZone = FALSE; /* time zone stuff is unreliable */ + BOOL bZone = (field_type != PG_TYPE_TIMESTAMP_NO_TMZONE && PG_VERSION_GE(SC_get_conn(stmt), 7.2)); + int zone; + + /* + * sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, + * &st.d, &st.hh, &st.mm, &st.ss); + */ + bZone = FALSE; /* time zone stuff is unreliable */ timestamp2stime(value, &st, &bZone, &zone); } else @@ -710,7 +721,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 { case SQL_C_DATE: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_DATE: /* 91 */ + case SQL_C_TYPE_DATE: /* 91 */ #endif len = 6; { @@ -728,7 +739,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 case SQL_C_TIME: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_TIME: /* 92 */ + case SQL_C_TYPE_TIME: /* 92 */ #endif len = 6; { @@ -746,7 +757,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 case SQL_C_TIMESTAMP: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_TIMESTAMP: /* 93 */ + case SQL_C_TYPE_TIMESTAMP: /* 93 */ #endif len = 16; { @@ -923,7 +934,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 if (pcbValue) *(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len; - if (result == COPY_OK && stmt->current_col >=0) + if (result == COPY_OK && stmt->current_col >= 0) stmt->bindings[stmt->current_col].data_left = 0; return result; @@ -1180,7 +1191,7 @@ copy_statement_with_parameters(StatementClass *stmt) #ifdef DRIVER_CURSOR_IMPLEMENT BOOL search_from_pos = FALSE; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ if (ci->disallow_premature) prepare_dummy_cursor = stmt->pre_executing; @@ -1217,7 +1228,7 @@ copy_statement_with_parameters(StatementClass *stmt) else search_from_pos = TRUE; } -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ /* If the application hasn't set a cursor name, then generate one */ if (stmt->cursor_name[0] == '\0') @@ -1346,7 +1357,7 @@ copy_statement_with_parameters(StatementClass *stmt) if (multibyte_strchr(&old_statement[opos], '(')) #else if (strchr(&old_statement[opos], '(')) -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ proc_no_param = FALSE; continue; } @@ -1417,7 +1428,7 @@ copy_statement_with_parameters(StatementClass *stmt) npos -= 5; CVT_APPEND_STR(", CTID, OID from"); } -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ } if (token_len == 3) { @@ -1591,7 +1602,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_C_DATE: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_DATE: /* 91 */ + case SQL_C_TYPE_DATE: /* 91 */ #endif { DATE_STRUCT *ds = (DATE_STRUCT *) buffer; @@ -1605,7 +1616,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_C_TIME: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_TIME: /* 92 */ + case SQL_C_TYPE_TIME: /* 92 */ #endif { TIME_STRUCT *ts = (TIME_STRUCT *) buffer; @@ -1619,7 +1630,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_C_TIMESTAMP: #if (ODBCVER >= 0x0300) - case SQL_C_TYPE_TIMESTAMP: /* 93 */ + case SQL_C_TYPE_TIMESTAMP: /* 93 */ #endif { TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer; @@ -1682,7 +1693,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_DATE: #if (ODBCVER >= 0x0300) - case SQL_TYPE_DATE: /* 91 */ + case SQL_TYPE_DATE: /* 91 */ #endif if (buf) { /* copy char data to time */ @@ -1697,7 +1708,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_TIME: #if (ODBCVER >= 0x0300) - case SQL_TYPE_TIME: /* 92 */ + case SQL_TYPE_TIME: /* 92 */ #endif if (buf) { /* copy char data to time */ @@ -1712,7 +1723,7 @@ copy_statement_with_parameters(StatementClass *stmt) case SQL_TIMESTAMP: #if (ODBCVER >= 0x0300) - case SQL_TYPE_TIMESTAMP: /* 93 */ + case SQL_TYPE_TIMESTAMP: /* 93 */ #endif if (buf) @@ -1721,8 +1732,10 @@ copy_statement_with_parameters(StatementClass *stmt) parse_datetime(cbuf, &st); } - /* sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'", - st.y, st.m, st.d, st.hh, st.mm, st.ss);*/ + /* + * sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'", st.y, + * st.m, st.d, st.hh, st.mm, st.ss); + */ tmp[0] = '\''; /* Time zone stuff is unreliable */ stime2timestamp(&st, tmp + 1, FALSE, PG_VERSION_GE(conn, 7.2)); @@ -1916,7 +1929,7 @@ copy_statement_with_parameters(StatementClass *stmt) #ifdef DRIVER_CURSOR_IMPLEMENT if (search_from_pos) stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ if (prepare_dummy_cursor && SC_is_pre_executable(stmt)) { char fetchstr[128]; @@ -2414,10 +2427,12 @@ static const char *hextbl = "0123456789ABCDEF"; static int pg_bin2hex(UCHAR *src, UCHAR *dst, int length) { - UCHAR chr, *src_wk, *dst_wk; - BOOL backwards; - int i; - + UCHAR chr, + *src_wk, + *dst_wk; + BOOL backwards; + int i; + backwards = FALSE; if (dst < src) { @@ -2447,6 +2462,7 @@ pg_bin2hex(UCHAR *src, UCHAR *dst, int length) dst[2 * length] = '\0'; return length; } + /*------- * 1. get oid (from 'value') * 2. open the large object @@ -2474,7 +2490,7 @@ convert_lo(StatementClass *stmt, const void *value, Int2 fCType, PTR rgbValue, BindInfoClass *bindInfo = NULL; ConnectionClass *conn = SC_get_conn(stmt); ConnInfo *ci = &(conn->connInfo); - int factor = (fCType == SQL_C_CHAR ? 2 : 1); + int factor = (fCType == SQL_C_CHAR ? 2 : 1); /* If using SQLGetData, then current_col will be set */ if (stmt->current_col >= 0) diff --git a/convert.h b/convert.h index 2257fb2..565ce6b 100644 --- a/convert.h +++ b/convert.h @@ -28,7 +28,7 @@ typedef struct int mm; int ss; int fr; -} SIMPLE_TIME; +} SIMPLE_TIME; int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col); int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, diff --git a/dlg_specific.c b/dlg_specific.c index d264821..b757a93 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -445,11 +445,11 @@ updateCommons(const ConnInfo *ci) { sprintf(tmp, "%d", comval->unique_index); SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp, - fileName); + fileName); - sprintf(tmp, "%d", comval->onlyread); - SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp, - fileName); + sprintf(tmp, "%d", comval->onlyread); + SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp, + fileName); } sprintf(tmp, "%d", comval->use_declarefetch); @@ -497,7 +497,7 @@ updateCommons(const ConnInfo *ci) * comval->conn_settings, fileName); */ } -#endif /* WIN32 */ +#endif /* WIN32 */ void diff --git a/dlg_specific.h b/dlg_specific.h index 3d99857..b319212 100644 --- a/dlg_specific.h +++ b/dlg_specific.h @@ -134,7 +134,7 @@ int CALLBACK ds_optionsProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam); -#endif /* WIN32 */ +#endif /* WIN32 */ void updateGlobals(void); void writeDSNinfo(const ConnInfo *ci); diff --git a/drvconn.c b/drvconn.c index bdcf6af..e369525 100644 --- a/drvconn.c +++ b/drvconn.c @@ -338,7 +338,7 @@ dconn_FDriverConnectProc( return FALSE; } -#endif /* WIN32 */ +#endif /* WIN32 */ void @@ -354,7 +354,7 @@ dconn_get_connect_attributes(const UCHAR FAR * connect_string, ConnInfo *ci) memset(ci, 0, sizeof(ConnInfo)); #ifdef DRIVER_CURSOR_IMPLEMENT ci->updatable_cursors = 1; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ our_connect_string = strdup(connect_string); strtok_arg = our_connect_string; diff --git a/environ.c b/environ.c index 9bb9615..304d31d 100644 --- a/environ.c +++ b/environ.c @@ -517,7 +517,7 @@ EN_Destructor(EnvironmentClass *self) mylog("exit EN_Destructor: rv = %d\n", rv); #ifdef _MEMORY_DEBUG_ debug_memory_inouecheck(); -#endif /* _MEMORY_DEBUG_ */ +#endif /* _MEMORY_DEBUG_ */ return rv; } diff --git a/gpps.c b/gpps.c index 3d578c9..ee73a23 100644 --- a/gpps.c +++ b/gpps.c @@ -449,6 +449,6 @@ if (!keyFound) return aReturnLength > 0 ? aReturnLength - 1 : 0; } -#endif /* NOT_USED */ +#endif /* NOT_USED */ -#endif /* not WIN32 */ +#endif /* not WIN32 */ diff --git a/info.c b/info.c index 23291b5..c77b3c5 100644 --- a/info.c +++ b/info.c @@ -2839,7 +2839,7 @@ getClientColumnName(ConnectionClass *conn, const char *serverTableName, char *se } return ret; } -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ RETCODE SQL_API PGAPI_ForeignKeys( @@ -2888,7 +2888,7 @@ PGAPI_ForeignKeys( pkt_alloced, fkt_alloced; ConnectionClass *conn; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ int i, j, k, @@ -2950,7 +2950,7 @@ PGAPI_ForeignKeys( QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING); #if (ODBCVER >= 0x0300) QR_set_field_info(stmt->result, 14, "DEFERRABILITY", PG_TYPE_INT2, 2); -#endif /* ODBCVER >= 0x0300 */ +#endif /* ODBCVER >= 0x0300 */ /* * also, things need to think that this statement is finished so the @@ -2985,7 +2985,7 @@ PGAPI_ForeignKeys( pkey_text = fkey_text = pkt_text = fkt_text = NULL; pkey_alloced = fkey_alloced = pkt_alloced = fkt_alloced = FALSE; conn = SC_get_conn(stmt); -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* * Case #2 -- Get the foreign keys in the specified table (fktab) that @@ -3151,7 +3151,7 @@ PGAPI_ForeignKeys( pkt_text = getClientTableName(conn, pk_table, &pkt_alloced); #else pkt_text = pk_table; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* If there is a pk table specified, then check it. */ if (pk_table_needed[0] != '\0') { @@ -3192,7 +3192,7 @@ PGAPI_ForeignKeys( pkey_text = getClientColumnName(conn, pk_table, pkey_ptr, &pkey_alloced); #else pkey_text = pkey_ptr; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_text, pkey); if (strcmp(pkey_text, pkey)) { @@ -3202,7 +3202,7 @@ PGAPI_ForeignKeys( #ifdef MULTIBYTE if (pkey_alloced) free(pkey_text); -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* Get to next primary key */ for (k = 0; k < 2; k++) pkey_ptr += strlen(pkey_ptr) + 1; @@ -3245,7 +3245,7 @@ PGAPI_ForeignKeys( defer_type = SQL_INITIALLY_IMMEDIATE; else defer_type = SQL_NOT_DEFERRABLE; -#endif /* ODBCVER >= 0x0300 */ +#endif /* ODBCVER >= 0x0300 */ /* Get to first primary key */ pkey_ptr = trig_args; @@ -3262,7 +3262,7 @@ PGAPI_ForeignKeys( #else pkey_text = pkey_ptr; fkey_text = fkey_ptr; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pkt_text, pkey_text); set_tuplefield_null(&row->tuple[0]); set_tuplefield_string(&row->tuple[1], ""); @@ -3284,7 +3284,7 @@ PGAPI_ForeignKeys( set_tuplefield_string(&row->tuple[13], trig_args); #if (ODBCVER >= 0x0300) set_tuplefield_int2(&row->tuple[14], defer_type); -#endif /* ODBCVER >= 0x0300 */ +#endif /* ODBCVER >= 0x0300 */ QR_add_tuple(stmt->result, row); #ifdef MULTIBYTE @@ -3294,7 +3294,7 @@ PGAPI_ForeignKeys( if (pkey_alloced) free(pkey_text); pkey_alloced = FALSE; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* next primary/foreign key */ for (i = 0; i < 2; i++) { @@ -3306,7 +3306,7 @@ PGAPI_ForeignKeys( if (pkt_alloced) free(pkt_text); pkt_alloced = FALSE; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ result = PGAPI_Fetch(htbl_stmt); } @@ -3475,7 +3475,7 @@ PGAPI_ForeignKeys( defer_type = SQL_INITIALLY_IMMEDIATE; else defer_type = SQL_NOT_DEFERRABLE; -#endif /* ODBCVER >= 0x0300 */ +#endif /* ODBCVER >= 0x0300 */ mylog("Foreign Key Case#1: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys); @@ -3492,7 +3492,7 @@ PGAPI_ForeignKeys( fkt_text = getClientTableName(conn, fk_table, &fkt_alloced); #else fkt_text = fk_table; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* Get to first foreign key */ fkey_ptr = trig_args; @@ -3507,7 +3507,7 @@ PGAPI_ForeignKeys( #else pkey_text = pkey_ptr; fkey_text = fkey_ptr; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_text, fkt_text, fkey_text); row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField)); @@ -3538,7 +3538,7 @@ PGAPI_ForeignKeys( #if (ODBCVER >= 0x0300) mylog("defer_type = '%s'", defer_type); set_tuplefield_int2(&row->tuple[14], defer_type); -#endif /* ODBCVER >= 0x0300 */ +#endif /* ODBCVER >= 0x0300 */ QR_add_tuple(stmt->result, row); #ifdef MULTIBYTE @@ -3548,7 +3548,7 @@ PGAPI_ForeignKeys( if (fkey_alloced) free(fkey_text); fkey_alloced = FALSE; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ /* next primary/foreign key */ for (j = 0; j < 2; j++) @@ -3561,7 +3561,7 @@ PGAPI_ForeignKeys( if (fkt_alloced) free(fkt_text); fkt_alloced = FALSE; -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ result = PGAPI_Fetch(htbl_stmt); } } @@ -3582,7 +3582,7 @@ PGAPI_ForeignKeys( free(fkt_text); if (fkey_alloced) free(fkey_text); -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ PGAPI_FreeStmt(htbl_stmt, SQL_DROP); diff --git a/iodbc.h b/iodbc.h index 9d826b3..f8e7d24 100644 --- a/iodbc.h +++ b/iodbc.h @@ -33,7 +33,7 @@ typedef WORD WPARAM; typedef DWORD LPARAM; typedef void *HWND; typedef int BOOL; -#endif /* _UNIX_ */ +#endif /* _UNIX_ */ #if defined(WIN32) || defined(WIN32_SYSTEM) @@ -57,7 +57,7 @@ typedef int BOOL; #define STRLEN(str) ((str)? _fstrlen((char FAR*)(str)):0) #define STREQ(a, b) (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0) #endif -#endif /* WIN32 */ +#endif /* WIN32 */ #define SYSERR (-1) diff --git a/isql.h b/isql.h index 8aa0d18..67f27d5 100644 --- a/isql.h +++ b/isql.h @@ -234,10 +234,10 @@ extern "C" SDWORD FAR * pcbValue); RETCODE SQL_API SQLDataSources(HENV henv, - UWORD Direction, UCHAR FAR *ServerName, - WORD BufferLength1, WORD *NameLength1, - UCHAR FAR *Description, WORD BufferLength2, - WORD *NameLength2); + UWORD Direction, UCHAR FAR * ServerName, + WORD BufferLength1, WORD *NameLength1, + UCHAR FAR * Description, WORD BufferLength2, + WORD *NameLength2); #ifdef __cplusplus } diff --git a/isqlext.h b/isqlext.h index bb5292e..758d1bd 100644 --- a/isqlext.h +++ b/isqlext.h @@ -378,7 +378,7 @@ typedef struct SQLUINTEGER dwLowWord; SQLINTEGER dwHighWord; } SQLBIGINT; -#endif /* GCC */ +#endif /* GCC */ typedef struct tagDATE_STRUCT { diff --git a/odbcapi30.c b/odbcapi30.c index 9de10a9..8ad1dba 100644 --- a/odbcapi30.c +++ b/odbcapi30.c @@ -344,7 +344,7 @@ SQLGetStmtAttr(HSTMT StatementHandle, len = 4; break; case SQL_ATTR_AUTO_IPD: /* 10001 */ - /* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */ + /* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */ case SQL_ATTR_PARAMSET_SIZE: /* 22 */ case SQL_ATTR_PARAM_STATUS_PTR: /* 20 */ case SQL_ATTR_PARAMS_PROCESSED_PTR: /* 21 */ @@ -484,7 +484,7 @@ SQLSetStmtAttr(HSTMT StatementHandle, case SQL_ATTR_APP_ROW_DESC: /* 10010 */ case SQL_ATTR_APP_PARAM_DESC: /* 10011 */ case SQL_ATTR_AUTO_IPD: /* 10001 */ - /* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */ + /* case SQL_ATTR_ROW_BIND_TYPE: ** == SQL_BIND_TYPE(ODBC2.0) */ case SQL_ATTR_IMP_ROW_DESC: /* 10012 */ case SQL_ATTR_IMP_PARAM_DESC: /* 10013 */ case SQL_ATTR_METADATA_ID: /* 10014 */ diff --git a/parse.c b/parse.c index 27d1e95..e73cb82 100644 --- a/parse.c +++ b/parse.c @@ -615,7 +615,7 @@ parse_statement(StatementClass *stmt) if ((unsigned char) *ptr >= 0x80) ptr++; else -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ *ptr = tolower((unsigned char) *ptr); } } diff --git a/pgapifunc.h b/pgapifunc.h index dadabe1..2ebf203 100644 --- a/pgapifunc.h +++ b/pgapifunc.h @@ -241,4 +241,4 @@ RETCODE SQL_API PGAPI_SetScrollOptions( SDWORD crowKeyset, UWORD crowRowset); -#endif /* define_PG_API_FUNC_H__ */ +#endif /* define_PG_API_FUNC_H__ */ diff --git a/pgtypes.c b/pgtypes.c index 0a7bd35..1388650 100644 --- a/pgtypes.c +++ b/pgtypes.c @@ -539,7 +539,7 @@ getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_si static Int2 getTimestampScale(StatementClass *stmt, Int4 type, int col) { - ConnectionClass *conn = SC_get_conn (stmt); + ConnectionClass *conn = SC_get_conn(stmt); Int4 atttypmod; QResultClass *result; ColumnInfoClass *flds; @@ -563,11 +563,11 @@ getTimestampScale(StatementClass *stmt, Int4 type, int col) flds = result->fields; if (flds) atttypmod = flds->atttypmod[col]; -mylog("atttypmod1=%d\n", atttypmod); + mylog("atttypmod1=%d\n", atttypmod); } - else + else atttypmod = QR_get_atttypmod(result, col); -mylog("atttypmod2=%d\n", atttypmod); + mylog("atttypmod2=%d\n", atttypmod); return (atttypmod > -1 ? atttypmod : 0); } @@ -575,7 +575,8 @@ mylog("atttypmod2=%d\n", atttypmod); static Int4 getTimestampPrecision(StatementClass *stmt, Int4 type, int col) { - Int4 fixed, scale; + Int4 fixed, + scale; mylog("getTimestampPrecision: type=%d, col=%d\n", type, col); @@ -594,8 +595,8 @@ getTimestampPrecision(StatementClass *stmt, Int4 type, int col) fixed = 22; break; } - scale = getTimestampScale(stmt, type, col); - return (scale > 0) ? fixed + 1 + scale : fixed; + scale = getTimestampScale(stmt, type, col); + return (scale > 0) ? fixed + 1 + scale : fixed; } /* @@ -760,7 +761,7 @@ pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_ #else /* CR -> CR/LF */ return 2 * pgtype_precision(stmt, type, col, handle_unknown_size_as); -#endif /* MULTIBYTE */ +#endif /* MULTIBYTE */ default: return pgtype_precision(stmt, type, col, handle_unknown_size_as); } diff --git a/pgtypes.h b/pgtypes.h index 0e6a1cc..1d27643 100644 --- a/pgtypes.h +++ b/pgtypes.h @@ -58,9 +58,9 @@ #define PG_TYPE_VARCHAR 1043 #define PG_TYPE_DATE 1082 #define PG_TYPE_TIME 1083 -#define PG_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */ +#define PG_TYPE_TIMESTAMP_NO_TMZONE 1114 /* since 7.2 */ #define PG_TYPE_DATETIME 1184 -#define PG_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */ +#define PG_TYPE_TIME_WITH_TMZONE 1266 /* since 7.1 */ #define PG_TYPE_TIMESTAMP 1296 /* deprecated since 7.0 */ #define PG_TYPE_NUMERIC 1700 diff --git a/psqlodbc.c b/psqlodbc.c index 841360d..cc8d8b7 100644 --- a/psqlodbc.c +++ b/psqlodbc.c @@ -114,8 +114,8 @@ _fini(void) { return TRUE; } -#endif /* not __GNUC__ */ -#endif /* not WIN32 */ +#endif /* not __GNUC__ */ +#endif /* not WIN32 */ /* diff --git a/psqlodbc.h b/psqlodbc.h index 34972f2..5317be3 100644 --- a/psqlodbc.h +++ b/psqlodbc.h @@ -5,7 +5,7 @@ * * Comments: See "notice.txt" for copyright and license information. * - * $Id: psqlodbc.h,v 1.55 2001/11/05 10:35:14 inoue Exp $ + * $Id: psqlodbc.h,v 1.56 2001/11/05 17:46:38 momjian Exp $ * */ @@ -21,9 +21,9 @@ #include /* for FILE* pointers: see GLOBAL_VALUES */ /* Must come before sql.h */ -#ifndef ODBCVER +#ifndef ODBCVER #define ODBCVER 0x0250 -#endif /* ODBCVER_REP */ +#endif /* ODBCVER_REP */ #if defined(WIN32) || defined(WITH_UNIXODBC) || defined(WITH_IODBC) @@ -83,7 +83,7 @@ typedef UInt4 Oid; #else #define DRIVER_ODBC_VER "02.50" #define DBMS_NAME "PostgreSQL" -#endif /* ODBCVER */ +#endif /* ODBCVER */ #define POSTGRESDRIVERVERSION "07.01.0009" @@ -92,10 +92,10 @@ typedef UInt4 Oid; #define DRIVER_FILE_NAME "PSQLODBC30.DLL" #else #define DRIVER_FILE_NAME "PSQLODBC.DLL" -#endif /* ODBCVER */ +#endif /* ODBCVER */ #else #define DRIVER_FILE_NAME "libpsqlodbc.so" -#endif /* WIN32 */ +#endif /* WIN32 */ /* Limits */ #ifdef WIN32 @@ -209,14 +209,14 @@ typedef struct StatementOptions_ UInt4 *rowsFetched; UInt2 *rowStatusArray; void *bookmark_ptr; - UInt2 *row_operation_ptr; - UInt4 *row_offset_ptr; - UInt4 paramset_size; - UInt4 param_bind_type; - UInt4 *param_processed_ptr; - UInt2 *param_status_ptr; - UInt2 *param_operation_ptr; - UInt4 *param_offset_ptr; + UInt2 *row_operation_ptr; + UInt4 *row_offset_ptr; + UInt4 paramset_size; + UInt4 param_bind_type; + UInt4 *param_processed_ptr; + UInt2 *param_status_ptr; + UInt2 *param_operation_ptr; + UInt4 *param_offset_ptr; } StatementOptions; /* Used to pass extra query info to send_query */ @@ -263,6 +263,6 @@ void debug_memory_check(void); #define realloc debug_realloc #define strdup debug_strdup #define free debug_free -#endif /* _MEMORY_DEBUG_ */ +#endif /* _MEMORY_DEBUG_ */ #endif diff --git a/resource.h b/resource.h index b60d0df..b8bbd4f 100644 --- a/resource.h +++ b/resource.h @@ -61,6 +61,6 @@ #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1062 #define _APS_NEXT_SYMED_VALUE 101 -#endif /* */ +#endif /* */ -#endif /* */ +#endif /* */ diff --git a/results.c b/results.c index 7d9ce4c..a5cee56 100644 --- a/results.c +++ b/results.c @@ -1165,7 +1165,7 @@ PGAPI_ExtendedFetch( /* this should be refined */ else if (result > 10 && result < 20) *(rgfRowStatus + i) = result - 10; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ else *(rgfRowStatus + i) = SQL_ROW_SUCCESS; } @@ -1721,7 +1721,7 @@ SC_pos_add(StatementClass *stmt, /* * Stuff for updatable cursors end. */ -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ /* * This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. @@ -1752,7 +1752,7 @@ PGAPI_SetPos( if (stmt->options.scroll_concurrency != SQL_CONCUR_READ_ONLY) ; else -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ if (fOption != SQL_POSITION && fOption != SQL_REFRESH) { stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR; @@ -1798,7 +1798,7 @@ PGAPI_SetPos( case SQL_ADD: return SC_pos_add(stmt, irow); } -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ /* Reset for SQLGetData */ for (i = 0; i < num_cols; i++) bindings[i].data_left = -1; @@ -1812,7 +1812,7 @@ PGAPI_SetPos( #ifdef DRIVER_CURSOR_IMPLEMENT if (stmt->options.cursor_type == SQL_CURSOR_KEYSET_DRIVEN) SC_pos_reload(stmt, irow, (UWORD *) 0); -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ stmt->currTuple = stmt->rowset_start + irow - 1; stmt->bind_row = irow; SC_fetch(stmt); diff --git a/setup.c b/setup.c index 9db803a..6bcc01b 100644 --- a/setup.c +++ b/setup.c @@ -50,7 +50,7 @@ typedef struct tagSETUPDLG BOOL fNewDSN; /* New data source flag */ BOOL fDefault; /* Default data source flag */ -} SETUPDLG, FAR * LPSETUPDLG; +} SETUPDLG, FAR * LPSETUPDLG; diff --git a/statement.c b/statement.c index 0e81651..bfdb8a2 100644 --- a/statement.c +++ b/statement.c @@ -35,7 +35,7 @@ static struct { int type; char *s; -} Statement_Type[] = +} Statement_Type[] = { { @@ -215,7 +215,7 @@ InitializeStatementOptions(StatementOptions *opt) opt->retrieve_data = SQL_RD_ON; opt->use_bookmarks = SQL_UB_OFF; opt->paramset_size = 1; - opt->param_bind_type = 0; /*default is column-wise binding */ + opt->param_bind_type = 0; /* default is column-wise binding */ } @@ -324,7 +324,8 @@ SC_Destructor(StatementClass *self) /* about that here. */ if (self->bindings) { - int lf; + int lf; + for (lf = 0; lf < self->bindings_allocated; lf++) { if (self->bindings[lf].ttlbuf != NULL) @@ -711,7 +712,7 @@ SC_fetch(StatementClass *self) #ifdef DRIVER_CURSOR_IMPLEMENT int updret; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ Int2 num_cols, lf; Oid type; @@ -791,13 +792,13 @@ SC_fetch(StatementClass *self) updret = SQL_ROW_DELETED; num_cols -= 2; } -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ if (self->options.retrieve_data == SQL_RD_OFF) /* data isn't required */ #ifdef DRIVER_CURSOR_IMPLEMENT return updret ? updret + 10 : SQL_SUCCESS; #else return SQL_SUCCESS; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ for (lf = 0; lf < num_cols; lf++) { mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer); @@ -881,7 +882,7 @@ SC_fetch(StatementClass *self) #ifdef DRIVER_CURSOR_IMPLEMENT if (updret) result = updret + 10; -#endif /* DRIVER_CURSOR_IMPLEMENT */ +#endif /* DRIVER_CURSOR_IMPLEMENT */ return result; } -- 2.39.5