dbTalk Databases Forums  

Re: [BUGS] BUG #2606: (libpq) incorrect function declaration

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] BUG #2606: (libpq) incorrect function declaration in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] BUG #2606: (libpq) incorrect function declaration - 09-07-2006 , 10:47 AM







--ELM1157643445-4082-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"

Marc ROGLIANO wrote:
Quote:
The following bug has been logged online:

Bug reference: 2606
Logged by: Marc ROGLIANO
Email address: marc (AT) rogliano (DOT) net
PostgreSQL version: 8.1.4
Operating system: Windows XP
Description: (libpq) incorrect function declaration in libpq-fe.h
Details:

Hello,

In libpq-fe.h, the function lo_write is declared :

extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
=> 'const' missing before char *buf : buf should not be writable here
Right, patch attached and applied. Interestingly, it was documented as
taking a 'const' there, but not implemented as const in the code.

--
Bruce Momjian bruce (AT) momjian (DOT) us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

--ELM1157643445-4082-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/bjm/diff"

Index: src/backend/libpq/be-fsstubs.c
================================================== =================
RCS file: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v
retrieving revision 1.82
diff -c -c -r1.82 be-fsstubs.c
*** src/backend/libpq/be-fsstubs.c 26 Apr 2006 00:34:57 -0000 1.82
--- src/backend/libpq/be-fsstubs.c 7 Sep 2006 15:34:28 -0000
***************
*** 165,171 ****
}

int
! lo_write(int fd, char *buf, int len)
{
int status;

--- 165,171 ----
}

int
! lo_write(int fd, const char *buf, int len)
{
int status;

Index: src/backend/storage/large_object/inv_api.c
================================================== =================
RCS file: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v
retrieving revision 1.119
diff -c -c -r1.119 inv_api.c
*** src/backend/storage/large_object/inv_api.c 31 Jul 2006 20:09:05 -0000 1.119
--- src/backend/storage/large_object/inv_api.c 7 Sep 2006 15:34:29 -0000
***************
*** 488,494 ****
}

int
! inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
{
int nwritten = 0;
int n;
--- 488,494 ----
}

int
! inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
{
int nwritten = 0;
int n;
Index: src/include/libpq/be-fsstubs.h
================================================== =================
RCS file: /cvsroot/pgsql/src/include/libpq/be-fsstubs.h,v
retrieving revision 1.26
diff -c -c -r1.26 be-fsstubs.h
*** src/include/libpq/be-fsstubs.h 5 Mar 2006 15:58:56 -0000 1.26
--- src/include/libpq/be-fsstubs.h 7 Sep 2006 15:34:30 -0000
***************
*** 41,47 ****
* but too late now...
*/
extern int lo_read(int fd, char *buf, int len);
! extern int lo_write(int fd, char *buf, int len);

/*
* Cleanup LOs at xact commit/abort
--- 41,47 ----
* but too late now...
*/
extern int lo_read(int fd, char *buf, int len);
! extern int lo_write(int fd, const char *buf, int len);

/*
* Cleanup LOs at xact commit/abort
Index: src/include/storage/large_object.h
================================================== =================
RCS file: /cvsroot/pgsql/src/include/storage/large_object.h,v
retrieving revision 1.34
diff -c -c -r1.34 large_object.h
*** src/include/storage/large_object.h 26 Apr 2006 00:34:57 -0000 1.34
--- src/include/storage/large_object.h 7 Sep 2006 15:34:30 -0000
***************
*** 77,82 ****
extern int inv_seek(LargeObjectDesc *obj_desc, int offset, int whence);
extern int inv_tell(LargeObjectDesc *obj_desc);
extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes);
! extern int inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes);

#endif /* LARGE_OBJECT_H */
--- 77,82 ----
extern int inv_seek(LargeObjectDesc *obj_desc, int offset, int whence);
extern int inv_tell(LargeObjectDesc *obj_desc);
extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes);
! extern int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes);

#endif /* LARGE_OBJECT_H */
Index: src/interfaces/libpq/fe-lobj.c
================================================== =================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v
retrieving revision 1.58
diff -c -c -r1.58 fe-lobj.c
*** src/interfaces/libpq/fe-lobj.c 14 Jun 2006 17:49:25 -0000 1.58
--- src/interfaces/libpq/fe-lobj.c 7 Sep 2006 15:34:30 -0000
***************
*** 172,178 ****
* returns the number of bytes written, or -1 on failure.
*/
int
! lo_write(PGconn *conn, int fd, char *buf, size_t len)
{
PQArgBlock argv[2];
PGresult *res;
--- 172,178 ----
* returns the number of bytes written, or -1 on failure.
*/
int
! lo_write(PGconn *conn, int fd, const char *buf, size_t len)
{
PQArgBlock argv[2];
PGresult *res;
Index: src/interfaces/libpq/libpq-fe.h
================================================== =================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/libpq-fe.h,v
retrieving revision 1.132
diff -c -c -r1.132 libpq-fe.h
*** src/interfaces/libpq/libpq-fe.h 18 Aug 2006 19:52:39 -0000 1.132
--- src/interfaces/libpq/libpq-fe.h 7 Sep 2006 15:34:30 -0000
***************
*** 483,489 ****
extern int lo_open(PGconn *conn, Oid lobjId, int mode);
extern int lo_close(PGconn *conn, int fd);
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
! extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
extern Oid lo_creat(PGconn *conn, int mode);
extern Oid lo_create(PGconn *conn, Oid lobjId);
--- 483,489 ----
extern int lo_open(PGconn *conn, Oid lobjId, int mode);
extern int lo_close(PGconn *conn, int fd);
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
! extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
extern Oid lo_creat(PGconn *conn, int mode);
extern Oid lo_create(PGconn *conn, Oid lobjId);

--ELM1157643445-4082-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--ELM1157643445-4082-0_--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.