/* }}} */
} IBASE_BLOBINFO;
-int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, unsigned long max_len) /* {{{ */
+int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, zend_ulong max_len) /* {{{ */
{
if (ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low) { /*not null ?*/
ISC_STATUS stat;
zend_string *bl_data;
- unsigned long cur_len;
+ zend_ulong cur_len;
unsigned short seg_len;
bl_data = zend_string_alloc(max_len, 0);
int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob) /* {{{ */
{
- unsigned long put_cnt = 0, rem_cnt;
+ zend_ulong put_cnt = 0, rem_cnt;
unsigned short chunk_size;
convert_to_string_ex(string_arg);
isc_info_blob_type
};
- char bl_inf[sizeof(long)*8], *p;
+ char bl_inf[sizeof(zend_long)*8], *p;
bl_info->max_segment = 0;
bl_info->num_segments = 0;
char **events, unsigned short *l, char **event_buf, char **result_buf)
{
ISC_STATUS dummy_result[20];
- unsigned long dummy_count[15];
+ ISC_ULONG dummy_count[15];
/**
* Unfortunately, there's no clean and portable way in C to pass arguments to
int num_args;
char *event_buffer, *result_buffer, *events[15];
unsigned short i = 0, event_count = 0, buffer_size;
- unsigned long occurred_event[15];
+ ISC_ULONG occurred_event[15];
RESET_ERRMSG;
}
/* }}} */
-static isc_callback _php_ibase_callback(ibase_event *event, /* {{{ */
+#if FB_API_VER >= 20
+#define PHP_ISC_CALLBACK ISC_EVENT_CALLBACK
+static ISC_EVENT_CALLBACK _php_ibase_callback(ibase_event *event, /* {{{ */
+ ISC_USHORT buffer_size, ISC_UCHAR *result_buf)
+#else
+#define PHP_ISC_CALLBACK isc_callback
+static isc_callback _php_ibase_callback(ibase_event *event, /* {{{ */
unsigned short buffer_size, char *result_buf)
+#endif
{
/* this function is called asynchronously by the Interbase client library. */
TSRMLS_FETCH_FROM_CTX(event->thread_ctx);
*/
switch (event->state) {
unsigned short i;
- unsigned long occurred_event[15];
+ ISC_ULONG occurred_event[15];
zval return_value, args[2];
default: /* == DEAD */
case NEW:
/* re-register the event */
if (isc_que_events(IB_STATUS, &event->link->handle, &event->event_id, buffer_size,
- event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) {
+ event->event_buffer,(PHP_ISC_CALLBACK)_php_ibase_callback, (void *)event)) {
_php_ibase_error();
}
/* now register the events with the Interbase API */
if (isc_que_events(IB_STATUS, &ib_link->handle, &event->event_id, buffer_size,
- event->event_buffer,(isc_callback)_php_ibase_callback, (void *)event)) {
+ event->event_buffer,(PHP_ISC_CALLBACK)_php_ibase_callback, (void *)event)) {
_php_ibase_error();
efree(event);
for (i = n = 0; i < sqlda->sqld; ++i) {
unsigned short dim;
- unsigned long ar_size = 1;
+ zend_ulong ar_size = 1;
XSQLVAR *var = &sqlda->sqlvar[i];
if ((var->sqltype & ~1) == SQL_ARRAY) {
}
/* }}} */
-static int _php_ibase_bind_array(zval *val, char *buf, unsigned long buf_size, /* {{{ */
+static int _php_ibase_bind_array(zval *val, char *buf, zend_ulong buf_size, /* {{{ */
ibase_array *array, int dim)
{
zval null_val, *pnull_val = &null_val;
ZVAL_NULL(pnull_val);
if (dim < array->ar_desc.array_desc_dimensions) {
- unsigned long slice_size = buf_size / dim_len;
+ zend_ulong slice_size = buf_size / dim_len;
unsigned short i;
zval *subval = val;
#ifdef HAVE_STRFTIME
unsigned short n;
#endif
-#if (SIZEOF_LONG < 8)
+#if (SIZEOF_ZEND_LONG < 8)
ISC_INT64 l;
#endif
break;
case SQL_LONG:
convert_to_long(val);
-#if (SIZEOF_LONG > 4)
+#if (SIZEOF_ZEND_LONG > 4)
if (Z_LVAL_P(val) > ISC_LONG_MAX || Z_LVAL_P(val) < ISC_LONG_MIN) {
_php_ibase_module_error("Array parameter exceeds field width");
return FAILURE;
*(ISC_LONG *) buf = (ISC_LONG) Z_LVAL_P(val);
break;
case SQL_INT64:
-#if (SIZEOF_LONG >= 8)
+#if (SIZEOF_ZEND_LONG >= 8)
convert_to_long(val);
- *(long *) buf = Z_LVAL_P(val);
+ *(zend_long *) buf = Z_LVAL_P(val);
#else
convert_to_string(val);
if (!sscanf(Z_STRVAL_P(val), "%" LL_MASK "d", &l)) {
switch (type & ~1) {
unsigned short l;
- long n;
+ zend_long n;
char string_data[255];
struct tm t;
char *format;
n = *(short *) data;
goto _sql_long;
case SQL_INT64:
-#if (SIZEOF_LONG >= 8)
- n = *(long *) data;
+#if (SIZEOF_ZEND_LONG >= 8)
+ n = *(zend_long *) data;
goto _sql_long;
#else
if (scale == 0) {
if (scale == 0) {
ZVAL_LONG(val,n);
} else {
- long f = (long) scales[-scale];
+ zend_long f = (zend_long) scales[-scale];
if (n >= 0) {
- l = slprintf(string_data, sizeof(string_data), "%ld.%0*ld", n / f, -scale, n % f);
+ l = slprintf(string_data, sizeof(string_data), ZEND_LONG_FMT ".%0*" ZEND_LONG_FMT_SPEC, n / f, -scale, n % f);
} else if (n <= -f) {
- l = slprintf(string_data, sizeof(string_data), "%ld.%0*ld", n / f, -scale, -n % f);
+ l = slprintf(string_data, sizeof(string_data), ZEND_LONG_FMT ".%0*" ZEND_LONG_FMT_SPEC, n / f, -scale, -n % f);
} else {
- l = slprintf(string_data, sizeof(string_data), "-0.%0*ld", -scale, -n % f);
+ l = slprintf(string_data, sizeof(string_data), "-0.%0*" ZEND_LONG_FMT_SPEC, -scale, -n % f);
}
ZVAL_STRINGL(val, string_data, l);
}
}
/* }}} */
-static int _php_ibase_arr_zval(zval *ar_zval, char *data, unsigned long data_size, /* {{{ */
+static int _php_ibase_arr_zval(zval *ar_zval, char *data, zend_ulong data_size, /* {{{ */
ibase_array *ib_array, int dim, int flag)
{
/**
unsigned short i;
if (dim < ib_array->ar_desc.array_desc_dimensions) { /* array again */
- unsigned long slice_size = data_size / dim_len;
+ zend_ulong slice_size = data_size / dim_len;
array_init(ar_zval);
{
zval *result_arg;
zend_long flag = 0;
- long i, array_cnt = 0;
+ zend_long i, array_cnt = 0;
ibase_result *ib_result;
RESET_ERRMSG;
if (flag & PHP_IBASE_FETCH_BLOBS) { /* fetch blob contents into hash */
ibase_blob blob_handle;
- unsigned long max_len = 0;
+ zend_ulong max_len = 0;
static char bl_items[] = {isc_info_blob_total_length};
char bl_info[20];
unsigned short i;
static char spb[] = { isc_info_svc_timeout, 10, 0, 0, 0 };
char res_buf[400], *result, *heap_buf = NULL, *heap_p;
- long heap_buf_size = 200, line_len;
+ zend_long heap_buf_size = 200, line_len;
/* info about users requires an action first */
if (info_action == isc_info_svc_get_users) {
}
}
if (!heap_buf || (heap_p - heap_buf + line_len +2) > heap_buf_size) {
- long res_size = heap_buf ? heap_p - heap_buf : 0;
+ zend_long res_size = heap_buf ? heap_p - heap_buf : 0;
while (heap_buf_size < (res_size + line_len +2)) {
heap_buf_size *= 2;
switch (action) {
default:
unknown_option:
- _php_ibase_module_error("Unrecognised option (%ld)", action);
+ _php_ibase_module_error("Unrecognised option (" ZEND_LONG_FMT ")", action);
RETURN_FALSE;
case isc_spb_rpr_check_db:
}
/* don't return the generator value as a string unless it doesn't fit in a long */
-#if SIZEOF_LONG < 8
+#if SIZEOF_ZEND_LONG < 8
if (result < ZEND_LONG_MIN || result > ZEND_LONG_MAX) {
char *res;
int l;
ZEND_BEGIN_MODULE_GLOBALS(ibase)
ISC_STATUS status[20];
zend_resource *default_link;
- long num_links, num_persistent;
+ zend_long num_links, num_persistent;
char errmsg[MAX_ERRMSG];
- long sql_code;
+ zend_long sql_code;
ZEND_END_MODULE_GLOBALS(ibase)
ZEND_EXTERN_MODULE_GLOBALS(ibase)
void php_ibase_blobs_minit(INIT_FUNC_ARGS);
int _php_ibase_string_to_quad(char const *id, ISC_QUAD *qd);
zend_string *_php_ibase_quad_to_string(ISC_QUAD const qd);
-int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, unsigned long max_len);
+int _php_ibase_blob_get(zval *return_value, ibase_blob *ib_blob, zend_ulong max_len);
int _php_ibase_blob_add(zval *string_arg, ibase_blob *ib_blob);
/* provided by ibase_events.c */
case dtype_int64:
l = *(ISC_INT64*)argv[i]->dsc_address;
- if (argv[i]->dsc_scale == 0 && l <= LONG_MAX && l >= LONG_MIN) {
- ZVAL_LONG(&args[i], (long)l);
+ if (argv[i]->dsc_scale == 0 && l <= ZEND_LONG_MAX && l >= ZEND_LONG_MIN) {
+ ZVAL_LONG(&args[i], (zend_long)l);
} else {
ZVAL_DOUBLE(&args[i], ((double)l)/scales[-argv[i]->dsc_scale]);
}
case IS_LONG:
r->dsc_dtype = dtype_long;
- *(long*)r->dsc_address = Z_LVAL(return_value);
- r->dsc_length = sizeof(long);
+ *(zend_long*)r->dsc_address = Z_LVAL(return_value);
+ r->dsc_length = sizeof(zend_long);
break;
case IS_DOUBLE: