Make ECPGraise's str parameter const to suppress warnings from gcc
and errors from pickier compilers.
This commit is contained in:
parent
3b192c232d
commit
6216e84df6
|
@ -34,7 +34,7 @@ extern "C"
|
||||||
const char *descriptor, const char *query);
|
const char *descriptor, const char *query);
|
||||||
bool ECPGdeallocate_desc(int line, const char *name);
|
bool ECPGdeallocate_desc(int line, const char *name);
|
||||||
bool ECPGallocate_desc(int line, const char *name);
|
bool ECPGallocate_desc(int line, const char *name);
|
||||||
void ECPGraise(int line, int code, char *str);
|
void ECPGraise(int line, int code, const char *str);
|
||||||
bool ECPGget_desc_header(int, char *, int *);
|
bool ECPGget_desc_header(int, char *, int *);
|
||||||
bool ECPGget_desc(int, char *, int,...);
|
bool ECPGget_desc(int, char *, int,...);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <sqlca.h>
|
#include <sqlca.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
ECPGraise(int line, int code, char *str)
|
ECPGraise(int line, int code, const char *str)
|
||||||
{
|
{
|
||||||
sqlca.sqlcode = code;
|
sqlca.sqlcode = code;
|
||||||
|
|
||||||
|
@ -119,13 +119,15 @@ ECPGraise(int line, int code, char *str)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECPG_PGSQL:
|
case ECPG_PGSQL:
|
||||||
|
{
|
||||||
|
int slen = strlen(str);
|
||||||
/* strip trailing newline */
|
/* strip trailing newline */
|
||||||
if (str[strlen(str) - 1] == '\n')
|
if (slen > 0 && str[slen - 1] == '\n')
|
||||||
str[strlen(str) - 1] = '\0';
|
slen--;
|
||||||
|
|
||||||
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
||||||
"'%s' in line %d.", str, line);
|
"'%.*s' in line %d.", slen, str, line);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ECPG_TRANS:
|
case ECPG_TRANS:
|
||||||
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
||||||
|
|
Loading…
Reference in New Issue