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

Commit6c0d4aa

Browse files
committed
Fix more fallout from line-wrap patch, to wit, arbitrarily changing
the API of PQdsplen without bothering to fix its callers. AlthoughReportSyntaxErrorPosition could probably do with more smarts abouthandling control characters, for the moment I'll just get it back tohandling tabs consistently.
1 parentf9a726a commit6c0d4aa

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎src/bin/psql/common.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.111 2005/11/22 18:17:29 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.112 2006/02/12 03:30:21 tgl Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"common.h"
@@ -444,6 +444,7 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query)
444444
intclen,
445445
slen,
446446
i,
447+
w,
447448
*qidx,
448449
*scridx,
449450
qoffset,
@@ -503,7 +504,11 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query)
503504
{
504505
qidx[i]=qoffset;
505506
scridx[i]=scroffset;
506-
scroffset+=PQdsplen(&query[qoffset],pset.encoding);
507+
w=PQdsplen(&query[qoffset],pset.encoding);
508+
/* treat control chars as width 1; see tab hack below */
509+
if (w <=0)
510+
w=1;
511+
scroffset+=w;
507512
qoffset+=PQmblen(&query[qoffset],pset.encoding);
508513
}
509514
qidx[i]=qoffset;
@@ -618,7 +623,12 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query)
618623
*/
619624
scroffset=0;
620625
for (i=0;i<msg.len;i+=PQmblen(&msg.data[i],pset.encoding))
621-
scroffset+=PQdsplen(&msg.data[i],pset.encoding);
626+
{
627+
w=PQdsplen(&msg.data[i],pset.encoding);
628+
if (w <=0)
629+
w=1;
630+
scroffset+=w;
631+
}
622632

623633
/* Finish and emit the message. */
624634
appendPQExpBufferStr(&msg,&wquery[qidx[ibeg]]);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp