aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c14
-rw-r--r--src/interfaces/ecpg/ecpglib/misc.c20
-rw-r--r--src/interfaces/ecpg/include/ecpg_informix.h12
-rw-r--r--src/interfaces/ecpg/include/ecpglib.h2
-rw-r--r--src/interfaces/ecpg/include/pgtypes_date.h2
-rw-r--r--src/interfaces/ecpg/include/pgtypes_timestamp.h2
-rw-r--r--src/interfaces/ecpg/pgtypeslib/datetime.c2
-rw-r--r--src/interfaces/ecpg/pgtypeslib/interval.c4
-rw-r--r--src/interfaces/ecpg/pgtypeslib/timestamp.c2
-rw-r--r--src/interfaces/ecpg/preproc/type.c2
-rw-r--r--src/interfaces/ecpg/preproc/type.h2
-rw-r--r--src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc6
-rw-r--r--src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc2
-rw-r--r--src/interfaces/ecpg/test/compat_informix/test_informix2.pgc2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c6
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c2
-rw-r--r--src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c2
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-init.c2
-rw-r--r--src/interfaces/ecpg/test/expected/preproc-whenever.c2
-rw-r--r--src/interfaces/ecpg/test/preproc/init.pgc2
-rw-r--r--src/interfaces/ecpg/test/preproc/whenever.pgc2
-rw-r--r--src/interfaces/libpq/fe-connect.c16
22 files changed, 54 insertions, 54 deletions
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index e9bcb4cde25..13058cf7bf7 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -195,7 +195,7 @@ ecpg_strndup(const char *str, size_t len)
}
int
-deccvasc(char *cp, int len, decimal *np)
+deccvasc(const char *cp, int len, decimal *np)
{
char *str;
int ret = 0;
@@ -520,7 +520,7 @@ rdatestr(date d, char *str)
*
*/
int
-rstrdate(char *str, date * d)
+rstrdate(const char *str, date * d)
{
return rdefmtdate(d, "mm/dd/yyyy", str);
}
@@ -545,7 +545,7 @@ rjulmdy(date d, short mdy[3])
}
int
-rdefmtdate(date * d, char *fmt, char *str)
+rdefmtdate(date * d, const char *fmt, const char *str)
{
/* TODO: take care of DBCENTURY environment variable */
/* PGSQL functions allow all centuries */
@@ -571,7 +571,7 @@ rdefmtdate(date * d, char *fmt, char *str)
}
int
-rfmtdate(date d, char *fmt, char *str)
+rfmtdate(date d, const char *fmt, char *str)
{
errno = 0;
if (PGTYPESdate_fmt_asc(d, fmt, str) == 0)
@@ -747,7 +747,7 @@ initValue(long lng_val)
/* return the position oft the right-most dot in some string */
static int
-getRightMostDot(char *str)
+getRightMostDot(const char *str)
{
size_t len = strlen(str);
int i,
@@ -765,7 +765,7 @@ getRightMostDot(char *str)
/* And finally some misc functions */
int
-rfmtlong(long lng_val, char *fmt, char *outbuf)
+rfmtlong(long lng_val, const char *fmt, char *outbuf)
{
size_t fmt_len = strlen(fmt);
size_t temp_len;
@@ -1047,7 +1047,7 @@ rsetnull(int t, char *ptr)
}
int
-risnull(int t, char *ptr)
+risnull(int t, const char *ptr)
{
return ECPGis_noind_null(t, ptr);
}
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index a0257c8957d..be9cac6e7b4 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -375,7 +375,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
}
static bool
-_check(unsigned char *ptr, int length)
+_check(const unsigned char *ptr, int length)
{
for (length--; length >= 0; length--)
if (ptr[length] != 0xff)
@@ -385,36 +385,36 @@ _check(unsigned char *ptr, int length)
}
bool
-ECPGis_noind_null(enum ECPGttype type, void *ptr)
+ECPGis_noind_null(enum ECPGttype type, const void *ptr)
{
switch (type)
{
case ECPGt_char:
case ECPGt_unsigned_char:
case ECPGt_string:
- if (*((char *) ptr) == '\0')
+ if (*((const char *) ptr) == '\0')
return true;
break;
case ECPGt_short:
case ECPGt_unsigned_short:
- if (*((short int *) ptr) == SHRT_MIN)
+ if (*((const short int *) ptr) == SHRT_MIN)
return true;
break;
case ECPGt_int:
case ECPGt_unsigned_int:
- if (*((int *) ptr) == INT_MIN)
+ if (*((const int *) ptr) == INT_MIN)
return true;
break;
case ECPGt_long:
case ECPGt_unsigned_long:
case ECPGt_date:
- if (*((long *) ptr) == LONG_MIN)
+ if (*((const long *) ptr) == LONG_MIN)
return true;
break;
#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
case ECPGt_unsigned_long_long:
- if (*((long long *) ptr) == LONG_LONG_MIN)
+ if (*((const long long *) ptr) == LONG_LONG_MIN)
return true;
break;
#endif /* HAVE_LONG_LONG_INT */
@@ -425,15 +425,15 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
return _check(ptr, sizeof(double));
break;
case ECPGt_varchar:
- if (*(((struct ECPGgeneric_varchar *) ptr)->arr) == 0x00)
+ if (*(((const struct ECPGgeneric_varchar *) ptr)->arr) == 0x00)
return true;
break;
case ECPGt_decimal:
- if (((decimal *) ptr)->sign == NUMERIC_NULL)
+ if (((const decimal *) ptr)->sign == NUMERIC_NULL)
return true;
break;
case ECPGt_numeric:
- if (((numeric *) ptr)->sign == NUMERIC_NULL)
+ if (((const numeric *) ptr)->sign == NUMERIC_NULL)
return true;
break;
case ECPGt_interval:
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h
index dd6258152ae..a5260a55427 100644
--- a/src/interfaces/ecpg/include/ecpg_informix.h
+++ b/src/interfaces/ecpg/include/ecpg_informix.h
@@ -36,15 +36,15 @@ extern "C"
extern int rdatestr(date, char *);
extern void rtoday(date *);
extern int rjulmdy(date, short *);
-extern int rdefmtdate(date *, char *, char *);
-extern int rfmtdate(date, char *, char *);
+extern int rdefmtdate(date *, const char *, const char *);
+extern int rfmtdate(date, const char *, char *);
extern int rmdyjul(short *, date *);
-extern int rstrdate(char *, date *);
+extern int rstrdate(const char *, date *);
extern int rdayofweek(date);
-extern int rfmtlong(long, char *, char *);
+extern int rfmtlong(long, const char *, char *);
extern int rgetmsg(int, char *, int);
-extern int risnull(int, char *);
+extern int risnull(int, const char *);
extern int rsetnull(int, char *);
extern int rtypalign(int, int);
extern int rtypmsize(int, int);
@@ -62,7 +62,7 @@ extern void ECPG_informix_reset_sqlca(void);
int decadd(decimal *, decimal *, decimal *);
int deccmp(decimal *, decimal *);
void deccopy(decimal *, decimal *);
-int deccvasc(char *, int, decimal *);
+int deccvasc(const char *, int, decimal *);
int deccvdbl(double, decimal *);
int deccvint(int, decimal *);
int deccvlong(long, decimal *);
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index 536b7506ffa..8a601996d2d 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -80,7 +80,7 @@ bool ECPGset_desc_header(int, const char *, int);
bool ECPGset_desc(int, const char *, int,...);
void ECPGset_noind_null(enum ECPGttype, void *);
-bool ECPGis_noind_null(enum ECPGttype, void *);
+bool ECPGis_noind_null(enum ECPGttype, const void *);
bool ECPGdescribe(int, int, bool, const char *, const char *,...);
void ECPGset_var(int, void *, int);
diff --git a/src/interfaces/ecpg/include/pgtypes_date.h b/src/interfaces/ecpg/include/pgtypes_date.h
index 3d1a181b2b7..caf8a33d125 100644
--- a/src/interfaces/ecpg/include/pgtypes_date.h
+++ b/src/interfaces/ecpg/include/pgtypes_date.h
@@ -21,7 +21,7 @@ extern void PGTYPESdate_julmdy(date, int *);
extern void PGTYPESdate_mdyjul(int *, date *);
extern int PGTYPESdate_dayofweek(date);
extern void PGTYPESdate_today(date *);
-extern int PGTYPESdate_defmt_asc(date *, const char *, char *);
+extern int PGTYPESdate_defmt_asc(date *, const char *, const char *);
extern int PGTYPESdate_fmt_asc(date, const char *, char *);
#ifdef __cplusplus
diff --git a/src/interfaces/ecpg/include/pgtypes_timestamp.h b/src/interfaces/ecpg/include/pgtypes_timestamp.h
index 283ecca25eb..1545be4ee9b 100644
--- a/src/interfaces/ecpg/include/pgtypes_timestamp.h
+++ b/src/interfaces/ecpg/include/pgtypes_timestamp.h
@@ -19,7 +19,7 @@ extern char *PGTYPEStimestamp_to_asc(timestamp);
extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *);
extern void PGTYPEStimestamp_current(timestamp *);
-extern int PGTYPEStimestamp_defmt_asc(char *, const char *, timestamp *);
+extern int PGTYPEStimestamp_defmt_asc(const char *, const char *, timestamp *);
extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout);
extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout);
diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c
index c2f78f5a56c..1e692a5f9ef 100644
--- a/src/interfaces/ecpg/pgtypeslib/datetime.c
+++ b/src/interfaces/ecpg/pgtypeslib/datetime.c
@@ -329,7 +329,7 @@ PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf)
#define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */
int
-PGTYPESdate_defmt_asc(date * d, const char *fmt, char *str)
+PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str)
{
/*
* token[2] = { 4,6 } means that token 2 starts at position 4 and ends at
diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c
index 41976a188af..24a2f36d4db 100644
--- a/src/interfaces/ecpg/pgtypeslib/interval.c
+++ b/src/interfaces/ecpg/pgtypeslib/interval.c
@@ -65,7 +65,7 @@ AdjustFractDays(double frac, struct /* pg_ */ tm *tm, fsec_t *fsec, int scale)
/* copy&pasted from .../src/backend/utils/adt/datetime.c */
static int
-ParseISO8601Number(char *str, char **endptr, int *ipart, double *fpart)
+ParseISO8601Number(const char *str, char **endptr, int *ipart, double *fpart)
{
double val;
@@ -90,7 +90,7 @@ ParseISO8601Number(char *str, char **endptr, int *ipart, double *fpart)
/* copy&pasted from .../src/backend/utils/adt/datetime.c */
static int
-ISO8601IntegerWidth(char *fieldstart)
+ISO8601IntegerWidth(const char *fieldstart)
{
/* We might have had a leading '-' */
if (*fieldstart == '-')
diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c
index b63880dc55d..abccc268dcc 100644
--- a/src/interfaces/ecpg/pgtypeslib/timestamp.c
+++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c
@@ -813,7 +813,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv)
}
int
-PGTYPEStimestamp_defmt_asc(char *str, const char *fmt, timestamp * d)
+PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp * d)
{
int year,
month,
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index 256a3c395c5..4abbf93d191 100644
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -74,7 +74,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member *rm)
/* The NAME argument is copied. The type argument is preserved as a pointer. */
void
-ECPGmake_struct_member(char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
+ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
{
struct ECPGstruct_member *ptr,
*ne =
diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h
index 4b933364807..fc70d7d2182 100644
--- a/src/interfaces/ecpg/preproc/type.h
+++ b/src/interfaces/ecpg/preproc/type.h
@@ -33,7 +33,7 @@ struct ECPGtype
};
/* Everything is malloced. */
-void ECPGmake_struct_member(char *, struct ECPGtype *, struct ECPGstruct_member **);
+void ECPGmake_struct_member(const char *, struct ECPGtype *, struct ECPGstruct_member **);
struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
diff --git a/src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc b/src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
index f1a90488890..a147f405ab0 100644
--- a/src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/rfmtdate.pgc
@@ -13,7 +13,7 @@ static void
check_return(int ret);
static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
{
static int i;
date d;
@@ -38,7 +38,7 @@ date_test_strdate(char *input)
}
static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
{
static int i;
char dbuf[11];
@@ -63,7 +63,7 @@ date_test_defmt(char *fmt, char *input)
}
static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
{
static int i;
char buf[200];
diff --git a/src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc b/src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
index a1070e13311..2ecf09c8374 100644
--- a/src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/rfmtlong.pgc
@@ -13,7 +13,7 @@ static void
check_return(int ret);
static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
{
static int i;
int r;
diff --git a/src/interfaces/ecpg/test/compat_informix/test_informix2.pgc b/src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
index 0386093d70b..5380f9eb5a1 100644
--- a/src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/test_informix2.pgc
@@ -7,7 +7,7 @@ EXEC SQL include ../regression;
EXEC SQL DEFINE MAXDBLEN 30;
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
-static void sql_check(char *fn, char *caller, int ignore)
+static void sql_check(const char *fn, const char *caller, int ignore)
{
char errorstring[255];
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
index 87a435e9bd2..68be08276d0 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c
@@ -24,7 +24,7 @@ static void
check_return(int ret);
static void
-date_test_strdate(char *input)
+date_test_strdate(const char *input)
{
static int i;
date d;
@@ -49,7 +49,7 @@ date_test_strdate(char *input)
}
static void
-date_test_defmt(char *fmt, char *input)
+date_test_defmt(const char *fmt, const char *input)
{
static int i;
char dbuf[11];
@@ -74,7 +74,7 @@ date_test_defmt(char *fmt, char *input)
}
static void
-date_test_fmt(date d, char *fmt)
+date_test_fmt(date d, const char *fmt)
{
static int i;
char buf[200];
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
index 70e015a1301..b2e397e38c2 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c
@@ -24,7 +24,7 @@ static void
check_return(int ret);
static void
-fmtlong(long lng, char *fmt)
+fmtlong(long lng, const char *fmt)
{
static int i;
int r;
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
index 4e372a57991..eeb9b62ab4f 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c
@@ -97,7 +97,7 @@ struct sqlca_t *ECPGget_sqlca(void);
/* Check SQLCODE, and produce a "standard error" if it's wrong! */
-static void sql_check(char *fn, char *caller, int ignore)
+static void sql_check(const char *fn, const char *caller, int ignore)
{
char errorstring[255];
diff --git a/src/interfaces/ecpg/test/expected/preproc-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c
index ca23d348d6e..b0e04731fe1 100644
--- a/src/interfaces/ecpg/test/expected/preproc-init.c
+++ b/src/interfaces/ecpg/test/expected/preproc-init.c
@@ -114,7 +114,7 @@ static int fe(enum e x)
return (int)x;
}
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
{
if (!notice)
notice = "-empty-";
diff --git a/src/interfaces/ecpg/test/expected/preproc-whenever.c b/src/interfaces/ecpg/test/expected/preproc-whenever.c
index 922ef76b922..332ef85b10a 100644
--- a/src/interfaces/ecpg/test/expected/preproc-whenever.c
+++ b/src/interfaces/ecpg/test/expected/preproc-whenever.c
@@ -24,7 +24,7 @@
#line 5 "whenever.pgc"
-static void print(char *msg)
+static void print(const char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
diff --git a/src/interfaces/ecpg/test/preproc/init.pgc b/src/interfaces/ecpg/test/preproc/init.pgc
index 11dc01ade45..b1f71997a2a 100644
--- a/src/interfaces/ecpg/test/preproc/init.pgc
+++ b/src/interfaces/ecpg/test/preproc/init.pgc
@@ -35,7 +35,7 @@ static int fe(enum e x)
return (int)x;
}
-static void sqlnotice(char *notice, short trans)
+static void sqlnotice(const char *notice, short trans)
{
if (!notice)
notice = "-empty-";
diff --git a/src/interfaces/ecpg/test/preproc/whenever.pgc b/src/interfaces/ecpg/test/preproc/whenever.pgc
index 9b3ae9e9ec6..14cf571e6ae 100644
--- a/src/interfaces/ecpg/test/preproc/whenever.pgc
+++ b/src/interfaces/ecpg/test/preproc/whenever.pgc
@@ -4,7 +4,7 @@ exec sql include ../regression;
exec sql whenever sqlerror sqlprint;
-static void print(char *msg)
+static void print(const char *msg)
{
fprintf(stderr, "Error in statement '%s':\n", msg);
sqlprint();
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index ada219032ec..2c175a2a24a 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -398,9 +398,9 @@ static int parseServiceFile(const char *serviceFile,
PQconninfoOption *options,
PQExpBuffer errorMessage,
bool *group_found);
-static char *pwdfMatchesString(char *buf, char *token);
-static char *passwordFromFile(char *hostname, char *port, char *dbname,
- char *username, char *pgpassfile);
+static char *pwdfMatchesString(char *buf, const char *token);
+static char *passwordFromFile(const char *hostname, const char *port, const char *dbname,
+ const char *username, const char *pgpassfile);
static void pgpassfileWarning(PGconn *conn);
static void default_threadlock(int acquire);
@@ -6329,10 +6329,10 @@ defaultNoticeProcessor(void *arg, const char *message)
* token doesn't match
*/
static char *
-pwdfMatchesString(char *buf, char *token)
+pwdfMatchesString(char *buf, const char *token)
{
- char *tbuf,
- *ttok;
+ char *tbuf;
+ const char *ttok;
bool bslash = false;
if (buf == NULL || token == NULL)
@@ -6366,8 +6366,8 @@ pwdfMatchesString(char *buf, char *token)
/* Get a password from the password file. Return value is malloc'd. */
static char *
-passwordFromFile(char *hostname, char *port, char *dbname,
- char *username, char *pgpassfile)
+passwordFromFile(const char *hostname, const char *port, const char *dbname,
+ const char *username, const char *pgpassfile)
{
FILE *fp;
struct stat stat_buf;