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);
|
||||
bool ECPGdeallocate_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(int, char *, int,...);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <sqlca.h>
|
||||
|
||||
void
|
||||
ECPGraise(int line, int code, char *str)
|
||||
ECPGraise(int line, int code, const char *str)
|
||||
{
|
||||
sqlca.sqlcode = code;
|
||||
|
||||
@ -119,13 +119,15 @@ ECPGraise(int line, int code, char *str)
|
||||
break;
|
||||
|
||||
case ECPG_PGSQL:
|
||||
{
|
||||
int slen = strlen(str);
|
||||
/* strip trailing newline */
|
||||
if (str[strlen(str) - 1] == '\n')
|
||||
str[strlen(str) - 1] = '\0';
|
||||
|
||||
if (slen > 0 && str[slen - 1] == '\n')
|
||||
slen--;
|
||||
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
||||
"'%s' in line %d.", str, line);
|
||||
"'%.*s' in line %d.", slen, str, line);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECPG_TRANS:
|
||||
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
|
||||
|
Loading…
x
Reference in New Issue
Block a user