Skip to content

Commit 1e15f9e

Browse files
author
Michael Meskes
committed
Fixed array pointers, no longer using void * in arithmetics.
1 parent 055d4f9 commit 1e15f9e

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,5 +1188,9 @@ Sun Dec 23 13:08:36 CET 2001
11881188
Mon Jan 7 12:18:01 CET 2002
11891189

11901190
- Fixed parser to accept initializing expressions starting with "(".
1191+
1192+
Tue Jan 8 15:16:37 CET 2002
1193+
1194+
- Fixed array pointers, no longer using void *.
11911195
- Set ecpg version to 2.9.0.
11921196
- Set library version to 3.3.0.

src/interfaces/ecpg/lib/data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.21 2001/12/23 12:17:41 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.22 2002/01/08 14:25:04 meskes Exp $ */
22

33
#include "postgres_fe.h"
44

@@ -14,7 +14,7 @@
1414
bool
1515
ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
1616
enum ECPGttype type, enum ECPGttype ind_type,
17-
void *var, void *ind, long varcharsize, long offset,
17+
char *var, char *ind, long varcharsize, long offset,
1818
long ind_offset, bool isarray)
1919
{
2020
char *pval = (char *) PQgetvalue(results, act_tuple, act_field);

src/interfaces/ecpg/lib/execute.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.34 2001/12/23 12:17:41 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.35 2002/01/08 14:25:04 meskes Exp $ */
22

33
/*
44
* 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 **
142142
return false;
143143

144144
var->type = type;
145-
var->pointer = va_arg(ap, void *);
145+
var->pointer = va_arg(ap, char *);
146146

147147
/* if variable is NULL, the statement hasn't been prepared */
148148
if (var->pointer == NULL)
@@ -157,20 +157,20 @@ create_statement(int lineno, struct connection * connection, struct statement **
157157
var->offset = va_arg(ap, long);
158158

159159
if (var->arrsize == 0 || var->varcharsize == 0)
160-
var->value = *((void **) (var->pointer));
160+
var->value = *((char **) (var->pointer));
161161
else
162162
var->value = var->pointer;
163163

164164
var->ind_type = va_arg(ap, enum ECPGttype);
165-
var->ind_pointer = va_arg(ap, void *);
165+
var->ind_pointer = va_arg(ap, char *);
166166
var->ind_varcharsize = va_arg(ap, long);
167167
var->ind_arrsize = va_arg(ap, long);
168168
var->ind_offset = va_arg(ap, long);
169169
var->next = NULL;
170170

171171
if (var->ind_type != ECPGt_NO_INDICATOR
172172
&& (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
173-
var->ind_value = *((void **) (var->ind_pointer));
173+
var->ind_value = *((char **) (var->ind_pointer));
174174
else
175175
var->ind_value = var->ind_pointer;
176176

@@ -422,17 +422,17 @@ ECPGstore_result(const PGresult *results, int act_field,
422422
len = var->offset * ntuples;
423423
break;
424424
}
425-
var->value = (void *) ECPGalloc(len, stmt->lineno);
426-
*((void **) var->pointer) = var->value;
425+
var->value = (char *) ECPGalloc(len, stmt->lineno);
426+
*((char **) var->pointer) = var->value;
427427
ECPGadd_mem(var->value, stmt->lineno);
428428
}
429429

430430
/* allocate indicator variable if needed */
431431
if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer!=NULL)
432432
{
433433
int len = var->ind_offset * ntuples;
434-
var->ind_value = (void *) ECPGalloc(len, stmt->lineno);
435-
*((void **) var->ind_pointer) = var->ind_value;
434+
var->ind_value = (char *) ECPGalloc(len, stmt->lineno);
435+
*((char **) var->ind_pointer) = var->ind_value;
436436
ECPGadd_mem(var->ind_value, stmt->lineno);
437437
}
438438

src/interfaces/ecpg/lib/extern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
void ECPGadd_mem(void *ptr, int lineno);
77

88
bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type,
9-
enum ECPGttype, void *, void *, long, long, long, bool);
9+
enum ECPGttype, char *, char *, long, long, long, bool);
1010
struct connection *ECPGget_connection(const char *);
1111
void ECPGinit_sqlca(void);
1212
char *ECPGalloc(long, int);

src/interfaces/ecpg/preproc/type.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ get_type(enum ECPGttype type)
183183
/* Dump a type.
184184
The type is dumped as:
185185
type-tag <comma> - enum ECPGttype
186-
reference-to-variable <comma> - void *
186+
reference-to-variable <comma> - char *
187187
size <comma> - long size of this field (if varchar)
188188
arrsize <comma> - long number of elements in the arr
189189
offset <comma> - offset to the next element

0 commit comments

Comments
 (0)