]> git.pld-linux.org Git - packages/Firebird.git/blob - Firebird-gcc4.patch
- fix chkconfig, rc-scripts deps
[packages/Firebird.git] / Firebird-gcc4.patch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## gcc4.dpatch by  <Damyan Ivanov <divanov@creditreform.bg>>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Make sources compile with gcc4
6
7 @DPATCH@
8 diff -urNad firebird2-1.5.3.4870~/src/common/classes/alloc.h firebird2-1.5.3.4870/src/common/classes/alloc.h
9 --- firebird2-1.5.3.4870~/src/common/classes/alloc.h    2006-02-01 23:07:02.000000000 +0200
10 +++ firebird2-1.5.3.4870/src/common/classes/alloc.h     2006-02-01 23:07:04.000000000 +0200
11 @@ -241,23 +241,29 @@
12  
13  void operator delete[](void* mem) throw();
14  
15 +#if  __GNUC__ < 4
16 +#define STATIC_NEW static
17 +#else
18 +#define STATIC_NEW
19 +#endif
20 +
21  #ifdef DEBUG_GDS_ALLOC
22 -static inline void* operator new(size_t s, Firebird::MemoryPool& pool, char* file, int line) {
23 +STATIC_NEW inline void* operator new(size_t s, Firebird::MemoryPool& pool, char* file, int line) {
24         return pool.allocate(s, 0, file, line);
25  //     return pool.calloc(s, 0, file, line);
26  }
27 -static inline void* operator new[](size_t s, Firebird::MemoryPool& pool, char* file, int line) {
28 +STATIC_NEW inline void* operator new[](size_t s, Firebird::MemoryPool& pool, char* file, int line) {
29         return pool.allocate(s, 0, file, line);
30  //     return pool.calloc(s, 0, file, line);
31  }
32  #define FB_NEW(pool) new(pool,__FILE__,__LINE__)
33  #define FB_NEW_RPT(pool,count) new(pool,count,__FILE__,__LINE__)
34  #else
35 -static inline void* operator new(size_t s, Firebird::MemoryPool& pool) {
36 +STATIC_NEW inline void* operator new(size_t s, Firebird::MemoryPool& pool) {
37         return pool.allocate(s);
38  //     return pool.calloc(s);
39  }
40 -static inline void* operator new[](size_t s, Firebird::MemoryPool& pool) {
41 +STATIC_NEW inline void* operator new[](size_t s, Firebird::MemoryPool& pool) {
42         return pool.allocate(s);
43  //     return pool.calloc(s);
44  }
45 diff -urNad firebird2-1.5.3.4870~/src/common/config/config.cpp firebird2-1.5.3.4870/src/common/config/config.cpp
46 --- firebird2-1.5.3.4870~/src/common/config/config.cpp  2006-02-01 23:07:02.000000000 +0200
47 +++ firebird2-1.5.3.4870/src/common/config/config.cpp   2006-02-01 23:07:04.000000000 +0200
48 @@ -261,12 +261,12 @@
49  
50  int Config::getSortMemBlockSize()
51  {
52 -       return (int) sysConfig.values[KEY_SORT_MEM_BLOCK_SIZE];
53 +       return (int)(IPTR) sysConfig.values[KEY_SORT_MEM_BLOCK_SIZE];
54  }
55  
56  int Config::getSortMemUpperLimit()
57  {
58 -       return (int) sysConfig.values[KEY_SORT_MEM_UPPER_LIMIT];
59 +       return (int)(IPTR) sysConfig.values[KEY_SORT_MEM_UPPER_LIMIT];
60  }
61  
62  bool Config::getRemoteFileOpenAbility()
63 @@ -276,12 +276,12 @@
64  
65  int Config::getGuardianOption()
66  {
67 -       return (int) sysConfig.values[KEY_GUARDIAN_OPTION];
68 +       return (int)(IPTR) sysConfig.values[KEY_GUARDIAN_OPTION];
69  }
70  
71  int Config::getCpuAffinityMask()
72  {
73 -       return (int) sysConfig.values[KEY_CPU_AFFINITY_MASK];
74 +       return (int)(IPTR) sysConfig.values[KEY_CPU_AFFINITY_MASK];
75  }
76  
77  bool Config::getOldParameterOrdering()
78 @@ -291,7 +291,7 @@
79  
80  int Config::getTcpRemoteBufferSize()
81  {
82 -       return (int) sysConfig.values[KEY_TCP_REMOTE_BUFFER_SIZE];
83 +       return (int)(IPTR) sysConfig.values[KEY_TCP_REMOTE_BUFFER_SIZE];
84  }
85  
86  bool Config::getTcpNoNagle()
87 @@ -301,37 +301,37 @@
88  
89  int Config::getIpcMapSize()
90  {
91 -       return (int) sysConfig.values[KEY_IPC_MAP_SIZE];
92 +       return (int)(IPTR) sysConfig.values[KEY_IPC_MAP_SIZE];
93  }
94  
95  int Config::getDefaultDbCachePages()
96  {
97 -       return (int) sysConfig.values[KEY_DEFAULT_DB_CACHE_PAGES];
98 +       return (int)(IPTR) sysConfig.values[KEY_DEFAULT_DB_CACHE_PAGES];
99  }
100  
101  int Config::getConnectionTimeout()
102  {
103 -       return (int) sysConfig.values[KEY_CONNECTION_TIMEOUT];
104 +       return (int)(IPTR) sysConfig.values[KEY_CONNECTION_TIMEOUT];
105  }
106  
107  int Config::getDummyPacketInterval()
108  {
109 -       return (int) sysConfig.values[KEY_DUMMY_PACKET_INTERVAL];
110 +       return (int)(IPTR) sysConfig.values[KEY_DUMMY_PACKET_INTERVAL];
111  }
112  
113  int Config::getLockMemSize()
114  {
115 -       return (int) sysConfig.values[KEY_LOCK_MEM_SIZE];
116 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_MEM_SIZE];
117  }
118  
119  int Config::getLockSemCount()
120  {
121 -       return (int) sysConfig.values[KEY_LOCK_SEM_COUNT];
122 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_SEM_COUNT];
123  }
124  
125  int Config::getLockSignal()
126  {
127 -       return (int) sysConfig.values[KEY_LOCK_SIGNAL];
128 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_SIGNAL];
129  }
130  
131  bool Config::getLockGrantOrder()
132 @@ -341,27 +341,27 @@
133  
134  int Config::getLockHashSlots()
135  {
136 -       return (int) sysConfig.values[KEY_LOCK_HASH_SLOTS];
137 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_HASH_SLOTS];
138  }
139  
140  int Config::getLockAcquireSpins()
141  {
142 -       return (int) sysConfig.values[KEY_LOCK_ACQUIRE_SPINS];
143 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_ACQUIRE_SPINS];
144  }
145  
146  int Config::getEventMemSize()
147  {
148 -       return (int) sysConfig.values[KEY_EVENT_MEM_SIZE];
149 +       return (int)(IPTR) sysConfig.values[KEY_EVENT_MEM_SIZE];
150  }
151  
152  int Config::getDeadlockTimeout()
153  {
154 -       return (int) sysConfig.values[KEY_DEADLOCK_TIMEOUT];
155 +       return (int)(IPTR) sysConfig.values[KEY_DEADLOCK_TIMEOUT];
156  }
157  
158  int Config::getSolarisStallValue()
159  {
160 -       return (int) sysConfig.values[KEY_SOLARIS_STALL_VALUE];
161 +       return (int)(IPTR) sysConfig.values[KEY_SOLARIS_STALL_VALUE];
162  }
163  
164  bool Config::getTraceMemoryPools()
165 @@ -371,7 +371,7 @@
166  
167  int Config::getPrioritySwitchDelay()
168  {
169 -       int rc = (int) sysConfig.values[KEY_PRIORITY_SWITCH_DELAY];
170 +       int rc = (int)(IPTR) sysConfig.values[KEY_PRIORITY_SWITCH_DELAY];
171         if (rc < 1)
172                 rc = 1;
173         return rc;
174 @@ -379,7 +379,7 @@
175  
176  int Config::getDeadThreadsCollection()
177  {
178 -       int rc = (int) sysConfig.values[KEY_DEAD_THREADS_COLLECTION];
179 +       int rc = (int)(IPTR) sysConfig.values[KEY_DEAD_THREADS_COLLECTION];
180         if (rc < 1)
181                 rc = 1;
182         return rc;
183 @@ -387,7 +387,7 @@
184  
185  int Config::getPriorityBoost()
186  {
187 -       int rc = (int) sysConfig.values[KEY_PRIORITY_BOOST];
188 +       int rc = (int)(IPTR) sysConfig.values[KEY_PRIORITY_BOOST];
189         if (rc < 1)
190                 rc = 1;
191         if (rc > 1000)
192 @@ -402,7 +402,7 @@
193  
194  int Config::getRemoteServicePort()
195  {
196 -       return (int) sysConfig.values[KEY_REMOTE_SERVICE_PORT];
197 +       return (int)(IPTR) sysConfig.values[KEY_REMOTE_SERVICE_PORT];
198  }
199  
200  const char *Config::getRemotePipeName()
201 @@ -417,17 +417,17 @@
202  
203  int Config::getMaxUnflushedWrites()
204  {
205 -       return (int) sysConfig.values[KEY_MAX_UNFLUSHED_WRITES];
206 +       return (int)(IPTR) sysConfig.values[KEY_MAX_UNFLUSHED_WRITES];
207  }
208  
209  int Config::getMaxUnflushedWriteTime()
210  {
211 -       return (int) sysConfig.values[KEY_MAX_UNFLUSHED_WRITE_TIME];
212 +       return (int)(IPTR) sysConfig.values[KEY_MAX_UNFLUSHED_WRITE_TIME];
213  }
214  
215  int Config::getProcessPriorityLevel()
216  {
217 -       return (int) sysConfig.values[KEY_PROCESS_PRIORITY_LEVEL];
218 +       return (int)(IPTR) sysConfig.values[KEY_PROCESS_PRIORITY_LEVEL];
219  }
220  
221  bool Config::getCreateInternalWindow()
222 @@ -443,7 +443,7 @@
223  int Config::getRemoteAuxPort()
224  {
225  #ifdef SUPERSERVER
226 -       return (int) sysConfig.values[KEY_REMOTE_AUX_PORT];
227 +       return (int)(IPTR) sysConfig.values[KEY_REMOTE_AUX_PORT];
228  #else
229         return 0;
230  #endif
231 diff -urNad firebird2-1.5.3.4870~/src/gpre/c_cxx.cpp firebird2-1.5.3.4870/src/gpre/c_cxx.cpp
232 --- firebird2-1.5.3.4870~/src/gpre/c_cxx.cpp    2006-02-01 23:07:02.000000000 +0200
233 +++ firebird2-1.5.3.4870/src/gpre/c_cxx.cpp     2006-02-01 23:07:04.000000000 +0200
234 @@ -2184,7 +2184,7 @@
235  
236         args.pat_database = (DBB) init->nod_arg[3];
237         args.pat_vector1 = status_vector(action);
238 -       args.pat_long1 = (int) init->nod_arg[2];
239 +       args.pat_long1 = (int)(IPTR) init->nod_arg[2];
240         args.pat_value2 = (int) event_list->nod_count;
241  
242  //  generate call to dynamically generate event blocks 
243 @@ -2255,7 +2255,7 @@
244                 event_init = (GPRE_NOD) event_action->act_object;
245                 stack_name = (SYM) event_init->nod_arg[0];
246                 if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
247 -                       ident = (int) event_init->nod_arg[2];
248 +                       ident = (int)(IPTR) event_init->nod_arg[2];
249                         database = (DBB) event_init->nod_arg[3];
250                 }
251         }
252 diff -urNad firebird2-1.5.3.4870~/src/gpre/cmd.cpp firebird2-1.5.3.4870/src/gpre/cmd.cpp
253 --- firebird2-1.5.3.4870~/src/gpre/cmd.cpp      2006-02-01 23:07:02.000000000 +0200
254 +++ firebird2-1.5.3.4870/src/gpre/cmd.cpp       2006-02-01 23:07:04.000000000 +0200
255 @@ -204,7 +204,7 @@
256  
257         case ACT_drop_shadow:
258                 put_numeric(request, gds_dyn_delete_shadow,
259 -                                       (SSHORT) action->act_object);
260 +                                       (SSHORT)(IPTR) action->act_object);
261                 STUFF_END;
262                 break;
263  
264 diff -urNad firebird2-1.5.3.4870~/src/gpre/cme.cpp firebird2-1.5.3.4870/src/gpre/cme.cpp
265 --- firebird2-1.5.3.4870~/src/gpre/cme.cpp      2006-02-01 23:07:02.000000000 +0200
266 +++ firebird2-1.5.3.4870/src/gpre/cme.cpp       2006-02-01 23:07:04.000000000 +0200
267 @@ -251,7 +251,7 @@
268  // ** Begin date/time/timestamp support *
269         case nod_extract:
270                 STUFF(blr_extract);
271 -               switch ((KWWORDS) (int) node->nod_arg[0])
272 +               switch ((KWWORDS) (int)(IPTR) node->nod_arg[1])
273                 {
274                 case KW_YEAR:
275                         STUFF(blr_extract_year);
276 @@ -478,7 +478,7 @@
277  // ** Begin date/time/timestamp support *
278         case nod_extract:
279                 {
280 -                       KWWORDS kw_word = (KWWORDS) (int) node->nod_arg[0];
281 +                       KWWORDS kw_word = (KWWORDS) (int)(IPTR) node->nod_arg[0];
282                         CME_get_dtype(node->nod_arg[1], f);
283                         switch (f->fld_dtype)
284                         {
285 diff -urNad firebird2-1.5.3.4870~/src/gpre/cob.cpp firebird2-1.5.3.4870/src/gpre/cob.cpp
286 --- firebird2-1.5.3.4870~/src/gpre/cob.cpp      2006-02-01 23:07:02.000000000 +0200
287 +++ firebird2-1.5.3.4870/src/gpre/cob.cpp       2006-02-01 23:07:04.000000000 +0200
288 @@ -382,7 +382,7 @@
289  static void    gen_on_error (ACT);
290  static void    gen_procedure (ACT);
291  static void    gen_put_segment (ACT);
292 -static void    gen_raw (UCHAR *, enum req_t, int, int);
293 +static void    gen_raw (UCHAR *, enum req_t, int, IPTR);
294  static void    gen_ready (ACT);
295  static void    gen_receive (ACT, POR);
296  static void    gen_release (ACT);
297 @@ -2656,7 +2656,7 @@
298  
299         args.pat_database = (DBB) init->nod_arg[3];
300         args.pat_vector1 = status_vector(action);
301 -       args.pat_value1 = (int) init->nod_arg[2];
302 +       args.pat_value1 = (IPTR) init->nod_arg[2];
303         args.pat_value2 = (int) event_list->nod_count;
304         args.pat_string1 = ISC_EVENT_BLOCK;
305         args.pat_string2 = ISC_EVENT_WAIT;
306 @@ -2712,7 +2712,7 @@
307         LLS stack_ptr;
308         ACT event_action;
309         SSHORT column;
310 -       int ident;
311 +       IPTR ident;
312         TEXT s[64];
313         TEXT *pattern1 =
314                 "CALL \"%S2\" USING %V1, %RF%DH%RE, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE";
315 @@ -2730,7 +2730,7 @@
316                 event_init = (GPRE_NOD) event_action->act_object;
317                 stack_name = (SYM) event_init->nod_arg[0];
318                 if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
319 -                       ident = (int) event_init->nod_arg[2];
320 +                       ident = (IPTR) event_init->nod_arg[2];
321                         database = (DBB) event_init->nod_arg[3];
322                 }
323         }
324 @@ -3845,7 +3845,7 @@
325  
326  static void gen_raw(
327                            UCHAR * blr,
328 -                          enum req_t request_type, int request_length, int ident)
329 +                          enum req_t request_type, int request_length, IPTR ident)
330  {
331         UCHAR *c;
332         TEXT s[256];
333 @@ -4193,7 +4193,7 @@
334                         printa(names[COLUMN_0], FALSE, "01  %s%d.",
335                                    names[ISC_], blob->blb_bpb_ident);
336                         gen_raw(blob->blb_bpb, request->req_type, blob->blb_bpb_length,
337 -                                       (int) request);
338 +                                       (IPTR) request);
339                         printa(names[COMMENT], FALSE, " ");
340                 }
341  #ifdef PYXIS
342 @@ -4703,7 +4703,7 @@
343  static void gen_type( ACT action)
344  {
345  
346 -       printa(names[COLUMN], TRUE, "%ld", action->act_object);
347 +       printa(names[COLUMN], TRUE, "%ld", (IPTR) action->act_object);
348  }
349  
350  
351 diff -urNad firebird2-1.5.3.4870~/src/gpre/pat.h firebird2-1.5.3.4870/src/gpre/pat.h
352 --- firebird2-1.5.3.4870~/src/gpre/pat.h        2006-02-01 23:07:02.000000000 +0200
353 +++ firebird2-1.5.3.4870/src/gpre/pat.h 2006-02-01 23:07:04.000000000 +0200
354 @@ -85,7 +85,7 @@
355         USHORT pat_ident2;
356         TEXT *pat_vector1;
357         TEXT *pat_vector2;
358 -       int pat_value1;
359 +       IPTR pat_value1;
360         int pat_value2;
361         int pat_value3;
362         int pat_value4;
363 diff -urNad firebird2-1.5.3.4870~/src/jrd/blb.cpp firebird2-1.5.3.4870/src/jrd/blb.cpp
364 --- firebird2-1.5.3.4870~/src/jrd/blb.cpp       2006-02-01 23:07:02.000000000 +0200
365 +++ firebird2-1.5.3.4870/src/jrd/blb.cpp        2006-02-01 23:07:04.000000000 +0200
366 @@ -860,8 +860,8 @@
367         request = tdbb->tdbb_request;
368         source = (BID) from_desc->dsc_address;
369         destination = (BID) to_desc->dsc_address;
370 -       id = (USHORT) field->nod_arg[e_fld_id];
371 -       rpb = &request->req_rpb[(int) field->nod_arg[e_fld_stream]];
372 +       id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
373 +       rpb = &request->req_rpb[(int)(IPTR) field->nod_arg[e_fld_stream]];
374         relation = rpb->rpb_relation;
375         record = rpb->rpb_record;
376  
377 diff -urNad firebird2-1.5.3.4870~/src/jrd/cmp.cpp firebird2-1.5.3.4870/src/jrd/cmp.cpp
378 --- firebird2-1.5.3.4870~/src/jrd/cmp.cpp       2006-02-01 23:07:02.000000000 +0200
379 +++ firebird2-1.5.3.4870/src/jrd/cmp.cpp        2006-02-01 23:07:04.000000000 +0200
380 @@ -958,9 +958,9 @@
381                         FMT format;
382                         USHORT id;
383  
384 -                       id = (USHORT) node->nod_arg[e_fld_id];
385 +                       id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
386                         format =
387 -                               CMP_format(tdbb, csb, (USHORT) node->nod_arg[e_fld_stream]);
388 +                               CMP_format(tdbb, csb, (USHORT)(IPTR) node->nod_arg[e_fld_stream]);
389                         if (id >= format->fmt_count) {
390                                 desc->dsc_dtype = dtype_null;
391                                 desc->dsc_length = 0;
392 @@ -983,9 +983,9 @@
393  
394                         sub = node->nod_arg[e_scl_field];
395                         relation =
396 -                               csb->csb_rpt[(USHORT) sub->
397 +                               csb->csb_rpt[(USHORT)(IPTR) sub->
398                                                          nod_arg[e_fld_stream]].csb_relation;
399 -                       id = (USHORT) sub->nod_arg[e_fld_id];
400 +                       id = (USHORT)(IPTR) sub->nod_arg[e_fld_id];
401                         field = MET_get_field(relation, id);
402                         if (!field || !(array = field->fld_array))
403                                 IBERROR(223);   /* msg 223 argument of scalar operation must be an array */
404 @@ -1661,7 +1661,7 @@
405                 return;
406  
407         case nod_extract:
408 -               if ((ULONG) node->nod_arg[e_extract_part] == blr_extract_second) {
409 +               if ((ULONG)(IPTR) node->nod_arg[e_extract_part] == blr_extract_second) {
410                         /* QUADDATE - SECOND returns a float, or scaled! */
411                         desc->dsc_dtype = dtype_long;
412                         desc->dsc_length = sizeof(ULONG);
413 @@ -1720,7 +1720,7 @@
414  
415                         message = node->nod_arg[e_arg_message];
416                         format = (FMT) message->nod_arg[e_msg_format];
417 -                       *desc = format->fmt_desc[(int) node->nod_arg[e_arg_number]];
418 +                       *desc = format->fmt_desc[(int)(IPTR) node->nod_arg[e_arg_number]];
419                         return;
420                 }
421  
422 @@ -2653,8 +2653,8 @@
423                                 !input->nod_arg[e_fld_id] && !input->nod_arg[e_fld_stream])
424                                 --field_id;
425                         else
426 -                               field_id = (USHORT) input->nod_arg[e_fld_id];
427 -                       stream = (USHORT) input->nod_arg[e_fld_stream];
428 +                               field_id = (USHORT)(IPTR) input->nod_arg[e_fld_id];
429 +                       stream = (USHORT)(IPTR) input->nod_arg[e_fld_stream];
430                         if (remap_fld) {
431                                 JRD_REL relation;
432                                 JRD_FLD field;
433 @@ -2662,7 +2662,7 @@
434                                 relation = (*csb)->csb_rpt[stream].csb_relation;
435                                 field = MET_get_field(relation, field_id);
436                                 if (field->fld_source)
437 -                                       field_id = (USHORT) field->fld_source->nod_arg[e_fld_id];
438 +                                       field_id = (USHORT)(IPTR) field->fld_source->nod_arg[e_fld_id];
439                         }
440                         if (remap)
441                                 stream = remap[stream];
442 @@ -2773,7 +2773,7 @@
443                         node->nod_type = input->nod_type;
444                         node->nod_count = 0;
445  
446 -                       stream = (USHORT) input->nod_arg[e_rel_stream];
447 +                       stream = (USHORT)(IPTR) input->nod_arg[e_rel_stream];
448         /** 
449             Last entry in the remap contains the the original stream number.
450             Get that stream number so that the flags can be copied 
451 @@ -2853,7 +2853,7 @@
452                         node->nod_arg[e_prc_inputs] =
453                                 copy(tdbb, csb, input->nod_arg[e_prc_inputs], remap, field_id,
454                                          node->nod_arg[e_prc_in_msg], remap_fld);
455 -                       stream = (USHORT) input->nod_arg[e_prc_stream];
456 +                       stream = (USHORT)(IPTR) input->nod_arg[e_prc_stream];
457                         new_stream = (*csb)->csb_n_stream++;
458                         node->nod_arg[e_prc_stream] = (JRD_NOD) (SLONG) new_stream;
459                         /* TMN: Here we should really have the following assert */
460 @@ -2863,7 +2863,7 @@
461                         element = CMP_csb_element(csb, new_stream);
462                         // SKIDDER: Maybe we need to check if we really found a procedure ?
463                         element->csb_procedure = MET_lookup_procedure_id(tdbb,
464 -                         (SSHORT)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
465 +                         (SSHORT)(IPTR)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
466  
467                         (*csb)->csb_rpt[new_stream].csb_flags |=
468                                 (*csb)->csb_rpt[stream].csb_flags & csb_no_dbkey;
469 @@ -2876,7 +2876,7 @@
470                 node = PAR_make_node(tdbb, e_agg_length);
471                 node->nod_type = input->nod_type;
472                 node->nod_count = 0;
473 -               stream = (USHORT) input->nod_arg[e_agg_stream];
474 +               stream = (USHORT)(IPTR) input->nod_arg[e_agg_stream];
475                 assert(stream <= MAX_STREAMS);
476                 new_stream = (*csb)->csb_n_stream++;
477                 assert(new_stream <= MAX_STREAMS);
478 @@ -2905,7 +2905,7 @@
479                 node = PAR_make_node(tdbb, e_uni_length);
480                 node->nod_type = input->nod_type;
481                 node->nod_count = 2;
482 -               stream = (USHORT) input->nod_arg[e_uni_stream];
483 +               stream = (USHORT)(IPTR) input->nod_arg[e_uni_stream];
484                 new_stream = (*csb)->csb_n_stream++;
485                 node->nod_arg[e_uni_stream] = (JRD_NOD) (SLONG) new_stream;
486                 /* TMN: Here we should really have the following assert */
487 @@ -3043,7 +3043,7 @@
488                         csb_repeat *tail;
489                         JRD_REL relation;
490  
491 -                       stream = (USHORT) node->nod_arg[e_rel_stream];
492 +                       stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
493                         csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
494                         tail = &csb->csb_rpt[stream];
495                         if ( (relation = tail->csb_relation) )
496 @@ -3271,7 +3271,7 @@
497                         JRD_FLD field;
498                         UCHAR *map, local_map[MAP_LENGTH];
499  
500 -                       stream = (USHORT) node->nod_arg[e_fld_stream];
501 +                       stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
502  
503                         /* Look at all rse's which are lower in scope than the rse which this field 
504                            is referencing, and mark them as varying -- the rule is that if a field 
505 @@ -3292,7 +3292,7 @@
506                         if (!(relation = tail->csb_relation) ||
507                                 !(field =
508                                   MET_get_field(relation,
509 -                                                               (USHORT) node->nod_arg[e_fld_id]))) break;
510 +                                                               (USHORT)(IPTR) node->nod_arg[e_fld_id]))) break;
511  
512                         /* if this is a modify or store, check REFERENCES access to any foreign keys. */
513  
514 @@ -3404,9 +3404,9 @@
515  
516                         sub = node->nod_arg[e_asgn_from];
517                         if (sub->nod_type == nod_field) {
518 -                               stream = (USHORT) sub->nod_arg[e_fld_stream];
519 +                               stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
520                                 field = MET_get_field((*csb)->csb_rpt[stream].csb_relation,
521 -                                                                         (USHORT) sub->nod_arg[e_fld_id]);
522 +                                                                         (USHORT)(IPTR) sub->nod_arg[e_fld_id]);
523                                 if (field)
524                                         node->nod_arg[e_asgn_missing2] = field->fld_missing_value;
525                         }
526 @@ -3414,12 +3414,12 @@
527                         sub = node->nod_arg[e_asgn_to];
528                         if (sub->nod_type != nod_field)
529                                 break;
530 -                       stream = (USHORT) sub->nod_arg[e_fld_stream];
531 +                       stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
532                         tail = &(*csb)->csb_rpt[stream];
533                         if (!
534                                 (field =
535                                  MET_get_field(tail->csb_relation,
536 -                                                          (USHORT) sub->nod_arg[e_fld_id]))) break;
537 +                                                          (USHORT)(IPTR) sub->nod_arg[e_fld_id]))) break;
538                         if (field->fld_missing_value) {
539                                 node->nod_arg[e_asgn_missing] = field->fld_missing_value;
540                                 node->nod_count = 3;
541 @@ -3433,7 +3433,7 @@
542                 break;
543  
544         case nod_modify:
545 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
546 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
547                 tail = &(*csb)->csb_rpt[stream];
548                 tail->csb_flags |= csb_modify;
549                 pass1_modify(tdbb, csb, node);
550 @@ -3441,13 +3441,13 @@
551                 /* assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT); */
552                 if ( (node->nod_arg[e_mod_validate] =
553                         make_validation(tdbb, csb,
554 -                                                       (USHORT) node->
555 +                                                       (USHORT)(IPTR) node->
556                                                         nod_arg[e_mod_new_stream])) ) node->nod_count =
557                                 MAX(node->nod_count, (USHORT) e_mod_validate + 1);
558                 break;
559  
560         case nod_erase:
561 -               stream = (USHORT) node->nod_arg[e_erase_stream];
562 +               stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
563                 tail = &(*csb)->csb_rpt[stream];
564                 tail->csb_flags |= csb_erase;
565                 pass1_erase(tdbb, csb, node);
566 @@ -3463,12 +3463,12 @@
567  
568         case nod_store:
569                 sub = node->nod_arg[e_sto_relation];
570 -               stream = (USHORT) sub->nod_arg[e_rel_stream];
571 +               stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
572                 tail = &(*csb)->csb_rpt[stream];
573                 tail->csb_flags |= csb_store;
574                 sub = pass1_store(tdbb, csb, node);
575                 if (sub) {
576 -                       stream = (USHORT) sub->nod_arg[e_rel_stream];
577 +                       stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
578                         if ((!node->nod_arg[e_sto_sub_store]) &&
579                                 (node->nod_arg[e_sto_validate] =
580                                  make_validation(tdbb, csb, stream))) node->nod_count =
581 @@ -3495,7 +3495,7 @@
582  
583         case nod_aggregate:
584                 assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
585 -               (*csb)->csb_rpt[(USHORT) node->nod_arg[e_agg_stream]].csb_flags |=
586 +               (*csb)->csb_rpt[(USHORT)(IPTR) node->nod_arg[e_agg_stream]].csb_flags |=
587                         csb_no_dbkey;
588                 ignore_dbkey(tdbb, *csb, (RSE) node->nod_arg[e_agg_rse], view);
589                 node->nod_arg[e_agg_rse] =
590 @@ -3523,7 +3523,7 @@
591                         NOD_T type;
592  
593                         type = node->nod_type;
594 -                       stream = (USHORT) node->nod_arg[0];
595 +                       stream = (USHORT)(IPTR) node->nod_arg[0];
596  
597                         if (!(*csb)->csb_rpt[stream].csb_map) 
598                                 return node;
599 @@ -3558,7 +3558,7 @@
600                 break;
601  
602         case nod_cardinality:
603 -               stream = (USHORT) node->nod_arg[e_card_stream];
604 +               stream = (USHORT)(IPTR) node->nod_arg[e_card_stream];
605                 (*csb)->csb_rpt[stream].csb_flags |= csb_compute;
606                 break;
607  
608 @@ -3625,7 +3625,7 @@
609  /* To support views of views, loop until we hit a real relation */
610  
611         for (;;) {
612 -               stream = new_stream = (USHORT) node->nod_arg[e_erase_stream];
613 +               stream = new_stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
614                 tail = &(*csb)->csb_rpt[stream];
615                 tail->csb_flags |= csb_erase;
616                 relation = (*csb)->csb_rpt[stream].csb_relation;
617 @@ -3693,7 +3693,7 @@
618  
619                 parent = relation;
620                 parent_stream = stream;
621 -               new_stream = (USHORT) source->nod_arg[e_rel_stream];
622 +               new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
623                 node->nod_arg[e_erase_stream] = (JRD_NOD) (SLONG) map[new_stream];
624         }
625  }
626 @@ -3740,7 +3740,7 @@
627                                 field = MET_get_field(relation, id);
628                                 if (field->fld_source)
629                                         new_id =
630 -                                               (USHORT) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
631 +                                               (USHORT)(IPTR) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
632                                 else
633                                         new_id = id;
634                         }
635 @@ -3802,8 +3802,8 @@
636  /* To support views of views, loop until we hit a real relation */
637  
638         for (;;) {
639 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
640 -               new_stream = (USHORT) node->nod_arg[e_mod_new_stream];
641 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
642 +               new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
643                 tail = &(*csb)->csb_rpt[new_stream];
644                 tail->csb_flags |= csb_modify;
645                 relation = (*csb)->csb_rpt[stream].csb_relation;
646 @@ -3842,7 +3842,7 @@
647                         node->nod_count =
648                                 MAX(node->nod_count, (USHORT) e_mod_map_view + 1);
649                         map = (*csb)->csb_rpt[stream].csb_map;
650 -                       stream = (USHORT) source->nod_arg[e_rel_stream];
651 +                       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
652                         stream = map[stream];
653                         view_stream = new_stream;
654  
655 @@ -3850,18 +3850,18 @@
656  
657                         map =
658                                 alloc_map(tdbb, csb,
659 -                                                 (SSHORT) node->nod_arg[e_mod_new_stream]);
660 +                                                 (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
661                         source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
662                         /* TMN: Here we should really have the following assert */
663                         /* assert(source->nod_arg [e_rel_stream] <= MAX_UCHAR); */
664 -                       map[new_stream] = (UCHAR) source->nod_arg[e_rel_stream];
665 +                       map[new_stream] = (UCHAR)(IPTR) source->nod_arg[e_rel_stream];
666                         view_node = copy(tdbb, csb, node, map, 0, NULL, TRUE);
667                         view_node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) stream;
668                         view_node->nod_arg[e_mod_new_stream] =
669                                 source->nod_arg[e_rel_stream];
670                         view_node->nod_arg[e_mod_map_view] = NULL;
671                         node->nod_arg[e_mod_sub_mod] = view_node;
672 -                       new_stream = (USHORT) source->nod_arg[e_rel_stream];
673 +                       new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
674                         view_node->nod_arg[e_mod_statement] =
675                                 pass1_expand_view(tdbb, *csb, view_stream, new_stream, TRUE);
676                         node->nod_count =
677 @@ -3874,14 +3874,14 @@
678                         /* View passes muster -- do some translation.  Start with source stream */
679  
680                         map = (*csb)->csb_rpt[stream].csb_map;
681 -                       stream = (USHORT) source->nod_arg[e_rel_stream];
682 +                       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
683                         node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) map[stream];
684  
685                         /* Next, do update stream */
686  
687                         map =
688                                 alloc_map(tdbb, csb,
689 -                                                 (SSHORT) node->nod_arg[e_mod_new_stream]);
690 +                                                 (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
691                         source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
692                         node->nod_arg[e_mod_new_stream] = source->nod_arg[e_rel_stream];
693                 }
694 @@ -4128,7 +4128,7 @@
695  
696                 pass1(tdbb, csb, source, parent_view, view_stream, FALSE);
697                 procedure = MET_lookup_procedure_id(tdbb, 
698 -                 (SSHORT)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
699 +                 (SSHORT)(IPTR)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
700                 post_procedure_access(tdbb, *csb, procedure);
701                 CMP_post_resource(&(*csb)->csb_resources, (BLK) procedure,
702                                                   Resource::rsc_procedure, procedure->prc_id);
703 @@ -4160,7 +4160,7 @@
704                                           view->rel_id);
705         source->nod_arg[e_rel_view] = (JRD_NOD) parent_view;
706  
707 -       stream = (USHORT) source->nod_arg[e_rel_stream];
708 +       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
709         element = CMP_csb_element(csb, stream);
710         element->csb_view = parent_view;
711  /* TMN: Here we should really have the following assert */
712 @@ -4175,7 +4175,7 @@
713                 for (vcx_ptr = &parent_view->rel_view_contexts; *vcx_ptr;
714                          vcx_ptr = &(*vcx_ptr)->vcx_next)
715                         if ((*vcx_ptr)->vcx_context ==
716 -                               (USHORT) source->nod_arg[e_rel_context]) {
717 +                               (USHORT)(IPTR) source->nod_arg[e_rel_context]) {
718                                 element->csb_alias = (*vcx_ptr)->vcx_context_name;
719                                 break;
720                         }
721 @@ -4319,7 +4319,7 @@
722  
723         for (;;) {
724                 original = node->nod_arg[e_sto_relation];
725 -               stream = (USHORT) original->nod_arg[e_rel_stream];
726 +               stream = (USHORT)(IPTR) original->nod_arg[e_rel_stream];
727                 tail = &(*csb)->csb_rpt[stream];
728                 tail->csb_flags |= csb_store;
729                 relation = (*csb)->csb_rpt[stream].csb_relation;
730 @@ -4373,7 +4373,7 @@
731                         node->nod_arg[e_sto_relation] =
732                                 copy(tdbb, csb, source, map, 0, NULL, FALSE);
733                         new_stream =
734 -                               (USHORT) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
735 +                               (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
736                         node->nod_arg[e_sto_statement] =
737                                 pass1_expand_view(tdbb, *csb, stream, new_stream, TRUE);
738                         node->nod_arg[e_sto_statement] =
739 @@ -4721,9 +4721,9 @@
740                 /* AB: Mark the streams involved with an UPDATE statement
741                    active. So that the optimizer can use indices for 
742                    eventually used sub-selects. */
743 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
744 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
745                 csb->csb_rpt[stream].csb_flags |= csb_active;
746 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
747 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
748                 csb->csb_rpt[stream].csb_flags |= csb_active;
749         }
750  
751 @@ -4735,9 +4735,9 @@
752  
753         if (node->nod_type == nod_modify) {
754                 /* AB: Remove the previous flags */
755 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
756 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
757                 csb->csb_rpt[stream].csb_flags &= ~csb_active;
758 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
759 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
760                 csb->csb_rpt[stream].csb_flags &= ~csb_active;
761         }
762  
763 @@ -4836,7 +4836,7 @@
764                         FMT format;
765                         fmt::fmt_desc_iterator desc;
766  
767 -                       stream = (USHORT) node->nod_arg[e_mod_org_stream];
768 +                       stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
769                         csb->csb_rpt[stream].csb_flags |= csb_update;
770                         format = CMP_format(tdbb, csb, stream);
771                         desc = format->fmt_desc.begin();
772 @@ -4861,13 +4861,13 @@
773                 break;
774  
775         case nod_erase:
776 -               stream = (USHORT) node->nod_arg[e_erase_stream];
777 +               stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
778                 csb->csb_rpt[stream].csb_flags |= csb_update;
779                 break;
780  
781         case nod_field:
782 -               stream = (USHORT) node->nod_arg[e_fld_stream];
783 -               id = (USHORT) node->nod_arg[e_fld_id];
784 +               stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
785 +               id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
786                 SBM_set(tdbb, &csb->csb_rpt[stream].csb_fields, id);
787                 if (node->nod_flags & nod_value) {
788                         csb->csb_impure += sizeof(struct vlux);
789 @@ -4941,7 +4941,7 @@
790                 pass2_rse(tdbb, csb, (RSE) node->nod_arg[e_agg_rse]);
791                 pass2(tdbb, csb, node->nod_arg[e_agg_map], node);
792                 pass2(tdbb, csb, node->nod_arg[e_agg_group], node);
793 -               stream = (USHORT) node->nod_arg[e_agg_stream];
794 +               stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
795                 assert(stream <= MAX_STREAMS);
796                 process_map(tdbb, csb, node->nod_arg[e_agg_map],
797                                         &csb->csb_rpt[stream].csb_format);
798 @@ -5050,7 +5050,7 @@
799  
800                 node = *ptr;
801                 if (node->nod_type == nod_relation) {
802 -                       USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
803 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
804                         csb->csb_rpt[stream].csb_flags |= csb_active;
805                         pass2(tdbb, csb, node, (JRD_NOD) rse);
806                 }
807 @@ -5058,12 +5058,12 @@
808                         pass2_rse(tdbb, csb, (RSE) node);
809                 }
810                 else if (node->nod_type == nod_procedure) {
811 -                       USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
812 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
813                         csb->csb_rpt[stream].csb_flags |= csb_active;
814                         pass2(tdbb, csb, node, (JRD_NOD) rse);
815                 }
816                 else if (node->nod_type == nod_aggregate) {
817 -                       USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
818 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
819                         assert(stream <= MAX_STREAMS);
820                         csb->csb_rpt[stream].csb_flags |= csb_active;
821                         pass2(tdbb, csb, node, (JRD_NOD) rse);
822 @@ -5118,7 +5118,7 @@
823  /* Make up a format block sufficiently large to hold instantiated record */
824  
825         clauses = node->nod_arg[e_uni_clauses];
826 -       id = (USHORT) node->nod_arg[e_uni_stream];
827 +       id = (USHORT)(IPTR) node->nod_arg[e_uni_stream];
828         format = &csb->csb_rpt[id].csb_format;
829  
830  /* Process alternating rse and map blocks */
831 @@ -5160,7 +5160,7 @@
832  
833         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end;
834                  ptr++) if ((*ptr)->nod_type == nod_relation) {
835 -                       stream = (USHORT) (*ptr)->nod_arg[e_rel_stream];
836 +                       stream = (USHORT)(IPTR) (*ptr)->nod_arg[e_rel_stream];
837                         if (!(csb->csb_rpt[stream].csb_plan))
838                                 ERR_post(gds_no_stream_plan, gds_arg_string,
839                                                  csb->csb_rpt[stream].csb_relation->rel_name, 0);
840 @@ -5213,7 +5213,7 @@
841  
842  /* find the tail for the relation specified in the rse */
843  
844 -       stream = (USHORT) plan_relation_node->nod_arg[e_rel_stream];
845 +       stream = (USHORT)(IPTR) plan_relation_node->nod_arg[e_rel_stream];
846         tail = &csb->csb_rpt[stream];
847  
848  /* if the plan references a view, find the real base relation 
849 @@ -5449,15 +5449,15 @@
850                  ptr < end; ptr++) {
851                 node = *ptr;
852                 if (node->nod_type == nod_relation) {
853 -                       USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
854 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
855                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
856                 }
857                 else if (node->nod_type == nod_procedure) {
858 -                       USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
859 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
860                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
861                 }
862                 else if (node->nod_type == nod_aggregate) {
863 -                       USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
864 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
865                         assert(stream <= MAX_STREAMS);
866                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
867                 }
868 @@ -5553,7 +5553,7 @@
869         for (end = ptr + map->nod_count; ptr < end; ptr++) {
870                 assignment = *ptr;
871                 field = assignment->nod_arg[e_asgn_to];
872 -               id = (USHORT) field->nod_arg[e_fld_id];
873 +               id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
874                 if (id >= format->fmt_count) {
875                         format->fmt_desc.resize(id + 1);
876                 }
877 @@ -5689,13 +5689,13 @@
878                 /* for aggregates, check current rse, if not found then check 
879                    the sub-rse */
880                 if (sub->nod_type == nod_aggregate) {
881 -                       if ((stream == (USHORT) sub->nod_arg[e_rel_stream]) ||
882 +                       if ((stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]) ||
883                                 (stream_in_rse(stream, (RSE) sub->nod_arg[e_agg_rse])))
884                                 return TRUE;    /* do not mark as variant */
885                 }
886  
887                 if ((sub->nod_type == nod_relation) &&
888 -                       (stream == (USHORT) sub->nod_arg[e_rel_stream]))
889 +                       (stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]))
890                         return TRUE;            /* do not mark as variant */
891         }
892  
893 diff -urNad firebird2-1.5.3.4870~/src/jrd/common.h firebird2-1.5.3.4870/src/jrd/common.h
894 --- firebird2-1.5.3.4870~/src/jrd/common.h      2006-02-01 23:07:02.000000000 +0200
895 +++ firebird2-1.5.3.4870/src/jrd/common.h       2006-02-01 23:07:04.000000000 +0200
896 @@ -856,8 +856,8 @@
897  
898  #define JRD_BUGCHK 15                  /* facility code for bugcheck messages */
899  #ifndef OFFSET
900 -#define OFFSET(struct,fld)      ((int) &((struct) 0)->fld)
901 -#define OFFSETA(struct,fld)     ((int) ((struct) 0)->fld)
902 +#define OFFSET(struct,fld)      ((int)(IPTR) &((struct) 0)->fld)
903 +#define OFFSETA(struct,fld)     ((int)(IPTR) ((struct) 0)->fld)
904  #endif
905  
906  #ifndef ODS_ALIGNMENT
907 diff -urNad firebird2-1.5.3.4870~/src/jrd/dpm.epp firebird2-1.5.3.4870/src/jrd/dpm.epp
908 --- firebird2-1.5.3.4870~/src/jrd/dpm.epp       2006-02-01 23:07:02.000000000 +0200
909 +++ firebird2-1.5.3.4870/src/jrd/dpm.epp        2006-02-01 23:07:04.000000000 +0200
910 @@ -2119,7 +2119,7 @@
911  
912         DEBUG if (stack)
913                 while (*stack)
914 -                       CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
915 +                       CCH_precedence(tdbb, &rpb->rpb_window, (SLONG)(IPTR) LLS_POP(stack));
916  
917         CCH_precedence(tdbb, &rpb->rpb_window, -rpb->rpb_transaction);
918         CCH_MARK(tdbb, &rpb->rpb_window);
919 @@ -2736,7 +2736,7 @@
920     If the page need to be compressed, compress it. */
921  
922         while (*stack)
923 -               CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
924 +               CCH_precedence(tdbb, &rpb->rpb_window, (SLONG)(IPTR) LLS_POP(stack));
925         CCH_MARK(tdbb, &rpb->rpb_window);
926         i = page->dpg_count + ((slot) ? 0 : 1);
927  
928 diff -urNad firebird2-1.5.3.4870~/src/jrd/evl.cpp firebird2-1.5.3.4870/src/jrd/evl.cpp
929 --- firebird2-1.5.3.4870~/src/jrd/evl.cpp       2006-02-01 23:07:02.000000000 +0200
930 +++ firebird2-1.5.3.4870/src/jrd/evl.cpp        2006-02-01 23:07:04.000000000 +0200
931 @@ -248,7 +248,7 @@
932                 arg_number = (int)(IPTR)node->nod_arg[e_arg_number];
933                 desc = &format->fmt_desc[arg_number];
934                 impure->vlu_desc.dsc_address =
935 -                       (UCHAR *) request + message->nod_impure + (int) desc->dsc_address;
936 +                       (UCHAR *) request + message->nod_impure + (int)(IPTR) desc->dsc_address;
937                 impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
938                 impure->vlu_desc.dsc_length = desc->dsc_length;
939                 impure->vlu_desc.dsc_scale = desc->dsc_scale;
940 @@ -288,8 +288,8 @@
941                 // may happen. I checked triggers and insert/update statements.
942                 // All seem to work fine.
943                 record =
944 -                       request->req_rpb[(int) node->nod_arg[e_fld_stream]].rpb_record;
945 -               EVL_field(0, record, (USHORT) node->nod_arg[e_fld_id],
946 +                       request->req_rpb[(int)(IPTR) node->nod_arg[e_fld_stream]].rpb_record;
947 +               EVL_field(0, record, (USHORT)(IPTR) node->nod_arg[e_fld_id],
948                                   &impure->vlu_desc);
949                 if (!impure->vlu_desc.dsc_address)
950                         ERR_post(gds_read_only_field, 0);
951 @@ -359,7 +359,7 @@
952                         impure = (INV) ((SCHAR *) tdbb->tdbb_request + node->nod_impure);
953                         SBM_reset(&impure->inv_bitmap);
954                         desc = EVL_expr(tdbb, node->nod_arg[0]);
955 -                       id = 1 + 2 * (USHORT) node->nod_arg[1];
956 +                       id = 1 + 2 * (USHORT)(IPTR) node->nod_arg[1];
957                         numbers = desc->dsc_address;
958                         numbers += id * sizeof(SLONG);
959                         MOVE_FAST(numbers, &rel_dbkey, sizeof(SLONG));
960 @@ -828,10 +828,10 @@
961                         }
962                         message = node->nod_arg[e_arg_message];
963                         format = (FMT) message->nod_arg[e_msg_format];
964 -                       desc = &format->fmt_desc[(int) node->nod_arg[e_arg_number]];
965 +                       desc = &format->fmt_desc[(int)(IPTR) node->nod_arg[e_arg_number]];
966  
967                         impure->vlu_desc.dsc_address = (UCHAR *) request +
968 -                               message->nod_impure + (int) desc->dsc_address;
969 +                               message->nod_impure + (int)(IPTR) desc->dsc_address;
970                         impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
971                         impure->vlu_desc.dsc_length = desc->dsc_length;
972                         impure->vlu_desc.dsc_scale = desc->dsc_scale;
973 @@ -851,14 +851,14 @@
974         case nod_field:
975                 {
976                         REC record =
977 -                               request->req_rpb[(int)node->nod_arg[e_fld_stream]].rpb_record;
978 +                               request->req_rpb[(int)(IPTR)node->nod_arg[e_fld_stream]].rpb_record;
979                         /* In order to "map a null to a default" value (in EVL_field()), 
980                          * the relation block is referenced. 
981                          * Reference: Bug 10116, 10424 
982                          */
983 -                       if (!EVL_field(request->req_rpb[(USHORT) node->nod_arg[e_fld_stream]].rpb_relation,
984 +                       if (!EVL_field(request->req_rpb[(USHORT)(IPTR) node->nod_arg[e_fld_stream]].rpb_relation,
985                                                         record,
986 -                                                       (USHORT) node->nod_arg[e_fld_id],
987 +                                                       (USHORT)(IPTR) node->nod_arg[e_fld_id],
988                                                         &impure->vlu_desc))
989                         {
990                                 request->req_flags |= req_null;
991 @@ -997,7 +997,7 @@
992                         ULONG extract_part;
993  
994                         impure = (VLU) ((SCHAR *) request + node->nod_impure);
995 -                       extract_part = (ULONG) node->nod_arg[e_extract_part];
996 +                       extract_part = (ULONG)(IPTR) node->nod_arg[e_extract_part];
997                         value = EVL_expr(tdbb, node->nod_arg[e_extract_value]);
998  
999                         impure->vlu_desc.dsc_dtype = dtype_short;
1000 @@ -1173,8 +1173,8 @@
1001  
1002                 switch (node->nod_type) {
1003                 case nod_gen_id:                /* return a 32-bit generator value */
1004 -                       impure->vlu_misc.vlu_long = (SLONG) DPM_gen_id(tdbb,
1005 -                                                                                                                  (SLONG)
1006 +                       impure->vlu_misc.vlu_long = (SLONG)(IPTR) DPM_gen_id(tdbb,
1007 +                                                                                                                  (SLONG)(IPTR)
1008                                                                                                                    node->nod_arg
1009                                                                                                                    [e_gen_id], 0,
1010                                                                                                                    MOV_get_int64
1011 @@ -1189,7 +1189,7 @@
1012  
1013                 case nod_gen_id2:
1014                         impure->vlu_misc.vlu_int64 = DPM_gen_id(tdbb,
1015 -                                                                                                       (SLONG)
1016 +                                                                                                       (SLONG)(IPTR)
1017                                                                                                         node->nod_arg[e_gen_id],
1018                                                                                                         0,
1019                                                                                                         MOV_get_int64(values[0],
1020 @@ -1383,7 +1383,7 @@
1021                 return FALSE;
1022         }
1023  
1024 -       desc->dsc_address = record->rec_data + (int) desc->dsc_address;
1025 +       desc->dsc_address = record->rec_data + (int)(IPTR) desc->dsc_address;
1026  
1027         if (TEST_NULL(record, id)) {
1028                 desc->dsc_flags |= DSC_null;
1029 @@ -1725,9 +1725,9 @@
1030         {
1031                 from = (*ptr)->nod_arg[e_asgn_from];
1032                 field = (*ptr)->nod_arg[e_asgn_to];
1033 -               id = (USHORT) field->nod_arg[e_fld_id];
1034 +               id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
1035                 record =
1036 -                       request->req_rpb[(int) field->nod_arg[e_fld_stream]].rpb_record;
1037 +                       request->req_rpb[(int)(IPTR) field->nod_arg[e_fld_stream]].rpb_record;
1038                 impure = (VLUX) ((SCHAR *) request + from->nod_impure);
1039                 switch (from->nod_type)
1040                 {
1041 @@ -3395,7 +3395,7 @@
1042  
1043         request = tdbb->tdbb_request;
1044         impure = (VLU) ((SCHAR *) request + node->nod_impure);
1045 -       rpb = &request->req_rpb[(int) node->nod_arg[0]];
1046 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[0]];
1047         relation = rpb->rpb_relation;
1048  
1049  /* Format dbkey as vector of relation id, record number */
1050 @@ -4500,7 +4500,7 @@
1051  
1052         request = tdbb->tdbb_request;
1053         impure = (VLU) ((SCHAR *) request + node->nod_impure);
1054 -       rpb = &request->req_rpb[(int) node->nod_arg[0]];
1055 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[0]];
1056  
1057  /* If the current transaction has updated the record, the record version
1058   * coming in from DSQL will have the original transaction # (or current
1059 diff -urNad firebird2-1.5.3.4870~/src/jrd/exe.cpp firebird2-1.5.3.4870/src/jrd/exe.cpp
1060 --- firebird2-1.5.3.4870~/src/jrd/exe.cpp       2006-02-01 23:07:02.000000000 +0200
1061 +++ firebird2-1.5.3.4870/src/jrd/exe.cpp        2006-02-01 23:07:04.000000000 +0200
1062 @@ -375,8 +375,8 @@
1063  
1064         if (to->nod_type == nod_field)
1065         {
1066 -               SSHORT id = (USHORT) to->nod_arg[e_fld_id];
1067 -               REC record = request->req_rpb[(int) to->nod_arg[e_fld_stream]].rpb_record;
1068 +               SSHORT id = (USHORT)(IPTR) to->nod_arg[e_fld_id];
1069 +               REC record = request->req_rpb[(int)(IPTR) to->nod_arg[e_fld_stream]].rpb_record;
1070                 if (null) {
1071                         SET_NULL(record, id);
1072                 } else {
1073 @@ -639,7 +639,7 @@
1074         message = request->req_message;
1075         format = (FMT) message->nod_arg[e_msg_format];
1076  
1077 -       if (msg != (USHORT) message->nod_arg[e_msg_number])
1078 +       if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
1079                 ERR_post(gds_req_sync, 0);
1080  
1081         if (length != format->fmt_length)
1082 @@ -788,7 +788,7 @@
1083                 for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
1084                          ptr++) {
1085                         message = (*ptr)->nod_arg[e_send_message];
1086 -                       if ((USHORT) message->nod_arg[e_msg_number] == msg) {
1087 +                       if ((USHORT)(IPTR) message->nod_arg[e_msg_number] == msg) {
1088                                 request->req_next = *ptr;
1089                                 break;
1090                         }
1091 @@ -798,7 +798,7 @@
1092  
1093         format = (FMT) message->nod_arg[e_msg_format];
1094  
1095 -       if (msg != (USHORT) message->nod_arg[e_msg_number])
1096 +       if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
1097                 ERR_post(gds_req_sync, 0);
1098  
1099         if (length != format->fmt_length)
1100 @@ -1049,7 +1049,7 @@
1101                 desc = &format->fmt_desc[n];
1102                 if (!desc->dsc_address)
1103                         continue;
1104 -               p = record->rec_data + (SLONG) desc->dsc_address;
1105 +               p = record->rec_data + (SLONG)(IPTR) desc->dsc_address;
1106                 if (TEST_NULL(record, n))
1107                 {
1108                         if (length = desc->dsc_length)
1109 @@ -1134,7 +1134,7 @@
1110  
1111         request = tdbb->tdbb_request;
1112         transaction = request->req_transaction;
1113 -       rpb = &request->req_rpb[(int) node->nod_arg[e_erase_stream]];
1114 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[e_erase_stream]];
1115         relation = rpb->rpb_relation;
1116  
1117  #ifdef PC_ENGINE
1118 @@ -2015,7 +2015,7 @@
1119                         case jrd_req::req_evaluate:
1120                                 if (transaction != dbb->dbb_sys_trans) {
1121  
1122 -                                       UCHAR operation = (UCHAR) node->nod_arg[e_sav_operation];
1123 +                                       UCHAR operation = (UCHAR)(IPTR) node->nod_arg[e_sav_operation];
1124                                         TEXT * node_savepoint_name = (TEXT*) node->nod_arg[e_sav_name]; 
1125  
1126                                         // Skip the savepoint created by EXE_start
1127 @@ -2328,7 +2328,7 @@
1128                                 break;
1129  
1130                         case jrd_req::req_unwind:
1131 -                               if ((request->req_label == (USHORT) node->nod_arg[e_lbl_label]) &&
1132 +                               if ((request->req_label == (USHORT)(IPTR) node->nod_arg[e_lbl_label]) &&
1133                                                 (request->req_flags & (req_leave | req_error_handler))) {
1134                                         request->req_flags &= ~req_leave;
1135                                         request->req_operation = jrd_req::req_return;
1136 @@ -2342,7 +2342,7 @@
1137                 case nod_leave:
1138                         request->req_flags |= req_leave;
1139                         request->req_operation = jrd_req::req_unwind;
1140 -                       request->req_label = (USHORT) node->nod_arg[0];
1141 +                       request->req_label = (USHORT)(IPTR) node->nod_arg[0];
1142                         node = node->nod_parent;
1143                         break;
1144  
1145 @@ -2652,7 +2652,7 @@
1146                                 DSC *desc;
1147  
1148                                 desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
1149 -                               (void) DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1,
1150 +                               (void) DPM_gen_id(tdbb, (SLONG)(IPTR) node->nod_arg[e_gen_id], 1,
1151                                                                   MOV_get_int64(desc, 0));
1152                                 request->req_operation = jrd_req::req_return;
1153                         }
1154 @@ -2664,7 +2664,7 @@
1155                                 DSC *desc;
1156  
1157                                 desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
1158 -                               (void) DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1,
1159 +                               (void) DPM_gen_id(tdbb, (SLONG)(IPTR) node->nod_arg[e_gen_id], 1,
1160                                                                   MOV_get_int64(desc, 0));
1161                                 request->req_operation = jrd_req::req_return;
1162                         }
1163 @@ -2794,11 +2794,11 @@
1164         transaction = request->req_transaction;
1165         impure = (STA) ((SCHAR *) request + node->nod_impure);
1166  
1167 -       org_stream = (USHORT) node->nod_arg[e_mod_org_stream];
1168 +       org_stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
1169         org_rpb = &request->req_rpb[org_stream];
1170         relation = org_rpb->rpb_relation;
1171  
1172 -       new_stream = (USHORT) node->nod_arg[e_mod_new_stream];
1173 +       new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
1174         new_rpb = &request->req_rpb[new_stream];
1175  
1176  #ifdef PC_ENGINE
1177 @@ -3795,7 +3795,7 @@
1178         JRD_REQ    request     = tdbb->tdbb_request;
1179         JRD_TRA    transaction = request->req_transaction;
1180         STA    impure      = (STA) ((SCHAR *) request + node->nod_impure);
1181 -       SSHORT stream      = (USHORT) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
1182 +       SSHORT stream      = (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
1183         RPB*   rpb         = &request->req_rpb[stream];
1184         JRD_REL    relation    = rpb->rpb_relation;
1185  
1186 @@ -4201,8 +4201,8 @@
1187  
1188                         if (node->nod_type == nod_field)
1189                         {
1190 -                               stream = (USHORT) node->nod_arg[e_fld_stream];
1191 -                               id = (USHORT) node->nod_arg[e_fld_id];
1192 +                               stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1193 +                               id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
1194                                 relation = request->req_rpb[stream].rpb_relation;
1195  
1196                                 if ((vector = relation->rel_fields) &&
1197 diff -urNad firebird2-1.5.3.4870~/src/jrd/ext.cpp firebird2-1.5.3.4870/src/jrd/ext.cpp
1198 --- firebird2-1.5.3.4870~/src/jrd/ext.cpp       2006-02-01 23:07:02.000000000 +0200
1199 +++ firebird2-1.5.3.4870/src/jrd/ext.cpp        2006-02-01 23:07:04.000000000 +0200
1200 @@ -266,7 +266,7 @@
1201         record = rpb->rpb_record;
1202         format = record->rec_format;
1203  
1204 -       offset = (SSHORT) format->fmt_desc[0].dsc_address;
1205 +       offset = (SSHORT)(IPTR) format->fmt_desc[0].dsc_address;
1206         p = record->rec_data + offset;
1207         l = record->rec_length - offset;
1208  
1209 @@ -299,7 +299,7 @@
1210                         continue;
1211                 if ( (literal = (LIT) field->fld_missing_value) ) {
1212                         desc = *desc_ptr;
1213 -                       desc.dsc_address = record->rec_data + (int) desc.dsc_address;
1214 +                       desc.dsc_address = record->rec_data + (int)(IPTR) desc.dsc_address;
1215                         if (!MOV_compare(&literal->lit_desc, &desc))
1216                                 continue;
1217                 }
1218 @@ -512,7 +512,7 @@
1219                         desc_ptr->dsc_length &&
1220                         TEST_NULL(record, i))
1221                 {
1222 -                       p = record->rec_data + (int) desc_ptr->dsc_address;
1223 +                       p = record->rec_data + (int)(IPTR) desc_ptr->dsc_address;
1224                         if ( (literal = (LIT) field->fld_missing_value) ) {
1225                                 desc = *desc_ptr;
1226                                 desc.dsc_address = p;
1227 @@ -528,7 +528,7 @@
1228                 }
1229         }
1230  
1231 -       offset = (USHORT) format->fmt_desc[0].dsc_address;
1232 +       offset = (USHORT)(IPTR) format->fmt_desc[0].dsc_address;
1233         p = record->rec_data + offset;
1234         l = record->rec_length - offset;
1235  
1236 diff -urNad firebird2-1.5.3.4870~/src/jrd/gds.cpp firebird2-1.5.3.4870/src/jrd/gds.cpp
1237 --- firebird2-1.5.3.4870~/src/jrd/gds.cpp       2006-02-01 23:07:03.000000000 +0200
1238 +++ firebird2-1.5.3.4870/src/jrd/gds.cpp        2006-02-01 23:07:04.000000000 +0200
1239 @@ -2287,7 +2287,7 @@
1240                 return result;
1241  
1242         if (stdio_flag)
1243 -               if (!(result = ib_fdopen((int) result, "w+")))
1244 +               if (!(result = ib_fdopen((int)(IPTR) result, "w+")))
1245                         return (void *)-1;
1246  
1247         if (expanded_string)
1248 diff -urNad firebird2-1.5.3.4870~/src/jrd/idx.cpp firebird2-1.5.3.4870/src/jrd/idx.cpp
1249 --- firebird2-1.5.3.4870~/src/jrd/idx.cpp       2006-02-01 23:07:02.000000000 +0200
1250 +++ firebird2-1.5.3.4870/src/jrd/idx.cpp        2006-02-01 23:07:04.000000000 +0200
1251 @@ -1055,12 +1055,12 @@
1252                          index_number < idx->idx_foreign_primaries->count();
1253                          index_number++) {
1254                         if (idx->idx_id !=
1255 -                               (UCHAR) (*idx->idx_foreign_primaries)[index_number]) continue;
1256 +                               (UCHAR)(IPTR) (*idx->idx_foreign_primaries)[index_number]) continue;
1257                         partner_relation =
1258                                 MET_relation(tdbb,
1259 -                                                        (int) (*idx->idx_foreign_relations)[index_number]);
1260 +                                                        (int)(IPTR) (*idx->idx_foreign_relations)[index_number]);
1261                         index_id =
1262 -                               (USHORT) (*idx->idx_foreign_indexes)[index_number];
1263 +                               (USHORT)(IPTR) (*idx->idx_foreign_indexes)[index_number];
1264                         if ( (result =
1265                                 check_partner_index(tdbb, relation, record, transaction, idx,
1266                                                                         partner_relation, index_id)) )
1267 diff -urNad firebird2-1.5.3.4870~/src/jrd/inf.cpp firebird2-1.5.3.4870/src/jrd/inf.cpp
1268 --- firebird2-1.5.3.4870~/src/jrd/inf.cpp       2003-06-08 16:13:23.000000000 +0300
1269 +++ firebird2-1.5.3.4870/src/jrd/inf.cpp        2006-02-01 23:07:23.000000000 +0200
1270 @@ -972,7 +972,7 @@
1271                         node = request->req_message;
1272                         if (item == gds_info_message_number)
1273                                 length =
1274 -                                       INF_convert((SLONG) node->nod_arg[e_msg_number],
1275 +                                       INF_convert((SLONG)(IPTR) node->nod_arg[e_msg_number],
1276                                                                 buffer_ptr);
1277                         else {
1278                                 format = (FMT) node->nod_arg[e_msg_format];
1279 diff -urNad firebird2-1.5.3.4870~/src/jrd/met.epp firebird2-1.5.3.4870/src/jrd/met.epp
1280 --- firebird2-1.5.3.4870~/src/jrd/met.epp       2006-02-01 23:07:02.000000000 +0200
1281 +++ firebird2-1.5.3.4870/src/jrd/met.epp        2006-02-01 23:07:04.000000000 +0200
1282 @@ -932,7 +932,7 @@
1283                         if (desc->dsc_address)
1284                         {
1285                                 format->fmt_length =
1286 -                                       (ULONG) desc->dsc_address + desc->dsc_length;
1287 +                                       (ULONG)(IPTR) desc->dsc_address + desc->dsc_length;
1288                                 break;
1289                         }
1290                 }
1291 @@ -2133,13 +2133,13 @@
1292                                  index_number < references->frgn_reference_ids->count();
1293                                  index_number++)
1294                         {
1295 -                               if (idx->idx_id == (UCHAR) (*references->frgn_reference_ids)
1296 +                               if (idx->idx_id == (UCHAR)(IPTR) (*references->frgn_reference_ids)
1297                                                                                         [index_number])
1298                                 {
1299                                         idx->idx_primary_relation =
1300 -                                               (USHORT) (*references->frgn_relations)[index_number];
1301 +                                               (USHORT)(IPTR) (*references->frgn_relations)[index_number];
1302                                         idx->idx_primary_index =
1303 -                                               (UCHAR) (*references->frgn_indexes)[index_number];
1304 +                                               (UCHAR)(IPTR) (*references->frgn_indexes)[index_number];
1305                                         return TRUE;
1306                                 }
1307                         }
1308 @@ -2155,7 +2155,7 @@
1309                                  index_number < dependencies->prim_reference_ids->count();
1310                                  index_number++)
1311                         {
1312 -                               if (idx->idx_id == (UCHAR) (*dependencies->prim_reference_ids)
1313 +                               if (idx->idx_id == (UCHAR)(IPTR) (*dependencies->prim_reference_ids)
1314                                                                                         [index_number])
1315                                 {
1316                                         idx->idx_foreign_primaries =
1317 @@ -3001,10 +3001,10 @@
1318                 {
1319                         if ( (node = csb_->csb_rpt[i].csb_message) )
1320                         {
1321 -                               if ((int) node->nod_arg[e_msg_number] == 0)
1322 +                               if ((int)(IPTR) node->nod_arg[e_msg_number] == 0)
1323                                 {
1324                                         procedure->prc_input_msg = node;
1325 -                               } else if ((int) node->nod_arg[e_msg_number] == 1)
1326 +                               } else if ((int)(IPTR) node->nod_arg[e_msg_number] == 1)
1327                                 {
1328                                         procedure->prc_output_msg = node;
1329                                 }
1330 @@ -4580,7 +4580,7 @@
1331                 node = (JRD_NOD) LLS_POP(&csb->csb_dependencies);
1332                 if (!node->nod_arg[e_dep_object])
1333                         continue;
1334 -               dpdo_type = (SSHORT) node->nod_arg[e_dep_object_type];
1335 +               dpdo_type = (SSHORT)(IPTR) node->nod_arg[e_dep_object_type];
1336          relation = NULL;
1337          procedure = NULL;
1338          switch (dpdo_type) {
1339 @@ -4593,13 +4593,13 @@
1340              dpdo_name = (TEXT*) procedure->prc_name->str_data;
1341              break;
1342          case obj_exception:
1343 -            number = (SLONG) node->nod_arg [e_dep_object];
1344 +            number = (SLONG)(IPTR) node->nod_arg [e_dep_object];
1345              MET_lookup_exception (tdbb, number, name, NULL);
1346              dpdo_name = name;
1347              break;
1348              /* CVC: Here I'm going to track those pesky things named generators and UDFs. */
1349          case obj_generator:
1350 -            number = (SLONG) node->nod_arg [e_dep_object];
1351 +            number = (SLONG)(IPTR) node->nod_arg [e_dep_object];
1352              MET_lookup_generator_id (tdbb, number, name);
1353              dpdo_name = name;
1354              break;
1355 @@ -4617,7 +4617,7 @@
1356                 {
1357                         if (field_node->nod_type == nod_field)
1358                         {
1359 -                               fld_id = (SSHORT) field_node->nod_arg[0];
1360 +                               fld_id = (SSHORT)(IPTR) field_node->nod_arg[0];
1361                                 if (relation)
1362                                 {
1363                                         if ( (field = MET_get_field(relation, fld_id)) )
1364 diff -urNad firebird2-1.5.3.4870~/src/jrd/sdl.cpp firebird2-1.5.3.4870/src/jrd/sdl.cpp
1365 --- firebird2-1.5.3.4870~/src/jrd/sdl.cpp       2006-02-01 23:07:03.000000000 +0200
1366 +++ firebird2-1.5.3.4870/src/jrd/sdl.cpp        2006-02-01 23:07:04.000000000 +0200
1367 @@ -699,7 +699,7 @@
1368                         }
1369                         element_desc = array_desc->ads_rpt[value].ads_desc;
1370                         element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array +
1371 -                               (SLONG) element_desc.dsc_address +
1372 +                               (SLONG)(IPTR) element_desc.dsc_address +
1373                                 (array_desc->ads_element_length * subscript);
1374  
1375                         /* Is this element within the array bounds? */
1376
1377 --- Firebird.org/src/jrd/jrd.cpp~       2004-11-17 12:41:16.000000000 +0100
1378 +++ Firebird/src/jrd/jrd.cpp    2006-03-28 18:47:32.722559750 +0200
1379 @@ -3877,9 +3877,9 @@
1380         {
1381                 if ( (node = csb->csb_rpt[i].csb_message) )
1382                 {
1383 -                       if ((int) node->nod_arg[e_msg_number] == 0) {
1384 +                       if ((int)(IPTR) node->nod_arg[e_msg_number] == 0) {
1385                                 in_message = node;
1386 -                       } else if ((int) node->nod_arg[e_msg_number] == 1) {
1387 +                       } else if ((int)(IPTR) node->nod_arg[e_msg_number] == 1) {
1388                                 out_message = node;
1389                         }
1390                 }
1391 --- Firebird.org/src/jrd/jrn.cpp.org    2006-03-28 18:52:47.582237250 +0200
1392 +++ Firebird/src/jrd/jrn.cpp    2006-03-28 18:54:06.667179750 +0200
1393 @@ -836,7 +836,7 @@
1394         for (loop = 0; loop < 20; loop++) {
1395                 for (;;) {
1396                         journal->jrn_channel = (int *) socket(AF_INET, SOCK_STREAM, 0);
1397 -                       if ((int) journal->jrn_channel != -1)
1398 +                       if ((int)(IPTR) journal->jrn_channel != -1)
1399                                 break;
1400                         if (!SYSCALL_INTERRUPTED(errno)) {
1401                                 error(status_vector, journal, errno, "socket");
1402 @@ -859,18 +859,18 @@
1403                         return ret_val;
1404                 }
1405  
1406 -               if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
1407 +               if (!connect((int)(IPTR) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
1408                         break;
1409  
1410                 sleep(3);
1411  
1412                 if (loop < 16) {
1413 -                       close((int) journal->jrn_channel);
1414 +                       close((int)(IPTR) journal->jrn_channel);
1415                         continue;
1416                 }
1417                 if (!SYSCALL_INTERRUPTED(errno)) {
1418                         if (retry) {
1419 -                               close((int) journal->jrn_channel);
1420 +                               close((int)(IPTR) journal->jrn_channel);
1421                                 gds__free(journal);
1422                                 *ret_jrn = (JRN) NULL;
1423                                 return FB_SUCCESS;
1424 @@ -879,7 +879,7 @@
1425                         gds__free(journal);
1426                         return FB_FAILURE;
1427                 }
1428 -               close((int) journal->jrn_channel);
1429 +               close((int)(IPTR) journal->jrn_channel);
1430         }
1431  #endif
1432  
1433 @@ -939,7 +939,7 @@
1434                 if (retry)
1435                 {
1436  #ifdef BSD_SOCKETS
1437 -                       close((int) journal->jrn_channel);
1438 +                       close((int)(IPTR) journal->jrn_channel);
1439  #endif
1440  
1441  #ifdef WIN_NT
1442 @@ -1056,7 +1056,7 @@
1443      with us, so keep trying until successful.  */
1444  
1445         do {
1446 -               l = recv((int) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
1447 +               l = recv((int)(IPTR) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
1448         } while (l < 0 && SYSCALL_INTERRUPTED(errno));
1449  
1450         if (l < 0) {
1451 @@ -1095,7 +1095,7 @@
1452   **************************************/
1453  
1454  #ifdef BSD_SOCKETS
1455 -       if (close((int) journal->jrn_channel) < 0) {
1456 +       if (close((int)(IPTR) journal->jrn_channel) < 0) {
1457                 error(status_vector, journal, errno, "close");
1458                 return FB_FAILURE;
1459         }
1460 @@ -1166,7 +1166,7 @@
1461      with us, so keep trying until successful.  */
1462  
1463         do {
1464 -               l = send((int) journal->jrn_channel, (char *) buffer, (int) length, 0);
1465 +               l = send((int)(IPTR) journal->jrn_channel, (char *) buffer, (int) length, 0);
1466         } while (l < 0 && SYSCALL_INTERRUPTED(errno));
1467  
1468         if (l < 0) {
1469 --- Firebird.org/src/jrd/nav.cpp.org    2006-03-28 19:04:53.447601000 +0200
1470 +++ Firebird/src/jrd/nav.cpp    2006-03-28 19:08:20.452538000 +0200
1471 @@ -487,7 +487,7 @@
1472  
1473         init_fetch(impure);
1474         idx =
1475 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
1476 +               (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
1477  
1478  /* The bitmap is only valid when we are continuing on in one 
1479     direction.  It is of no help when we change direction,
1480 @@ -521,12 +521,12 @@
1481  #ifdef SCROLLABLE_CURSORS
1482                 MOVE_FAST(
1483                                   (impure->irsb_nav_data +
1484 -                                  (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
1485 +                                  (2 * (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
1486                                   upper.key_data, upper.key_length);
1487  #else
1488                 MOVE_FAST(
1489                                   (impure->irsb_nav_data +
1490 -                                  (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
1491 +                                  (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
1492                                   upper.key_length);
1493  #endif
1494         }
1495 @@ -534,7 +534,7 @@
1496                 lower.key_length = impure->irsb_nav_lower_length;
1497                 MOVE_FAST(
1498                                   (impure->irsb_nav_data +
1499 -                                  (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
1500 +                                  (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
1501                                   lower.key_length);
1502         }
1503  
1504 @@ -1404,7 +1404,7 @@
1505         tdbb = GET_THREAD_DATA;
1506  
1507         idx =
1508 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
1509 +               (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
1510         page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index);
1511  
1512  /* the outer loop goes through all the sibling pages
1513 @@ -1619,7 +1619,7 @@
1514         tdbb = GET_THREAD_DATA;
1515         request = tdbb->tdbb_request;
1516         idx =
1517 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
1518 +               (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
1519  
1520         BOOLEAN result;
1521  
1522 @@ -1656,7 +1656,7 @@
1523                                 rpb->rpb_record,
1524                                 reinterpret_cast <
1525                                 struct idx *>((SCHAR *) impure +
1526 -                                                         (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]),
1527 +                                                         (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]),
1528                                 &value,
1529                                 0);
1530                 if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) {
1531 @@ -1757,7 +1757,7 @@
1532         retrieval_node = (JRD_NOD) rsb->rsb_arg[RSB_NAV_index];
1533         retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval];
1534         idx =
1535 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
1536 +               (IDX *) ((SCHAR *) impure + (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
1537         page =
1538                 BTR_find_page(tdbb, retrieval, window, idx, &lower, &upper,
1539                                           (direction == RSE_get_backward));
1540 @@ -1770,7 +1770,7 @@
1541                 impure->irsb_nav_lower_length = lower.key_length;
1542                 MOVE_FAST(lower.key_data,
1543                                   (impure->irsb_nav_data +
1544 -                                  (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
1545 +                                  (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
1546                                   lower.key_length);
1547         }
1548  
1549 @@ -1778,7 +1778,7 @@
1550                 impure->irsb_nav_upper_length = upper.key_length;
1551                 MOVE_FAST(upper.key_data,
1552                                   (impure->irsb_nav_data +
1553 -                                  (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
1554 +                                  (2 * (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
1555                                   upper.key_length);
1556         }
1557  
1558 @@ -1802,7 +1802,7 @@
1559                         impure->irsb_nav_upper_length = upper.key_length;
1560                         MOVE_FAST(upper.key_data,
1561                                           (impure->irsb_nav_data +
1562 -                                          (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
1563 +                                          (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
1564                                           upper.key_length);
1565                 }
1566                 if (retrieval->irb_lower_count)
1567 @@ -1813,7 +1813,7 @@
1568                         impure->irsb_nav_lower_length = lower.key_length;
1569                         MOVE_FAST(lower.key_data,
1570                                           (impure->irsb_nav_data +
1571 -                                          (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
1572 +                                          (SLONG)(IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
1573                                           lower.key_length);
1574                 }
1575                 if (retrieval->irb_upper_count)
1576 --- Firebird.org/src/jrd/opt.cpp.org    2006-03-28 19:12:44.949068000 +0200
1577 +++ Firebird/src/jrd/opt.cpp    2006-03-28 19:21:54.587418250 +0200
1578 @@ -380,7 +380,7 @@
1579  
1580                 if (node->nod_type != nod_rse)
1581                 {
1582 -                       stream = (USHORT) node->nod_arg[STREAM_INDEX(node)];
1583 +                       stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1584                         assert(stream <= MAX_UCHAR);
1585                         assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR);
1586                         beds[++beds[0]] = (UCHAR) stream;
1587 @@ -400,7 +400,7 @@
1588                                                   (USHORT) (key_streams[0] - i));
1589                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1590                         local_streams[++local_streams[0]] =
1591 -                               (UCHAR) node->nod_arg[e_uni_stream];
1592 +                               (UCHAR)(IPTR) node->nod_arg[e_uni_stream];
1593                 }
1594                 else if (node->nod_type == nod_aggregate) {
1595                         assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
1596 @@ -408,13 +408,13 @@
1597                         rsb = gen_aggregate(tdbb, opt_, node);
1598                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1599                         local_streams[++local_streams[0]] =
1600 -                               (UCHAR) node->nod_arg[e_agg_stream];
1601 +                               (UCHAR)(IPTR) node->nod_arg[e_agg_stream];
1602                 }
1603                 else if (node->nod_type == nod_procedure) {
1604                         rsb = gen_procedure(tdbb, opt_, node);
1605                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1606                         local_streams[++local_streams[0]] =
1607 -                               (UCHAR) node->nod_arg[e_prc_stream];
1608 +                               (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
1609                 }
1610                 else if (node->nod_type == nod_rse) {
1611                         compute_rse_streams(csb, (RSE) node, beds);
1612 @@ -895,7 +895,7 @@
1613  
1614  /* Make sure we have the correct stream */
1615  
1616 -       if ((USHORT) dbkey->nod_arg[0] != stream)
1617 +       if ((USHORT)(IPTR) dbkey->nod_arg[0] != stream)
1618                 return NULL;
1619  
1620  /* If this is a dbkey for the appropriate stream, it's invertable */
1621 @@ -1769,7 +1769,7 @@
1622         switch (node->nod_type) {
1623         case nod_field:
1624  
1625 -               n = (USHORT) node->nod_arg[e_fld_stream];
1626 +               n = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1627  
1628                 if (allowOnlyCurrentStream) {
1629                         if (n != stream) {
1630 @@ -1795,7 +1795,7 @@
1631  
1632         case nod_dbkey:
1633  
1634 -               n = (USHORT) node->nod_arg[0];
1635 +               n = (USHORT)(IPTR) node->nod_arg[0];
1636  
1637                 if (allowOnlyCurrentStream) {
1638                         if (n != stream) {
1639 @@ -1866,7 +1866,7 @@
1640  
1641         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
1642                 if ((*ptr)->nod_type != nod_rse) {
1643 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1644 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1645                         csb->csb_rpt[n].csb_flags |= csb_active;
1646                 }
1647         }
1648 @@ -1903,7 +1903,7 @@
1649         {
1650                 if ((*ptr)->nod_type != nod_rse)
1651                 {
1652 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1653 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1654                         csb->csb_rpt[n].csb_flags &= ~csb_active;
1655                 }
1656         }
1657 @@ -1944,12 +1944,12 @@
1658  
1659         switch (node->nod_type) {
1660         case nod_field:
1661 -               n = (USHORT) node->nod_arg[e_fld_stream];
1662 +               n = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1663                 SET_DEP_BIT(dependencies, n);
1664                 return;
1665  
1666         case nod_dbkey:
1667 -               n = (USHORT) node->nod_arg[0];
1668 +               n = (USHORT)(IPTR) node->nod_arg[0];
1669                 SET_DEP_BIT(dependencies, n);
1670                 return;
1671  
1672 @@ -2005,7 +2005,7 @@
1673  
1674         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
1675                 if ((*ptr)->nod_type != nod_rse) {
1676 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1677 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1678                         CLEAR_DEP_BIT(dependencies, n);
1679                 }
1680         }
1681 @@ -2033,7 +2033,7 @@
1682  
1683         if (node->nod_type == nod_relation) {
1684                 assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
1685 -               streams[++streams[0]] = (UCHAR) node->nod_arg[e_rel_stream];
1686 +               streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[e_rel_stream];
1687         }
1688         else if (node->nod_type == nod_union) {
1689                 clauses = node->nod_arg[e_uni_clauses];
1690 @@ -2073,7 +2073,7 @@
1691                 node = *ptr;
1692                 if (node->nod_type != nod_rse) {
1693                         assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
1694 -                       streams[++streams[0]] = (UCHAR) node->nod_arg[STREAM_INDEX(node)];
1695 +                       streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1696                 }
1697                 else {
1698                         compute_rse_streams(csb, (RSE) node, streams);
1699 @@ -3371,7 +3371,7 @@
1700         JRD_NOD dbkey_temp, *ptr, *end;
1701         DEV_BLKCHK(dbkey, type_nod);
1702         if (dbkey->nod_type == nod_dbkey) {
1703 -               if ((USHORT) dbkey->nod_arg[0] == stream)
1704 +               if ((USHORT)(IPTR) dbkey->nod_arg[0] == stream)
1705                         return dbkey;
1706                 else {
1707                         *position = *position + 1;
1708 @@ -3632,7 +3632,7 @@
1709  
1710                 temp[0]++;
1711                 relation_node = plan_node->nod_arg[e_retrieve_relation];
1712 -               temp[temp[0]] = (UCHAR) relation_node->nod_arg[e_rel_stream];
1713 +               temp[temp[0]] = (UCHAR)(IPTR) relation_node->nod_arg[e_rel_stream];
1714         }
1715  
1716         // just because the user specified a join does not mean that 
1717 @@ -3806,7 +3806,7 @@
1718         rsb->rsb_type = rsb_aggregate;
1719         assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
1720         assert((int)node->nod_arg[e_agg_stream] <= MAX_UCHAR);
1721 -       rsb->rsb_stream = (UCHAR) node->nod_arg[e_agg_stream];
1722 +       rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_agg_stream];
1723         rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
1724         rsb->rsb_next = OPT_compile(tdbb, csb, rse, NULL);
1725         rsb->rsb_arg[0] = (RSB) node;
1726 @@ -4170,8 +4170,8 @@
1727                  idx->idx_rpt; ptr < end; ptr++, idx_tail++) {
1728                 node = *ptr;
1729                 if (node->nod_type != nod_field
1730 -                       || (USHORT) node->nod_arg[e_fld_stream] != stream
1731 -                       || (USHORT) node->nod_arg[e_fld_id] != idx_tail->idx_field
1732 +                       || (USHORT)(IPTR) node->nod_arg[e_fld_stream] != stream
1733 +                       || (USHORT)(IPTR) node->nod_arg[e_fld_id] != idx_tail->idx_field
1734                         || ptr[2*sort->nod_count] /* do not use index if NULLS FIRST is used */
1735  #ifdef SCROLLABLE_CURSORS
1736                         )
1737 @@ -4331,7 +4331,7 @@
1738                 {
1739                         stream_ptr[i]->stream_rsb = NULL;
1740                         stream_ptr[i]->stream_num =
1741 -                               (USHORT) node->nod_arg[STREAM_INDEX(node)];
1742 +                               (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1743                 }
1744         }
1745  
1746 @@ -4409,10 +4409,10 @@
1747         SET_TDBB(tdbb);
1748         csb = opt->opt_csb;     
1749         procedure = MET_lookup_procedure_id(tdbb,
1750 -          (SSHORT)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
1751 +          (SSHORT)(IPTR)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
1752         rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) Rsb();
1753         rsb->rsb_type = rsb_procedure;
1754 -       rsb->rsb_stream = (UCHAR) node->nod_arg[e_prc_stream];
1755 +       rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
1756         rsb->rsb_procedure = procedure;
1757         rsb->rsb_format = procedure->prc_format;
1758         rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure));
1759 @@ -5025,8 +5025,8 @@
1760                         for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) {
1761                                 node = *node_ptr;
1762                                 if (node->nod_type == nod_field
1763 -                                       && (USHORT) node->nod_arg[e_fld_stream] == *ptr
1764 -                                       && (USHORT) node->nod_arg[e_fld_id] == id) {
1765 +                                       && (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
1766 +                                       && (USHORT)(IPTR) node->nod_arg[e_fld_id] == id) {
1767                                         desc = &descriptor;
1768                                         CMP_get_desc(tdbb, csb, node, desc);
1769                                         /* International type text has a computed key */
1770 @@ -5123,8 +5123,8 @@
1771                 map_item->smb_desc.dsc_address = (UCHAR *) map_length;
1772                 map_length += desc->dsc_length;
1773                 if (node->nod_type == nod_field) {
1774 -                       map_item->smb_stream = (USHORT) node->nod_arg[e_fld_stream];
1775 -                       map_item->smb_field_id = (USHORT) node->nod_arg[e_fld_id];
1776 +                       map_item->smb_stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1777 +                       map_item->smb_field_id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
1778                 }
1779         }
1780  
1781 @@ -5136,8 +5136,8 @@
1782     field has already been mentioned as a sort key, don't bother to repeat
1783     it. */
1784         while (stream_stack) {
1785 -               id = (USHORT) LLS_POP(&id_stack);
1786 -               stream = (USHORT) LLS_POP(&stream_stack);
1787 +               id = (USHORT)(IPTR) LLS_POP(&id_stack);
1788 +               stream = (USHORT)(IPTR) LLS_POP(&stream_stack);
1789                 format = CMP_format(tdbb, csb, stream);
1790                 desc = &format->fmt_desc[id];
1791                 if (id >= format->fmt_count || desc->dsc_length == 0)
1792 @@ -5466,7 +5466,7 @@
1793         rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
1794         rsb->rsb_type = rsb_union;
1795         rsb->rsb_count = count;
1796 -       rsb->rsb_stream = (UCHAR) union_node->nod_arg[e_uni_stream];
1797 +       rsb->rsb_stream = (UCHAR)(IPTR) union_node->nod_arg[e_uni_stream];
1798         rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
1799         rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
1800         rsb_ptr = rsb->rsb_arg;
1801 @@ -6008,8 +6008,8 @@
1802         field = boolean->nod_arg[0];
1803         if (field->nod_type != nod_field)
1804                 return NULL;
1805 -       if ((USHORT) field->nod_arg[e_fld_stream] != stream ||
1806 -               (USHORT) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field)
1807 +       if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
1808 +               (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field)
1809                 return NULL;
1810         node = make_index_node(tdbb, relation, opt->opt_csb, idx);
1811         retrieval = (IRB) node->nod_arg[e_idx_retrieval];
1812 @@ -6077,8 +6077,8 @@
1813                         return NULL;
1814         }
1815  
1816 -       if ((USHORT) field->nod_arg[e_fld_stream] != stream ||
1817 -               (USHORT) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field
1818 +       if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
1819 +               (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field
1820                 || !(idx->idx_rpt[0].idx_itype == idx_string
1821                          || idx->idx_rpt[0].idx_itype == idx_byte_array
1822                          || idx->idx_rpt[0].idx_itype == idx_metadata
1823 @@ -6176,10 +6176,10 @@
1824                 if (access_type) {
1825                         for (arg = access_type->nod_arg, end = arg + plan_count;
1826                                  arg < end; arg += 3) {
1827 -                               if (relation_id != (SSHORT) * arg)
1828 +                               if (relation_id != (SSHORT)(IPTR) * arg)
1829                                         /* index %s cannot be used in the specified plan */
1830                                         ERR_post(gds_index_unused, gds_arg_string, *(arg + 2), 0);
1831 -                               if (idx->idx_id == (USHORT) * (arg + 1))
1832 +                               if (idx->idx_id == (USHORT)(IPTR) * (arg + 1))
1833                                         if (access_type->nod_type == nod_navigational)
1834                                                 idx->idx_runtime_flags |= idx_plan_navigate;
1835                                         else            /* nod_indices */
1836 @@ -6251,13 +6251,13 @@
1837                    If left side is still not a field, give up */
1838  
1839                 if (match->nod_type != nod_field ||
1840 -                       (USHORT) match->nod_arg[e_fld_stream] != stream ||
1841 +                       (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
1842                         !computable(opt->opt_csb, value, stream, true, false))
1843                 {
1844                         match = value;
1845                         value = boolean->nod_arg[0];
1846                         if (match->nod_type != nod_field ||
1847 -                               (USHORT) match->nod_arg[e_fld_stream] != stream ||
1848 +                               (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
1849                                 !computable(opt->opt_csb, value, stream, true, false))
1850                         {
1851                                 return 0;
1852 @@ -6276,7 +6276,7 @@
1853  #ifdef EXPRESSION_INDICES
1854                         (idx->idx_expression ||
1855  #endif
1856 -                        ((USHORT) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field)
1857 +                        ((USHORT)(IPTR) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field)
1858  #ifdef EXPRESSION_INDICES
1859                         )
1860  #endif
1861 @@ -6664,7 +6664,7 @@
1862                 return FALSE;
1863         for (streams = river->riv_streams, end =
1864                  streams + river->riv_count; streams < end; streams++)
1865 -               if ((USHORT) node->nod_arg[e_fld_stream] == *streams)
1866 +               if ((USHORT)(IPTR) node->nod_arg[e_fld_stream] == *streams)
1867                         return TRUE;
1868         return FALSE;
1869  }
1870 @@ -6861,7 +6861,7 @@
1871                  ptr < end; ptr++) {
1872                 node = *ptr;
1873                 if (node->nod_type != nod_rse) {
1874 -                       stream = (USHORT) node->nod_arg[STREAM_INDEX(node)];
1875 +                       stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1876                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
1877                 }
1878                 else
1879 --- Firebird.org/src/jrd/par.cpp.org    2006-03-28 19:40:36.909559000 +0200
1880 +++ Firebird/src/jrd/par.cpp    2006-03-28 19:40:47.922247250 +0200
1881 @@ -2518,7 +2518,7 @@
1882                 node->nod_arg[e_agg_rse] = parse(tdbb, csb, TYPE_RSE);
1883                 node->nod_arg[e_agg_group] = parse(tdbb, csb, OTHER);
1884                 node->nod_arg[e_agg_map] =
1885 -                       par_map(tdbb, csb, (USHORT) node->nod_arg[e_agg_stream]);
1886 +                       par_map(tdbb, csb, (USHORT)(IPTR) node->nod_arg[e_agg_stream]);
1887                 break;
1888  
1889         case blr_group_by:
1890 --- Firebird.org/src/jrd/rse.cpp.org    2006-03-28 19:44:31.600226250 +0200
1891 +++ Firebird/src/jrd/rse.cpp    2006-03-28 19:46:40.508282500 +0200
1892 @@ -730,8 +730,8 @@
1893                                 /* Initialize the record number of each stream in the union */
1894  
1895                                 ptr = &rsb->rsb_arg[rsb->rsb_count];
1896 -                               for (end = ptr + (USHORT) * ptr; ++ptr <= end;)
1897 -                                       request->req_rpb[(USHORT) * ptr].rpb_number = -1;
1898 +                               for (end = ptr + (USHORT)(IPTR) * ptr; ++ptr <= end;)
1899 +                                       request->req_rpb[(USHORT)(IPTR) * ptr].rpb_number = -1;
1900  
1901                                 rsb = rsb->rsb_arg[0];
1902                         }
1903 @@ -2151,7 +2151,7 @@
1904         }
1905  
1906         desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
1907 -       desc.dsc_address = (UCHAR *) (om + (int) desc.dsc_address);
1908 +       desc.dsc_address = (UCHAR *) (om + (int)(IPTR) desc.dsc_address);
1909         eos_desc.dsc_dtype = dtype_short;
1910         eos_desc.dsc_scale = 0;
1911         eos_desc.dsc_length = sizeof(SSHORT);
1912 @@ -2914,7 +2914,7 @@
1913         request = tdbb->tdbb_request;
1914         stack = (LLS) rsb->rsb_arg[streams];
1915         for (; stack; stack = stack->lls_next) {
1916 -               rpb = &request->req_rpb[(USHORT) stack->lls_object];
1917 +               rpb = &request->req_rpb[(USHORT)(IPTR) stack->lls_object];
1918  
1919                 /* Make sure a record block has been allocated.  If there isn't
1920                    one, first find the format, then allocate the record block */
1921 @@ -2959,7 +2959,7 @@
1922         for (item = map->smb_rpt; item < end_item; item++) {
1923                 flag = *(data + item->smb_flag_offset);
1924                 from = item->smb_desc;
1925 -               from.dsc_address = data + (ULONG) from.dsc_address;
1926 +               from.dsc_address = data + (ULONG)(IPTR) from.dsc_address;
1927                 if ((node = item->smb_node) && node->nod_type != nod_field)
1928                         continue;
1929  
1930 @@ -2972,7 +2972,7 @@
1931                    list that contains the data to send back
1932                  */
1933                 if (IS_INTL_DATA(&item->smb_desc) &&
1934 -                       (USHORT) item->smb_desc.dsc_address <
1935 +                       (USHORT)(IPTR) item->smb_desc.dsc_address <
1936                         map->smb_key_length * sizeof(ULONG)) continue;
1937  
1938                 rpb = &request->req_rpb[item->smb_stream];
1939 @@ -3211,7 +3211,7 @@
1940                 end_item = map->smb_rpt + map->smb_count;
1941                 for (item = map->smb_rpt; item < end_item; item++) {
1942                         to = item->smb_desc;
1943 -                       to.dsc_address = data + (ULONG) to.dsc_address;
1944 +                       to.dsc_address = data + (ULONG)(IPTR) to.dsc_address;
1945                         flag = FALSE;
1946                         if (item->smb_node) {
1947                                 from = EVL_expr(tdbb, item->smb_node);
1948 @@ -3238,7 +3238,7 @@
1949                                    the sort record, then want to sort by language dependent order */
1950  
1951                                 if (IS_INTL_DATA(&item->smb_desc) &&
1952 -                                       (USHORT) item->smb_desc.dsc_address <
1953 +                                       (USHORT)(IPTR) item->smb_desc.dsc_address <
1954                                         map->smb_key_length * sizeof(ULONG)) {
1955                                         INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc),
1956                                                                            from, &to, FALSE);
1957 @@ -3301,12 +3301,12 @@
1958         desc2.dsc_flags = 0;
1959         desc2.dsc_address = (UCHAR *) & indicator;
1960         desc1 = *flag_desc;
1961 -       desc1.dsc_address = msg + (int) flag_desc->dsc_address;
1962 +       desc1.dsc_address = msg + (int)(IPTR) flag_desc->dsc_address;
1963         MOV_move(&desc1, &desc2);
1964         if (indicator) {
1965                 SET_NULL(record, to_id);
1966                 l = to_desc->dsc_length;
1967 -               p = record->rec_data + (int) to_desc->dsc_address;
1968 +               p = record->rec_data + (int)(IPTR) to_desc->dsc_address;
1969                 switch (to_desc->dsc_dtype) {
1970                 case dtype_text:
1971                         /* YYY - not necessarily the right thing to do */
1972 @@ -3336,9 +3336,9 @@
1973         else {
1974                 CLEAR_NULL(record, to_id);
1975                 desc1 = *from_desc;
1976 -               desc1.dsc_address = msg + (int) desc1.dsc_address;
1977 +               desc1.dsc_address = msg + (int)(IPTR) desc1.dsc_address;
1978                 desc2 = *to_desc;
1979 -               desc2.dsc_address = record->rec_data + (int) desc2.dsc_address;
1980 +               desc2.dsc_address = record->rec_data + (int)(IPTR) desc2.dsc_address;
1981                 if (!DSC_EQUIV((&desc1), (&desc2)))
1982                         MOV_move(&desc1, &desc2);
1983  
1984 @@ -3817,7 +3817,7 @@
1985         if (!sfb_->sfb_file_name) {
1986                 TEXT file_name[128];
1987  
1988 -               sfb_->sfb_file = (int) gds__temp_file(FALSE, SCRATCH, file_name);
1989 +               sfb_->sfb_file = (int)(IPTR) gds__temp_file(FALSE, SCRATCH, file_name);
1990                 if (sfb_->sfb_file == -1)
1991                         SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error,
1992                                            errno);
1993 --- Firebird.org/src/jrd/sort.cpp~      2003-12-24 14:02:01.000000000 +0100
1994 +++ Firebird/src/jrd/sort.cpp   2006-03-28 19:57:36.897304250 +0200
1995 @@ -1788,7 +1788,7 @@
1996                         /* Create a scratch file */
1997  
1998                         sfb->sfb_file =
1999 -                               (int) gds__temp_file(FALSE, SCRATCH, file_name,
2000 +                               (int)(IPTR) gds__temp_file(FALSE, SCRATCH, file_name,
2001                                                                          sfb->sfb_dls->dls_directory, TRUE);
2002  
2003                         /* allocate the file name even if the file is not open,
This page took 0.36803 seconds and 3 git commands to generate.