]> granicus.if.org Git - php/commitdiff
MFH: build fixes, cs, ws, etc.
authorJani Taskinen <jani@php.net>
Sat, 26 Jul 2008 23:42:53 +0000 (23:42 +0000)
committerJani Taskinen <jani@php.net>
Sat, 26 Jul 2008 23:42:53 +0000 (23:42 +0000)
ext/sqlite3/config.m4
ext/sqlite3/config0.m4
ext/sqlite3/php_sqlite3.h
ext/sqlite3/sqlite3.c

index 0adb01b4e3531ea19dce4b0895ae6f8511a57aa3..5a52170191df45b1c6e602d6b1fc335a93041b2b 100644 (file)
@@ -72,8 +72,7 @@ if test $PHP_SQLITE3 != "no"; then
 dnl    if test "$PHP_MAJOR_VERSION" -ge "6"; then
 dnl      other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
 dnl    fi
-
-    PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite -I@ext_builddir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
+    PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
   fi
 
   AC_DEFINE(HAVE_SQLITE3,1,[ ])
@@ -81,6 +80,6 @@ dnl    fi
   sqlite3_sources="sqlite3.c $sqlite3_extra_sources"
 
   PHP_NEW_EXTENSION(sqlite3, $sqlite3_sources, $ext_shared,,$PHP_SQLITE3_CFLAGS)
+  PHP_ADD_BUILD_DIR([$ext_builddir/libsqlite])
   PHP_SUBST(SQLITE3_SHARED_LIBADD)
-
 fi
index 0adb01b4e3531ea19dce4b0895ae6f8511a57aa3..5a52170191df45b1c6e602d6b1fc335a93041b2b 100644 (file)
@@ -72,8 +72,7 @@ if test $PHP_SQLITE3 != "no"; then
 dnl    if test "$PHP_MAJOR_VERSION" -ge "6"; then
 dnl      other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
 dnl    fi
-
-    PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite -I@ext_builddir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
+    PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
   fi
 
   AC_DEFINE(HAVE_SQLITE3,1,[ ])
@@ -81,6 +80,6 @@ dnl    fi
   sqlite3_sources="sqlite3.c $sqlite3_extra_sources"
 
   PHP_NEW_EXTENSION(sqlite3, $sqlite3_sources, $ext_shared,,$PHP_SQLITE3_CFLAGS)
+  PHP_ADD_BUILD_DIR([$ext_builddir/libsqlite])
   PHP_SUBST(SQLITE3_SHARED_LIBADD)
-
 fi
index 566c947d2c2de40a72ce9a8b7dc45a87679f3602..f40143ed84b53be462389ae2f8b950fc263491fc 100644 (file)
    +----------------------------------------------------------------------+
    | Authors: Scott MacVicar <scottmac@php.net>                           |
    +----------------------------------------------------------------------+
-
-   $Id$
 */
 
+/* $Id$ */
+
 #ifndef PHP_SQLITE_H
 #define PHP_SQLITE_H
 
index 295a5ce491139da36553078c222e0d80b9984058..65026ad25c81b78c81fcc43d3d443a95b48e1e18 100644 (file)
    +----------------------------------------------------------------------+
    | Authors: Scott MacVicar <scottmac@php.net>                           |
    +----------------------------------------------------------------------+
-
-   $Id$
 */
 
+/* $Id$ */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -33,9 +33,9 @@
 #include "zend_interfaces.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(sqlite3)
+
 static PHP_GINIT_FUNCTION(sqlite3);
-static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4,
-               const char *arg5, const char *arg6);
+static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4, const char *arg5, const char *arg6);
 static void sqlite3_param_dtor(void *data);
 static int php_sqlite3_compare_stmt_free( php_sqlite3_stmt_free_list **stmt_list, sqlite3_stmt *statement );
 
@@ -46,7 +46,7 @@ static int php_sqlite3_compare_stmt_free( php_sqlite3_stmt_free_list **stmt_list
        }
 
 /* {{{ PHP_INI
- */
+*/
 PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("sqlite3.extension_dir",  NULL, PHP_INI_SYSTEM, OnUpdateString, extension_dir, zend_sqlite3_globals, sqlite3_globals)
 PHP_INI_END()
@@ -63,8 +63,7 @@ zend_class_entry *php_sqlite3_stmt_entry;
 zend_class_entry *php_sqlite3_result_entry;
 
 /* {{{ proto bool SQLite3::open(String filename [, int Flags [, string Encryption Key]])
-       Opens a SQLite 3 Database, if the build includes encryption then it will attempt to use the key
-*/
+   Opens a SQLite 3 Database, if the build includes encryption then it will attempt to use the key. */
 PHP_METHOD(sqlite3, open)
 {
        php_sqlite3_db_object *db_obj;
@@ -73,8 +72,7 @@ PHP_METHOD(sqlite3, open)
        int filename_len, encryption_key_len, flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
        db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object TSRMLS_CC);
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
-                               &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
                return;
        }
 
@@ -87,12 +85,10 @@ PHP_METHOD(sqlite3, open)
                        RETURN_FALSE;
                }
 
-#if PHP_MAJOR_VERSION < 6
                if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
                        efree(fullpath);
                        RETURN_FALSE;
                }
-#endif
 
                if (php_check_open_basedir(fullpath TSRMLS_CC)) {
                        efree(fullpath);
@@ -124,11 +120,7 @@ PHP_METHOD(sqlite3, open)
        }
 #endif
 
-       if (
-#if PHP_MAJOR_VERSION < 6
-               PG(safe_mode) ||
-#endif
-                       (PG(open_basedir) && *PG(open_basedir))) {
+       if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
                sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL);
        }
 
@@ -140,8 +132,7 @@ PHP_METHOD(sqlite3, open)
 /* }}} */
 
 /* {{{ proto bool SQLite3::close()
-       Close a SQLite 3 Database.
-*/
+   Close a SQLite 3 Database. */
 PHP_METHOD(sqlite3, close)
 {
        php_sqlite3_db_object *db_obj;
@@ -168,8 +159,7 @@ PHP_METHOD(sqlite3, close)
 /* }}} */
 
 /* {{{ proto bool SQLite3::exec(String Query)
-       Executes a result-less query against a given database
-*/
+   Executes a result-less query against a given database. */
 PHP_METHOD(sqlite3, exec)
 {
        php_sqlite3_db_object *db_obj;
@@ -180,8 +170,7 @@ PHP_METHOD(sqlite3, exec)
 
        SQLITE3_CHECK_INITIALIZED(db_obj->initialised, SQLite3)
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                               &sql, &sql_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) {
                return;
        }
 
@@ -196,8 +185,7 @@ PHP_METHOD(sqlite3, exec)
 /* }}} */
 
 /* {{{ proto Array SQLite3::version()
-       Returns the SQLite3 Library version as a string constant and as a number.
-*/
+   Returns the SQLite3 Library version as a string constant and as a number. */
 PHP_METHOD(sqlite3, version)
 {
        if (zend_parse_parameters_none() == FAILURE) {
@@ -214,8 +202,7 @@ PHP_METHOD(sqlite3, version)
 /* }}} */
 
 /* {{{ proto int SQLite3::lastInsertRowID()
-       Returns the rowid of the most recent INSERT into the database from the database connection.
-*/
+   Returns the rowid of the most recent INSERT into the database from the database connection. */
 PHP_METHOD(sqlite3, lastInsertRowID)
 {
        php_sqlite3_db_object *db_obj;
@@ -233,8 +220,7 @@ PHP_METHOD(sqlite3, lastInsertRowID)
 /* }}} */
 
 /* {{{ proto int SQLite3::lastErrorCode()
-       Returns the numeric result code of the most recent failed sqlite API call for the database connection.
-*/
+   Returns the numeric result code of the most recent failed sqlite API call for the database connection. */
 PHP_METHOD(sqlite3, lastErrorCode)
 {
        php_sqlite3_db_object *db_obj;
@@ -252,8 +238,7 @@ PHP_METHOD(sqlite3, lastErrorCode)
 /* }}} */
 
 /* {{{ proto string SQLite3::lastErrorMsg()
-       Returns english text describing the most recent failed sqlite API call for the database connection.
-*/
+   Returns english text describing the most recent failed sqlite API call for the database connection. */
 PHP_METHOD(sqlite3, lastErrorMsg)
 {
        php_sqlite3_db_object *db_obj;
@@ -271,8 +256,7 @@ PHP_METHOD(sqlite3, lastErrorMsg)
 /* }}} */
 
 /* {{{ proto bool SQLite3::loadExtension(String Shared Library)
-       Attempts to load an SQLite extension library
-*/
+   Attempts to load an SQLite extension library. */
 PHP_METHOD(sqlite3, loadExtension)
 {
        php_sqlite3_db_object *db_obj;
@@ -284,8 +268,7 @@ PHP_METHOD(sqlite3, loadExtension)
 
        SQLITE3_CHECK_INITIALIZED(db_obj->initialised, SQLite3)
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                               &extension, &extension_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &extension, &extension_len)) {
                return;
        }
 
@@ -336,8 +319,7 @@ PHP_METHOD(sqlite3, loadExtension)
 /* }}} */
 
 /* {{{ proto int SQLite3::changes()
-       Returns the number of database rows that were changed (or inserted or deleted) by the most recent SQL statement.
-*/
+  Returns the number of database rows that were changed (or inserted or deleted) by the most recent SQL statement. */
 PHP_METHOD(sqlite3, changes)
 {
        php_sqlite3_db_object *db_obj;
@@ -355,15 +337,13 @@ PHP_METHOD(sqlite3, changes)
 /* }}} */
 
 /* {{{ proto String SQLite3::escapeString(String value)
-       Returns a string that has been properly escaped
-*/
+   Returns a string that has been properly escaped. */
 PHP_METHOD(sqlite3, escapeString)
 {
        char *sql, *ret;
        int sql_len;
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                               &sql, &sql_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) {
                return;
        }
 
@@ -380,8 +360,7 @@ PHP_METHOD(sqlite3, escapeString)
 /* }}} */
 
 /* {{{ proto sqlite3_stmt SQLite3::prepare(String Query)
-       Returns a prepared SQL statement for execution
-*/
+   Returns a prepared SQL statement for execution. */
 PHP_METHOD(sqlite3, prepare)
 {
        php_sqlite3_db_object *db_obj;
@@ -393,8 +372,7 @@ PHP_METHOD(sqlite3, prepare)
 
        SQLITE3_CHECK_INITIALIZED(db_obj->initialised, SQLite3)
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                               &sql, &sql_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) {
                return;
        }
 
@@ -408,7 +386,7 @@ PHP_METHOD(sqlite3, prepare)
        stmt_obj->db_obj_zval = getThis();
 
        Z_ADDREF_P(object);
-
+       
        errcode = sqlite3_prepare_v2(db_obj->db, sql, sql_len, &(stmt_obj->stmt), NULL);
        if (errcode != SQLITE_OK) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to prepare statement: %d, %s", errcode, sqlite3_errmsg(db_obj->db));
@@ -419,8 +397,7 @@ PHP_METHOD(sqlite3, prepare)
 /* }}} */
 
 /* {{{ proto sqlite3_result SQLite3::query(String Query)
-       Returns true or false, for queries that return data it will return a sqlite3_result object
-*/
+   Returns true or false, for queries that return data it will return a sqlite3_result object. */
 PHP_METHOD(sqlite3, query)
 {
        php_sqlite3_db_object *db_obj;
@@ -434,8 +411,7 @@ PHP_METHOD(sqlite3, query)
 
        SQLITE3_CHECK_INITIALIZED(db_obj->initialised, SQLite3)
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                               &sql, &sql_len)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &sql, &sql_len)) {
                return;
        }
 
@@ -499,7 +475,7 @@ PHP_METHOD(sqlite3, query)
 }
 /* }}} */
 
-static zval* sqlite_value_to_zval(sqlite3_stmt *stmt, int column)
+static zval* sqlite_value_to_zval(sqlite3_stmt *stmt, int column) /* {{{ */
 {
        zval *data;
        MAKE_STD_ZVAL(data);
@@ -530,10 +506,10 @@ static zval* sqlite_value_to_zval(sqlite3_stmt *stmt, int column)
        }
        return data;
 }
+/* }}} */
 
 /* {{{ proto sqlite3_result SQLite3::querySingle(String Query [, entire_row = false])
-       Returns a string of the first column, or an array of the entire row
-*/
+   Returns a string of the first column, or an array of the entire row. */
 PHP_METHOD(sqlite3, querySingle)
 {
        php_sqlite3_db_object *db_obj;
@@ -545,8 +521,7 @@ PHP_METHOD(sqlite3, querySingle)
 
        SQLITE3_CHECK_INITIALIZED(db_obj->initialised, SQLite3)
 
-       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b",
-                               &sql, &sql_len, &entire_row)) {
+       if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &sql, &sql_len, &entire_row)) {
                return;
        }
 
@@ -569,7 +544,6 @@ PHP_METHOD(sqlite3, querySingle)
                RETURN_FALSE;
        }
 
-
        return_code = sqlite3_step(stmt);
 
        switch (return_code) {
@@ -610,9 +584,7 @@ PHP_METHOD(sqlite3, querySingle)
 }
 /* }}} */
 
-static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb,
-               int argc, sqlite3_value **argv, sqlite3_context *context,
-               int is_agg TSRMLS_DC)
+static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, sqlite3_value **argv, sqlite3_context *context, int is_agg TSRMLS_DC) /* {{{ */
 {
        zval ***zargs = NULL;
        zval *retval = NULL;
@@ -675,8 +647,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb,
                        case SQLITE_BLOB:
                        case SQLITE3_TEXT:
                        default:
-                               ZVAL_STRINGL(*zargs[i + is_agg], (char*)sqlite3_value_text(argv[i]),
-                                               sqlite3_value_bytes(argv[i]), 1);
+                               ZVAL_STRINGL(*zargs[i + is_agg], (char*)sqlite3_value_text(argv[i]), sqlite3_value_bytes(argv[i]), 1);
                                break;
                }
        }
@@ -719,8 +690,7 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb,
 
                                default:
                                        convert_to_string_ex(&retval);
-                                       sqlite3_result_text(context, Z_STRVAL_P(retval),
-                                               Z_STRLEN_P(retval), SQLITE_TRANSIENT);
+                                       sqlite3_result_text(context, Z_STRVAL_P(retval), Z_STRLEN_P(retval), SQLITE_TRANSIENT);
                                        break;
                        }
                } else {
@@ -747,37 +717,39 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb,
        if (retval) {
                zval_ptr_dtor(&retval);
        }
-
        return ret;
 }
+/* }}}*/
 
-static void php_sqlite3_callback_func(sqlite3_context *context, int argc, sqlite3_value **argv)
+static void php_sqlite3_callback_func(sqlite3_context *context, int argc, sqlite3_value **argv) /* {{{ */
 {
        php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
        TSRMLS_FETCH();
 
        sqlite3_do_callback(&func->afunc, func->func, argc, argv, context, 0 TSRMLS_CC);
 }
+/* }}}*/
 
-static void php_sqlite3_callback_step(sqlite3_context *context, int argc, sqlite3_value **argv)
+static void php_sqlite3_callback_step(sqlite3_context *context, int argc, sqlite3_value **argv) /* {{{ */
 {
        php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
        TSRMLS_FETCH();
 
        sqlite3_do_callback(&func->astep, func->step, argc, argv, context, 1 TSRMLS_CC);
 }
+/* }}} */
 
-static void php_sqlite3_callback_final(sqlite3_context *context)
+static void php_sqlite3_callback_final(sqlite3_context *context) /* {{{ */
 {
        php_sqlite3_func *func = (php_sqlite3_func *)sqlite3_user_data(context);
        TSRMLS_FETCH();
 
        sqlite3_do_callback(&func->afini, func->fini, 0, NULL, context, 1 TSRMLS_CC);
 }
+/* }}} */
 
 /* {{{ proto bool SQLite3::createFunction(string name, mixed callback [, int argcount]))
-       Allows registration of a PHP function as a SQLite UDF that can be called within SQL statements
-*/
+   Allows registration of a PHP function as a SQLite UDF that can be called within SQL statements. */
 PHP_METHOD(sqlite3, createFunction)
 {
        php_sqlite3_db_object *db_obj;
@@ -828,8 +800,7 @@ PHP_METHOD(sqlite3, createFunction)
 /* }}} */
 
 /* {{{ proto bool SQLite3::createAggregate(string name, mixed step, mixed final [, int argcount]))
-       Allows registration of a PHP function for use as an aggregate
-*/
+   Allows registration of a PHP function for use as an aggregate. */
 PHP_METHOD(sqlite3, createAggregate)
 {
        php_sqlite3_db_object *db_obj;
@@ -891,8 +862,7 @@ PHP_METHOD(sqlite3, createAggregate)
 /* }}} */
 
 /* {{{ proto int SQLite3_stmt::paramCount()
-       Returns the number of parameters within the prepared statement
-*/
+   Returns the number of parameters within the prepared statement. */
 PHP_METHOD(sqlite3_stmt, paramCount)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -908,8 +878,7 @@ PHP_METHOD(sqlite3_stmt, paramCount)
 /* }}} */
 
 /* {{{ proto bool SQLite3_stmt::close()
-       Closes the prepared statement
-*/
+   Closes the prepared statement. */
 PHP_METHOD(sqlite3_stmt, close)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -920,16 +889,14 @@ PHP_METHOD(sqlite3_stmt, close)
                return;
        }
 
-       /*zend_llist_del_element(&(stmt_obj->db_obj->stmt_list), stmt_obj->stmt,
-                                                       (int (*)(void *, void *)) php_sqlite3_compare_stmt_free);*/
+       /*zend_llist_del_element(&(stmt_obj->db_obj->stmt_list), stmt_obj->stmt, (int (*)(void *, void *)) php_sqlite3_compare_stmt_free);*/
 
        RETURN_TRUE;
 }
 /* }}} */
 
 /* {{{ proto bool SQLite3_stmt::reset()
-       Reset the prepared statement to the state before it was executed, bindings still remain.
-*/
+   Reset the prepared statement to the state before it was executed, bindings still remain. */
 PHP_METHOD(sqlite3_stmt, reset)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -949,8 +916,7 @@ PHP_METHOD(sqlite3_stmt, reset)
 /* }}} */
 
 /* {{{ proto bool SQLite3_stmt::clear()
-       Clear all current bound parameters
-*/
+   Clear all current bound parameters. */
 PHP_METHOD(sqlite3_stmt, clear)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -1016,8 +982,7 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa
 /* }}} */
 
 /* {{{ proto bool SQLite3_stmt::bindParam(int parameter_number, mixed parameter [, int type])
-       Bind Paramater to a stmt variable
-*/
+   Bind Paramater to a stmt variable. */
 PHP_METHOD(sqlite3_stmt, bindParam)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -1028,10 +993,8 @@ PHP_METHOD(sqlite3_stmt, bindParam)
        param.param_number = -1;
        param.type = SQLITE3_TEXT;
 
-       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|l",
-                               &param.param_number, &param.parameter, &param.type) == FAILURE) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l",
-                                        &param.name, &param.name_len, &param.parameter, &param.type) == FAILURE) {
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &param.param_number, &param.parameter, &param.type) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|l", &param.name, &param.name_len, &param.parameter, &param.type) == FAILURE) {
                        return;
                }
        }
@@ -1050,8 +1013,7 @@ PHP_METHOD(sqlite3_stmt, bindParam)
 /* }}} */
 
 /* {{{ proto bool SQLite3_stmt::bindValue(inte parameter_number, mixed parameter [, int type])
-       Bind Value of a parameter to a stmt variable
-*/
+   Bind Value of a parameter to a stmt variable. */
 PHP_METHOD(sqlite3_stmt, bindValue)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -1062,10 +1024,8 @@ PHP_METHOD(sqlite3_stmt, bindValue)
        param.param_number = -1;
        param.type = SQLITE3_TEXT;
 
-       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l",
-                               &param.param_number, &param.parameter, &param.type) == FAILURE) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/|l",
-                               &param.name, &param.name_len, &param.parameter, &param.type) == FAILURE) {
+       if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "lz/|l", &param.param_number, &param.parameter, &param.type) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz/|l", &param.name, &param.name_len, &param.parameter, &param.type) == FAILURE) {
                        return;
                }
        }
@@ -1084,8 +1044,7 @@ PHP_METHOD(sqlite3_stmt, bindValue)
 /* }}} */
 
 /* {{{ proto SQLite3_result SQLite3_stmt::execute()
-       Executes a prepared statement and returns a result set object
-*/
+   Executes a prepared statement and returns a result set object. */
 PHP_METHOD(sqlite3_stmt, execute)
 {
        php_sqlite3_stmt *stmt_obj;
@@ -1130,7 +1089,7 @@ PHP_METHOD(sqlite3_stmt, execute)
                                                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to read stream for parameter %ld", param->param_number);
                                                        RETURN_FALSE;
                                                }
-                                               blength = php_stream_copy_to_mem(stream, &buffer, PHP_STREAM_COPY_ALL, 0);
+                                               blength = php_stream_copy_to_mem(stream, (void *)&buffer, PHP_STREAM_COPY_ALL, 0);
                                        } else {
                                                convert_to_string(param->parameter);
                                                blength =  Z_STRLEN_P(param->parameter);
@@ -1196,8 +1155,7 @@ PHP_METHOD(sqlite3_stmt, execute)
 /* }}} */
 
 /* {{{ proto int SQLite3_result::numColumns()
-       Number of columns in the result set
-*/
+   Number of columns in the result set. */
 PHP_METHOD(sqlite3_result, numColumns)
 {
        php_sqlite3_result *result_obj;
@@ -1215,8 +1173,7 @@ PHP_METHOD(sqlite3_result, numColumns)
 /* }}} */
 
 /* {{{ proto string SQLite3_result::columnName(int column)
-       Returns the name of the nth column
-*/
+   Returns the name of the nth column. */
 PHP_METHOD(sqlite3_result, columnName)
 {
        php_sqlite3_result *result_obj;
@@ -1230,13 +1187,12 @@ PHP_METHOD(sqlite3_result, columnName)
                return;
        }
 
-       RETVAL_STRING((char *)sqlite3_column_name(result_obj->stmt_obj->stmt, column), 1);
+       RETVAL_STRING((char*)sqlite3_column_name(result_obj->stmt_obj->stmt, column), 1);
 }
 /* }}} */
 
-/* {{{ proto string SQLite3_result::columnType(int column)
-       Returns the type of the nth column
-*/
+/* {{{ proto int SQLite3_result::columnType(int column)
+   Returns the type of the nth column. */
 PHP_METHOD(sqlite3_result, columnType)
 {
        php_sqlite3_result *result_obj;
@@ -1255,8 +1211,7 @@ PHP_METHOD(sqlite3_result, columnType)
 /* }}} */
 
 /* {{{ proto array SQLite3_result::fetchArray([int mode])
-       Fetch a result row as both an associative or numerically indexed array or both
-*/
+   Fetch a result row as both an associative or numerically indexed array or both. */
 PHP_METHOD(sqlite3_result, fetchArray)
 {
        php_sqlite3_result *result_obj;
@@ -1307,8 +1262,7 @@ PHP_METHOD(sqlite3_result, fetchArray)
 /* }}} */
 
 /* {{{ proto bool SQLite3_result::reset()
-       Resets the result set back to the first row
-*/
+   Resets the result set back to the first row. */
 PHP_METHOD(sqlite3_result, reset)
 {
        php_sqlite3_result *result_obj;
@@ -1332,8 +1286,7 @@ PHP_METHOD(sqlite3_result, reset)
 /* }}} */
 
 /* {{{ proto bool SQLite3_result::finalize()
-       Closes the result set
-*/
+   Closes the result set. */
 PHP_METHOD(sqlite3_result, finalize)
 {
        php_sqlite3_result *result_obj;
@@ -1496,7 +1449,6 @@ ZEND_END_ARG_INFO()
 static
 ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_result_finalize, 0)
 ZEND_END_ARG_INFO()
-
 /* }}} */
 
 /* {{{ php_sqlite3_class_methods */
@@ -1543,25 +1495,22 @@ static zend_function_entry php_sqlite3_result_class_methods[] = {
        PHP_ME(sqlite3_result, fetchArray,              arginfo_sqlite3_result_fetcharray, ZEND_ACC_PUBLIC)
        PHP_ME(sqlite3_result, reset,                   arginfo_sqlite3_result_reset, ZEND_ACC_PUBLIC)
        PHP_ME(sqlite3_result, finalize,                arginfo_sqlite3_result_finalize, ZEND_ACC_PUBLIC)
-
        {NULL, NULL, NULL}
 };
 /* }}} */
 
-/* {{{ Authorization Callback */
-static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4,
-               const char *arg5, const char *arg6)
+/* {{{ Authorization Callback 
+*/
+static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4, const char *arg5, const char *arg6)
 {
        TSRMLS_FETCH();
        switch (access_type) {
                case SQLITE_ATTACH:
                {
                        if (strncmp(arg3, ":memory:", sizeof(":memory:")-1)) {
-#if PHP_MAJOR_VERSION < 6
                                if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
                                        return SQLITE_DENY;
                                }
-#endif
                                if (php_check_open_basedir(arg3 TSRMLS_CC)) {
                                        return SQLITE_DENY;
                                }
@@ -1577,7 +1526,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
 /* }}} */
 
 /* {{{ php_sqlite3_stmt_free
- */
+*/
 static void php_sqlite3_stmt_free(void **item)
 {
        php_sqlite3_stmt_free_list *free_item = (php_sqlite3_stmt_free_list *)*item;
@@ -1592,13 +1541,13 @@ static void php_sqlite3_stmt_free(void **item)
 }
 /* }}} */
 
-
 static int php_sqlite3_compare_stmt_free( php_sqlite3_stmt_free_list **stmt_list, sqlite3_stmt *statement )  /* {{{ */
 {
        return (statement == (*stmt_list)->stmt);
 }
+/* }}} */
 
-static void php_sqlite3_object_free_storage(void *object TSRMLS_DC)
+static void php_sqlite3_object_free_storage(void *object TSRMLS_DC) /* {{{ */
 {
        php_sqlite3_db_object *intern = (php_sqlite3_db_object *)object;
        php_sqlite3_func *func;
@@ -1636,8 +1585,9 @@ static void php_sqlite3_object_free_storage(void *object TSRMLS_DC)
        zend_object_std_dtor(&intern->zo TSRMLS_CC);
        efree(intern);
 }
+/* }}} */
 
-static void php_sqlite3_stmt_object_free_storage(void *object TSRMLS_DC)
+static void php_sqlite3_stmt_object_free_storage(void *object TSRMLS_DC) /* {{{ */
 {
        php_sqlite3_stmt *intern = (php_sqlite3_stmt *)object;
 
@@ -1661,8 +1611,9 @@ static void php_sqlite3_stmt_object_free_storage(void *object TSRMLS_DC)
        zend_object_std_dtor(&intern->zo TSRMLS_CC);
        efree(intern);
 }
+/* }}} */
 
-static void php_sqlite3_result_object_free_storage(void *object TSRMLS_DC)
+static void php_sqlite3_result_object_free_storage(void *object TSRMLS_DC) /* {{{ */
 {
        php_sqlite3_result *intern = (php_sqlite3_result *)object;
 
@@ -1684,8 +1635,9 @@ static void php_sqlite3_result_object_free_storage(void *object TSRMLS_DC)
        zend_object_std_dtor(&intern->zo TSRMLS_CC);
        efree(intern);
 }
+/* }}} */
 
-static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSRMLS_DC)
+static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
 {
        zval *tmp;
        zend_object_value retval;
@@ -1706,8 +1658,9 @@ static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSR
 
        return retval;
 }
+/* }}} */
 
-static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_type TSRMLS_DC)
+static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
 {
        zval *tmp;
        zend_object_value retval;
@@ -1725,8 +1678,9 @@ static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_typ
 
        return retval;
 }
+/* }}} */
 
-static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_type TSRMLS_DC)
+static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
 {
        zval *tmp;
        zend_object_value retval;
@@ -1747,8 +1701,9 @@ static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_t
 
        return retval;
 }
+/* }}} */
 
-static void sqlite3_param_dtor(void *data)
+static void sqlite3_param_dtor(void *data) /* {{{ */
 {
        struct php_sqlite3_bound_param *param = (struct php_sqlite3_bound_param*)data;
 
@@ -1761,9 +1716,10 @@ static void sqlite3_param_dtor(void *data)
                param->parameter = NULL;
        }
 }
+/* }}} */
 
 /* {{{ PHP_MINIT_FUNCTION
- */
+*/
 PHP_MINIT_FUNCTION(sqlite3)
 {
        zend_class_entry ce;
@@ -1819,7 +1775,7 @@ PHP_MINIT_FUNCTION(sqlite3)
 /* }}} */
 
 /* {{{ PHP_MSHUTDOWN_FUNCTION
- */
+*/
 PHP_MSHUTDOWN_FUNCTION(sqlite3)
 {
        UNREGISTER_INI_ENTRIES();
@@ -1829,7 +1785,7 @@ PHP_MSHUTDOWN_FUNCTION(sqlite3)
 /* }}} */
 
 /* {{{ PHP_MINFO_FUNCTION
- */
+*/
 PHP_MINFO_FUNCTION(sqlite3)
 {
        php_info_print_table_start();
@@ -1840,9 +1796,10 @@ PHP_MINFO_FUNCTION(sqlite3)
 
        DISPLAY_INI_ENTRIES();
 }
+/* }}} */
 
 /* {{{ PHP_GINIT_FUNCTION
- */
+*/
 static PHP_GINIT_FUNCTION(sqlite3)
 {
        memset(sqlite3_globals, 0, sizeof(*sqlite3_globals));
@@ -1850,7 +1807,7 @@ static PHP_GINIT_FUNCTION(sqlite3)
 /* }}} */
 
 /* {{{ sqlite3_module_entry
- */
+*/
 zend_module_entry sqlite3_module_entry = {
        STANDARD_MODULE_HEADER,
        "sqlite3",
@@ -1861,15 +1818,11 @@ zend_module_entry sqlite3_module_entry = {
        NULL,
        PHP_MINFO(sqlite3),
        PHP_SQLITE3_VERSION,
-#if ZEND_MODULE_API_NO >= 20060613
        PHP_MODULE_GLOBALS(sqlite3),
        PHP_GINIT(sqlite3),
        NULL,
        NULL,
        STANDARD_MODULE_PROPERTIES_EX
-#else
-       STANDARD_MODULE_PROPERTIES
-#endif
 };
 /* }}} */