indeyets                Wed Apr  1 11:32:14 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/pdo_sqlite     sqlite_statement.c 
  Log:
  MFH: const pointer was used in non-const context
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.18.2.4.2.3.2.4&r2=1.18.2.4.2.3.2.5&diff_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.4 
php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.5
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.4  Tue Jan 13 
02:50:54 2009
+++ php-src/ext/pdo_sqlite/sqlite_statement.c   Wed Apr  1 11:32:14 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.4 2009/01/13 02:50:54 scottmac Exp 
$ */
+/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.5 2009/04/01 11:32:14 indeyets Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -282,6 +282,8 @@
 static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, long colno, zval 
*return_value TSRMLS_DC)
 {
        pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
+       const char *_str;
+       size_t _str_len;
        char *str;
        zval *flags;
        
@@ -318,14 +320,20 @@
                        break;
        }
 
-       str = (char*)sqlite3_column_decltype(S->stmt, colno);
-       if (str) {
+       _str = sqlite3_column_decltype(S->stmt, colno);
+       _str_len = strlen(_str);
+       if (_str) {
+               str = emalloc(_str_len);
+               strcpy(str, _str);
                add_assoc_string(return_value, "sqlite:decl_type", str, 1);
        }
 
 #ifdef SQLITE_ENABLE_COLUMN_METADATA
-       str = sqlite3_column_table_name(S->stmt, colno);
-       if (str) {
+       _str = sqlite3_column_table_name(S->stmt, colno);
+       _str_len = strlen(_str);
+       if (_str) {
+               str = emalloc(_str_len);
+               strcpy(str, _str);
                add_assoc_string(return_value, "table", str, 1);
        }
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to