summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <abies@php.net>2004-06-12 22:17:16 +0000
committerArd Biesheuvel <abies@php.net>2004-06-12 22:17:16 +0000
commite1519d6f174ed6b86edb22294a966832a1dc6666 (patch)
tree897e0b046a142360ebe97a623db70317fb2c743c
parentc84c5640e7f38cab0c55fe599259352f2cd66f9e (diff)
downloadphp-git-e1519d6f174ed6b86edb22294a966832a1dc6666.tar.gz
GCC fixes
-rw-r--r--ext/pdo_firebird/config.m412
-rw-r--r--ext/pdo_firebird/firebird_driver.c28
-rw-r--r--ext/pdo_firebird/firebird_statement.c5
-rw-r--r--ext/pdo_firebird/php_pdo_firebird_int.h2
4 files changed, 30 insertions, 17 deletions
diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4
index 1baee70ac6..8efbe1b60f 100644
--- a/ext/pdo_firebird/config.m4
+++ b/ext/pdo_firebird/config.m4
@@ -31,9 +31,19 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then
-L$FIREBIRD_LIBDIR
])
+ if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$prefix/include/php/ext
+ elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$abs_srcdir/ext
+ elif test -f ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=ext
+ else
+ AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
+ fi
+
PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD)
PHP_ADD_INCLUDE($FIREBIRD_INCDIR)
AC_DEFINE(HAVE_PDO_FIREBIRD,1,[ ])
- PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared)
+ PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_inc_path)
PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD)
fi
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index 0fac01a87b..1ee80c6217 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -22,6 +22,8 @@
#include "config.h"
#endif
+#define _GNU_SOURCE
+
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
@@ -30,14 +32,12 @@
#include "php_pdo_firebird.h"
#include "php_pdo_firebird_int.h"
-#define _GNU_SOURCE
-
/* map driver specific error message to PDO error */
void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{{ */
{
pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H
: (pdo_firebird_db_handle *)dbh->driver_data;
- long *error_code = stmt ? &stmt->error_code : &dbh->error_code;
+ enum pdo_error_type *error_code = stmt ? &stmt->error_code : &dbh->error_code;
switch (isc_sqlcode(H->isc_status)) {
@@ -273,14 +273,13 @@ static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len T
static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, /* {{{ */
char **quoted, int *quotedlen TSRMLS_DC)
{
- pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
int qcount = 0;
char const *c;
/* Firebird only requires single quotes to be doubled if string lengths are used */
/* count the number of ' characters */
- for (c = unquoted; c = strchr(c,'\''); qcount++, c++);
+ for (c = unquoted; (c = strchr(c,'\'')); qcount++, c++);
if (!qcount) {
return 0;
@@ -292,7 +291,7 @@ static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unqu
*quoted = c = emalloc(*quotedlen+1);
/* foreach (chunk that ends in a quote) */
- for (l = unquoted; r = strchr(l,'\''); l = r+1) {
+ for (l = unquoted; (r = strchr(l,'\'')); l = r+1) {
/* copy the chunk */
strncpy(c, l, r-l);
@@ -362,7 +361,7 @@ static int firebird_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TS
/* if (the value is really being changed and a transaction is open) */
if ((Z_LVAL_P(val)?1:0) ^ dbh->auto_commit && dbh->in_txn) {
- if (dbh->auto_commit = Z_BVAL_P(val)) {
+ if ((dbh->auto_commit = Z_BVAL_P(val))) {
/* just keep the running transaction but commit it */
if (isc_commit_retaining(H->isc_status, &H->tr)) {
RECORD_ERROR(dbh);
@@ -401,8 +400,7 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
switch (attr) {
- char tmp[200] = "Firebird 1.0/Interbase 6";
- info_func_t info_func;
+ char tmp[200];
case PDO_ATTR_AUTOCOMMIT:
ZVAL_LONG(val,dbh->auto_commit);
@@ -414,20 +412,23 @@ static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TS
case PDO_ATTR_CLIENT_VERSION: {
#if defined(__GNUC__) || defined(PHP_WIN32)
+ info_func_t info_func = NULL;
#ifdef __GNUC__
- info_func_t info_func = (info_func_t)dlsym(RTLD_DEFAULT, "isc_get_client_version");
+ info_func = (info_func_t)dlsym(RTLD_DEFAULT, "isc_get_client_version");
#else
HMODULE l = GetModuleHandle("fbclient");
if (!l && !(l = GetModuleHandle("gds32"))) {
- return 0;
+ break;
}
info_func = (info_func_t)GetProcAddress(l, "isc_get_client_version");
#endif
if (info_func) {
info_func(tmp);
+ ZVAL_STRING(val,tmp,1);
+ } else {
+ ZVAL_STRING(val,"Firebird 1.0/Interbase 6",1);
}
- ZVAL_STRING(val,tmp,1);
#else
ZVAL_NULL(val);
#endif
@@ -458,7 +459,7 @@ static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval
if (sqlcode) {
add_next_index_long(info, sqlcode);
- while (l = isc_interprete(&buf[i],&s)) {
+ while ((l = isc_interprete(&buf[i],&s))) {
i += l;
strcpy(&buf[i++], " ");
}
@@ -504,7 +505,6 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRM
isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name };
char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval };
char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;
- short len;
dpb = dpb_buffer + 1;
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index a3f9fe8b47..a3ab575aaa 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -109,7 +109,7 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
return 1;
} while (0);
- RECORD_ERROR(stmt->dbh);
+ RECORD_ERROR(stmt);
return 0;
}
@@ -163,6 +163,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{
return 1;
}
+/* }}} */
/* internal function to override return types of parameters */
static void set_param_type(enum pdo_param_type *param_type, XSQLVAR const *var) /* {{{ */
@@ -419,6 +420,8 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat
return 1;
}
return 0;
+ default:
+ ;
}
return 1;
}
diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h
index 8bb6a5cba2..f67e7b2d9e 100644
--- a/ext/pdo_firebird/php_pdo_firebird_int.h
+++ b/ext/pdo_firebird/php_pdo_firebird_int.h
@@ -31,7 +31,7 @@
#define PDO_FB_DIALECT 3
-#define SHORT_MAX (1 << 8*sizeof(short)-1)
+#define SHORT_MAX (1 << (8*sizeof(short)-1))
#if SIZEOF_LONG == 8
# define LL_MASK l