Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6216e84

Browse files
committed
Make ECPGraise's str parameter const to suppress warnings from gcc
and errors from pickier compilers.
1 parent3b192c2 commit6216e84

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎src/interfaces/ecpg/include/ecpglib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern"C"
3434
constchar*descriptor,constchar*query);
3535
boolECPGdeallocate_desc(intline,constchar*name);
3636
boolECPGallocate_desc(intline,constchar*name);
37-
voidECPGraise(intline,intcode,char*str);
37+
voidECPGraise(intline,intcode,constchar*str);
3838
boolECPGget_desc_header(int,char*,int*);
3939
boolECPGget_desc(int,char*,int,...);
4040

‎src/interfaces/ecpg/lib/error.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include<sqlca.h>
88

99
void
10-
ECPGraise(intline,intcode,char*str)
10+
ECPGraise(intline,intcode,constchar*str)
1111
{
1212
sqlca.sqlcode=code;
1313

@@ -119,13 +119,15 @@ ECPGraise(int line, int code, char *str)
119119
break;
120120

121121
caseECPG_PGSQL:
122+
{
123+
intslen=strlen(str);
122124
/* strip trailing newline */
123-
if (str[strlen(str)-1]=='\n')
124-
str[strlen(str)-1]='\0';
125-
125+
if (slen>0&&str[slen-1]=='\n')
126+
slen--;
126127
snprintf(sqlca.sqlerrm.sqlerrmc,sizeof(sqlca.sqlerrm.sqlerrmc),
127-
"'%s' in line %d.",str,line);
128+
"'%.*s' in line %d.",slen,str,line);
128129
break;
130+
}
129131

130132
caseECPG_TRANS:
131133
snprintf(sqlca.sqlerrm.sqlerrmc,sizeof(sqlca.sqlerrm.sqlerrmc),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp