-#! /bin/sh /usr/share/dpatch/dpatch-run
-## gcc4.dpatch by <Damyan Ivanov <divanov@creditreform.bg>>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Make sources compile with gcc4
-
-@DPATCH@
-diff -urNad firebird2-1.5.3.4870~/src/common/classes/alloc.h firebird2-1.5.3.4870/src/common/classes/alloc.h
---- firebird2-1.5.3.4870~/src/common/classes/alloc.h 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/common/classes/alloc.h 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/burp/burp.cpp firebird-1.5.3.4870/src/burp/burp.cpp
+--- firebird-1.5.3.4870-orig/src/burp/burp.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/burp/burp.cpp 2006-03-17 01:32:16.000000000 -0500
+@@ -1606,7 +1606,7 @@
+ #ifndef WIN_NT
+ signal(SIGPIPE, SIG_IGN);
+ #endif
+- fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDOUT_DESC);
++ fil->fil_fd = GBAK_STDOUT_DESC();
+ break;
+ }
+ else
+@@ -1724,7 +1724,7 @@
+
+ tdgbl->action->act_action = ACT_restore;
+ if (!strcmp(fil->fil_name, "stdin")) {
+- fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDIN_DESC);
++ fil->fil_fd = GBAK_STDIN_DESC();
+ tdgbl->file_desc = fil->fil_fd;
+ tdgbl->gbl_sw_files = fil->fil_next;
+ }
+diff -ur firebird-1.5.3.4870-orig/src/burp/std_desc.h firebird-1.5.3.4870/src/burp/std_desc.h
+--- firebird-1.5.3.4870-orig/src/burp/std_desc.h 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/burp/std_desc.h 2006-03-17 01:41:38.000000000 -0500
+@@ -35,12 +35,33 @@
+ #include "firebird.h"
+
+ #ifdef WIN_NT
++
+ #include <windows.h>
+-#define GBAK_STDIN_DESC GetStdHandle(STD_INPUT_HANDLE) /* standart input file descriptor */
+-#define GBAK_STDOUT_DESC GetStdHandle(STD_OUTPUT_HANDLE) /* standart output file descriptor */
++
++typedef HANDLE DESC;
++
++static inline DESC GBAK_STDIN_DESC(void)
++{
++ return GetStdHandle(STD_INPUT_HANDLE); // standard input file descriptor
++}
++static inline DESC GBAK_STDOUT_DESC(void)
++{
++ return GetStdHandle(STD_OUTPUT_HANDLE); // standard output file descriptor
++}
++
+ #else //WIN_NT
+-#define GBAK_STDIN_DESC (int)0 /* standart input file descriptor */
+-#define GBAK_STDOUT_DESC (int)1 /* standart output file descriptor */
++
++typedef int DESC;
++
++static inline DESC GBAK_STDIN_DESC(void)
++{
++ return 0; // standard input file descriptor
++}
++static inline DESC GBAK_STDOUT_DESC(void)
++{
++ return 1; // standard output file descriptor
++}
++
+ #endif //WIN_NT
+
+ #endif //GBAK_STD_DESC_H
+diff -ur firebird-1.5.3.4870-orig/src/common/classes/alloc.h firebird-1.5.3.4870/src/common/classes/alloc.h
+--- firebird-1.5.3.4870-orig/src/common/classes/alloc.h 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/common/classes/alloc.h 2006-03-17 01:32:16.000000000 -0500
@@ -241,23 +241,29 @@
void operator delete[](void* mem) throw();
return pool.allocate(s);
// return pool.calloc(s);
}
-diff -urNad firebird2-1.5.3.4870~/src/common/config/config.cpp firebird2-1.5.3.4870/src/common/config/config.cpp
---- firebird2-1.5.3.4870~/src/common/config/config.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/common/config/config.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/common/config/config.cpp firebird-1.5.3.4870/src/common/config/config.cpp
+--- firebird-1.5.3.4870-orig/src/common/config/config.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/common/config/config.cpp 2006-03-17 01:32:16.000000000 -0500
@@ -261,12 +261,12 @@
int Config::getSortMemBlockSize()
#else
return 0;
#endif
-diff -urNad firebird2-1.5.3.4870~/src/gpre/c_cxx.cpp firebird2-1.5.3.4870/src/gpre/c_cxx.cpp
---- firebird2-1.5.3.4870~/src/gpre/c_cxx.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/gpre/c_cxx.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/dsql/parse.cpp firebird-1.5.3.4870/src/dsql/parse.cpp
+--- firebird-1.5.3.4870-orig/src/dsql/parse.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/dsql/parse.cpp 2006-03-17 01:32:17.000000000 -0500
+@@ -6421,7 +6421,7 @@
+ case 79:
+ {
+ lex.g_field->fld_dtype = dtype_cstring;
+- lex.g_field->fld_character_length = (USHORT) yyvsp[-2]; }
++ lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-2]; }
+ break;
+ case 80:
+ { yyval = (DSQL_NOD) NULL; }
+@@ -7541,27 +7541,27 @@
+ case 507:
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+- lex.g_field->fld_seg_length = (USHORT) yyvsp[-1];
++ lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[-1];
+ lex.g_field->fld_sub_type = 0;
+ }
+ break;
+ case 508:
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+- lex.g_field->fld_seg_length = (USHORT) yyvsp[-3];
+- lex.g_field->fld_sub_type = (USHORT) yyvsp[-1];
++ lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[-3];
++ lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 509:
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+ lex.g_field->fld_seg_length = 80;
+- lex.g_field->fld_sub_type = (USHORT) yyvsp[-1];
++ lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 510:
+ {
+- lex.g_field->fld_seg_length = (USHORT) yyvsp[0];
++ lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[0];
+ }
+ break;
+ case 511:
+@@ -7571,7 +7571,7 @@
+ break;
+ case 512:
+ {
+- lex.g_field->fld_sub_type = (USHORT) yyvsp[0];
++ lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[0];
+ }
+ break;
+ case 513:
+@@ -7592,7 +7592,7 @@
+ case 517:
+ {
+ lex.g_field->fld_dtype = dtype_text;
+- lex.g_field->fld_character_length = (USHORT) yyvsp[-1];
++ lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1];
+ lex.g_field->fld_flags |= FLD_national;
+ }
+ break;
+@@ -7606,14 +7606,14 @@
+ case 519:
+ {
+ lex.g_field->fld_dtype = dtype_varying;
+- lex.g_field->fld_character_length = (USHORT) yyvsp[-1];
++ lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1];
+ lex.g_field->fld_flags |= FLD_national;
+ }
+ break;
+ case 520:
+ {
+ lex.g_field->fld_dtype = dtype_text;
+- lex.g_field->fld_character_length = (USHORT) yyvsp[-1];
++ lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 521:
+@@ -7625,7 +7625,7 @@
+ case 522:
+ {
+ lex.g_field->fld_dtype = dtype_varying;
+- lex.g_field->fld_character_length = (USHORT) yyvsp[-1];
++ lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 531:
+@@ -7705,7 +7705,7 @@
+ lex.g_field->fld_dtype = dtype_long;
+ lex.g_field->fld_length = sizeof (SLONG);
+ }
+- lex.g_field->fld_precision = (USHORT) yyvsp[-1];
++ lex.g_field->fld_precision = (USHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 536:
+@@ -7765,8 +7765,8 @@
+ lex.g_field->fld_length = sizeof (SLONG);
+ }
+ }
+- lex.g_field->fld_precision = (USHORT) yyvsp[-3];
+- lex.g_field->fld_scale = - (SSHORT) yyvsp[-1];
++ lex.g_field->fld_precision = (USHORT)(IPTR) yyvsp[-3];
++ lex.g_field->fld_scale = - (SSHORT)(IPTR) yyvsp[-1];
+ }
+ break;
+ case 539:
+@@ -7932,7 +7932,7 @@
+ { yyval = make_node (nod_table_lock, (int) 2, make_list (yyvsp[-1]), yyvsp[0]); }
+ break;
+ case 602:
+-{ yyval = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT) yyvsp[-1] | (SSHORT) yyvsp[0]), (SSHORT) 0, NULL); }
++{ yyval = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(IPTR) yyvsp[-1] | (SSHORT)(IPTR) yyvsp[0]), (SSHORT) 0, NULL); }
+ break;
+ case 603:
+ { yyval = 0; }
+diff -ur firebird-1.5.3.4870-orig/src/gpre/c_cxx.cpp firebird-1.5.3.4870/src/gpre/c_cxx.cpp
+--- firebird-1.5.3.4870-orig/src/gpre/c_cxx.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/gpre/c_cxx.cpp 2006-03-17 01:32:18.000000000 -0500
@@ -2184,7 +2184,7 @@
args.pat_database = (DBB) init->nod_arg[3];
database = (DBB) event_init->nod_arg[3];
}
}
-diff -urNad firebird2-1.5.3.4870~/src/gpre/cmd.cpp firebird2-1.5.3.4870/src/gpre/cmd.cpp
---- firebird2-1.5.3.4870~/src/gpre/cmd.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/gpre/cmd.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/gpre/cmd.cpp firebird-1.5.3.4870/src/gpre/cmd.cpp
+--- firebird-1.5.3.4870-orig/src/gpre/cmd.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/gpre/cmd.cpp 2006-03-17 01:32:18.000000000 -0500
@@ -204,7 +204,7 @@
case ACT_drop_shadow:
STUFF_END;
break;
-diff -urNad firebird2-1.5.3.4870~/src/gpre/cme.cpp firebird2-1.5.3.4870/src/gpre/cme.cpp
---- firebird2-1.5.3.4870~/src/gpre/cme.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/gpre/cme.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/gpre/cme.cpp firebird-1.5.3.4870/src/gpre/cme.cpp
+--- firebird-1.5.3.4870-orig/src/gpre/cme.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/gpre/cme.cpp 2006-03-17 01:32:18.000000000 -0500
@@ -251,7 +251,7 @@
// ** Begin date/time/timestamp support *
case nod_extract:
CME_get_dtype(node->nod_arg[1], f);
switch (f->fld_dtype)
{
-diff -urNad firebird2-1.5.3.4870~/src/gpre/cob.cpp firebird2-1.5.3.4870/src/gpre/cob.cpp
---- firebird2-1.5.3.4870~/src/gpre/cob.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/gpre/cob.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/gpre/cob.cpp firebird-1.5.3.4870/src/gpre/cob.cpp
+--- firebird-1.5.3.4870-orig/src/gpre/cob.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/gpre/cob.cpp 2006-03-17 01:32:18.000000000 -0500
@@ -382,7 +382,7 @@
static void gen_on_error (ACT);
static void gen_procedure (ACT);
}
-diff -urNad firebird2-1.5.3.4870~/src/gpre/pat.h firebird2-1.5.3.4870/src/gpre/pat.h
---- firebird2-1.5.3.4870~/src/gpre/pat.h 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/gpre/pat.h 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/gpre/pat.h firebird-1.5.3.4870/src/gpre/pat.h
+--- firebird-1.5.3.4870-orig/src/gpre/pat.h 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/gpre/pat.h 2006-03-17 01:32:18.000000000 -0500
@@ -85,7 +85,7 @@
USHORT pat_ident2;
TEXT *pat_vector1;
int pat_value2;
int pat_value3;
int pat_value4;
-diff -urNad firebird2-1.5.3.4870~/src/jrd/blb.cpp firebird2-1.5.3.4870/src/jrd/blb.cpp
---- firebird2-1.5.3.4870~/src/jrd/blb.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/blb.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/blb.cpp firebird-1.5.3.4870/src/jrd/blb.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/blb.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/blb.cpp 2006-03-17 01:32:28.000000000 -0500
@@ -860,8 +860,8 @@
request = tdbb->tdbb_request;
source = (BID) from_desc->dsc_address;
relation = rpb->rpb_relation;
record = rpb->rpb_record;
-diff -urNad firebird2-1.5.3.4870~/src/jrd/cmp.cpp firebird2-1.5.3.4870/src/jrd/cmp.cpp
---- firebird2-1.5.3.4870~/src/jrd/cmp.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/cmp.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/cmp.cpp firebird-1.5.3.4870/src/jrd/cmp.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/cmp.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/cmp.cpp 2006-03-17 01:32:29.000000000 -0500
@@ -958,9 +958,9 @@
FMT format;
USHORT id;
return TRUE; /* do not mark as variant */
}
-diff -urNad firebird2-1.5.3.4870~/src/jrd/common.h firebird2-1.5.3.4870/src/jrd/common.h
---- firebird2-1.5.3.4870~/src/jrd/common.h 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/common.h 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/common.h firebird-1.5.3.4870/src/jrd/common.h
+--- firebird-1.5.3.4870-orig/src/jrd/common.h 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/common.h 2006-03-17 01:32:29.000000000 -0500
@@ -856,8 +856,8 @@
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */
#endif
#ifndef ODS_ALIGNMENT
-diff -urNad firebird2-1.5.3.4870~/src/jrd/dpm.epp firebird2-1.5.3.4870/src/jrd/dpm.epp
---- firebird2-1.5.3.4870~/src/jrd/dpm.epp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/dpm.epp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/dpm.epp firebird-1.5.3.4870/src/jrd/dpm.epp
+--- firebird-1.5.3.4870-orig/src/jrd/dpm.epp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/dpm.epp 2006-03-17 01:32:29.000000000 -0500
@@ -2119,7 +2119,7 @@
DEBUG if (stack)
CCH_MARK(tdbb, &rpb->rpb_window);
i = page->dpg_count + ((slot) ? 0 : 1);
-diff -urNad firebird2-1.5.3.4870~/src/jrd/evl.cpp firebird2-1.5.3.4870/src/jrd/evl.cpp
---- firebird2-1.5.3.4870~/src/jrd/evl.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/evl.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/evl.cpp firebird-1.5.3.4870/src/jrd/evl.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/evl.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/evl.cpp 2006-03-17 01:32:29.000000000 -0500
@@ -248,7 +248,7 @@
arg_number = (int)(IPTR)node->nod_arg[e_arg_number];
desc = &format->fmt_desc[arg_number];
/* If the current transaction has updated the record, the record version
* coming in from DSQL will have the original transaction # (or current
-diff -urNad firebird2-1.5.3.4870~/src/jrd/exe.cpp firebird2-1.5.3.4870/src/jrd/exe.cpp
---- firebird2-1.5.3.4870~/src/jrd/exe.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/exe.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/exe.cpp firebird-1.5.3.4870/src/jrd/exe.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/exe.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/exe.cpp 2006-03-17 01:32:29.000000000 -0500
@@ -375,8 +375,8 @@
if (to->nod_type == nod_field)
relation = request->req_rpb[stream].rpb_relation;
if ((vector = relation->rel_fields) &&
-diff -urNad firebird2-1.5.3.4870~/src/jrd/ext.cpp firebird2-1.5.3.4870/src/jrd/ext.cpp
---- firebird2-1.5.3.4870~/src/jrd/ext.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/ext.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/ext.cpp firebird-1.5.3.4870/src/jrd/ext.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/ext.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/ext.cpp 2006-03-17 01:32:29.000000000 -0500
@@ -266,7 +266,7 @@
record = rpb->rpb_record;
format = record->rec_format;
p = record->rec_data + offset;
l = record->rec_length - offset;
-diff -urNad firebird2-1.5.3.4870~/src/jrd/gds.cpp firebird2-1.5.3.4870/src/jrd/gds.cpp
---- firebird2-1.5.3.4870~/src/jrd/gds.cpp 2006-02-01 23:07:03.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/gds.cpp 2006-02-01 23:07:04.000000000 +0200
-@@ -2287,7 +2287,7 @@
+diff -ur firebird-1.5.3.4870-orig/src/jrd/gds.cpp firebird-1.5.3.4870/src/jrd/gds.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/gds.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/gds.cpp 2006-03-17 01:32:30.000000000 -0500
+@@ -2304,7 +2304,7 @@
return result;
if (stdio_flag)
return (void *)-1;
if (expanded_string)
-diff -urNad firebird2-1.5.3.4870~/src/jrd/idx.cpp firebird2-1.5.3.4870/src/jrd/idx.cpp
---- firebird2-1.5.3.4870~/src/jrd/idx.cpp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/idx.cpp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/idx.cpp firebird-1.5.3.4870/src/jrd/idx.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/idx.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/idx.cpp 2006-03-17 01:32:30.000000000 -0500
@@ -1055,12 +1055,12 @@
index_number < idx->idx_foreign_primaries->count();
index_number++) {
if ( (result =
check_partner_index(tdbb, relation, record, transaction, idx,
partner_relation, index_id)) )
-diff -urNad firebird2-1.5.3.4870~/src/jrd/inf.cpp firebird2-1.5.3.4870/src/jrd/inf.cpp
---- firebird2-1.5.3.4870~/src/jrd/inf.cpp 2003-06-08 16:13:23.000000000 +0300
-+++ firebird2-1.5.3.4870/src/jrd/inf.cpp 2006-02-01 23:07:23.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/inf.cpp firebird-1.5.3.4870/src/jrd/inf.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/inf.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/inf.cpp 2006-03-17 01:32:30.000000000 -0500
@@ -972,7 +972,7 @@
node = request->req_message;
if (item == gds_info_message_number)
buffer_ptr);
else {
format = (FMT) node->nod_arg[e_msg_format];
-diff -urNad firebird2-1.5.3.4870~/src/jrd/met.epp firebird2-1.5.3.4870/src/jrd/met.epp
---- firebird2-1.5.3.4870~/src/jrd/met.epp 2006-02-01 23:07:02.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/met.epp 2006-02-01 23:07:04.000000000 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/met.epp firebird-1.5.3.4870/src/jrd/met.epp
+--- firebird-1.5.3.4870-orig/src/jrd/met.epp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/met.epp 2006-03-17 01:32:31.000000000 -0500
@@ -932,7 +932,7 @@
if (desc->dsc_address)
{
if (relation)
{
if ( (field = MET_get_field(relation, fld_id)) )
-diff -urNad firebird2-1.5.3.4870~/src/jrd/sdl.cpp firebird2-1.5.3.4870/src/jrd/sdl.cpp
---- firebird2-1.5.3.4870~/src/jrd/sdl.cpp 2006-02-01 23:07:03.000000000 +0200
-+++ firebird2-1.5.3.4870/src/jrd/sdl.cpp 2006-02-01 23:07:04.000000000 +0200
-@@ -699,7 +699,7 @@
- }
- element_desc = array_desc->ads_rpt[value].ads_desc;
- element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array +
-- (SLONG) element_desc.dsc_address +
-+ (SLONG)(IPTR) element_desc.dsc_address +
- (array_desc->ads_element_length * subscript);
-
- /* Is this element within the array bounds? */
-
---- Firebird.org/src/jrd/jrd.cpp~ 2004-11-17 12:41:16.000000000 +0100
-+++ Firebird/src/jrd/jrd.cpp 2006-03-28 18:47:32.722559750 +0200
-@@ -3877,9 +3877,9 @@
- {
- if ( (node = csb->csb_rpt[i].csb_message) )
- {
-- if ((int) node->nod_arg[e_msg_number] == 0) {
-+ if ((int)(IPTR) node->nod_arg[e_msg_number] == 0) {
- in_message = node;
-- } else if ((int) node->nod_arg[e_msg_number] == 1) {
-+ } else if ((int)(IPTR) node->nod_arg[e_msg_number] == 1) {
- out_message = node;
- }
- }
---- Firebird.org/src/jrd/jrn.cpp.org 2006-03-28 18:52:47.582237250 +0200
-+++ Firebird/src/jrd/jrn.cpp 2006-03-28 18:54:06.667179750 +0200
-@@ -836,7 +836,7 @@
- for (loop = 0; loop < 20; loop++) {
- for (;;) {
- journal->jrn_channel = (int *) socket(AF_INET, SOCK_STREAM, 0);
-- if ((int) journal->jrn_channel != -1)
-+ if ((int)(IPTR) journal->jrn_channel != -1)
- break;
- if (!SYSCALL_INTERRUPTED(errno)) {
- error(status_vector, journal, errno, "socket");
-@@ -859,18 +859,18 @@
- return ret_val;
- }
-
-- if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
-+ if (!connect((int)(IPTR) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
- break;
-
- sleep(3);
-
- if (loop < 16) {
-- close((int) journal->jrn_channel);
-+ close((int)(IPTR) journal->jrn_channel);
- continue;
- }
- if (!SYSCALL_INTERRUPTED(errno)) {
- if (retry) {
-- close((int) journal->jrn_channel);
-+ close((int)(IPTR) journal->jrn_channel);
- gds__free(journal);
- *ret_jrn = (JRN) NULL;
- return FB_SUCCESS;
-@@ -879,7 +879,7 @@
- gds__free(journal);
- return FB_FAILURE;
- }
-- close((int) journal->jrn_channel);
-+ close((int)(IPTR) journal->jrn_channel);
- }
- #endif
-
-@@ -939,7 +939,7 @@
- if (retry)
- {
- #ifdef BSD_SOCKETS
-- close((int) journal->jrn_channel);
-+ close((int)(IPTR) journal->jrn_channel);
- #endif
-
- #ifdef WIN_NT
-@@ -1056,7 +1056,7 @@
- with us, so keep trying until successful. */
-
- do {
-- l = recv((int) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
-+ l = recv((int)(IPTR) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
- } while (l < 0 && SYSCALL_INTERRUPTED(errno));
-
- if (l < 0) {
-@@ -1095,7 +1095,7 @@
- **************************************/
-
- #ifdef BSD_SOCKETS
-- if (close((int) journal->jrn_channel) < 0) {
-+ if (close((int)(IPTR) journal->jrn_channel) < 0) {
- error(status_vector, journal, errno, "close");
- return FB_FAILURE;
- }
-@@ -1166,7 +1166,7 @@
- with us, so keep trying until successful. */
-
- do {
-- l = send((int) journal->jrn_channel, (char *) buffer, (int) length, 0);
-+ l = send((int)(IPTR) journal->jrn_channel, (char *) buffer, (int) length, 0);
- } while (l < 0 && SYSCALL_INTERRUPTED(errno));
-
- if (l < 0) {
---- Firebird.org/src/jrd/nav.cpp.org 2006-03-28 19:04:53.447601000 +0200
-+++ Firebird/src/jrd/nav.cpp 2006-03-28 19:08:20.452538000 +0200
-@@ -487,7 +487,7 @@
-
- init_fetch(impure);
- idx =
-- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
-+ (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
-
- /* The bitmap is only valid when we are continuing on in one
- direction. It is of no help when we change direction,
-@@ -521,12 +521,12 @@
- #ifdef SCROLLABLE_CURSORS
- MOVE_FAST(
- (impure->irsb_nav_data +
-- (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
-+ (2 * (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
- upper.key_data, upper.key_length);
- #else
- MOVE_FAST(
- (impure->irsb_nav_data +
-- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
- upper.key_length);
- #endif
- }
-@@ -534,7 +534,7 @@
- lower.key_length = impure->irsb_nav_lower_length;
- MOVE_FAST(
- (impure->irsb_nav_data +
-- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
- lower.key_length);
- }
-
-@@ -1404,7 +1404,7 @@
- tdbb = GET_THREAD_DATA;
-
- idx =
-- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
-+ (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
- page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index);
-
- /* the outer loop goes through all the sibling pages
-@@ -1619,7 +1619,7 @@
- tdbb = GET_THREAD_DATA;
- request = tdbb->tdbb_request;
- idx =
-- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
-+ (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
-
- BOOLEAN result;
-
-@@ -1656,7 +1656,7 @@
- rpb->rpb_record,
- reinterpret_cast <
- struct idx *>((SCHAR *) impure +
-- (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]),
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]),
- &value,
- 0);
- if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) {
-@@ -1757,7 +1757,7 @@
- retrieval_node = (JRD_NOD) rsb->rsb_arg[RSB_NAV_index];
- retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval];
- idx =
-- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
-+ (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
- page =
- BTR_find_page(tdbb, retrieval, window, idx, &lower, &upper,
- (direction == RSE_get_backward));
-@@ -1770,7 +1770,7 @@
- impure->irsb_nav_lower_length = lower.key_length;
- MOVE_FAST(lower.key_data,
- (impure->irsb_nav_data +
-- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
- lower.key_length);
- }
-
-@@ -1778,7 +1778,7 @@
- impure->irsb_nav_upper_length = upper.key_length;
- MOVE_FAST(upper.key_data,
- (impure->irsb_nav_data +
-- (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
-+ (2 * (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
- upper.key_length);
- }
-
-@@ -1802,7 +1802,7 @@
- impure->irsb_nav_upper_length = upper.key_length;
- MOVE_FAST(upper.key_data,
- (impure->irsb_nav_data +
-- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
- upper.key_length);
- }
- if (retrieval->irb_lower_count)
-@@ -1813,7 +1813,7 @@
- impure->irsb_nav_lower_length = lower.key_length;
- MOVE_FAST(lower.key_data,
- (impure->irsb_nav_data +
-- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
-+ (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
- lower.key_length);
- }
- if (retrieval->irb_upper_count)
---- Firebird.org/src/jrd/opt.cpp.org 2006-03-28 19:12:44.949068000 +0200
-+++ Firebird/src/jrd/opt.cpp 2006-03-28 19:21:54.587418250 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/opt.cpp firebird-1.5.3.4870/src/jrd/opt.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/opt.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/opt.cpp 2006-03-17 01:32:31.000000000 -0500
@@ -380,7 +380,7 @@
if (node->nod_type != nod_rse)
return NULL;
/* If this is a dbkey for the appropriate stream, it's invertable */
-@@ -1769,7 +1769,7 @@
+@@ -1687,7 +1687,7 @@
switch (node->nod_type) {
case nod_field:
if (allowOnlyCurrentStream) {
if (n != stream) {
-@@ -1795,7 +1795,7 @@
+@@ -1713,7 +1713,7 @@
case nod_dbkey:
if (allowOnlyCurrentStream) {
if (n != stream) {
-@@ -1866,7 +1866,7 @@
+@@ -1784,7 +1784,7 @@
for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
if ((*ptr)->nod_type != nod_rse) {
csb->csb_rpt[n].csb_flags |= csb_active;
}
}
-@@ -1903,7 +1903,7 @@
+@@ -1821,7 +1821,7 @@
{
if ((*ptr)->nod_type != nod_rse)
{
csb->csb_rpt[n].csb_flags &= ~csb_active;
}
}
-@@ -1944,12 +1944,12 @@
+@@ -1862,12 +1862,12 @@
switch (node->nod_type) {
case nod_field:
SET_DEP_BIT(dependencies, n);
return;
-@@ -2005,7 +2005,7 @@
+@@ -1923,7 +1923,7 @@
for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
if ((*ptr)->nod_type != nod_rse) {
CLEAR_DEP_BIT(dependencies, n);
}
}
-@@ -2033,7 +2033,7 @@
+@@ -1951,7 +1951,7 @@
if (node->nod_type == nod_relation) {
assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
}
else if (node->nod_type == nod_union) {
clauses = node->nod_arg[e_uni_clauses];
-@@ -2073,7 +2073,7 @@
+@@ -1991,7 +1991,7 @@
node = *ptr;
if (node->nod_type != nod_rse) {
assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
}
else {
compute_rse_streams(csb, (RSE) node, streams);
-@@ -3371,7 +3371,7 @@
+@@ -3289,7 +3289,7 @@
JRD_NOD dbkey_temp, *ptr, *end;
DEV_BLKCHK(dbkey, type_nod);
if (dbkey->nod_type == nod_dbkey) {
return dbkey;
else {
*position = *position + 1;
-@@ -3632,7 +3632,7 @@
+@@ -3550,7 +3550,7 @@
temp[0]++;
relation_node = plan_node->nod_arg[e_retrieve_relation];
}
// just because the user specified a join does not mean that
-@@ -3806,7 +3806,7 @@
+@@ -3724,7 +3724,7 @@
rsb->rsb_type = rsb_aggregate;
assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
assert((int)node->nod_arg[e_agg_stream] <= MAX_UCHAR);
rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
rsb->rsb_next = OPT_compile(tdbb, csb, rse, NULL);
rsb->rsb_arg[0] = (RSB) node;
-@@ -4170,8 +4170,8 @@
+@@ -4088,8 +4088,8 @@
idx->idx_rpt; ptr < end; ptr++, idx_tail++) {
node = *ptr;
if (node->nod_type != nod_field
|| ptr[2*sort->nod_count] /* do not use index if NULLS FIRST is used */
#ifdef SCROLLABLE_CURSORS
)
-@@ -4331,7 +4331,7 @@
+@@ -4249,7 +4249,7 @@
{
stream_ptr[i]->stream_rsb = NULL;
stream_ptr[i]->stream_num =
}
}
-@@ -4409,10 +4409,10 @@
+@@ -4327,10 +4327,10 @@
SET_TDBB(tdbb);
csb = opt->opt_csb;
procedure = MET_lookup_procedure_id(tdbb,
rsb->rsb_procedure = procedure;
rsb->rsb_format = procedure->prc_format;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure));
-@@ -5025,8 +5025,8 @@
+@@ -4943,8 +4943,8 @@
for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) {
node = *node_ptr;
if (node->nod_type == nod_field
desc = &descriptor;
CMP_get_desc(tdbb, csb, node, desc);
/* International type text has a computed key */
-@@ -5123,8 +5123,8 @@
+@@ -5041,8 +5041,8 @@
map_item->smb_desc.dsc_address = (UCHAR *) map_length;
map_length += desc->dsc_length;
if (node->nod_type == nod_field) {
}
}
-@@ -5136,8 +5136,8 @@
+@@ -5054,8 +5054,8 @@
field has already been mentioned as a sort key, don't bother to repeat
it. */
while (stream_stack) {
format = CMP_format(tdbb, csb, stream);
desc = &format->fmt_desc[id];
if (id >= format->fmt_count || desc->dsc_length == 0)
-@@ -5466,7 +5466,7 @@
+@@ -5384,7 +5384,7 @@
rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
rsb->rsb_type = rsb_union;
rsb->rsb_count = count;
rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
rsb_ptr = rsb->rsb_arg;
-@@ -6008,8 +6008,8 @@
+@@ -5926,8 +5926,8 @@
field = boolean->nod_arg[0];
if (field->nod_type != nod_field)
return NULL;
return NULL;
node = make_index_node(tdbb, relation, opt->opt_csb, idx);
retrieval = (IRB) node->nod_arg[e_idx_retrieval];
-@@ -6077,8 +6077,8 @@
+@@ -5995,8 +5995,8 @@
return NULL;
}
|| !(idx->idx_rpt[0].idx_itype == idx_string
|| idx->idx_rpt[0].idx_itype == idx_byte_array
|| idx->idx_rpt[0].idx_itype == idx_metadata
-@@ -6176,10 +6176,10 @@
+@@ -6094,10 +6094,10 @@
if (access_type) {
for (arg = access_type->nod_arg, end = arg + plan_count;
arg < end; arg += 3) {
if (access_type->nod_type == nod_navigational)
idx->idx_runtime_flags |= idx_plan_navigate;
else /* nod_indices */
-@@ -6251,13 +6251,13 @@
+@@ -6169,13 +6169,13 @@
If left side is still not a field, give up */
if (match->nod_type != nod_field ||
!computable(opt->opt_csb, value, stream, true, false))
{
return 0;
-@@ -6276,7 +6276,7 @@
+@@ -6194,7 +6194,7 @@
#ifdef EXPRESSION_INDICES
(idx->idx_expression ||
#endif
#ifdef EXPRESSION_INDICES
)
#endif
-@@ -6664,7 +6664,7 @@
+@@ -6582,7 +6582,7 @@
return FALSE;
for (streams = river->riv_streams, end =
streams + river->riv_count; streams < end; streams++)
return TRUE;
return FALSE;
}
-@@ -6861,7 +6861,7 @@
+@@ -6779,7 +6779,7 @@
ptr < end; ptr++) {
node = *ptr;
if (node->nod_type != nod_rse) {
csb->csb_rpt[stream].csb_flags &= ~csb_active;
}
else
---- Firebird.org/src/jrd/par.cpp.org 2006-03-28 19:40:36.909559000 +0200
-+++ Firebird/src/jrd/par.cpp 2006-03-28 19:40:47.922247250 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/par.cpp firebird-1.5.3.4870/src/jrd/par.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/par.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/par.cpp 2006-03-17 01:32:31.000000000 -0500
@@ -2518,7 +2518,7 @@
node->nod_arg[e_agg_rse] = parse(tdbb, csb, TYPE_RSE);
node->nod_arg[e_agg_group] = parse(tdbb, csb, OTHER);
break;
case blr_group_by:
---- Firebird.org/src/jrd/rse.cpp.org 2006-03-28 19:44:31.600226250 +0200
-+++ Firebird/src/jrd/rse.cpp 2006-03-28 19:46:40.508282500 +0200
+diff -ur firebird-1.5.3.4870-orig/src/jrd/rse.cpp firebird-1.5.3.4870/src/jrd/rse.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/rse.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/rse.cpp 2006-03-17 01:32:31.000000000 -0500
@@ -730,8 +730,8 @@
/* Initialize the record number of each stream in the union */
rsb = rsb->rsb_arg[0];
}
-@@ -2151,7 +2151,7 @@
- }
-
- desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
-- desc.dsc_address = (UCHAR *) (om + (int) desc.dsc_address);
-+ desc.dsc_address = (UCHAR *) (om + (int)(IPTR) desc.dsc_address);
- eos_desc.dsc_dtype = dtype_short;
- eos_desc.dsc_scale = 0;
- eos_desc.dsc_length = sizeof(SSHORT);
@@ -2914,7 +2914,7 @@
request = tdbb->tdbb_request;
stack = (LLS) rsb->rsb_arg[streams];
/* Make sure a record block has been allocated. If there isn't
one, first find the format, then allocate the record block */
-@@ -2959,7 +2959,7 @@
- for (item = map->smb_rpt; item < end_item; item++) {
- flag = *(data + item->smb_flag_offset);
- from = item->smb_desc;
-- from.dsc_address = data + (ULONG) from.dsc_address;
-+ from.dsc_address = data + (ULONG)(IPTR) from.dsc_address;
- if ((node = item->smb_node) && node->nod_type != nod_field)
- continue;
-
@@ -2972,7 +2972,7 @@
list that contains the data to send back
*/
map->smb_key_length * sizeof(ULONG)) continue;
rpb = &request->req_rpb[item->smb_stream];
-@@ -3211,7 +3211,7 @@
- end_item = map->smb_rpt + map->smb_count;
- for (item = map->smb_rpt; item < end_item; item++) {
- to = item->smb_desc;
-- to.dsc_address = data + (ULONG) to.dsc_address;
-+ to.dsc_address = data + (ULONG)(IPTR) to.dsc_address;
- flag = FALSE;
- if (item->smb_node) {
- from = EVL_expr(tdbb, item->smb_node);
@@ -3238,7 +3238,7 @@
the sort record, then want to sort by language dependent order */
map->smb_key_length * sizeof(ULONG)) {
INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc),
from, &to, FALSE);
-@@ -3301,12 +3301,12 @@
- desc2.dsc_flags = 0;
- desc2.dsc_address = (UCHAR *) & indicator;
- desc1 = *flag_desc;
-- desc1.dsc_address = msg + (int) flag_desc->dsc_address;
-+ desc1.dsc_address = msg + (int)(IPTR) flag_desc->dsc_address;
- MOV_move(&desc1, &desc2);
- if (indicator) {
- SET_NULL(record, to_id);
- l = to_desc->dsc_length;
-- p = record->rec_data + (int) to_desc->dsc_address;
-+ p = record->rec_data + (int)(IPTR) to_desc->dsc_address;
- switch (to_desc->dsc_dtype) {
- case dtype_text:
- /* YYY - not necessarily the right thing to do */
-@@ -3336,9 +3336,9 @@
- else {
- CLEAR_NULL(record, to_id);
- desc1 = *from_desc;
-- desc1.dsc_address = msg + (int) desc1.dsc_address;
-+ desc1.dsc_address = msg + (int)(IPTR) desc1.dsc_address;
- desc2 = *to_desc;
-- desc2.dsc_address = record->rec_data + (int) desc2.dsc_address;
-+ desc2.dsc_address = record->rec_data + (int)(IPTR) desc2.dsc_address;
- if (!DSC_EQUIV((&desc1), (&desc2)))
- MOV_move(&desc1, &desc2);
-
-@@ -3817,7 +3817,7 @@
- if (!sfb_->sfb_file_name) {
- TEXT file_name[128];
+diff -ur firebird-1.5.3.4870-orig/src/jrd/sdl.cpp firebird-1.5.3.4870/src/jrd/sdl.cpp
+--- firebird-1.5.3.4870-orig/src/jrd/sdl.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/jrd/sdl.cpp 2006-03-17 01:32:31.000000000 -0500
+@@ -699,7 +699,7 @@
+ }
+ element_desc = array_desc->ads_rpt[value].ads_desc;
+ element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array +
+- (SLONG) element_desc.dsc_address +
++ (SLONG)(IPTR) element_desc.dsc_address +
+ (array_desc->ads_element_length * subscript);
+
+ /* Is this element within the array bounds? */
+diff -ur firebird-1.5.3.4870-orig/src/qli/command.cpp firebird-1.5.3.4870/src/qli/command.cpp
+--- firebird-1.5.3.4870-orig/src/qli/command.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/qli/command.cpp 2006-03-17 01:32:33.000000000 -0500
+@@ -311,32 +311,32 @@
+ ptr = node->syn_arg;
+
+ for (i = 0; i < node->syn_count; i++) {
+- foo = (USHORT) * ptr++;
++ foo = (USHORT)(IPTR) * ptr++;
+ sw = (ENUM set_t) foo;
+ value = *ptr++;
+ switch (sw) {
+ case set_blr:
+- QLI_blr = (USHORT) value;
++ QLI_blr = (USHORT)(IPTR) value;
+ break;
+
+ case set_statistics:
+- QLI_statistics = (USHORT) value;
++ QLI_statistics = (USHORT)(IPTR) value;
+ break;
+
+ case set_columns:
+- QLI_name_columns = QLI_columns = (USHORT) value;
++ QLI_name_columns = QLI_columns = (USHORT)(IPTR) value;
+ break;
+
+ case set_lines:
+- QLI_lines = (USHORT) value;
++ QLI_lines = (USHORT)(IPTR) value;
+ break;
+
+ case set_semi:
+- QLI_semi = (USHORT) value;
++ QLI_semi = (USHORT)(IPTR) value;
+ break;
+
+ case set_echo:
+- QLI_echo = (USHORT) value;
++ QLI_echo = (USHORT)(IPTR) value;
+ break;
+
+ case set_form:
+@@ -399,7 +399,7 @@
+ break;
+
+ case set_count:
+- QLI_count = (USHORT) value;
++ QLI_count = (USHORT)(IPTR) value;
+ break;
+
+ case set_charset:
+diff -ur firebird-1.5.3.4870-orig/src/qli/expand.cpp firebird-1.5.3.4870/src/qli/expand.cpp
+--- firebird-1.5.3.4870-orig/src/qli/expand.cpp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/qli/expand.cpp 2006-03-17 01:32:33.000000000 -0500
+@@ -2220,7 +2220,7 @@
+ for (i = 0; i < node->nod_count; i++) {
+ expr = *syn_ptr++;
+ if (expr->syn_type == nod_position) {
+- position = (USHORT) expr->syn_arg[0];
++ position = (USHORT)(IPTR) expr->syn_arg[0];
+ if (!list || !position || position > list->nod_count)
+ IBERROR(152); /* Msg152 invalid ORDER BY ordinal */
+ item = (ITM) list->nod_arg[position - 1];
+diff -ur firebird-1.5.3.4870-orig/src/qli/meta.epp firebird-1.5.3.4870/src/qli/meta.epp
+--- firebird-1.5.3.4870-orig/src/qli/meta.epp 2006-03-17 01:39:04.000000000 -0500
++++ firebird-1.5.3.4870/src/qli/meta.epp 2006-03-17 01:32:33.000000000 -0500
+@@ -3795,7 +3795,7 @@
+ RLB rlb;
+
+
+- privileges = (USHORT) node->syn_arg[s_grant_privileges];
++ privileges = (USHORT)(IPTR) node->syn_arg[s_grant_privileges];
+ relation = (QLI_REL) node->syn_arg[s_grant_relation];
+ relation->rel_database = database = setup_update(relation->rel_database);
+ relation_name = relation->rel_symbol->sym_string;
+diff -Naur firebird-1.5.3.4870.old/src/alice/alice.cpp firebird-1.5.3.4870/src/alice/alice.cpp
+--- firebird-1.5.3.4870.old/src/alice/alice.cpp 2006-08-06 06:47:26.000000000 +0200
++++ firebird-1.5.3.4870/src/alice/alice.cpp 2006-08-06 07:59:27.000000000 +0200
+@@ -129,7 +129,7 @@
+ ALICE_gfix( service->svc_argc,
+ service->svc_argv,
+ output_thread,
+- (SLONG) service);
++ (SLONG)(IPTR) service);
+
+ // Mark service thread as finished.
+ // If service is detached, cleanup memory being used by service.
+diff -Naur firebird-1.5.3.4870.old/src/burp/burp.cpp firebird-1.5.3.4870/src/burp/burp.cpp
+--- firebird-1.5.3.4870.old/src/burp/burp.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/burp/burp.cpp 2006-08-06 07:58:54.000000000 +0200
+@@ -181,7 +181,7 @@
+ int exit_code;
+
+ exit_code = BURP_gbak(service->svc_argc, service->svc_argv,
+- output_netware, (SLONG) service);
++ output_netware, (SLONG) (IPTR) service);
+
+ /* Mark service thread as finished. */
+ /* If service is detached, cleanup memory being used by service. */
+diff -Naur firebird-1.5.3.4870.old/src/burp/canonical.cpp firebird-1.5.3.4870/src/burp/canonical.cpp
+--- firebird-1.5.3.4870.old/src/burp/canonical.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/burp/canonical.cpp 2006-08-06 07:54:25.000000000 +0200
+@@ -502,7 +502,7 @@
+ UCHAR *p;
+ SSHORT n;
+
+- p = buffer + (int) desc->dsc_address;
++ p = buffer + (int) (IPTR)desc->dsc_address;
+
+ switch (desc->dsc_dtype)
+ {
+diff -Naur firebird-1.5.3.4870.old/src/dsql/ddl.cpp firebird-1.5.3.4870/src/dsql/ddl.cpp
+--- firebird-1.5.3.4870.old/src/dsql/ddl.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/dsql/ddl.cpp 2006-08-06 07:36:46.000000000 +0200
+@@ -1126,12 +1126,12 @@
+ if (constant)
+ {
+ request->append_number(gds_dyn_trg_sequence,
+- (SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0));
++ (SSHORT)(SLONG)(IPTR) (constant ? constant->nod_arg[0] : 0));
+ }
+
+ if ((constant = node->nod_arg[e_cnstr_type]) != NULL)
+ {
+- const SSHORT type = (SSHORT)(SLONG) constant->nod_arg[0];
++ const SSHORT type = (SSHORT)(SLONG)(IPTR) constant->nod_arg[0];
+ request->append_number(gds_dyn_trg_type, type);
+ }
+
+@@ -1270,7 +1270,7 @@
+
+ switch (element->nod_type) {
+ case nod_file_length:
+- start = (SLONG) (element->nod_arg[0]) + 1;
++ start = (SLONG) (IPTR) (element->nod_arg[0]) + 1;
+ break;
+
+ default:
+@@ -1336,25 +1336,25 @@
+
+ case nod_group_commit_wait:
+ request->append_uchar(gds_dyn_log_group_commit_wait);
+- temp_long = (SLONG) (element->nod_arg[0]);
++ temp_long = (SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(temp_long);
+ break;
+
+ case nod_check_point_len:
+ request->append_uchar(gds_dyn_log_check_point_length);
+- temp_long = (SLONG) (element->nod_arg[0]);
++ temp_long = (SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(temp_long);
+ break;
+
+ case nod_num_log_buffers:
+ request->append_uchar(gds_dyn_log_num_of_buffers);
+- temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
++ temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ushort_with_length(temp_short);
+ break;
+
+ case nod_log_buffer_size:
+ request->append_uchar(gds_dyn_log_buffer_size);
+- temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
++ temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ushort_with_length(temp_short);
+ break;
+
+@@ -1637,11 +1637,11 @@
+ request->append_number(gds_dyn_def_dimension, position);
+ DSQL_NOD element = *ptr++;
+ request->append_uchar(gds_dyn_dim_lower);
+- SLONG lrange = (SLONG) (element->nod_arg[0]);
++ SLONG lrange = (SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(lrange);
+ element = *ptr;
+ request->append_uchar(gds_dyn_dim_upper);
+- SLONG hrange = (SLONG) (element->nod_arg[0]);
++ SLONG hrange = (SLONG) (IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(hrange);
+ request->append_uchar(gds_dyn_end);
+ if (lrange >= hrange)
+@@ -2062,9 +2062,9 @@
+ request->append_cstring(gds_dyn_def_filter,
+ ((STR) (ptr[e_filter_name]))->str_data);
+ request->append_number(gds_dyn_filter_in_subtype,
+- (SSHORT)(SLONG) ((ptr[e_filter_in_type])->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) ((ptr[e_filter_in_type])->nod_arg[0]));
+ request->append_number(gds_dyn_filter_out_subtype,
+- (SSHORT)(SLONG) ((ptr[e_filter_out_type])->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) ((ptr[e_filter_out_type])->nod_arg[0]));
+ request->append_cstring(gds_dyn_func_entry_point,
+ ((STR) (ptr[e_filter_entry_pt]))->str_data);
+ request->append_cstring(gds_dyn_func_module_name,
+@@ -2670,16 +2670,16 @@
+ gds_arg_gds, gds_dsql_shadow_number_err, 0);
+ }
+
+- request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (ptr[e_shadow_number]));
++ request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (IPTR) (ptr[e_shadow_number]));
+ request->append_cstring(gds_dyn_def_file, ((STR) (ptr[e_shadow_name]))->str_data);
+ request->append_number(gds_dyn_shadow_man_auto,
+- (SSHORT)(SLONG) ((ptr[e_shadow_man_auto])->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_man_auto])->nod_arg[0]));
+ request->append_number(gds_dyn_shadow_conditional,
+- (SSHORT)(SLONG) ((ptr[e_shadow_conditional])->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_conditional])->nod_arg[0]));
+
+ request->append_file_start(0);
+
+- SLONG length = (SLONG) ptr[e_shadow_length];
++ SLONG length = (SLONG) (IPTR) ptr[e_shadow_length];
+ request->append_file_length(length);
+
+ request->append_uchar(gds_dyn_end);
+@@ -2806,15 +2806,15 @@
+
+ if (constant = node->nod_arg[e_trg_active])
+ request->append_number(gds_dyn_trg_inactive,
+- (SSHORT)(SLONG) constant->nod_arg[0]);
++ (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
+
+ if (constant = node->nod_arg[e_trg_position])
+ request->append_number(gds_dyn_trg_sequence,
+- (SSHORT)(SLONG) constant->nod_arg[0]);
++ (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
+
+ if (constant = node->nod_arg[e_trg_type]) {
+- request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) constant->nod_arg[0]);
+- trig_type = (USHORT)(ULONG) constant->nod_arg[0];
++ request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
++ trig_type = (USHORT)(ULONG) (IPTR) constant->nod_arg[0];
+ }
+ else {
+ assert(node->nod_type == nod_mod_trigger);
+@@ -2893,7 +2893,7 @@
+ for (DSQL_NOD* ptr = temp->nod_arg; ptr < end; ++ptr)
+ {
+ DSQL_NOD message = *ptr;
+- SSHORT number = (SSHORT)(SLONG) message->nod_arg[e_msg_number];
++ SSHORT number = (SSHORT)(SLONG) (IPTR) message->nod_arg[e_msg_number];
+ if (message->nod_type == nod_del_trigger_msg)
+ {
+ request->append_number(gds_dyn_delete_trigger_msg, number);
+@@ -2954,7 +2954,7 @@
+ // CVC: This is case of "returns <type> [by value|reference]"
+ /* Some data types can not be returned as value */
+
+- if (((int)(SLONG) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) &&
++ if (((int)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) &&
+ (field->fld_dtype == dtype_text ||
+ field->fld_dtype == dtype_varying ||
+ field->fld_dtype == dtype_cstring ||
+@@ -2998,7 +2998,7 @@
+ // CVC: This is case of "returns parameter <N>"
+
+
+- position = (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]);
++ position = (SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]);
+ /* Function modifies an argument whose value is the function return value */
+
+ if (!arguments || position > arguments->nod_count || position < 1) {
+@@ -3024,7 +3024,7 @@
+ if (field->fld_dtype == dtype_blob)
+ {
+ /* CVC: I need to test returning blobs by descriptor before allowing the change there. For now, I ignore the return type specification. */
+- BOOLEAN free_it = ((SSHORT)(SLONG) ret_val_ptr[1]->nod_arg[0] < 0);
++ BOOLEAN free_it = ((SSHORT)(SLONG) (IPTR) ret_val_ptr[1]->nod_arg[0] < 0);
+ request->append_number(gds_dyn_def_function_arg, blob_position);
+ request->append_number(gds_dyn_func_mechanism,
+ (SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct));
+@@ -3035,7 +3035,7 @@
+ {
+ request->append_number(gds_dyn_def_function_arg, (SSHORT) 0);
+ request->append_number(gds_dyn_func_mechanism,
+- (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]));
+ }
+
+ request->append_cstring(gds_dyn_function_name, udf_name);
+@@ -3070,7 +3070,7 @@
+ request->append_number(gds_dyn_def_function_arg, (SSHORT) position);
+
+ if (param_node [e_udf_param_type]) {
+- SSHORT arg_mechanism = (SSHORT)(SLONG) (param_node [e_udf_param_type]->nod_arg [0]);
++ SSHORT arg_mechanism = (SSHORT)(SLONG) (IPTR) (param_node [e_udf_param_type]->nod_arg [0]);
+ request->append_number(gds_dyn_func_mechanism, arg_mechanism);
+ }
+ else if (field->fld_dtype == dtype_blob) {
+@@ -3677,13 +3677,13 @@
+ if (constant)
+ {
+ request->append_number(gds_dyn_trg_sequence,
+- (SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0));
++ (SSHORT)(SLONG) (IPTR) (constant ? constant->nod_arg[0] : 0));
+ }
+
+ constant = node->nod_arg[e_cnstr_type];
+ if (constant)
+ {
+- trig_type = (USHORT)(ULONG) constant->nod_arg[0];
++ trig_type = (USHORT)(ULONG)(IPTR) constant->nod_arg[0];
+ request->append_number(gds_dyn_trg_type, trig_type);
+ }
+ else
+@@ -4173,7 +4173,7 @@
+
+ case nod_del_shadow:
+ request->append_number(gds_dyn_delete_shadow,
+- (SSHORT)(SLONG) (node->nod_arg[0]));
++ (SSHORT)(SLONG) (IPTR) (node->nod_arg[0]));
+ request->append_uchar(gds_dyn_end);
+ break;
+
+@@ -4611,25 +4611,25 @@
+
+ case nod_group_commit_wait:
+ request->append_uchar(gds_dyn_log_group_commit_wait);
+- temp_long = (SLONG) (element->nod_arg[0]);
++ temp_long = (SLONG)(IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(temp_long);
+ break;
+
+ case nod_check_point_len:
+ request->append_uchar(gds_dyn_log_check_point_length);
+- temp_long = (SLONG) (element->nod_arg[0]);
++ temp_long = (SLONG)(IPTR) (element->nod_arg[0]);
+ request->append_ulong_with_length(temp_long);
+ break;
+
+ case nod_num_log_buffers:
+ request->append_uchar(gds_dyn_log_num_of_buffers);
+- temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
++ temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]);
+ request->append_ushort_with_length(temp_short);
+ break;
+
+ case nod_log_buffer_size:
+ request->append_uchar(gds_dyn_log_buffer_size);
+- temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
++ temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]);
+ request->append_ushort_with_length(temp_short);
+ break;
+ case nod_drop_log:
+@@ -5095,7 +5095,7 @@
+ const_node = element->nod_arg[e_mod_fld_pos_new_position];
+
+ /* CVC: Since now the parser accepts pos=1..N, let's subtract one here. */
+- constant = (SSHORT)(SLONG) const_node->nod_arg [0] - 1;
++ constant = (SSHORT)(SLONG) (IPTR) const_node->nod_arg [0] - 1;
+
+ request->append_cstring(gds_dyn_rel_name,
+ relation_name->str_data);
+diff -Naur firebird-1.5.3.4870.old/src/dsql/dsql.cpp firebird-1.5.3.4870/src/dsql/dsql.cpp
+--- firebird-1.5.3.4870.old/src/dsql/dsql.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/dsql/dsql.cpp 2006-08-06 07:38:45.000000000 +0200
+@@ -1136,8 +1136,8 @@
+ parameter = request->req_blob->blb_segment;
+ PAR null = parameter->par_null;
+ USHORT* ret_length =
+- (USHORT *) (dsql_msg + (SLONG) null->par_user_desc.dsc_address);
+- UCHAR* buffer = dsql_msg + (SLONG) parameter->par_user_desc.dsc_address;
++ (USHORT *) (dsql_msg + (SLONG) (IPTR) null->par_user_desc.dsc_address);
++ UCHAR* buffer = dsql_msg + (SLONG) (IPTR) parameter->par_user_desc.dsc_address;
+ THREAD_EXIT;
+ s = isc_get_segment(tdsql->tsql_status,
+ GDS_REF(request->req_handle),
+@@ -1314,7 +1314,7 @@
+ parameter = request->req_blob->blb_segment;
+ buffer =
+ reinterpret_cast<SCHAR*>(
+- dsql_msg + (SLONG) parameter->par_user_desc.dsc_address);
++ dsql_msg + (SLONG) (IPTR) parameter->par_user_desc.dsc_address);
+ THREAD_EXIT;
+ s = isc_put_segment(tdsql->tsql_status,
+ GDS_REF(request->req_handle),
+@@ -3210,7 +3210,7 @@
+ PAR parameter, null;
+
+ if (node->nod_type == nod_constant)
+- return (SSHORT)(SLONG) node->nod_arg[0];
++ return (SSHORT)(SLONG) (IPTR) node->nod_arg[0];
+
+ parameter = (PAR) node->nod_arg[e_par_parameter];
+ if (null = parameter->par_null)
+@@ -3976,7 +3976,7 @@
+ /* Make sure the message given to us is long enough */
+
+ DSC desc = parameter->par_user_desc;
+- USHORT length = (SLONG) desc.dsc_address + desc.dsc_length;
++ USHORT length = (SLONG) (IPTR) desc.dsc_address + desc.dsc_length;
+ if (length > msg_length)
+ break;
+ if (!desc.dsc_dtype)
+@@ -3985,7 +3985,7 @@
+ flag = NULL;
+ if ((null = parameter->par_null) != NULL)
+ {
+- USHORT null_offset = (USHORT)(ULONG) (null->par_user_desc.dsc_address);
++ USHORT null_offset = (USHORT)(ULONG) (IPTR) (null->par_user_desc.dsc_address);
+ length = null_offset + sizeof(SSHORT);
+ if (length > msg_length)
+ break;
+@@ -4000,7 +4000,7 @@
+ }
+ }
+
+- desc.dsc_address = dsql_msg + (SLONG) desc.dsc_address;
++ desc.dsc_address = dsql_msg + (SLONG) (IPTR) desc.dsc_address;
+ if (!request)
+ MOVD_move(¶meter->par_desc, &desc);
+ else if (!flag || *flag >= 0)
+diff -Naur firebird-1.5.3.4870.old/src/dsql/gen.cpp firebird-1.5.3.4870/src/dsql/gen.cpp
+--- firebird-1.5.3.4870.old/src/dsql/gen.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/dsql/gen.cpp 2006-08-06 07:41:31.000000000 +0200
+@@ -636,7 +636,7 @@
+ for (parameter = message->msg_parameters; parameter;
+ parameter = parameter->par_next)
+ parameter->par_desc.dsc_address =
+- message->msg_buffer + (SLONG) parameter->par_desc.dsc_address;
++ message->msg_buffer + (SLONG) (IPTR) parameter->par_desc.dsc_address;
+ }
+
+
+@@ -1021,7 +1021,7 @@
+ case nod_exec_into:
+ if (node->nod_arg[e_exec_into_block]) {
+ STUFF(blr_label);
+- STUFF((int)(SLONG) node->nod_arg[e_exec_into_number]);
++ STUFF((int)(SLONG) (IPTR) node->nod_arg[e_exec_into_number]);
+ }
+ STUFF(blr_exec_into);
+ temp = node->nod_arg[e_exec_into_list];
+@@ -1049,12 +1049,12 @@
+
+ case nod_label:
+ STUFF(blr_label);
+- STUFF((int)(SLONG) node->nod_arg[e_label_number]);
++ STUFF((int)(SLONG) (IPTR) node->nod_arg[e_label_number]);
+ return;
+
+ case nod_breakleave:
+ STUFF(blr_leave);
+- STUFF((int)(SLONG) node->nod_arg[e_breakleave_number]);
++ STUFF((int)(SLONG)(IPTR) node->nod_arg[e_breakleave_number]);
+ return;
+
+ case nod_store:
+@@ -1069,7 +1069,7 @@
+
+ case nod_abort:
+ STUFF(blr_leave);
+- STUFF((int)(SLONG) node->nod_arg[e_abrt_number]);
++ STUFF((int)(SLONG) (IPTR) node->nod_arg[e_abrt_number]);
+ return;
+
+ case nod_start_savepoint:
+@@ -1149,14 +1149,14 @@
+
+ case nod_while:
+ STUFF(blr_label);
+- STUFF((int)(SLONG) node->nod_arg[e_while_number]);
++ STUFF((int)(SLONG) (IPTR) node->nod_arg[e_while_number]);
+ STUFF(blr_loop);
+ STUFF(blr_begin);
+ STUFF(blr_if);
+ GEN_expr(request, node->nod_arg[e_while_cond]);
+ GEN_statement(request, node->nod_arg[e_while_action]);
+ STUFF(blr_leave);
+- STUFF((int)(SLONG) node->nod_arg[e_while_number]);
++ STUFF((int)(SLONG) (IPTR) node->nod_arg[e_while_number]);
+ STUFF(blr_end);
+ return;
+
+@@ -1556,7 +1556,7 @@
+ switch (node->nod_type) {
+ case nod_sqlcode:
+ STUFF(blr_sql_code);
+- STUFF_WORD((USHORT)(ULONG) node->nod_arg[0]);
++ STUFF_WORD((USHORT)(ULONG) (IPTR) node->nod_arg[0]);
+ return;
+
+ case nod_gdscode:
+@@ -1667,7 +1667,7 @@
+ what loop is the user trying to abandon? */
+ if (for_select->nod_arg [e_flp_action]) {
+ STUFF (blr_label);
+- STUFF ((int) for_select->nod_arg [e_flp_number]);
++ STUFF ((int) (IPTR) for_select->nod_arg [e_flp_number]);
+ }
+
+ /* Generate FOR loop */
+@@ -2546,7 +2546,7 @@
+ for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++) {
+ dsql_nod* nulls_placement = (*ptr)->nod_arg[e_order_nulls];
+ if (nulls_placement) {
+- switch ((SLONG)nulls_placement->nod_arg[0]) {
++ switch ((SLONG) (IPTR) nulls_placement->nod_arg[0]) {
+ case NOD_NULLS_FIRST:
+ STUFF(blr_nullsfirst);
+ break;
+diff -Naur firebird-1.5.3.4870.old/src/dsql/parse.y firebird-1.5.3.4870/src/dsql/parse.y
+--- firebird-1.5.3.4870.old/src/dsql/parse.y 2006-08-06 06:47:21.000000000 +0200
++++ firebird-1.5.3.4870/src/dsql/parse.y 2006-08-06 07:49:47.000000000 +0200
+@@ -551,7 +551,7 @@
+ | set
+ | update
+ | KW_DEBUG signed_short_integer
+- { prepare_console_debug ((int) $2, &yydebug);
++ { prepare_console_debug ((int)(IPTR) $2, &yydebug);
+ $$ = make_node (nod_null, (int) 0, NULL); }
+ ;
+
+@@ -753,7 +753,7 @@
+ | CSTRING '(' pos_short_integer ')' charset_clause
+ {
+ lex.g_field->fld_dtype = dtype_cstring;
+- lex.g_field->fld_character_length = (USHORT) $3; }
++ lex.g_field->fld_character_length = (USHORT)(size_t) $3; }
+ ;
+
+ arg_desc_list1 :
+@@ -1158,7 +1158,7 @@
+ ;
+
+ logfile_attr : KW_SIZE equals long_integer
+- { lex.g_file->fil_length = (SLONG) $3; }
++ { lex.g_file->fil_length = (SLONG)(IPTR) $3; }
+ /*
+ | RAW_PARTITIONS equals pos_short_integer
+ { lex.g_file->fil_partitions = (SSHORT) $3;
+@@ -1178,9 +1178,9 @@
+ ;
+
+ file_clause : STARTING file_clause_noise long_integer
+- { lex.g_file->fil_start = (SLONG) $3;}
++ { lex.g_file->fil_start = (SLONG)(IPTR) $3;}
+ | LENGTH equals long_integer page_noise
+- { lex.g_file->fil_length = (SLONG) $3;}
++ { lex.g_file->fil_length = (SLONG)(IPTR) $3;}
+ ;
+
+ file_clause_noise :
+@@ -2186,7 +2186,7 @@
+ ;
+
+ array_range : signed_long_integer
+- { if ((SLONG) $1 < 1)
++ { if ((SLONG)(IPTR) $1 < 1)
+ $$ = make_node (nod_list, (int) 2,
+ MAKE_constant ((STR) $1, CONSTANT_SLONG),
+ MAKE_constant ((STR) 1, CONSTANT_SLONG));
+@@ -2292,26 +2292,26 @@
+ | BLOB '(' unsigned_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+- lex.g_field->fld_seg_length = (USHORT) $3;
++ lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
+ lex.g_field->fld_sub_type = 0;
+ }
+ | BLOB '(' unsigned_short_integer ',' signed_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+- lex.g_field->fld_seg_length = (USHORT) $3;
+- lex.g_field->fld_sub_type = (USHORT) $5;
++ lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
++ lex.g_field->fld_sub_type = (USHORT)(size_t) $5;
+ }
+ | BLOB '(' ',' signed_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_blob;
+ lex.g_field->fld_seg_length = 80;
+- lex.g_field->fld_sub_type = (USHORT) $4;
++ lex.g_field->fld_sub_type = (USHORT)(size_t) $4;
+ }
+ ;
+
+ blob_segsize : SEGMENT KW_SIZE unsigned_short_integer
+ {
+- lex.g_field->fld_seg_length = (USHORT) $3;
++ lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
+ }
+ |
+ {
+@@ -2321,7 +2321,7 @@
+
+ blob_subtype : SUB_TYPE signed_short_integer
+ {
+- lex.g_field->fld_sub_type = (USHORT) $2;
++ lex.g_field->fld_sub_type = (USHORT)(size_t) $2;
+ }
+ | SUB_TYPE symbol_blob_subtype_name
+ {
+@@ -2347,7 +2347,7 @@
+ national_character_type : national_character_keyword '(' pos_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_text;
+- lex.g_field->fld_character_length = (USHORT) $3;
++ lex.g_field->fld_character_length = (USHORT)(size_t) $3;
+ lex.g_field->fld_flags |= FLD_national;
+ }
+ | national_character_keyword
+@@ -2359,7 +2359,7 @@
+ | national_character_keyword VARYING '(' pos_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_varying;
+- lex.g_field->fld_character_length = (USHORT) $4;
++ lex.g_field->fld_character_length = (USHORT)(size_t) $4;
+ lex.g_field->fld_flags |= FLD_national;
+ }
+ ;
+@@ -2367,7 +2367,7 @@
+ character_type : character_keyword '(' pos_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_text;
+- lex.g_field->fld_character_length = (USHORT) $3;
++ lex.g_field->fld_character_length = (USHORT)(size_t) $3;
+ }
+ | character_keyword
+ {
+@@ -2377,7 +2377,7 @@
+ | varying_keyword '(' pos_short_integer ')'
+ {
+ lex.g_field->fld_dtype = dtype_varying;
+- lex.g_field->fld_character_length = (USHORT) $3;
++ lex.g_field->fld_character_length = (USHORT)(size_t) $3;
+ }
+ ;
+
+@@ -2429,10 +2429,10 @@
+ }
+ | '(' signed_long_integer ')'
+ {
+- if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) )
++ if ( ((SLONG)(IPTR) $2 < 1) || ((SLONG)(IPTR) $2 > 18) )
+ yyabandon (-842, isc_precision_err);
+ /* Precision most be between 1 and 18. */
+- if ((SLONG) $2 > 9)
++ if ((SLONG)(IPTR) $2 > 9)
+ {
+ if ( ( (client_dialect <= SQL_DIALECT_V5) &&
+ (db_dialect > SQL_DIALECT_V5) ) ||
+@@ -2469,7 +2469,7 @@
+ }
+ }
+ else
+- if ((SLONG) $2 < 5)
++ if ((SLONG)(IPTR) $2 < 5)
+ {
+ lex.g_field->fld_dtype = dtype_short;
+ lex.g_field->fld_length = sizeof (SSHORT);
+@@ -2479,17 +2479,17 @@
+ lex.g_field->fld_dtype = dtype_long;
+ lex.g_field->fld_length = sizeof (SLONG);
+ }
+- lex.g_field->fld_precision = (USHORT) $2;
++ lex.g_field->fld_precision = (USHORT)(size_t) $2;
+ }
+ | '(' signed_long_integer ',' signed_long_integer ')'
+ {
+- if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) )
++ if ( ((SLONG)(IPTR) $2 < 1) || ((SLONG)(IPTR) $2 > 18) )
+ yyabandon (-842, isc_precision_err);
+ /* Precision should be between 1 and 18 */
+- if (((SLONG) $4 > (SLONG) $2) || ((SLONG) $4 < 0))
++ if (((SLONG)(IPTR) $4 > (SLONG)(IPTR) $2) || ((SLONG)(IPTR) $4 < 0))
+ yyabandon (-842, isc_scale_nogt);
+ /* Scale must be between 0 and precision */
+- if ((SLONG) $2 > 9)
++ if ((SLONG)(IPTR) $2 > 9)
+ {
+ if ( ( (client_dialect <= SQL_DIALECT_V5) &&
+ (db_dialect > SQL_DIALECT_V5) ) ||
+@@ -2527,7 +2527,7 @@
+ }
+ else
+ {
+- if ((SLONG) $2 < 5)
++ if ((SLONG)(IPTR) $2 < 5)
+ {
+ lex.g_field->fld_dtype = dtype_short;
+ lex.g_field->fld_length = sizeof (SSHORT);
+@@ -2538,8 +2538,8 @@
+ lex.g_field->fld_length = sizeof (SLONG);
+ }
+ }
+- lex.g_field->fld_precision = (USHORT) $2;
+- lex.g_field->fld_scale = - (SSHORT) $4;
++ lex.g_field->fld_precision = (USHORT)(size_t) $2;
++ lex.g_field->fld_scale = - (SSHORT)(size_t) $4;
+ }
+ ;
+
+@@ -2553,7 +2553,7 @@
+
+ float_type : KW_FLOAT precision_opt
+ {
+- if ((SLONG) $2 > 7)
++ if ((SLONG)(IPTR) $2 > 7)
+ {
+ lex.g_field->fld_dtype = dtype_double;
+ lex.g_field->fld_length = sizeof (double);
+@@ -2756,7 +2756,7 @@
+ ;
+
+ table_lock : FOR lock_type lock_mode
+- { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT) $2 | (SSHORT) $3), (SSHORT) 0, NULL); }
++ { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(size_t) $2 | (SSHORT)(size_t) $3), (SSHORT) 0, NULL); }
+ |
+ { $$ = 0; }
+ ;
+@@ -3706,32 +3706,32 @@
+
+ signed_short_integer : nonneg_short_integer
+ | '-' neg_short_integer
+- { $$ = (DSQL_NOD) - (SLONG) $2; }
++ { $$ = (DSQL_NOD) - (SLONG)(IPTR) $2; }
+ ;
+
+ nonneg_short_integer : NUMBER
+- { if ((SLONG) $1 > SHRT_POS_MAX)
++ { if ((SLONG)(IPTR) $1 > SHRT_POS_MAX)
+ yyabandon (-842, isc_expec_short);
+ /* Short integer expected */
+ $$ = $1;}
+ ;
+
+ neg_short_integer : NUMBER
+- { if ((SLONG) $1 > SHRT_NEG_MAX)
++ { if ((SLONG)(IPTR) $1 > SHRT_NEG_MAX)
+ yyabandon (-842, isc_expec_short);
+ /* Short integer expected */
+ $$ = $1;}
+ ;
+
+ pos_short_integer : nonneg_short_integer
+- { if ((SLONG) $1 == 0)
++ { if ((SLONG)(IPTR) $1 == 0)
+ yyabandon (-842, isc_expec_positive);
+ /* Positive number expected */
+ $$ = $1;}
+ ;
+
+ unsigned_short_integer : NUMBER
+- { if ((SLONG) $1 > SHRT_UNSIGNED_MAX)
++ { if ((SLONG)(IPTR) $1 > SHRT_UNSIGNED_MAX)
+ yyabandon (-842, isc_expec_ushort);
+ /* Unsigned short integer expected */
+ $$ = $1;}
+@@ -3739,7 +3739,7 @@
+
+ signed_long_integer : long_integer
+ | '-' long_integer
+- { $$ = (DSQL_NOD) - (SLONG) $2; }
++ { $$ = (DSQL_NOD) - (SLONG)(IPTR) $2; }
+ ;
+
+ long_integer : NUMBER
+@@ -3820,14 +3820,14 @@
+
+ string_value_function : SUBSTRING '(' value FROM pos_short_integer ')'
+ { $$ = make_node (nod_substr, e_substr_count, $3,
+- MAKE_constant ((STR) ((SLONG)($5) - 1), CONSTANT_SLONG),
++ MAKE_constant ((STR) ((SLONG)(IPTR)($5) - 1), CONSTANT_SLONG),
+ MAKE_constant ((STR) SHRT_POS_MAX, CONSTANT_SLONG)); }
+ /* CVC: It was easier to provide a constant with maximum value if the
+ third parameter -length- is ommitted than to chase and fix the functions
+ that treat nod_substr as an aggregate and do not expect NULL arguments. */
+ | SUBSTRING '(' value FROM pos_short_integer FOR nonneg_short_integer ')'
+ { $$ = make_node (nod_substr, e_substr_count, $3,
+- MAKE_constant ((STR) ((SLONG)($5) - 1), CONSTANT_SLONG),
++ MAKE_constant ((STR) ((SLONG)(IPTR)($5) - 1), CONSTANT_SLONG),
+ MAKE_constant ((STR) ($7), CONSTANT_SLONG)); }
+ | KW_UPPER '(' value ')'
+ { $$ = make_node (nod_upcase, 1, $3); }
+@@ -4960,7 +4960,7 @@
+
+ CHECK_BOUND(p);
+ *p = 0;
+- sym = HSHD_lookup (NULL_PTR, (TEXT *) string, (SSHORT)(p - string), SYM_keyword, parser_version);
++ sym = HSHD_lookup (NULL_PTR, (TEXT *) string, (SSHORT)(size_t)(p - string), SYM_keyword, parser_version);
+ if (sym)
+ {
+ /* 13 June 2003. Nickolay Samofatov
+diff -Naur firebird-1.5.3.4870.old/src/dsql/pass1.cpp firebird-1.5.3.4870/src/dsql/pass1.cpp
+--- firebird-1.5.3.4870.old/src/dsql/pass1.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/dsql/pass1.cpp 2006-08-06 07:52:09.000000000 +0200
+@@ -642,7 +642,7 @@
+ TRUE, TRUE,
+ /* Pass 0 here to restore older parameter
+ ordering behavior */
+- (USHORT)(ULONG) input->nod_arg[0]);
++ (USHORT)(ULONG)(IPTR) input->nod_arg[0]);
+ return node;
+
+ case nod_udf:
+@@ -1561,7 +1561,7 @@
+ }
+ else {
+ // we have Count(*)
+- if (request->req_scope_level == (ULONG) node->nod_arg[1]) {
++ if (request->req_scope_level == (ULONG)(IPTR) node->nod_arg[1]) {
+ aggregate = TRUE;
+ }
+ }
+@@ -4426,7 +4426,7 @@
+ (slist_node->nod_type == nod_list))
+ {
+ /* an select list is there */
+- position = (ULONG) sub->nod_arg[0];
++ position = (ULONG)(IPTR) sub->nod_arg[0];
+ if ((position < 1) || (position > (ULONG) slist_node->nod_count))
+ {
+ ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
+@@ -4819,7 +4819,7 @@
+ }
+
+ if (node1->nod_type == nod_constant && node1->nod_desc.dsc_dtype == dtype_long) {
+- position = (ULONG) (node1->nod_arg[0]);
++ position = (ULONG)(IPTR) (node1->nod_arg[0]);
+ if ((position < 1) || !s_list ||
+ (position > (ULONG) s_list->nod_count)) {
+ ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
+@@ -5082,7 +5082,7 @@
+ ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
+ gds_arg_gds, gds_dsql_command_err, gds_arg_gds, gds_order_by_err, /* invalid ORDER BY clause */
+ 0);
+- number = (SLONG) position->nod_arg[0];
++ number = (SLONG)(IPTR) position->nod_arg[0];
+ if (number < 1 || number > union_items->nod_count)
+ ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
+ gds_arg_gds, gds_dsql_command_err, gds_arg_gds, gds_order_by_err, /* invalid ORDER BY clause */
+diff -Naur firebird-1.5.3.4870.old/src/dudley/generate.cpp firebird-1.5.3.4870/src/dudley/generate.cpp
+--- firebird-1.5.3.4870.old/src/dudley/generate.cpp 2006-08-06 06:47:26.000000000 +0200
++++ firebird-1.5.3.4870/src/dudley/generate.cpp 2006-08-06 08:06:49.000000000 +0200
+@@ -426,7 +426,7 @@
+ case nod_abort:
+ CHECK_BLR(2);
+ STUFF(blr_leave);
+- STUFF((int) node->nod_arg[0]);
++ STUFF((int) (IPTR) node->nod_arg[0]);
+ return;
+
+ case nod_erase:
+diff -Naur firebird-1.5.3.4870.old/src/dudley/trn.cpp firebird-1.5.3.4870/src/dudley/trn.cpp
+--- firebird-1.5.3.4870.old/src/dudley/trn.cpp 2006-08-06 06:47:26.000000000 +0200
++++ firebird-1.5.3.4870/src/dudley/trn.cpp 2006-08-06 08:07:12.000000000 +0200
+@@ -244,7 +244,7 @@
+ break;
+
+ case act_d_shadow:
+- drop_shadow(dyn, (SLONG) (action->act_object));
++ drop_shadow(dyn, (SLONG)(IPTR) (action->act_object));
+ break;
+
+ case act_m_trigger_msg:
+diff -Naur firebird-1.5.3.4870.old/src/jrd/jrd.cpp firebird-1.5.3.4870/src/jrd/jrd.cpp
+--- firebird-1.5.3.4870.old/src/jrd/jrd.cpp 2006-08-06 06:52:32.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/jrd.cpp 2006-08-06 06:53:15.000000000 +0200
+@@ -3877,9 +3877,9 @@
+ {
+ if ( (node = csb->csb_rpt[i].csb_message) )
+ {
+- if ((int) node->nod_arg[e_msg_number] == 0) {
++ if ((int) (IPTR) node->nod_arg[e_msg_number] == 0) {
+ in_message = node;
+- } else if ((int) node->nod_arg[e_msg_number] == 1) {
++ } else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1) {
+ out_message = node;
+ }
+ }
+diff -Naur firebird-1.5.3.4870.old/src/jrd/jrn.cpp firebird-1.5.3.4870/src/jrd/jrn.cpp
+--- firebird-1.5.3.4870.old/src/jrd/jrn.cpp 2006-08-06 06:47:17.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/jrn.cpp 2006-08-06 06:55:26.000000000 +0200
+@@ -836,7 +836,7 @@
+ for (loop = 0; loop < 20; loop++) {
+ for (;;) {
+ journal->jrn_channel = (int *) socket(AF_INET, SOCK_STREAM, 0);
+- if ((int) journal->jrn_channel != -1)
++ if ((int) (IPTR) journal->jrn_channel != -1)
+ break;
+ if (!SYSCALL_INTERRUPTED(errno)) {
+ error(status_vector, journal, errno, "socket");
+@@ -859,18 +859,18 @@
+ return ret_val;
+ }
+
+- if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
++ if (!connect((int) (IPTR) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
+ break;
+
+ sleep(3);
+
+ if (loop < 16) {
+- close((int) journal->jrn_channel);
++ close((int) (IPTR) journal->jrn_channel);
+ continue;
+ }
+ if (!SYSCALL_INTERRUPTED(errno)) {
+ if (retry) {
+- close((int) journal->jrn_channel);
++ close((int) (IPTR) journal->jrn_channel);
+ gds__free(journal);
+ *ret_jrn = (JRN) NULL;
+ return FB_SUCCESS;
+@@ -879,7 +879,7 @@
+ gds__free(journal);
+ return FB_FAILURE;
+ }
+- close((int) journal->jrn_channel);
++ close((int) (IPTR) journal->jrn_channel);
+ }
+ #endif
+
+@@ -939,7 +939,7 @@
+ if (retry)
+ {
+ #ifdef BSD_SOCKETS
+- close((int) journal->jrn_channel);
++ close((int) (IPTR) journal->jrn_channel);
+ #endif
+
+ #ifdef WIN_NT
+@@ -1056,7 +1056,7 @@
+ with us, so keep trying until successful. */
+
+ do {
+- l = recv((int) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
++ l = recv((int) (IPTR) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
+ } while (l < 0 && SYSCALL_INTERRUPTED(errno));
+
+ if (l < 0) {
+@@ -1095,7 +1095,7 @@
+ **************************************/
+
+ #ifdef BSD_SOCKETS
+- if (close((int) journal->jrn_channel) < 0) {
++ if (close((int) (IPTR) journal->jrn_channel) < 0) {
+ error(status_vector, journal, errno, "close");
+ return FB_FAILURE;
+ }
+@@ -1166,7 +1166,7 @@
+ with us, so keep trying until successful. */
+
+ do {
+- l = send((int) journal->jrn_channel, (char *) buffer, (int) length, 0);
++ l = send((int) (IPTR) journal->jrn_channel, (char *) buffer, (int) length, 0);
+ } while (l < 0 && SYSCALL_INTERRUPTED(errno));
+
+ if (l < 0) {
+diff -Naur firebird-1.5.3.4870.old/src/jrd/lck.cpp firebird-1.5.3.4870/src/jrd/lck.cpp
+--- firebird-1.5.3.4870.old/src/jrd/lck.cpp 2006-08-06 06:47:17.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/lck.cpp 2006-08-06 07:56:17.000000000 +0200
+@@ -87,8 +87,8 @@
+ #ifdef SUPERSERVER
+
+ #define LCK_OWNER_ID_PROCESS (SLONG) getpid()
+-#define LCK_OWNER_ID_DBB (SLONG) dbb
+-#define LCK_OWNER_ID_ATT (SLONG) attachment
++#define LCK_OWNER_ID_DBB (SLONG)(IPTR) dbb
++#define LCK_OWNER_ID_ATT (SLONG)(IPTR) attachment
+
+ #define LCK_OWNER_TYPE_PROCESS LCK_OWNER_process
+ #define LCK_OWNER_TYPE_DBB LCK_OWNER_dbb
+diff -Naur firebird-1.5.3.4870.old/src/jrd/nav.cpp firebird-1.5.3.4870/src/jrd/nav.cpp
+--- firebird-1.5.3.4870.old/src/jrd/nav.cpp 2006-08-06 06:47:18.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/nav.cpp 2006-08-06 07:00:00.000000000 +0200
+@@ -487,7 +487,7 @@
+
+ init_fetch(impure);
+ idx =
+- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
++ (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
+
+ /* The bitmap is only valid when we are continuing on in one
+ direction. It is of no help when we change direction,
+@@ -521,12 +521,12 @@
+ #ifdef SCROLLABLE_CURSORS
+ MOVE_FAST(
+ (impure->irsb_nav_data +
+- (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
++ (2 * (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
+ upper.key_data, upper.key_length);
+ #else
+ MOVE_FAST(
+ (impure->irsb_nav_data +
+- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
++ (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
+ upper.key_length);
+ #endif
+ }
+@@ -534,7 +534,7 @@
+ lower.key_length = impure->irsb_nav_lower_length;
+ MOVE_FAST(
+ (impure->irsb_nav_data +
+- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
++ (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
+ lower.key_length);
+ }
+
+@@ -1404,7 +1404,7 @@
+ tdbb = GET_THREAD_DATA;
+
+ idx =
+- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
++ (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
+ page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index);
+
+ /* the outer loop goes through all the sibling pages
+@@ -1619,7 +1619,7 @@
+ tdbb = GET_THREAD_DATA;
+ request = tdbb->tdbb_request;
+ idx =
+- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
++ (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
+
+ BOOLEAN result;
+
+@@ -1656,7 +1656,7 @@
+ rpb->rpb_record,
+ reinterpret_cast <
+ struct idx *>((SCHAR *) impure +
+- (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]),
++ (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]),
+ &value,
+ 0);
+ if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) {
+@@ -1757,7 +1757,7 @@
+ retrieval_node = (JRD_NOD) rsb->rsb_arg[RSB_NAV_index];
+ retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval];
+ idx =
+- (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
++ (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
+ page =
+ BTR_find_page(tdbb, retrieval, window, idx, &lower, &upper,
+ (direction == RSE_get_backward));
+@@ -1802,7 +1802,7 @@
+ impure->irsb_nav_upper_length = upper.key_length;
+ MOVE_FAST(upper.key_data,
+ (impure->irsb_nav_data +
+- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
++ (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
+ upper.key_length);
+ }
+ if (retrieval->irb_lower_count)
+@@ -1813,7 +1813,7 @@
+ impure->irsb_nav_lower_length = lower.key_length;
+ MOVE_FAST(lower.key_data,
+ (impure->irsb_nav_data +
+- (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
++ (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
+ lower.key_length);
+ }
+ if (retrieval->irb_upper_count)
+diff -Naur firebird-1.5.3.4870.old/src/jrd/rse.cpp firebird-1.5.3.4870/src/jrd/rse.cpp
+--- firebird-1.5.3.4870.old/src/jrd/rse.cpp 2006-08-06 06:47:17.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/rse.cpp 2006-08-06 07:17:52.000000000 +0200
+@@ -2151,7 +2151,7 @@
+ }
+
+ desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
+- desc.dsc_address = (UCHAR *) (om + (int) desc.dsc_address);
++ desc.dsc_address = (UCHAR *) (om + (int) (IPTR) desc.dsc_address);
+ eos_desc.dsc_dtype = dtype_short;
+ eos_desc.dsc_scale = 0;
+ eos_desc.dsc_length = sizeof(SSHORT);
+@@ -2959,7 +2959,7 @@
+ for (item = map->smb_rpt; item < end_item; item++) {
+ flag = *(data + item->smb_flag_offset);
+ from = item->smb_desc;
+- from.dsc_address = data + (ULONG) from.dsc_address;
++ from.dsc_address = data + (ULONG) (IPTR) from.dsc_address;
+ if ((node = item->smb_node) && node->nod_type != nod_field)
+ continue;
+
+@@ -3211,7 +3211,7 @@
+ end_item = map->smb_rpt + map->smb_count;
+ for (item = map->smb_rpt; item < end_item; item++) {
+ to = item->smb_desc;
+- to.dsc_address = data + (ULONG) to.dsc_address;
++ to.dsc_address = data + (ULONG) (IPTR) to.dsc_address;
+ flag = FALSE;
+ if (item->smb_node) {
+ from = EVL_expr(tdbb, item->smb_node);
+@@ -3301,12 +3301,12 @@
+ desc2.dsc_flags = 0;
+ desc2.dsc_address = (UCHAR *) & indicator;
+ desc1 = *flag_desc;
+- desc1.dsc_address = msg + (int) flag_desc->dsc_address;
++ desc1.dsc_address = msg + (int) (IPTR) flag_desc->dsc_address;
+ MOV_move(&desc1, &desc2);
+ if (indicator) {
+ SET_NULL(record, to_id);
+ l = to_desc->dsc_length;
+- p = record->rec_data + (int) to_desc->dsc_address;
++ p = record->rec_data + (int) (IPTR) to_desc->dsc_address;
+ switch (to_desc->dsc_dtype) {
+ case dtype_text:
+ /* YYY - not necessarily the right thing to do */
+@@ -3336,9 +3336,9 @@
+ else {
+ CLEAR_NULL(record, to_id);
+ desc1 = *from_desc;
+- desc1.dsc_address = msg + (int) desc1.dsc_address;
++ desc1.dsc_address = msg + (int) (IPTR) desc1.dsc_address;
+ desc2 = *to_desc;
+- desc2.dsc_address = record->rec_data + (int) desc2.dsc_address;
++ desc2.dsc_address = record->rec_data + (int) (IPTR) desc2.dsc_address;
+ if (!DSC_EQUIV((&desc1), (&desc2)))
+ MOV_move(&desc1, &desc2);
+
+@@ -3817,7 +3817,7 @@
+ if (!sfb_->sfb_file_name) {
+ TEXT file_name[128];
- sfb_->sfb_file = (int) gds__temp_file(FALSE, SCRATCH, file_name);
-+ sfb_->sfb_file = (int)(IPTR) gds__temp_file(FALSE, SCRATCH, file_name);
++ sfb_->sfb_file = (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name);
if (sfb_->sfb_file == -1)
SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error,
errno);
---- Firebird.org/src/jrd/sort.cpp~ 2003-12-24 14:02:01.000000000 +0100
-+++ Firebird/src/jrd/sort.cpp 2006-03-28 19:57:36.897304250 +0200
+diff -Naur firebird-1.5.3.4870.old/src/jrd/sort.cpp firebird-1.5.3.4870/src/jrd/sort.cpp
+--- firebird-1.5.3.4870.old/src/jrd/sort.cpp 2006-08-06 06:47:17.000000000 +0200
++++ firebird-1.5.3.4870/src/jrd/sort.cpp 2006-08-06 07:19:27.000000000 +0200
@@ -1788,7 +1788,7 @@
/* Create a scratch file */
sfb->sfb_file =
- (int) gds__temp_file(FALSE, SCRATCH, file_name,
-+ (int)(IPTR) gds__temp_file(FALSE, SCRATCH, file_name,
++ (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name,
sfb->sfb_dls->dls_directory, TRUE);
/* allocate the file name even if the file is not open,
+diff -Naur firebird-1.5.3.4870.old/src/qli/eval.cpp firebird-1.5.3.4870/src/qli/eval.cpp
+--- firebird-1.5.3.4870.old/src/qli/eval.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/eval.cpp 2006-08-06 08:02:09.000000000 +0200
+@@ -200,10 +200,10 @@
+
+ if (node->nod_type == nod_rpt_average && node->nod_arg[e_stt_default])
+ if (node->nod_desc.dsc_dtype == dtype_long)
+- *(SLONG *) node->nod_desc.dsc_address /= (SLONG) node->
++ *(SLONG *) node->nod_desc.dsc_address /= (SLONG) (IPTR) node->
+ nod_arg[e_stt_default];
+ else
+- *(double *) node->nod_desc.dsc_address /= (SLONG) node->
++ *(double *) node->nod_desc.dsc_address /= (SLONG) (IPTR) node->
+ nod_arg[e_stt_default];
+ }
+
+@@ -241,7 +241,7 @@
+
+ /* If this is the first value, just move it in. */
+
+- count = (SLONG) node->nod_arg[e_stt_default] + 1;
++ count = (SLONG) (IPTR) node->nod_arg[e_stt_default] + 1;
+ if (count == 1) {
+ if (desc2->dsc_missing)
+ desc1->dsc_missing = DSC_missing;
+@@ -374,7 +374,7 @@
+ case nod_rpt_min:
+ case nod_rpt_total:
+ case nod_rpt_average:
+- if (!(SLONG) node->nod_arg[e_stt_default])
++ if (!(SLONG) (IPTR) node->nod_arg[e_stt_default])
+ desc->dsc_missing = DSC_missing;
+
+ case nod_rpt_count:
+diff -Naur firebird-1.5.3.4870.old/src/qli/expand.cpp firebird-1.5.3.4870/src/qli/expand.cpp
+--- firebird-1.5.3.4870.old/src/qli/expand.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/expand.cpp 2006-08-06 08:02:45.000000000 +0200
+@@ -1830,7 +1830,7 @@
+
+ }
+
+- item->itm_count = (int) syn_item->syn_arg[0];
++ item->itm_count = (int)(IPTR) syn_item->syn_arg[0];
+ return item;
+ }
+
+@@ -2131,7 +2131,7 @@
+ /* Handle implicit boolean from SQL xxx IN (yyy FROM relation) */
+
+ if (input->syn_arg[s_rse_outer]) {
+- eql_node = MAKE_NODE((enum nod_t)(int)input->syn_arg[s_rse_op], 2);
++ eql_node = MAKE_NODE((enum nod_t)(int)(IPTR)input->syn_arg[s_rse_op], 2);
+ eql_node->nod_arg[0] =
+ expand_expression(input->syn_arg[s_rse_outer], old_stack);
+ eql_node->nod_arg[1] =
+diff -Naur firebird-1.5.3.4870.old/src/qli/gener.cpp firebird-1.5.3.4870/src/qli/gener.cpp
+--- firebird-1.5.3.4870.old/src/qli/gener.cpp 2006-08-06 06:47:19.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/gener.cpp 2006-08-06 08:03:12.000000000 +0200
+@@ -1556,7 +1556,7 @@
+
+ rlb = CHECK_RLB(request->req_blr);
+
+- if ((NOD_T) (int) node->nod_arg[e_rse_join_type] == (NOD_T) 0)
++ if ((NOD_T) (int) (IPTR) node->nod_arg[e_rse_join_type] == (NOD_T) 0)
+ STUFF(blr_rse);
+ else
+ STUFF(blr_rs_stream);
+@@ -1625,7 +1625,7 @@
+ if (list = node->nod_arg[e_rse_reduced])
+ gen_sort(list, request, blr_project);
+
+- join_type = (NOD_T) (int) node->nod_arg[e_rse_join_type];
++ join_type = (NOD_T) (int) (IPTR) node->nod_arg[e_rse_join_type];
+ if (join_type != (NOD_T) 0 && join_type != nod_join_inner) {
+ STUFF(blr_join_type);
+ if (join_type == nod_join_left)
+diff -Naur firebird-1.5.3.4870.old/src/qli/lex.cpp firebird-1.5.3.4870/src/qli/lex.cpp
+--- firebird-1.5.3.4870.old/src/qli/lex.cpp 2006-08-06 06:47:19.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/lex.cpp 2006-08-06 08:03:26.000000000 +0200
+@@ -597,7 +597,7 @@
+ for (temp = QLI_line;
+ temp->line_next && QLI_statements;
+ temp = temp->line_next)
+-if (temp->line_next->line_position == (SLONG) QLI_statements->lls_object) return;
++if (temp->line_next->line_position == (SLONG) (IPTR) QLI_statements->lls_object) return;
+
+ statement = (LLS) ALLOCP(type_lls);
+ statement->lls_object = (BLK) temp->line_position;
+diff -Naur firebird-1.5.3.4870.old/src/qli/parse.cpp firebird-1.5.3.4870/src/qli/parse.cpp
+--- firebird-1.5.3.4870.old/src/qli/parse.cpp 2006-08-06 06:47:19.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/parse.cpp 2006-08-06 08:04:28.000000000 +0200
+@@ -1524,7 +1524,7 @@
+ IBERROR(176); /* Msg176 No statements issued yet */
+
+ if (MATCH(KW_ASTERISK))
+- LEX_edit((SLONG) 0, (SLONG) statement_list->lls_object);
++ LEX_edit((SLONG) 0, (SLONG) (IPTR) statement_list->lls_object);
+ else {
+ if (KEYWORD(KW_SEMI))
+ l = 1;
+@@ -1534,7 +1534,7 @@
+ for (start = stop = statement_list;
+ l && start->lls_next; l--, start = start->lls_next);
+ command_end();
+- LEX_edit((SLONG) start->lls_object, (SLONG) stop->lls_object);
++ LEX_edit((SLONG) (IPTR) start->lls_object, (SLONG) (IPTR) stop->lls_object);
+ }
+ }
+ #ifdef PYXIS
+@@ -2925,7 +2925,7 @@
+ node->syn_arg[0] = INT_CAST 1;
+ if (op == nod_column || QLI_token->tok_type == tok_number)
+ node->syn_arg[0] = INT_CAST parse_ordinal();
+- if ((op == nod_skip) && ((int) node->syn_arg[0] < 1))
++ if ((op == nod_skip) && ((int) (IPTR) node->syn_arg[0] < 1))
+ SYNTAX_ERROR(478); /* Msg478 number > 0 */
+ }
+ LLS_PUSH(node, &stack);
+diff -Naur firebird-1.5.3.4870.old/src/qli/show.epp firebird-1.5.3.4870/src/qli/show.epp
+--- firebird-1.5.3.4870.old/src/qli/show.epp 2006-08-06 06:47:19.000000000 +0200
++++ firebird-1.5.3.4870/src/qli/show.epp 2006-08-06 08:05:12.000000000 +0200
+@@ -154,7 +154,7 @@
+ ptr = node->syn_arg;
+
+ for (i = 0; i < node->syn_count; i++) {
+- sw = (ENUM show_t) (int) * ptr++;
++ sw = (ENUM show_t) (int)(IPTR) * ptr++;
+ value = *ptr++;
+ if (sw != show_matching_language &&
+ sw != show_version &&
+diff -Naur firebird-1.5.3.4870.old/src/remote/inet_server.cpp firebird-1.5.3.4870/src/remote/inet_server.cpp
+--- firebird-1.5.3.4870.old/src/remote/inet_server.cpp 2006-08-06 06:47:27.000000000 +0200
++++ firebird-1.5.3.4870/src/remote/inet_server.cpp 2006-08-06 07:59:49.000000000 +0200
+@@ -380,7 +380,7 @@
+ if (!debug) {
+ FD_ZERO(&mask);
+ FD_SET(2, &mask);
+- divorce_terminal((int) &mask);
++ divorce_terminal((int) (IPTR) &mask);
+ }
+ {
+ ISC_STATUS_ARRAY status_vector;
+diff -Naur firebird-1.5.3.4870.old/src/remote/interface.cpp firebird-1.5.3.4870/src/remote/interface.cpp
+--- firebird-1.5.3.4870.old/src/remote/interface.cpp 2006-08-06 06:47:27.000000000 +0200
++++ firebird-1.5.3.4870/src/remote/interface.cpp 2006-08-06 07:53:34.000000000 +0200
+@@ -3231,7 +3231,7 @@
+ // Nickolay Samofatov: We pass this value to the server (as 32-bit value)
+ // then it returns it to us and we do not use it. Maybe pass zero here
+ // to avoid client-side security risks?
+- event->p_event_ast = (SLONG) ast;
++ event->p_event_ast = (SLONG)(IPTR) ast;
+ event->p_event_arg = (SLONG)(IPTR) arg;
+
+ event->p_event_rid = rem_event->rvnt_id;
+@@ -6226,8 +6226,8 @@
+ for (; to_desc < end_desc; from_desc++, to_desc++) {
+ from = *from_desc;
+ to = *to_desc;
+- from.dsc_address = from_msg + (SLONG) from.dsc_address;
+- to.dsc_address = to_msg + (SLONG) to.dsc_address;
++ from.dsc_address = from_msg + (SLONG)(IPTR) from.dsc_address;
++ to.dsc_address = to_msg + (SLONG)(IPTR) to.dsc_address;
+ CVT_move(&from, &to, (FPTR_VOID) move_error);
+ }
+
+diff -Naur firebird-1.5.3.4870.old/src/remote/protocol.cpp firebird-1.5.3.4870/src/remote/protocol.cpp
+--- firebird-1.5.3.4870.old/src/remote/protocol.cpp 2006-08-06 06:47:27.000000000 +0200
++++ firebird-1.5.3.4870/src/remote/protocol.cpp 2006-08-06 07:53:50.000000000 +0200
+@@ -984,7 +984,7 @@
+ BLOB_PTR *p;
+ SSHORT n;
+
+- p = buffer + (ULONG) desc->dsc_address;
++ p = buffer + (ULONG) (IPTR) desc->dsc_address;
+
+ switch (desc->dsc_dtype) {
+ case dtype_text:
+diff -Naur firebird-1.5.3.4870.old/src/remote/server.cpp firebird-1.5.3.4870/src/remote/server.cpp
+--- firebird-1.5.3.4870.old/src/remote/server.cpp 2006-08-06 06:47:27.000000000 +0200
++++ firebird-1.5.3.4870/src/remote/server.cpp 2006-08-06 08:00:17.000000000 +0200
+@@ -4361,7 +4361,7 @@
+
+ // Nickolay Samofatov: We keep this values and even pass them to the client
+ // (as 32-bit values) when event is fired, but client ignores them.
+- p_event->p_event_ast = (SLONG) event->rvnt_ast;
++ p_event->p_event_ast = (SLONG)(IPTR) event->rvnt_ast;
+ p_event->p_event_arg = (SLONG)(IPTR) event->rvnt_arg;
+
+ p_event->p_event_rid = event->rvnt_rid;
+diff -Naur firebird-1.5.3.4870.old/src/utilities/gsec.cpp firebird-1.5.3.4870/src/utilities/gsec.cpp
+--- firebird-1.5.3.4870.old/src/utilities/gsec.cpp 2006-08-06 06:47:32.000000000 +0200
++++ firebird-1.5.3.4870/src/utilities/gsec.cpp 2006-08-06 07:57:42.000000000 +0200
+@@ -96,7 +96,7 @@
+ int exit_code;
+
+ exit_code = UTIL_gsec(service->svc_argc, service->svc_argv,
+- output_svc, (SLONG) service);
++ output_svc, (SLONG) (IPTR) service);
+
+ /* Mark service thread as finished. */
+ /* If service is detached, cleanup memory being used by service. */
+diff -Naur firebird-1.5.3.4870.old/src/wal/walw.cpp firebird-1.5.3.4870/src/wal/walw.cpp
+--- firebird-1.5.3.4870.old/src/wal/walw.cpp 2006-08-06 06:47:20.000000000 +0200
++++ firebird-1.5.3.4870/src/wal/walw.cpp 2006-08-06 07:57:21.000000000 +0200
+@@ -199,7 +199,7 @@
+ #ifdef SUPERSERVER
+ int argc;
+
+- argc = (int) argv[0];
++ argc = (int) (IPTR) argv[0];
+ #endif
+
+ dbname = "";
+diff -Naur firebird-1.5.3.4870.old/src/dudley/exe.epp firebird-1.5.3.4870/src/dudley/exe.epp
+--- firebird-1.5.3.4870.old/src/dudley/exe.epp 2006-08-06 06:47:26.000000000 +0200
++++ firebird-1.5.3.4870/src/dudley/exe.epp 2006-08-06 08:06:25.000000000 +0200
+@@ -626,7 +626,7 @@
+ break;
+
+ case act_d_shadow:
+- drop_shadow((SLONG) action->act_object);
++ drop_shadow((SLONG) (IPTR) action->act_object);
+ break;
+
+ case act_a_generator: