From: Michael Meskes Date: Tue, 8 Jan 2002 14:25:06 +0000 (+0000) Subject: Fixed array pointers, no longer using void * in arithmetics. X-Git-Tag: REL7_2_BETA5~65 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e15f9e11925467ec8799175b13296eca2a15b98;p=postgresql Fixed array pointers, no longer using void * in arithmetics. --- diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 976618ea92..9e1125e093 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -1188,5 +1188,9 @@ Sun Dec 23 13:08:36 CET 2001 Mon Jan 7 12:18:01 CET 2002 - Fixed parser to accept initializing expressions starting with "(". + +Tue Jan 8 15:16:37 CET 2002 + + - Fixed array pointers, no longer using void *. - Set ecpg version to 2.9.0. - Set library version to 3.3.0. diff --git a/src/interfaces/ecpg/lib/data.c b/src/interfaces/ecpg/lib/data.c index 678dde39a7..b460331ff8 100644 --- a/src/interfaces/ecpg/lib/data.c +++ b/src/interfaces/ecpg/lib/data.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.21 2001/12/23 12:17:41 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.22 2002/01/08 14:25:04 meskes Exp $ */ #include "postgres_fe.h" @@ -14,7 +14,7 @@ bool ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, enum ECPGttype type, enum ECPGttype ind_type, - void *var, void *ind, long varcharsize, long offset, + char *var, char *ind, long varcharsize, long offset, long ind_offset, bool isarray) { char *pval = (char *) PQgetvalue(results, act_tuple, act_field); diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c index c2f1e6bda4..dba99a1bd6 100644 --- a/src/interfaces/ecpg/lib/execute.c +++ b/src/interfaces/ecpg/lib/execute.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.34 2001/12/23 12:17:41 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.35 2002/01/08 14:25:04 meskes Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -142,7 +142,7 @@ create_statement(int lineno, struct connection * connection, struct statement ** return false; var->type = type; - var->pointer = va_arg(ap, void *); + var->pointer = va_arg(ap, char *); /* if variable is NULL, the statement hasn't been prepared */ if (var->pointer == NULL) @@ -157,12 +157,12 @@ create_statement(int lineno, struct connection * connection, struct statement ** var->offset = va_arg(ap, long); if (var->arrsize == 0 || var->varcharsize == 0) - var->value = *((void **) (var->pointer)); + var->value = *((char **) (var->pointer)); else var->value = var->pointer; var->ind_type = va_arg(ap, enum ECPGttype); - var->ind_pointer = va_arg(ap, void *); + var->ind_pointer = va_arg(ap, char *); var->ind_varcharsize = va_arg(ap, long); var->ind_arrsize = va_arg(ap, long); var->ind_offset = va_arg(ap, long); @@ -170,7 +170,7 @@ create_statement(int lineno, struct connection * connection, struct statement ** if (var->ind_type != ECPGt_NO_INDICATOR && (var->ind_arrsize == 0 || var->ind_varcharsize == 0)) - var->ind_value = *((void **) (var->ind_pointer)); + var->ind_value = *((char **) (var->ind_pointer)); else var->ind_value = var->ind_pointer; @@ -422,8 +422,8 @@ ECPGstore_result(const PGresult *results, int act_field, len = var->offset * ntuples; break; } - var->value = (void *) ECPGalloc(len, stmt->lineno); - *((void **) var->pointer) = var->value; + var->value = (char *) ECPGalloc(len, stmt->lineno); + *((char **) var->pointer) = var->value; ECPGadd_mem(var->value, stmt->lineno); } @@ -431,8 +431,8 @@ ECPGstore_result(const PGresult *results, int act_field, if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer!=NULL) { int len = var->ind_offset * ntuples; - var->ind_value = (void *) ECPGalloc(len, stmt->lineno); - *((void **) var->ind_pointer) = var->ind_value; + var->ind_value = (char *) ECPGalloc(len, stmt->lineno); + *((char **) var->ind_pointer) = var->ind_value; ECPGadd_mem(var->ind_value, stmt->lineno); } diff --git a/src/interfaces/ecpg/lib/extern.h b/src/interfaces/ecpg/lib/extern.h index 478ec4b99f..3fa935d6f0 100644 --- a/src/interfaces/ecpg/lib/extern.h +++ b/src/interfaces/ecpg/lib/extern.h @@ -6,7 +6,7 @@ void ECPGadd_mem(void *ptr, int lineno); bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type, - enum ECPGttype, void *, void *, long, long, long, bool); + enum ECPGttype, char *, char *, long, long, long, bool); struct connection *ECPGget_connection(const char *); void ECPGinit_sqlca(void); char *ECPGalloc(long, int); diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 6f6a6ff8d3..c064f34d8b 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -183,7 +183,7 @@ get_type(enum ECPGttype type) /* Dump a type. The type is dumped as: type-tag - enum ECPGttype - reference-to-variable - void * + reference-to-variable - char * size - long size of this field (if varchar) arrsize - long number of elements in the arr offset - offset to the next element