cvs: php4 /ext/interbase interbase.c interbase.dsp php_interbase.h
| From: | Zeev Suraski | Date: | Mon, 17 Jul 2000 20:51:47 +0000 |
| Subject: | cvs: php4 /ext/interbase interbase.c interbase.dsp php_interbase.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-791@lists.php.net to get a copy of this message | ||
zeev Mon Jul 17 13:51:47 2000 EDT
Added files:
/php4/ext/interbase interbase.dsp
Modified files:
/php4/ext/interbase interbase.c php_interbase.h
Log:
- Made Interbase compile under Win32, cleaned warnings
@- Added Win32 project for the Interbase module (Zeev)
Index: php4/ext/interbase/interbase.c
diff -u php4/ext/interbase/interbase.c:1.42 php4/ext/interbase/interbase.c:1.43
--- php4/ext/interbase/interbase.c:1.42 Sun Jul 9 03:30:52 2000
+++ php4/ext/interbase/interbase.c Mon Jul 17 13:51:47 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.42 2000/07/09 10:30:52 jah Exp $ */
+/* $Id: interbase.c,v 1.43 2000/07/17 20:51:47 zeev Exp $ */
/* TODO: Arrays, roles?
@@ -442,11 +442,10 @@
/* {{{ _php_ibase_free_trans() */
static void _php_ibase_free_trans(ibase_tr_link *ib_trans)
{
- zval **dummy;
ibase_db_link *ib_link;
IBLS_FETCH();
- ib_link = (ibase_db_link *) zend_fetch_resource(dummy, ib_trans->link_rsrc, "InterBase
link", NULL, 2, IBG(le_link), IBG(le_plink));
+ ib_link = (ibase_db_link *) zend_fetch_resource(NULL, ib_trans->link_rsrc, "InterBase
link", NULL, 2, IBG(le_link), IBG(le_plink));
if (ib_link) {
if (ib_link->trans[ib_trans->trans_num] != NULL) {
@@ -579,7 +578,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "Interbase Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.42 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.43 $");
#ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, "Dynamic Module", "yes");
#endif
@@ -663,7 +662,7 @@
dpb_length = dpb - dpb_buffer;
- if (isc_attach_database(IB_STATUS, strlen(server), server, db, dpb_length, dpb_buffer)) {
+ if (isc_attach_database(IB_STATUS, (short) strlen(server), server, db, (short) dpb_length,
dpb_buffer)) {
_php_ibase_error();
return FAILURE;
}
@@ -788,7 +787,7 @@
ib_link = (ibase_db_link *) malloc(sizeof(ibase_db_link));
ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
+ ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) :
SQL_DIALECT_CURRENT);
for (i = 0; i < IBASE_TRANS_ON_LINK; i++)
ib_link->trans[i] = NULL;
@@ -849,7 +848,7 @@
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
ib_link->link = db_handle;
- ib_link->dialect = (ib_dialect ? strtoul(ib_dialect, NULL, 10) : SQL_DIALECT_CURRENT);
+ ib_link->dialect = (ib_dialect ? (unsigned short) strtoul(ib_dialect, NULL, 10) :
SQL_DIALECT_CURRENT);
for (i = 0; i < IBASE_TRANS_ON_LINK; i++)
ib_link->trans[i] = NULL;
@@ -1021,7 +1020,7 @@
/* {{{ _php_ibase_alloc_query() */
/* allocate and prepare query */
-static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle trans,
char *query, int dialect)
+static int _php_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle trans,
char *query, unsigned short dialect)
{
#define IB_QUERY (*ib_queryp)
IBLS_FETCH();
@@ -1043,7 +1042,7 @@
goto _php_ibase_alloc_query_error;
}
- IB_QUERY->out_sqlda = emalloc(XSQLDA_LENGTH(0));
+ IB_QUERY->out_sqlda = (XSQLDA *) emalloc(XSQLDA_LENGTH(0));
IB_QUERY->out_sqlda->sqln = 0;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
@@ -1434,7 +1433,6 @@
PHP_FUNCTION(ibase_trans)
{
pval ***args;
- zval **dummy;
char tpb[20], *tpbp = NULL;
long trans_argl = 0;
int tpb_len = 0, argn, link_id, trans_n = 0, i;
@@ -1474,7 +1472,7 @@
}
if (argn < 2) {
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, dummy, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
+ ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
}
if (trans_argl ) {
@@ -1726,7 +1724,7 @@
case SQL_LONG:
if (scale) {
int j, f = 1;
- float n = *(long *)(data);
+ float n = (float) *(long *)(data);
for (j = 0; j < -scale; j++)
f *= 10;
@@ -1763,8 +1761,8 @@
case SQL_INT64:
val->type = IS_STRING;
val->value.str.len = sprintf(string_data, "%Ld.%Ld",
- (ISC_INT64) (*(ISC_INT64 *)data / (int) pow(10.0, (double) -scale)),
- (ISC_INT64) abs((*(ISC_INT64 *)data % (int) pow(10.0, (double) -scale))));
+ (ISC_INT64) (*((ISC_INT64 *)data) / (int) pow(10.0, (double) -scale)),
+ (ISC_INT64) abs((int) (*((ISC_INT64 *)data) % (int) pow(10.0, (double) -scale))));
val->value.str.val = estrdup(string_data);
break;
#endif
@@ -1989,8 +1987,9 @@
/* find total length of blob's data */
for (p = bl_info; *p != isc_info_end && p < bl_info+sizeof(bl_info);) {
- int item_len, item = *p++;
- item_len = (short)isc_vax_integer(p, 2);
+ unsigned short item_len, item = *p++;
+
+ item_len = (short) isc_vax_integer(p, 2);
p += 2;
if (item == isc_info_blob_total_length)
max_len = isc_vax_integer(p, item_len);
@@ -2000,7 +1999,8 @@
bl_data = emalloc(max_len+1);
for (cur_len = stat = 0; stat == 0 && cur_len < max_len; ) {
- unsigned short seg_len, max_seg = max_len-cur_len > USHRT_MAX ? USHRT_MAX :
max_len-cur_len;
+ unsigned short seg_len;
+ unsigned short max_seg = (unsigned short) (max_len - cur_len > USHRT_MAX ? USHRT_MAX :
max_len-cur_len);
stat = isc_get_segment(IB_STATUS, &bl_handle, &seg_len, max_seg,
&bl_data[cur_len]);
cur_len += seg_len;
if (cur_len > max_len) { /* never!*/
@@ -2160,7 +2160,7 @@
RETURN_FALSE;
}
link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
+ ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
break;
case 2:
if (zend_get_parameters_ex(2, &link_arg, &query_arg) == FAILURE) {
@@ -2463,7 +2463,9 @@
}
for (p = bl_inf; *p != isc_info_end && p < bl_inf+sizeof(bl_inf);) {
- int item_len, item = *p++;
+ unsigned short item_len;
+ int item = *p++;
+
item_len = (short)isc_vax_integer(p, 2);
p += 2;
switch (item) {
@@ -2508,7 +2510,7 @@
switch (ZEND_NUM_ARGS()) {
case 0:
link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
+ ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
break;
case 1:
if (zend_get_parameters_ex(1, &link_arg) == FAILURE) {
@@ -2598,7 +2600,7 @@
convert_to_string(string_arg);
- if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, string_arg->value.str.len,
string_arg->value.str.val)) {
+ if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short)
string_arg->value.str.len, string_arg->value.str.val)) {
_php_ibase_error();
RETURN_FALSE;
}
@@ -2625,7 +2627,7 @@
}
convert_to_long(len_arg);
- max_len = len_arg->value.lval;
+ max_len = (unsigned short) len_arg->value.lval;
GET_BLOB_HANDLE_ARG(blob_arg, ib_blob);
@@ -2634,7 +2636,7 @@
bl_data = emalloc(max_len+1);
for (cur_len = stat = 0; stat == 0; ) {
- stat = isc_get_segment(IB_STATUS, &ib_blob->bl_handle, &seg_len, max_len-cur_len,
&bl_data[cur_len]);
+ stat = isc_get_segment(IB_STATUS, &ib_blob->bl_handle, &seg_len, (unsigned short)
(max_len-cur_len), &bl_data[cur_len]);
cur_len += seg_len;
if (cur_len > max_len) { /* never!*/
efree(bl_data);
@@ -2855,7 +2857,8 @@
PHP_FUNCTION(ibase_blob_import)
{
zval **link_arg, **file_arg;
- int trans_n = 0, link_id = 0, trans_id = 0, size, b;
+ int trans_n = 0, link_id = 0, trans_id = 0, size;
+ unsigned short b;
int issock=0, socketd=0;
ibase_blob_handle ib_blob;
ibase_db_link *ib_link;
@@ -2871,7 +2874,7 @@
RETURN_FALSE;
}
link_id = IBG(default_link);
- ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
+ ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link",
IBG(le_link), IBG(le_plink));
break;
case 2:
if (zend_get_parameters_ex(2, &link_arg, &file_arg) == FAILURE) {
Index: php4/ext/interbase/php_interbase.h
diff -u php4/ext/interbase/php_interbase.h:1.16 php4/ext/interbase/php_interbase.h:1.17
--- php4/ext/interbase/php_interbase.h:1.16 Fri Jul 7 05:06:05 2000
+++ php4/ext/interbase/php_interbase.h Mon Jul 17 13:51:47 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_interbase.h,v 1.16 2000/07/07 12:06:05 jah Exp $ */
+/* $Id: php_interbase.h,v 1.17 2000/07/17 20:51:47 zeev Exp $ */
#ifndef PHP_INTERBASE_H
#define PHP_INTERBASE_H
@@ -96,7 +96,7 @@
typedef struct {
isc_tr_handle trans[IBASE_TRANS_ON_LINK];
isc_db_handle link;
- int dialect;
+ unsigned short dialect;
} ibase_db_link;
typedef struct {
@@ -126,7 +126,7 @@
XSQLDA *in_sqlda, *out_sqlda;
ibase_array *in_array, *out_array;
int in_array_cnt, out_array_cnt;
- int dialect;
+ unsigned short dialect;
int cursor_open;
} ibase_query;
Index: php4/ext/interbase/interbase.dsp
+++ php4/ext/interbase/interbase.dsp
# Microsoft Developer Studio Project File - Name="interbase" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=interbase - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "interbase.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "interbase.mak" CFG="interbase - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "interbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link
Library")
!MESSAGE "interbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "interbase - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS"
/YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"
/D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
# ADD RSC /l 0x40d /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "interbase - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS"
/YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS"
/YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
# ADD RSC /l 0x40d /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug
/machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386
/pdbtype:sept
!ENDIF
# Begin Target
# Name "interbase - Win32 Release"
# Name "interbase - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project