Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 7612
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: kruty [...] fi.muni.cz
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 1.40



Subject: from gborg: won't compile
[this bug has been migrated from Gborg] quote.c cannot be compiled, using native IRIX C compiler. On line 415 is construction "string++", where "string" variable is declared as "void*". As far as this is unkwnown object for compiler, it refuse to compile. Solution is very simply, for example to declare temporary variable "tstring" of "char*" type and assign the "string" value to "tstring". And replace the occurance of "string" with "tstring" in for loop. Diff follows: --- quote.c Thu Feb 19 03:34:36 2004 +++ quote.c.mod Tue Aug 31 14:01:46 2004 @@ -392,6 +392,7 @@ size_t *retlen; { char *result; + char *tstring; char *dest; int max_len = 0, i; @@ -411,8 +412,11 @@ dest = result; memcpy(dest++, "X'",1); - for (i=0 ; i <= len ; ++i, dest+=2) - sprintf(dest, "%X", *((char*)string++)); + tstring = (char*)string; + + for (i=0 ; i <= len ; ++i, dest+=2) { + sprintf(dest, "%X", *((char*)tstring++)); + } strcat(dest, "\'");
RT-Send-CC: dbdpg-general [...] gborg.postgresql.org
[guest - Fri Sep 10 19:22:48 2004]: Show quoted text
> [this bug has been migrated from Gborg]
Show quoted text
> Solution is very simply, for example to declare > temporary variable "tstring" of "char*" type and assign the > "string" value to "tstring". And replace the occurance of "string" > with "tstring" in for loop. Diff follows:
Or you could just add () so that the ++ is acting on a char* and not a void* so ((char*)string++). Of course the other possibility is just to dike that section of code out at it never gets called, IIRC. This section is a 1/2 implementation of ansi SQL_BINARY support which Pg does not support -- The only use I could for this code is to be able to quote something as SQL_BINARY before sending elsewhere. Rudy
From: markstos [...] cpan.org
[guest - Fri Sep 10 19:22:48 2004]: Show quoted text
> [this bug has been migrated from Gborg] > > quote.c cannot be compiled, using native IRIX C compiler. On line 415 > is construction "string++", where "string" variable is declared as > "void*". As far as this is unkwnown object for compiler, it refuse > to compile. Solution is very simply, for example to declare > temporary variable "tstring" of "char*" type and assign the > "string" value to "tstring". And replace the occurance of "string" > with "tstring" in for loop. Diff follows: > > --- quote.c Thu Feb 19 03:34:36 2004 > +++ quote.c.mod Tue Aug 31 14:01:46 2004 > @@ -392,6 +392,7 @@ > size_t *retlen; > { > char *result; > + char *tstring; > char *dest; > int max_len = 0, i; > > @@ -411,8 +412,11 @@ > dest = result; > memcpy(dest++, "X'",1); > > - for (i=0 ; i <= len ; ++i, dest+=2) > - sprintf(dest, "%X", *((char*)string++)); > + tstring = (char*)string; > + > + for (i=0 ; i <= len ; ++i, dest+=2) { > + sprintf(dest, "%X", *((char*)tstring++)); > + } > > strcat(dest, "\'");
This might be fixed in the current CVS. Could you test it from there? We could provide a tarball of a current snapshot if that would help.