Re: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_sqlite sqlite_statement.c
On 08.05.2009 03:29, Matteo Beccati wrote: #ifdef HAVE_CONFIG_H #include config.h @@ -265,11 +265,6 @@ case SQLITE3_TEXT: *ptr = (char*)sqlite3_column_text(S-stmt, colno); *len = sqlite3_column_bytes(S-stmt, colno); - if (*len) { - /* sqlite3.h says the NUL terminator is included in the byte count - * for TEXT values */ - *len--; - } return 1; It doesn't look like no-op to me, but it's not clear what's being decremented. I'd say it should do (*len)-- if the comment in sqlite3.h is correct. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_sqlite sqlite_statement.c
Antony Dovgal ha scritto: On 08.05.2009 03:29, Matteo Beccati wrote: #ifdef HAVE_CONFIG_H #include config.h @@ -265,11 +265,6 @@ case SQLITE3_TEXT: *ptr = (char*)sqlite3_column_text(S-stmt, colno); *len = sqlite3_column_bytes(S-stmt, colno); -if (*len) { -/* sqlite3.h says the NUL terminator is included in the byte count - * for TEXT values */ -*len--; -} return 1; It doesn't look like no-op to me, but it's not clear what's being decremented. I'd say it should do (*len)-- if the comment in sqlite3.h is correct. By no-op I meant that it's not doing anything in a broader context, i.e. it's not decreasing the length integer used by the caller function. I've been pointed to the compiler warning (see bug topic of http://bugs.php.net/bug.php?id=48185) and propery fixed it. When I ran the test suite lots of test cases were failing because the output was truncated. I think that this by itself is the proof that sqlite3_column_bytes() is not including the NULL terminator. To be sure I've also checked sqlite3.h and couldn't find any reference to that behaviour. The comment is wrong and the code is not doing what the comment tells, so I thought that a clean up was required, both for consistency and to fix the compiler warning. Cheers -- M. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_sqlite sqlite_statement.c
mbeccatiThu May 7 23:29:55 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pdo_sqlite sqlite_statement.c /php-srcNEWS Log: MFH - Fixed bug #48185 removing no-op code http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.18.2.4.2.3.2.6r2=1.18.2.4.2.3.2.7diff_format=u Index: php-src/ext/pdo_sqlite/sqlite_statement.c diff -u php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.6 php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.7 --- php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.6 Wed Apr 1 14:35:24 2009 +++ php-src/ext/pdo_sqlite/sqlite_statement.c Thu May 7 23:29:54 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.6 2009/04/01 14:35:24 indeyets Exp $ */ +/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.7 2009/05/07 23:29:54 mbeccati Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -265,11 +265,6 @@ case SQLITE3_TEXT: *ptr = (char*)sqlite3_column_text(S-stmt, colno); *len = sqlite3_column_bytes(S-stmt, colno); - if (*len) { - /* sqlite3.h says the NUL terminator is included in the byte count -* for TEXT values */ - *len--; - } return 1; default: http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.590r2=1.2027.2.547.2.965.2.591diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.590 php-src/NEWS:1.2027.2.547.2.965.2.591 --- php-src/NEWS:1.2027.2.547.2.965.2.590 Thu May 7 16:56:18 2009 +++ php-src/NEWSThu May 7 23:29:54 2009 @@ -33,6 +33,8 @@ - Added ability to throw exceptions from SQLite3 instead of warnings. (Scott) - Added startup notices for deprecated ini settings. (Kalle) +- Fixed bug #48185 (warning: value computed is not used in + pdo_sqlite_stmt_get_col line 271). (Matteo) - Fixed bug #48087 (call_user_method() invalid free of arguments). (Felipe) - Fixed bug #48060 (pdo_pgsql - large objects are returned as empty). (Matteo) - Fixed bug #48034 (PHP crashes when script is 8192 (8KB) bytes long). (Dmitry) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php