Re: cvs: php-src(PHP_5_3) /ext/pdo_sqlite sqlite_statement.c
| From: | Ilia Alshanetsky | Date: | Tue, 19 May 2009 18:39:33 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_3) /ext/pdo_sqlite sqlite_statement.c | ||
| References: | 1 2 3 4 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-58028@lists.php.net to get a copy of this message | ||
it looks like in recent version of sqlite3 the behavior had changed some what. I am going to check which version of sqlite3 had followed the old behavior and put the code into the appropriate define block.
Ilia Alshanetsky
On 19-May-09, at 1:33 PM, Matteo Beccati wrote:
Ilia Alshanetsky ha scritto:*len is a pointer to an integer, that is being decremented to reduce the overall length of the string to "remove" the NUL terminator. If you remove the operation you'll end up with 2 NULs at the end of the string.As I said, I coulndn't find any reference to the fact that "the NUL terminator is included in the byte count for TEXT values" in sqlite3.h. I don't want to argue about this, but here's a small test case that hopefully proves that the code you added back is just useless, as it doesn't do what you'd expect by reading the comment. $ cat len.c; gcc -Wall len.c; ./a.out #include <stdio.h> #include <assert.h> void decrease_len(int *len) {*len--;} int main(int argc, char **argv) {int len = 10;decrease_len(&len); assert(len == 9);return 0;} len.c: In function ‘decrease_len’: len.c:6: warning: value computed is not used a.out: len.c:14: main: Assertion `len == 9' failed. Aborted Cheers --Matteo Beccati OpenX - http://www.openx.org