if (stdio_flag)
- if (!(result = ib_fdopen((int) result, "w+")))
-+ if (!(result = ib_fdopen((size_t) result, "w+")))
++ if (!(result = ib_fdopen((int)(IPTR) result, "w+")))
return (void *)-1;
if (expanded_string)
+--- firebird-1.5.2.4731/src/gpre/cmd.cpp~ 2003-10-30 22:25:53.000000000 +0000
++++ firebird-1.5.2.4731/src/gpre/cmd.cpp 2005-05-03 00:06:56.620125296 +0000
+@@ -204,7 +204,7 @@
+
+ case ACT_drop_shadow:
+ put_numeric(request, gds_dyn_delete_shadow,
+- (SSHORT) action->act_object);
++ (SSHORT) (IPTR) action->act_object);
+ STUFF_END;
+ break;
+
+--- firebird-1.5.2.4731/src/gpre/cme.cpp.orig 2005-05-03 00:16:24.976721960 +0000
++++ firebird-1.5.2.4731/src/gpre/cme.cpp 2005-05-03 00:15:46.661546752 +0000
+@@ -251,7 +251,7 @@
+ // ** Begin date/time/timestamp support *
+ case nod_extract:
+ STUFF(blr_extract);
+- switch ((KWWORDS) (int) node->nod_arg[0])
++ switch ((KWWORDS) (IPTR) node->nod_arg[0])
+ {
+ case KW_YEAR:
+ STUFF(blr_extract_year);
+@@ -478,7 +478,7 @@
+ // ** Begin date/time/timestamp support *
+ case nod_extract:
+ {
+- KWWORDS kw_word = (KWWORDS) (int) node->nod_arg[0];
++ KWWORDS kw_word = (KWWORDS) (IPTR) node->nod_arg[0];
+ CME_get_dtype(node->nod_arg[1], f);
+ switch (f->fld_dtype)
+ {
+--- firebird-1.5.2.4731/src/gpre/c_cxx.cpp.orig 2005-05-03 00:17:13.068891056 +0000
++++ firebird-1.5.2.4731/src/gpre/c_cxx.cpp 2005-05-03 00:17:54.679565272 +0000
+@@ -2184,7 +2184,7 @@
+
+ args.pat_database = (DBB) init->nod_arg[3];
+ args.pat_vector1 = status_vector(action);
+- args.pat_value1 = (int) init->nod_arg[2];
++ args.pat_value1 = (IPTR) init->nod_arg[2];
+ args.pat_value2 = (int) event_list->nod_count;
+
+ // generate call to dynamically generate event blocks
+@@ -2255,7 +2255,7 @@
+ event_init = (GPRE_NOD) event_action->act_object;
+ stack_name = (SYM) event_init->nod_arg[0];
+ if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
+- ident = (int) event_init->nod_arg[2];
++ ident = (IPTR) event_init->nod_arg[2];
+ database = (DBB) event_init->nod_arg[3];
+ }
+ }
+--- firebird-1.5.2.4731/src/jrd/sdl.cpp~ 2003-04-10 06:49:14.000000000 +0000
++++ firebird-1.5.2.4731/src/jrd/sdl.cpp 2005-05-03 00:19:43.328048192 +0000
+@@ -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 +
++ (IPTR) element_desc.dsc_address +
+ (array_desc->ads_element_length * subscript);
+
+ /* Is this element within the array bounds? */
+--- firebird-1.5.2.4731/src/jrd/dpm.cpp.orig 2005-05-03 00:21:08.675073472 +0000
++++ firebird-1.5.2.4731/src/jrd/dpm.cpp 2005-05-03 00:21:25.822466672 +0000
+@@ -2214,7 +2214,7 @@
+
+ DEBUG if (stack)
+ while (*stack)
+- CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
++ CCH_precedence(tdbb, &rpb->rpb_window, (IPTR) LLS_POP(stack));
+
+ CCH_precedence(tdbb, &rpb->rpb_window, -rpb->rpb_transaction);
+ CCH_MARK(tdbb, &rpb->rpb_window);
+@@ -2831,7 +2831,7 @@
+ If the page need to be compressed, compress it. */
+
+ while (*stack)
+- CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
++ CCH_precedence(tdbb, &rpb->rpb_window, (IPTR) LLS_POP(stack));
+ CCH_MARK(tdbb, &rpb->rpb_window);
+ i = page->dpg_count + ((slot) ? 0 : 1);
+
+--- firebird-1.5.2.4731/src/jrd/met.cpp.orig 2005-05-03 00:22:57.523525992 +0000
++++ firebird-1.5.2.4731/src/jrd/met.cpp 2005-05-03 00:24:20.650888712 +0000
+@@ -1541,7 +1541,7 @@
+ if (desc->dsc_address)
+ {
+ format->fmt_length =
+- (ULONG) desc->dsc_address + desc->dsc_length;
++ (IPTR) desc->dsc_address + desc->dsc_length;
+ break;
+ }
+ }
+@@ -3181,13 +3181,13 @@
+ index_number < references->frgn_reference_ids->count();
+ index_number++)
+ {
+- if (idx->idx_id == (UCHAR) (*references->frgn_reference_ids)
++ if (idx->idx_id == (IPTR) (*references->frgn_reference_ids)
+ [index_number])
+ {
+ idx->idx_primary_relation =
+- (USHORT) (*references->frgn_relations)[index_number];
++ (IPTR) (*references->frgn_relations)[index_number];
+ idx->idx_primary_index =
+- (UCHAR) (*references->frgn_indexes)[index_number];
++ (IPTR) (*references->frgn_indexes)[index_number];
+ return TRUE;
+ }
+ }
+@@ -3203,7 +3203,7 @@
+ index_number < dependencies->prim_reference_ids->count();
+ index_number++)
+ {
+- if (idx->idx_id == (UCHAR) (*dependencies->prim_reference_ids)
++ if (idx->idx_id == (IPTR) (*dependencies->prim_reference_ids)
+ [index_number])
+ {
+ idx->idx_foreign_primaries =
+@@ -4182,10 +4182,10 @@
+ {
+ if ( (node = csb_->csb_rpt[i].csb_message) )
+ {
+- if ((int) node->nod_arg[e_msg_number] == 0)
++ if ((IPTR) node->nod_arg[e_msg_number] == 0)
+ {
+ procedure->prc_input_msg = node;
+- } else if ((int) node->nod_arg[e_msg_number] == 1)
++ } else if ((IPTR) node->nod_arg[e_msg_number] == 1)
+ {
+ procedure->prc_output_msg = node;
+ }
+@@ -6141,7 +6141,7 @@
+ node = (JRD_NOD) LLS_POP(&csb->csb_dependencies);
+ if (!node->nod_arg[e_dep_object])
+ continue;
+- dpdo_type = (SSHORT) node->nod_arg[e_dep_object_type];
++ dpdo_type = (IPTR) node->nod_arg[e_dep_object_type];
+ relation = NULL;
+ procedure = NULL;
+ switch (dpdo_type) {
+@@ -6154,13 +6154,13 @@
+ dpdo_name = (TEXT*) procedure->prc_name->str_data;
+ break;
+ case obj_exception:
+- number = (SLONG) node->nod_arg [e_dep_object];
++ number = (IPTR) node->nod_arg [e_dep_object];
+ MET_lookup_exception (tdbb, number, name, NULL);
+ dpdo_name = name;
+ break;
+ /* CVC: Here I'm going to track those pesky things named generators and UDFs. */
+ case obj_generator:
+- number = (SLONG) node->nod_arg [e_dep_object];
++ number = (IPTR) node->nod_arg [e_dep_object];
+ MET_lookup_generator_id (tdbb, number, name);
+ dpdo_name = name;
+ break;
+@@ -6178,7 +6178,7 @@
+ {
+ if (field_node->nod_type == nod_field)
+ {
+- fld_id = (SSHORT) field_node->nod_arg[0];
++ fld_id = (IPTR) field_node->nod_arg[0];
+ if (relation)
+ {
+ if ( (field = MET_get_field(relation, fld_id)) )
+--- firebird-1.5.2.4731/src/jrd/blb.cpp.orig 2005-05-03 00:24:45.720077616 +0000
++++ firebird-1.5.2.4731/src/jrd/blb.cpp 2005-05-03 00:24:58.563125176 +0000
+@@ -860,8 +860,8 @@
+ request = tdbb->tdbb_request;
+ source = (BID) from_desc->dsc_address;
+ destination = (BID) to_desc->dsc_address;
+- id = (USHORT) field->nod_arg[e_fld_id];
+- rpb = &request->req_rpb[(int) field->nod_arg[e_fld_stream]];
++ id = (IPTR) field->nod_arg[e_fld_id];
++ rpb = &request->req_rpb[(IPTR) field->nod_arg[e_fld_stream]];
+ relation = rpb->rpb_relation;
+ record = rpb->rpb_record;
+
+--- firebird-1.5.2.4731/src/jrd/cmp.cpp.orig 2005-05-03 00:25:15.000000000 +0000
++++ firebird-1.5.2.4731/src/jrd/cmp.cpp 2005-05-03 00:32:27.036946792 +0000
+@@ -958,9 +958,9 @@
+ FMT format;
+ USHORT id;
+
+- id = (USHORT) node->nod_arg[e_fld_id];
++ id = (IPTR) node->nod_arg[e_fld_id];
+ format =
+- CMP_format(tdbb, csb, (USHORT) node->nod_arg[e_fld_stream]);
++ CMP_format(tdbb, csb, (IPTR) node->nod_arg[e_fld_stream]);
+ if (id >= format->fmt_count) {
+ desc->dsc_dtype = dtype_null;
+ desc->dsc_length = 0;
+@@ -983,9 +983,9 @@
+
+ sub = node->nod_arg[e_scl_field];
+ relation =
+- csb->csb_rpt[(USHORT) sub->
++ csb->csb_rpt[(IPTR) sub->
+ nod_arg[e_fld_stream]].csb_relation;
+- id = (USHORT) sub->nod_arg[e_fld_id];
++ id = (IPTR) sub->nod_arg[e_fld_id];
+ field = MET_get_field(relation, id);
+ if (!field || !(array = field->fld_array))
+ IBERROR(223); /* msg 223 argument of scalar operation must be an array */
+@@ -1661,7 +1661,7 @@
+ return;
+
+ case nod_extract:
+- if ((ULONG) node->nod_arg[e_extract_part] == blr_extract_second) {
++ if ((IPTR) node->nod_arg[e_extract_part] == blr_extract_second) {
+ /* QUADDATE - SECOND returns a float, or scaled! */
+ desc->dsc_dtype = dtype_long;
+ desc->dsc_length = sizeof(ULONG);
+@@ -1720,7 +1720,7 @@
+
+ message = node->nod_arg[e_arg_message];
+ format = (FMT) message->nod_arg[e_msg_format];
+- *desc = format->fmt_desc[(int) node->nod_arg[e_arg_number]];
++ *desc = format->fmt_desc[(IPTR) node->nod_arg[e_arg_number]];
+ return;
+ }
+
+@@ -2651,8 +2651,8 @@
+ !input->nod_arg[e_fld_id] && !input->nod_arg[e_fld_stream])
+ --field_id;
+ else
+- field_id = (USHORT) input->nod_arg[e_fld_id];
+- stream = (USHORT) input->nod_arg[e_fld_stream];
++ field_id = (IPTR) input->nod_arg[e_fld_id];
++ stream = (IPTR) input->nod_arg[e_fld_stream];
+ if (remap_fld) {
+ JRD_REL relation;
+ JRD_FLD field;
+@@ -2660,7 +2660,7 @@
+ relation = (*csb)->csb_rpt[stream].csb_relation;
+ field = MET_get_field(relation, field_id);
+ if (field->fld_source)
+- field_id = (USHORT) field->fld_source->nod_arg[e_fld_id];
++ field_id = (IPTR) field->fld_source->nod_arg[e_fld_id];
+ }
+ if (remap)
+ stream = remap[stream];
+@@ -2771,7 +2771,7 @@
+ node->nod_type = input->nod_type;
+ node->nod_count = 0;
+
+- stream = (USHORT) input->nod_arg[e_rel_stream];
++ stream = (IPTR) input->nod_arg[e_rel_stream];
+ /**
+ Last entry in the remap contains the the original stream number.
+ Get that stream number so that the flags can be copied
+@@ -2851,7 +2851,7 @@
+ node->nod_arg[e_prc_inputs] =
+ copy(tdbb, csb, input->nod_arg[e_prc_inputs], remap, field_id,
+ node->nod_arg[e_prc_in_msg], remap_fld);
+- stream = (USHORT) input->nod_arg[e_prc_stream];
++ stream = (IPTR) input->nod_arg[e_prc_stream];
+ new_stream = (*csb)->csb_n_stream++;
+ node->nod_arg[e_prc_stream] = (JRD_NOD) (SLONG) new_stream;
+ /* TMN: Here we should really have the following assert */
+@@ -2861,7 +2861,7 @@
+ element = CMP_csb_element(csb, new_stream);
+ // SKIDDER: Maybe we need to check if we really found a procedure ?
+ element->csb_procedure = MET_lookup_procedure_id(tdbb,
+- (SSHORT)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
++ (IPTR)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
+
+ (*csb)->csb_rpt[new_stream].csb_flags |=
+ (*csb)->csb_rpt[stream].csb_flags & csb_no_dbkey;
+@@ -2874,7 +2874,7 @@
+ node = PAR_make_node(tdbb, e_agg_length);
+ node->nod_type = input->nod_type;
+ node->nod_count = 0;
+- stream = (USHORT) input->nod_arg[e_agg_stream];
++ stream = (IPTR) input->nod_arg[e_agg_stream];
+ assert(stream <= MAX_STREAMS);
+ new_stream = (*csb)->csb_n_stream++;
+ assert(new_stream <= MAX_STREAMS);
+@@ -2903,7 +2903,7 @@
+ node = PAR_make_node(tdbb, e_uni_length);
+ node->nod_type = input->nod_type;
+ node->nod_count = 2;
+- stream = (USHORT) input->nod_arg[e_uni_stream];
++ stream = (IPTR) input->nod_arg[e_uni_stream];
+ new_stream = (*csb)->csb_n_stream++;
+ node->nod_arg[e_uni_stream] = (JRD_NOD) (SLONG) new_stream;
+ /* TMN: Here we should really have the following assert */
+@@ -3041,7 +3041,7 @@
+ csb_repeat *tail;
+ JRD_REL relation;
+
+- stream = (USHORT) node->nod_arg[e_rel_stream];
++ stream = (IPTR) node->nod_arg[e_rel_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
+ tail = &csb->csb_rpt[stream];
+ if ( (relation = tail->csb_relation) )
+@@ -3269,7 +3269,7 @@
+ JRD_FLD field;
+ UCHAR *map, local_map[MAP_LENGTH];
+
+- stream = (USHORT) node->nod_arg[e_fld_stream];
++ stream = (IPTR) node->nod_arg[e_fld_stream];
+
+ /* Look at all rse's which are lower in scope than the rse which this field
+ is referencing, and mark them as varying -- the rule is that if a field
+@@ -3290,7 +3290,7 @@
+ if (!(relation = tail->csb_relation) ||
+ !(field =
+ MET_get_field(relation,
+- (USHORT) node->nod_arg[e_fld_id]))) break;
++ (IPTR) node->nod_arg[e_fld_id]))) break;
+
+ /* if this is a modify or store, check REFERENCES access to any foreign keys. */
+
+@@ -3402,9 +3402,9 @@
+
+ sub = node->nod_arg[e_asgn_from];
+ if (sub->nod_type == nod_field) {
+- stream = (USHORT) sub->nod_arg[e_fld_stream];
++ stream = (IPTR) sub->nod_arg[e_fld_stream];
+ field = MET_get_field((*csb)->csb_rpt[stream].csb_relation,
+- (USHORT) sub->nod_arg[e_fld_id]);
++ (IPTR) sub->nod_arg[e_fld_id]);
+ if (field)
+ node->nod_arg[e_asgn_missing2] = field->fld_missing_value;
+ }
+@@ -3412,12 +3412,12 @@
+ sub = node->nod_arg[e_asgn_to];
+ if (sub->nod_type != nod_field)
+ break;
+- stream = (USHORT) sub->nod_arg[e_fld_stream];
++ stream = (IPTR) sub->nod_arg[e_fld_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ if (!
+ (field =
+ MET_get_field(tail->csb_relation,
+- (USHORT) sub->nod_arg[e_fld_id]))) break;
++ (IPTR) sub->nod_arg[e_fld_id]))) break;
+ if (field->fld_missing_value) {
+ node->nod_arg[e_asgn_missing] = field->fld_missing_value;
+ node->nod_count = 3;
+@@ -3431,7 +3431,7 @@
+ break;
+
+ case nod_modify:
+- stream = (USHORT) node->nod_arg[e_mod_new_stream];
++ stream = (IPTR) node->nod_arg[e_mod_new_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ tail->csb_flags |= csb_modify;
+ pass1_modify(tdbb, csb, node);
+@@ -3439,13 +3439,13 @@
+ /* assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT); */
+ if ( (node->nod_arg[e_mod_validate] =
+ make_validation(tdbb, csb,
+- (USHORT) node->
++ (IPTR) node->
+ nod_arg[e_mod_new_stream])) ) node->nod_count =
+ MAX(node->nod_count, (USHORT) e_mod_validate + 1);
+ break;
+
+ case nod_erase:
+- stream = (USHORT) node->nod_arg[e_erase_stream];
++ stream = (IPTR) node->nod_arg[e_erase_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ tail->csb_flags |= csb_erase;
+ pass1_erase(tdbb, csb, node);
+@@ -3461,12 +3461,12 @@
+
+ case nod_store:
+ sub = node->nod_arg[e_sto_relation];
+- stream = (USHORT) sub->nod_arg[e_rel_stream];
++ stream = (IPTR) sub->nod_arg[e_rel_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ tail->csb_flags |= csb_store;
+ sub = pass1_store(tdbb, csb, node);
+ if (sub) {
+- stream = (USHORT) sub->nod_arg[e_rel_stream];
++ stream = (IPTR) sub->nod_arg[e_rel_stream];
+ if ((!node->nod_arg[e_sto_sub_store]) &&
+ (node->nod_arg[e_sto_validate] =
+ make_validation(tdbb, csb, stream))) node->nod_count =
+@@ -3493,7 +3493,7 @@
+
+ case nod_aggregate:
+ assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
+- (*csb)->csb_rpt[(USHORT) node->nod_arg[e_agg_stream]].csb_flags |=
++ (*csb)->csb_rpt[(IPTR) node->nod_arg[e_agg_stream]].csb_flags |=
+ csb_no_dbkey;
+ ignore_dbkey(tdbb, *csb, (RSE) node->nod_arg[e_agg_rse], view);
+ node->nod_arg[e_agg_rse] =
+@@ -3521,7 +3521,7 @@
+ NOD_T type;
+
+ type = node->nod_type;
+- stream = (USHORT) node->nod_arg[0];
++ stream = (IPTR) node->nod_arg[0];
+
+ if (!(*csb)->csb_rpt[stream].csb_map)
+ return node;
+@@ -3556,7 +3556,7 @@
+ break;
+
+ case nod_cardinality:
+- stream = (USHORT) node->nod_arg[e_card_stream];
++ stream = (IPTR) node->nod_arg[e_card_stream];
+ (*csb)->csb_rpt[stream].csb_flags |= csb_compute;
+ break;
+
+@@ -3623,7 +3623,7 @@
+ /* To support views of views, loop until we hit a real relation */
+
+ for (;;) {
+- stream = new_stream = (USHORT) node->nod_arg[e_erase_stream];
++ stream = new_stream = (IPTR) node->nod_arg[e_erase_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ tail->csb_flags |= csb_erase;
+ relation = (*csb)->csb_rpt[stream].csb_relation;
+@@ -3691,7 +3691,7 @@
+
+ parent = relation;
+ parent_stream = stream;
+- new_stream = (USHORT) source->nod_arg[e_rel_stream];
++ new_stream = (IPTR) source->nod_arg[e_rel_stream];
+ node->nod_arg[e_erase_stream] = (JRD_NOD) (SLONG) map[new_stream];
+ }
+ }
+@@ -3738,7 +3738,7 @@
+ field = MET_get_field(relation, id);
+ if (field->fld_source)
+ new_id =
+- (USHORT) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
++ (IPTR) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
+ else
+ new_id = id;
+ }
+@@ -3800,8 +3800,8 @@
+ /* To support views of views, loop until we hit a real relation */
+
+ for (;;) {
+- stream = (USHORT) node->nod_arg[e_mod_org_stream];
+- new_stream = (USHORT) node->nod_arg[e_mod_new_stream];
++ stream = (IPTR) node->nod_arg[e_mod_org_stream];
++ new_stream = (IPTR) node->nod_arg[e_mod_new_stream];
+ tail = &(*csb)->csb_rpt[new_stream];
+ tail->csb_flags |= csb_modify;
+ relation = (*csb)->csb_rpt[stream].csb_relation;
+@@ -3840,7 +3840,7 @@
+ node->nod_count =
+ MAX(node->nod_count, (USHORT) e_mod_map_view + 1);
+ map = (*csb)->csb_rpt[stream].csb_map;
+- stream = (USHORT) source->nod_arg[e_rel_stream];
++ stream = (IPTR) source->nod_arg[e_rel_stream];
+ stream = map[stream];
+ view_stream = new_stream;
+
+@@ -3848,18 +3848,18 @@
+
+ map =
+ alloc_map(tdbb, csb,
+- (SSHORT) node->nod_arg[e_mod_new_stream]);
++ (IPTR) node->nod_arg[e_mod_new_stream]);
+ source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
+ /* TMN: Here we should really have the following assert */
+ /* assert(source->nod_arg [e_rel_stream] <= MAX_UCHAR); */
+- map[new_stream] = (UCHAR) source->nod_arg[e_rel_stream];
++ map[new_stream] = (IPTR) source->nod_arg[e_rel_stream];
+ view_node = copy(tdbb, csb, node, map, 0, NULL, TRUE);
+ view_node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) stream;
+ view_node->nod_arg[e_mod_new_stream] =
+ source->nod_arg[e_rel_stream];
+ view_node->nod_arg[e_mod_map_view] = NULL;
+ node->nod_arg[e_mod_sub_mod] = view_node;
+- new_stream = (USHORT) source->nod_arg[e_rel_stream];
++ new_stream = (IPTR) source->nod_arg[e_rel_stream];
+ view_node->nod_arg[e_mod_statement] =
+ pass1_expand_view(tdbb, *csb, view_stream, new_stream, TRUE);
+ node->nod_count =
+@@ -3872,14 +3872,14 @@
+ /* View passes muster -- do some translation. Start with source stream */
+
+ map = (*csb)->csb_rpt[stream].csb_map;
+- stream = (USHORT) source->nod_arg[e_rel_stream];
++ stream = (IPTR) source->nod_arg[e_rel_stream];
+ node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) map[stream];
+
+ /* Next, do update stream */
+
+ map =
+ alloc_map(tdbb, csb,
+- (SSHORT) node->nod_arg[e_mod_new_stream]);
++ (IPTR) node->nod_arg[e_mod_new_stream]);
+ source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
+ node->nod_arg[e_mod_new_stream] = source->nod_arg[e_rel_stream];
+ }
+@@ -4126,7 +4126,7 @@
+
+ pass1(tdbb, csb, source, parent_view, view_stream, FALSE);
+ procedure = MET_lookup_procedure_id(tdbb,
+- (SSHORT)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
++ (IPTR)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
+ post_procedure_access(tdbb, *csb, procedure);
+ CMP_post_resource(&(*csb)->csb_resources, (BLK) procedure,
+ Resource::rsc_procedure, procedure->prc_id);
+@@ -4158,7 +4158,7 @@
+ view->rel_id);
+ source->nod_arg[e_rel_view] = (JRD_NOD) parent_view;
+
+- stream = (USHORT) source->nod_arg[e_rel_stream];
++ stream = (IPTR) source->nod_arg[e_rel_stream];
+ element = CMP_csb_element(csb, stream);
+ element->csb_view = parent_view;
+ /* TMN: Here we should really have the following assert */
+@@ -4173,7 +4173,7 @@
+ for (vcx_ptr = &parent_view->rel_view_contexts; *vcx_ptr;
+ vcx_ptr = &(*vcx_ptr)->vcx_next)
+ if ((*vcx_ptr)->vcx_context ==
+- (USHORT) source->nod_arg[e_rel_context]) {
++ (IPTR) source->nod_arg[e_rel_context]) {
+ element->csb_alias = (*vcx_ptr)->vcx_context_name;
+ break;
+ }
+@@ -4317,7 +4317,7 @@
+
+ for (;;) {
+ original = node->nod_arg[e_sto_relation];
+- stream = (USHORT) original->nod_arg[e_rel_stream];
++ stream = (IPTR) original->nod_arg[e_rel_stream];
+ tail = &(*csb)->csb_rpt[stream];
+ tail->csb_flags |= csb_store;
+ relation = (*csb)->csb_rpt[stream].csb_relation;
+@@ -4371,7 +4371,7 @@
+ node->nod_arg[e_sto_relation] =
+ copy(tdbb, csb, source, map, 0, NULL, FALSE);
+ new_stream =
+- (USHORT) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
++ (IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
+ node->nod_arg[e_sto_statement] =
+ pass1_expand_view(tdbb, *csb, stream, new_stream, TRUE);
+ node->nod_arg[e_sto_statement] =
+@@ -4719,9 +4719,9 @@
+ /* AB: Mark the streams involved with an UPDATE statement
+ active. So that the optimizer can use indices for
+ eventually used sub-selects. */
+- stream = (USHORT) node->nod_arg[e_mod_org_stream];
++ stream = (IPTR) node->nod_arg[e_mod_org_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_active;
+- stream = (USHORT) node->nod_arg[e_mod_new_stream];
++ stream = (IPTR) node->nod_arg[e_mod_new_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_active;
+ }
+
+@@ -4733,9 +4733,9 @@
+
+ if (node->nod_type == nod_modify) {
+ /* AB: Remove the previous flags */
+- stream = (USHORT) node->nod_arg[e_mod_org_stream];
++ stream = (IPTR) node->nod_arg[e_mod_org_stream];
+ csb->csb_rpt[stream].csb_flags &= ~csb_active;
+- stream = (USHORT) node->nod_arg[e_mod_new_stream];
++ stream = (IPTR) node->nod_arg[e_mod_new_stream];
+ csb->csb_rpt[stream].csb_flags &= ~csb_active;
+ }
+
+@@ -4834,7 +4834,7 @@
+ FMT format;
+ fmt::fmt_desc_iterator desc;
+
+- stream = (USHORT) node->nod_arg[e_mod_org_stream];
++ stream = (IPTR) node->nod_arg[e_mod_org_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_update;
+ format = CMP_format(tdbb, csb, stream);
+ desc = format->fmt_desc.begin();
+@@ -4859,13 +4859,13 @@
+ break;
+
+ case nod_erase:
+- stream = (USHORT) node->nod_arg[e_erase_stream];
++ stream = (IPTR) node->nod_arg[e_erase_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_update;
+ break;
+
+ case nod_field:
+- stream = (USHORT) node->nod_arg[e_fld_stream];
+- id = (USHORT) node->nod_arg[e_fld_id];
++ stream = (IPTR) node->nod_arg[e_fld_stream];
++ id = (IPTR) node->nod_arg[e_fld_id];
+ SBM_set(tdbb, &csb->csb_rpt[stream].csb_fields, id);
+ if (node->nod_flags & nod_value) {
+ csb->csb_impure += sizeof(struct vlux);
+@@ -4939,7 +4939,7 @@
+ pass2_rse(tdbb, csb, (RSE) node->nod_arg[e_agg_rse]);
+ pass2(tdbb, csb, node->nod_arg[e_agg_map], node);
+ pass2(tdbb, csb, node->nod_arg[e_agg_group], node);
+- stream = (USHORT) node->nod_arg[e_agg_stream];
++ stream = (IPTR) node->nod_arg[e_agg_stream];
+ assert(stream <= MAX_STREAMS);
+ process_map(tdbb, csb, node->nod_arg[e_agg_map],
+ &csb->csb_rpt[stream].csb_format);
+@@ -5048,7 +5048,7 @@
+
+ node = *ptr;
+ if (node->nod_type == nod_relation) {
+- USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_rel_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_active;
+ pass2(tdbb, csb, node, (JRD_NOD) rse);
+ }
+@@ -5056,12 +5056,12 @@
+ pass2_rse(tdbb, csb, (RSE) node);
+ }
+ else if (node->nod_type == nod_procedure) {
+- USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_prc_stream];
+ csb->csb_rpt[stream].csb_flags |= csb_active;
+ pass2(tdbb, csb, node, (JRD_NOD) rse);
+ }
+ else if (node->nod_type == nod_aggregate) {
+- USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_agg_stream];
+ assert(stream <= MAX_STREAMS);
+ csb->csb_rpt[stream].csb_flags |= csb_active;
+ pass2(tdbb, csb, node, (JRD_NOD) rse);
+@@ -5116,7 +5116,7 @@
+ /* Make up a format block sufficiently large to hold instantiated record */
+
+ clauses = node->nod_arg[e_uni_clauses];
+- id = (USHORT) node->nod_arg[e_uni_stream];
++ id = (IPTR) node->nod_arg[e_uni_stream];
+ format = &csb->csb_rpt[id].csb_format;
+
+ /* Process alternating rse and map blocks */
+@@ -5158,7 +5158,7 @@
+
+ for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end;
+ ptr++) if ((*ptr)->nod_type == nod_relation) {
+- stream = (USHORT) (*ptr)->nod_arg[e_rel_stream];
++ stream = (IPTR) (*ptr)->nod_arg[e_rel_stream];
+ if (!(csb->csb_rpt[stream].csb_plan))
+ ERR_post(gds_no_stream_plan, gds_arg_string,
+ csb->csb_rpt[stream].csb_relation->rel_name, 0);
+@@ -5211,7 +5211,7 @@
+
+ /* find the tail for the relation specified in the rse */
+
+- stream = (USHORT) plan_relation_node->nod_arg[e_rel_stream];
++ stream = (IPTR) plan_relation_node->nod_arg[e_rel_stream];
+ tail = &csb->csb_rpt[stream];
+
+ /* if the plan references a view, find the real base relation
+@@ -5447,15 +5447,15 @@
+ ptr < end; ptr++) {
+ node = *ptr;
+ if (node->nod_type == nod_relation) {
+- USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_rel_stream];
+ csb->csb_rpt[stream].csb_flags &= ~csb_active;
+ }
+ else if (node->nod_type == nod_procedure) {
+- USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_prc_stream];
+ csb->csb_rpt[stream].csb_flags &= ~csb_active;
+ }
+ else if (node->nod_type == nod_aggregate) {
+- USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
++ USHORT stream = (IPTR) node->nod_arg[e_agg_stream];
+ assert(stream <= MAX_STREAMS);
+ csb->csb_rpt[stream].csb_flags &= ~csb_active;
+ }
+@@ -5551,7 +5551,7 @@
+ for (end = ptr + map->nod_count; ptr < end; ptr++) {
+ assignment = *ptr;
+ field = assignment->nod_arg[e_asgn_to];
+- id = (USHORT) field->nod_arg[e_fld_id];
++ id = (IPTR) field->nod_arg[e_fld_id];
+ if (id >= format->fmt_count) {
+ format->fmt_desc.resize(id + 1);
+ }
+@@ -5687,13 +5687,13 @@
+ /* for aggregates, check current rse, if not found then check
+ the sub-rse */
+ if (sub->nod_type == nod_aggregate) {
+- if ((stream == (USHORT) sub->nod_arg[e_rel_stream]) ||
++ if ((stream == (IPTR) sub->nod_arg[e_rel_stream]) ||
+ (stream_in_rse(stream, (RSE) sub->nod_arg[e_agg_rse])))
+ return TRUE; /* do not mark as variant */
+ }
+
+ if ((sub->nod_type == nod_relation) &&
+- (stream == (USHORT) sub->nod_arg[e_rel_stream]))
++ (stream == (IPTR) sub->nod_arg[e_rel_stream]))
+ return TRUE; /* do not mark as variant */
+ }
+