]> git.pld-linux.org Git - packages/Firebird.git/blob - Firebird-gcc4.patch
- more
[packages/Firebird.git] / Firebird-gcc4.patch
1 diff -ur firebird-1.5.3.4870-orig/src/burp/burp.cpp firebird-1.5.3.4870/src/burp/burp.cpp
2 --- firebird-1.5.3.4870-orig/src/burp/burp.cpp  2006-03-17 01:39:04.000000000 -0500
3 +++ firebird-1.5.3.4870/src/burp/burp.cpp       2006-03-17 01:32:16.000000000 -0500
4 @@ -1606,7 +1606,7 @@
5  #ifndef WIN_NT
6                                 signal(SIGPIPE, SIG_IGN);
7  #endif
8 -                               fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDOUT_DESC);
9 +                               fil->fil_fd = GBAK_STDOUT_DESC();
10                                 break;
11                         }
12                         else
13 @@ -1724,7 +1724,7 @@
14  
15         tdgbl->action->act_action = ACT_restore;
16         if (!strcmp(fil->fil_name, "stdin")) {
17 -               fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDIN_DESC);
18 +               fil->fil_fd = GBAK_STDIN_DESC();
19                 tdgbl->file_desc = fil->fil_fd;
20                 tdgbl->gbl_sw_files = fil->fil_next;
21         }
22 diff -ur firebird-1.5.3.4870-orig/src/burp/std_desc.h firebird-1.5.3.4870/src/burp/std_desc.h
23 --- firebird-1.5.3.4870-orig/src/burp/std_desc.h        2006-03-17 01:39:04.000000000 -0500
24 +++ firebird-1.5.3.4870/src/burp/std_desc.h     2006-03-17 01:41:38.000000000 -0500
25 @@ -35,12 +35,33 @@
26  #include "firebird.h"
27  
28  #ifdef WIN_NT
29 +
30  #include <windows.h>
31 -#define        GBAK_STDIN_DESC                 GetStdHandle(STD_INPUT_HANDLE)  /* standart input  file descriptor */
32 -#define        GBAK_STDOUT_DESC                GetStdHandle(STD_OUTPUT_HANDLE) /* standart output file descriptor */
33 +
34 +typedef HANDLE DESC;
35 +
36 +static inline DESC GBAK_STDIN_DESC(void)
37 +{
38 +       return GetStdHandle(STD_INPUT_HANDLE); // standard input file descriptor 
39 +}
40 +static inline DESC GBAK_STDOUT_DESC(void)
41 +{
42 +       return GetStdHandle(STD_OUTPUT_HANDLE); // standard output file descriptor
43 +}
44 +
45  #else //WIN_NT
46 -#define        GBAK_STDIN_DESC                 (int)0  /* standart input  file descriptor */
47 -#define        GBAK_STDOUT_DESC                (int)1  /* standart output file descriptor */
48 +
49 +typedef int DESC;
50 +
51 +static inline DESC GBAK_STDIN_DESC(void)
52 +{
53 +       return 0;       // standard input file descriptor 
54 +}
55 +static inline DESC GBAK_STDOUT_DESC(void)
56 +{
57 +       return 1;       // standard output file descriptor
58 +}
59 +
60  #endif //WIN_NT
61  
62  #endif  //GBAK_STD_DESC_H
63 diff -ur firebird-1.5.3.4870-orig/src/common/classes/alloc.h firebird-1.5.3.4870/src/common/classes/alloc.h
64 --- firebird-1.5.3.4870-orig/src/common/classes/alloc.h 2006-03-17 01:39:04.000000000 -0500
65 +++ firebird-1.5.3.4870/src/common/classes/alloc.h      2006-03-17 01:32:16.000000000 -0500
66 @@ -241,23 +241,29 @@
67  
68  void operator delete[](void* mem) throw();
69  
70 +#if  __GNUC__ < 4
71 +#define STATIC_NEW static
72 +#else
73 +#define STATIC_NEW
74 +#endif
75 +
76  #ifdef DEBUG_GDS_ALLOC
77 -static inline void* operator new(size_t s, Firebird::MemoryPool& pool, char* file, int line) {
78 +STATIC_NEW inline void* operator new(size_t s, Firebird::MemoryPool& pool, char* file, int line) {
79         return pool.allocate(s, 0, file, line);
80  //     return pool.calloc(s, 0, file, line);
81  }
82 -static inline void* operator new[](size_t s, Firebird::MemoryPool& pool, char* file, int line) {
83 +STATIC_NEW inline void* operator new[](size_t s, Firebird::MemoryPool& pool, char* file, int line) {
84         return pool.allocate(s, 0, file, line);
85  //     return pool.calloc(s, 0, file, line);
86  }
87  #define FB_NEW(pool) new(pool,__FILE__,__LINE__)
88  #define FB_NEW_RPT(pool,count) new(pool,count,__FILE__,__LINE__)
89  #else
90 -static inline void* operator new(size_t s, Firebird::MemoryPool& pool) {
91 +STATIC_NEW inline void* operator new(size_t s, Firebird::MemoryPool& pool) {
92         return pool.allocate(s);
93  //     return pool.calloc(s);
94  }
95 -static inline void* operator new[](size_t s, Firebird::MemoryPool& pool) {
96 +STATIC_NEW inline void* operator new[](size_t s, Firebird::MemoryPool& pool) {
97         return pool.allocate(s);
98  //     return pool.calloc(s);
99  }
100 diff -ur firebird-1.5.3.4870-orig/src/common/config/config.cpp firebird-1.5.3.4870/src/common/config/config.cpp
101 --- firebird-1.5.3.4870-orig/src/common/config/config.cpp       2006-03-17 01:39:04.000000000 -0500
102 +++ firebird-1.5.3.4870/src/common/config/config.cpp    2006-03-17 01:32:16.000000000 -0500
103 @@ -261,12 +261,12 @@
104  
105  int Config::getSortMemBlockSize()
106  {
107 -       return (int) sysConfig.values[KEY_SORT_MEM_BLOCK_SIZE];
108 +       return (int)(IPTR) sysConfig.values[KEY_SORT_MEM_BLOCK_SIZE];
109  }
110  
111  int Config::getSortMemUpperLimit()
112  {
113 -       return (int) sysConfig.values[KEY_SORT_MEM_UPPER_LIMIT];
114 +       return (int)(IPTR) sysConfig.values[KEY_SORT_MEM_UPPER_LIMIT];
115  }
116  
117  bool Config::getRemoteFileOpenAbility()
118 @@ -276,12 +276,12 @@
119  
120  int Config::getGuardianOption()
121  {
122 -       return (int) sysConfig.values[KEY_GUARDIAN_OPTION];
123 +       return (int)(IPTR) sysConfig.values[KEY_GUARDIAN_OPTION];
124  }
125  
126  int Config::getCpuAffinityMask()
127  {
128 -       return (int) sysConfig.values[KEY_CPU_AFFINITY_MASK];
129 +       return (int)(IPTR) sysConfig.values[KEY_CPU_AFFINITY_MASK];
130  }
131  
132  bool Config::getOldParameterOrdering()
133 @@ -291,7 +291,7 @@
134  
135  int Config::getTcpRemoteBufferSize()
136  {
137 -       return (int) sysConfig.values[KEY_TCP_REMOTE_BUFFER_SIZE];
138 +       return (int)(IPTR) sysConfig.values[KEY_TCP_REMOTE_BUFFER_SIZE];
139  }
140  
141  bool Config::getTcpNoNagle()
142 @@ -301,37 +301,37 @@
143  
144  int Config::getIpcMapSize()
145  {
146 -       return (int) sysConfig.values[KEY_IPC_MAP_SIZE];
147 +       return (int)(IPTR) sysConfig.values[KEY_IPC_MAP_SIZE];
148  }
149  
150  int Config::getDefaultDbCachePages()
151  {
152 -       return (int) sysConfig.values[KEY_DEFAULT_DB_CACHE_PAGES];
153 +       return (int)(IPTR) sysConfig.values[KEY_DEFAULT_DB_CACHE_PAGES];
154  }
155  
156  int Config::getConnectionTimeout()
157  {
158 -       return (int) sysConfig.values[KEY_CONNECTION_TIMEOUT];
159 +       return (int)(IPTR) sysConfig.values[KEY_CONNECTION_TIMEOUT];
160  }
161  
162  int Config::getDummyPacketInterval()
163  {
164 -       return (int) sysConfig.values[KEY_DUMMY_PACKET_INTERVAL];
165 +       return (int)(IPTR) sysConfig.values[KEY_DUMMY_PACKET_INTERVAL];
166  }
167  
168  int Config::getLockMemSize()
169  {
170 -       return (int) sysConfig.values[KEY_LOCK_MEM_SIZE];
171 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_MEM_SIZE];
172  }
173  
174  int Config::getLockSemCount()
175  {
176 -       return (int) sysConfig.values[KEY_LOCK_SEM_COUNT];
177 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_SEM_COUNT];
178  }
179  
180  int Config::getLockSignal()
181  {
182 -       return (int) sysConfig.values[KEY_LOCK_SIGNAL];
183 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_SIGNAL];
184  }
185  
186  bool Config::getLockGrantOrder()
187 @@ -341,27 +341,27 @@
188  
189  int Config::getLockHashSlots()
190  {
191 -       return (int) sysConfig.values[KEY_LOCK_HASH_SLOTS];
192 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_HASH_SLOTS];
193  }
194  
195  int Config::getLockAcquireSpins()
196  {
197 -       return (int) sysConfig.values[KEY_LOCK_ACQUIRE_SPINS];
198 +       return (int)(IPTR) sysConfig.values[KEY_LOCK_ACQUIRE_SPINS];
199  }
200  
201  int Config::getEventMemSize()
202  {
203 -       return (int) sysConfig.values[KEY_EVENT_MEM_SIZE];
204 +       return (int)(IPTR) sysConfig.values[KEY_EVENT_MEM_SIZE];
205  }
206  
207  int Config::getDeadlockTimeout()
208  {
209 -       return (int) sysConfig.values[KEY_DEADLOCK_TIMEOUT];
210 +       return (int)(IPTR) sysConfig.values[KEY_DEADLOCK_TIMEOUT];
211  }
212  
213  int Config::getSolarisStallValue()
214  {
215 -       return (int) sysConfig.values[KEY_SOLARIS_STALL_VALUE];
216 +       return (int)(IPTR) sysConfig.values[KEY_SOLARIS_STALL_VALUE];
217  }
218  
219  bool Config::getTraceMemoryPools()
220 @@ -371,7 +371,7 @@
221  
222  int Config::getPrioritySwitchDelay()
223  {
224 -       int rc = (int) sysConfig.values[KEY_PRIORITY_SWITCH_DELAY];
225 +       int rc = (int)(IPTR) sysConfig.values[KEY_PRIORITY_SWITCH_DELAY];
226         if (rc < 1)
227                 rc = 1;
228         return rc;
229 @@ -379,7 +379,7 @@
230  
231  int Config::getDeadThreadsCollection()
232  {
233 -       int rc = (int) sysConfig.values[KEY_DEAD_THREADS_COLLECTION];
234 +       int rc = (int)(IPTR) sysConfig.values[KEY_DEAD_THREADS_COLLECTION];
235         if (rc < 1)
236                 rc = 1;
237         return rc;
238 @@ -387,7 +387,7 @@
239  
240  int Config::getPriorityBoost()
241  {
242 -       int rc = (int) sysConfig.values[KEY_PRIORITY_BOOST];
243 +       int rc = (int)(IPTR) sysConfig.values[KEY_PRIORITY_BOOST];
244         if (rc < 1)
245                 rc = 1;
246         if (rc > 1000)
247 @@ -402,7 +402,7 @@
248  
249  int Config::getRemoteServicePort()
250  {
251 -       return (int) sysConfig.values[KEY_REMOTE_SERVICE_PORT];
252 +       return (int)(IPTR) sysConfig.values[KEY_REMOTE_SERVICE_PORT];
253  }
254  
255  const char *Config::getRemotePipeName()
256 @@ -417,17 +417,17 @@
257  
258  int Config::getMaxUnflushedWrites()
259  {
260 -       return (int) sysConfig.values[KEY_MAX_UNFLUSHED_WRITES];
261 +       return (int)(IPTR) sysConfig.values[KEY_MAX_UNFLUSHED_WRITES];
262  }
263  
264  int Config::getMaxUnflushedWriteTime()
265  {
266 -       return (int) sysConfig.values[KEY_MAX_UNFLUSHED_WRITE_TIME];
267 +       return (int)(IPTR) sysConfig.values[KEY_MAX_UNFLUSHED_WRITE_TIME];
268  }
269  
270  int Config::getProcessPriorityLevel()
271  {
272 -       return (int) sysConfig.values[KEY_PROCESS_PRIORITY_LEVEL];
273 +       return (int)(IPTR) sysConfig.values[KEY_PROCESS_PRIORITY_LEVEL];
274  }
275  
276  bool Config::getCreateInternalWindow()
277 @@ -443,7 +443,7 @@
278  int Config::getRemoteAuxPort()
279  {
280  #ifdef SUPERSERVER
281 -       return (int) sysConfig.values[KEY_REMOTE_AUX_PORT];
282 +       return (int)(IPTR) sysConfig.values[KEY_REMOTE_AUX_PORT];
283  #else
284         return 0;
285  #endif
286 diff -ur firebird-1.5.3.4870-orig/src/dsql/parse.cpp firebird-1.5.3.4870/src/dsql/parse.cpp
287 --- firebird-1.5.3.4870-orig/src/dsql/parse.cpp 2006-03-17 01:39:04.000000000 -0500
288 +++ firebird-1.5.3.4870/src/dsql/parse.cpp      2006-03-17 01:32:17.000000000 -0500
289 @@ -6421,7 +6421,7 @@
290  case 79:
291  { 
292                         lex.g_field->fld_dtype = dtype_cstring; 
293 -                       lex.g_field->fld_character_length = (USHORT) yyvsp[-2]; }
294 +                       lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-2]; }
295  break;
296  case 80:
297  { yyval = (DSQL_NOD) NULL; }
298 @@ -7541,27 +7541,27 @@
299  case 507:
300  { 
301                         lex.g_field->fld_dtype = dtype_blob; 
302 -                       lex.g_field->fld_seg_length = (USHORT) yyvsp[-1];
303 +                       lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[-1];
304                         lex.g_field->fld_sub_type = 0;
305                         }
306  break;
307  case 508:
308  { 
309                         lex.g_field->fld_dtype = dtype_blob; 
310 -                       lex.g_field->fld_seg_length = (USHORT) yyvsp[-3];
311 -                       lex.g_field->fld_sub_type = (USHORT) yyvsp[-1];
312 +                       lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[-3];
313 +                       lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[-1];
314                         }
315  break;
316  case 509:
317  { 
318                         lex.g_field->fld_dtype = dtype_blob; 
319                         lex.g_field->fld_seg_length = 80;
320 -                       lex.g_field->fld_sub_type = (USHORT) yyvsp[-1];
321 +                       lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[-1];
322                         }
323  break;
324  case 510:
325  {
326 -                       lex.g_field->fld_seg_length = (USHORT) yyvsp[0];
327 +                       lex.g_field->fld_seg_length = (USHORT)(IPTR) yyvsp[0];
328                         }
329  break;
330  case 511:
331 @@ -7571,7 +7571,7 @@
332  break;
333  case 512:
334  {
335 -                       lex.g_field->fld_sub_type = (USHORT) yyvsp[0];
336 +                       lex.g_field->fld_sub_type = (USHORT)(IPTR) yyvsp[0];
337                         }
338  break;
339  case 513:
340 @@ -7592,7 +7592,7 @@
341  case 517:
342  { 
343                         lex.g_field->fld_dtype = dtype_text; 
344 -                       lex.g_field->fld_character_length = (USHORT) yyvsp[-1]; 
345 +                       lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1]; 
346                         lex.g_field->fld_flags |= FLD_national;
347                         }
348  break;
349 @@ -7606,14 +7606,14 @@
350  case 519:
351  { 
352                         lex.g_field->fld_dtype = dtype_varying; 
353 -                       lex.g_field->fld_character_length = (USHORT) yyvsp[-1]; 
354 +                       lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1]; 
355                         lex.g_field->fld_flags |= FLD_national;
356                         }
357  break;
358  case 520:
359  { 
360                         lex.g_field->fld_dtype = dtype_text; 
361 -                       lex.g_field->fld_character_length = (USHORT) yyvsp[-1]; 
362 +                       lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1]; 
363                         }
364  break;
365  case 521:
366 @@ -7625,7 +7625,7 @@
367  case 522:
368  { 
369                         lex.g_field->fld_dtype = dtype_varying; 
370 -                       lex.g_field->fld_character_length = (USHORT) yyvsp[-1]; 
371 +                       lex.g_field->fld_character_length = (USHORT)(IPTR) yyvsp[-1]; 
372                         }
373  break;
374  case 531:
375 @@ -7705,7 +7705,7 @@
376                                 lex.g_field->fld_dtype = dtype_long; 
377                                 lex.g_field->fld_length = sizeof (SLONG); 
378                                 }
379 -                       lex.g_field->fld_precision = (USHORT) yyvsp[-1];
380 +                       lex.g_field->fld_precision = (USHORT)(IPTR) yyvsp[-1];
381                         }
382  break;
383  case 536:
384 @@ -7765,8 +7765,8 @@
385                                 lex.g_field->fld_length = sizeof (SLONG); 
386                                 }
387                             }
388 -                       lex.g_field->fld_precision = (USHORT) yyvsp[-3];
389 -                       lex.g_field->fld_scale = - (SSHORT) yyvsp[-1];
390 +                       lex.g_field->fld_precision = (USHORT)(IPTR) yyvsp[-3];
391 +                       lex.g_field->fld_scale = - (SSHORT)(IPTR) yyvsp[-1];
392                         }
393  break;
394  case 539:
395 @@ -7932,7 +7932,7 @@
396  { yyval = make_node (nod_table_lock, (int) 2, make_list (yyvsp[-1]), yyvsp[0]); }
397  break;
398  case 602:
399 -{ yyval = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT) yyvsp[-1] | (SSHORT) yyvsp[0]), (SSHORT) 0, NULL); }
400 +{ yyval = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(IPTR) yyvsp[-1] | (SSHORT)(IPTR) yyvsp[0]), (SSHORT) 0, NULL); }
401  break;
402  case 603:
403  { yyval = 0; }
404 diff -ur firebird-1.5.3.4870-orig/src/gpre/c_cxx.cpp firebird-1.5.3.4870/src/gpre/c_cxx.cpp
405 --- firebird-1.5.3.4870-orig/src/gpre/c_cxx.cpp 2006-03-17 01:39:04.000000000 -0500
406 +++ firebird-1.5.3.4870/src/gpre/c_cxx.cpp      2006-03-17 01:32:18.000000000 -0500
407 @@ -2184,7 +2184,7 @@
408  
409         args.pat_database = (DBB) init->nod_arg[3];
410         args.pat_vector1 = status_vector(action);
411 -       args.pat_long1 = (int) init->nod_arg[2];
412 +       args.pat_long1 = (int)(IPTR) init->nod_arg[2];
413         args.pat_value2 = (int) event_list->nod_count;
414  
415  //  generate call to dynamically generate event blocks 
416 @@ -2255,7 +2255,7 @@
417                 event_init = (GPRE_NOD) event_action->act_object;
418                 stack_name = (SYM) event_init->nod_arg[0];
419                 if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
420 -                       ident = (int) event_init->nod_arg[2];
421 +                       ident = (int)(IPTR) event_init->nod_arg[2];
422                         database = (DBB) event_init->nod_arg[3];
423                 }
424         }
425 diff -ur firebird-1.5.3.4870-orig/src/gpre/cmd.cpp firebird-1.5.3.4870/src/gpre/cmd.cpp
426 --- firebird-1.5.3.4870-orig/src/gpre/cmd.cpp   2006-03-17 01:39:04.000000000 -0500
427 +++ firebird-1.5.3.4870/src/gpre/cmd.cpp        2006-03-17 01:32:18.000000000 -0500
428 @@ -204,7 +204,7 @@
429  
430         case ACT_drop_shadow:
431                 put_numeric(request, gds_dyn_delete_shadow,
432 -                                       (SSHORT) action->act_object);
433 +                                       (SSHORT)(IPTR) action->act_object);
434                 STUFF_END;
435                 break;
436  
437 diff -ur firebird-1.5.3.4870-orig/src/gpre/cme.cpp firebird-1.5.3.4870/src/gpre/cme.cpp
438 --- firebird-1.5.3.4870-orig/src/gpre/cme.cpp   2006-03-17 01:39:04.000000000 -0500
439 +++ firebird-1.5.3.4870/src/gpre/cme.cpp        2006-03-17 01:32:18.000000000 -0500
440 @@ -251,7 +251,7 @@
441  // ** Begin date/time/timestamp support *
442         case nod_extract:
443                 STUFF(blr_extract);
444 -               switch ((KWWORDS) (int) node->nod_arg[0])
445 +               switch ((KWWORDS) (int)(IPTR) node->nod_arg[1])
446                 {
447                 case KW_YEAR:
448                         STUFF(blr_extract_year);
449 @@ -478,7 +478,7 @@
450  // ** Begin date/time/timestamp support *
451         case nod_extract:
452                 {
453 -                       KWWORDS kw_word = (KWWORDS) (int) node->nod_arg[0];
454 +                       KWWORDS kw_word = (KWWORDS) (int)(IPTR) node->nod_arg[0];
455                         CME_get_dtype(node->nod_arg[1], f);
456                         switch (f->fld_dtype)
457                         {
458 diff -ur firebird-1.5.3.4870-orig/src/gpre/cob.cpp firebird-1.5.3.4870/src/gpre/cob.cpp
459 --- firebird-1.5.3.4870-orig/src/gpre/cob.cpp   2006-03-17 01:39:04.000000000 -0500
460 +++ firebird-1.5.3.4870/src/gpre/cob.cpp        2006-03-17 01:32:18.000000000 -0500
461 @@ -382,7 +382,7 @@
462  static void    gen_on_error (ACT);
463  static void    gen_procedure (ACT);
464  static void    gen_put_segment (ACT);
465 -static void    gen_raw (UCHAR *, enum req_t, int, int);
466 +static void    gen_raw (UCHAR *, enum req_t, int, IPTR);
467  static void    gen_ready (ACT);
468  static void    gen_receive (ACT, POR);
469  static void    gen_release (ACT);
470 @@ -2656,7 +2656,7 @@
471  
472         args.pat_database = (DBB) init->nod_arg[3];
473         args.pat_vector1 = status_vector(action);
474 -       args.pat_value1 = (int) init->nod_arg[2];
475 +       args.pat_value1 = (IPTR) init->nod_arg[2];
476         args.pat_value2 = (int) event_list->nod_count;
477         args.pat_string1 = ISC_EVENT_BLOCK;
478         args.pat_string2 = ISC_EVENT_WAIT;
479 @@ -2712,7 +2712,7 @@
480         LLS stack_ptr;
481         ACT event_action;
482         SSHORT column;
483 -       int ident;
484 +       IPTR ident;
485         TEXT s[64];
486         TEXT *pattern1 =
487                 "CALL \"%S2\" USING %V1, %RF%DH%RE, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE";
488 @@ -2730,7 +2730,7 @@
489                 event_init = (GPRE_NOD) event_action->act_object;
490                 stack_name = (SYM) event_init->nod_arg[0];
491                 if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
492 -                       ident = (int) event_init->nod_arg[2];
493 +                       ident = (IPTR) event_init->nod_arg[2];
494                         database = (DBB) event_init->nod_arg[3];
495                 }
496         }
497 @@ -3845,7 +3845,7 @@
498  
499  static void gen_raw(
500                            UCHAR * blr,
501 -                          enum req_t request_type, int request_length, int ident)
502 +                          enum req_t request_type, int request_length, IPTR ident)
503  {
504         UCHAR *c;
505         TEXT s[256];
506 @@ -4193,7 +4193,7 @@
507                         printa(names[COLUMN_0], FALSE, "01  %s%d.",
508                                    names[ISC_], blob->blb_bpb_ident);
509                         gen_raw(blob->blb_bpb, request->req_type, blob->blb_bpb_length,
510 -                                       (int) request);
511 +                                       (IPTR) request);
512                         printa(names[COMMENT], FALSE, " ");
513                 }
514  #ifdef PYXIS
515 @@ -4703,7 +4703,7 @@
516  static void gen_type( ACT action)
517  {
518  
519 -       printa(names[COLUMN], TRUE, "%ld", action->act_object);
520 +       printa(names[COLUMN], TRUE, "%ld", (IPTR) action->act_object);
521  }
522  
523  
524 diff -ur firebird-1.5.3.4870-orig/src/gpre/pat.h firebird-1.5.3.4870/src/gpre/pat.h
525 --- firebird-1.5.3.4870-orig/src/gpre/pat.h     2006-03-17 01:39:04.000000000 -0500
526 +++ firebird-1.5.3.4870/src/gpre/pat.h  2006-03-17 01:32:18.000000000 -0500
527 @@ -85,7 +85,7 @@
528         USHORT pat_ident2;
529         TEXT *pat_vector1;
530         TEXT *pat_vector2;
531 -       int pat_value1;
532 +       IPTR pat_value1;
533         int pat_value2;
534         int pat_value3;
535         int pat_value4;
536 diff -ur firebird-1.5.3.4870-orig/src/jrd/blb.cpp firebird-1.5.3.4870/src/jrd/blb.cpp
537 --- firebird-1.5.3.4870-orig/src/jrd/blb.cpp    2006-03-17 01:39:04.000000000 -0500
538 +++ firebird-1.5.3.4870/src/jrd/blb.cpp 2006-03-17 01:32:28.000000000 -0500
539 @@ -860,8 +860,8 @@
540         request = tdbb->tdbb_request;
541         source = (BID) from_desc->dsc_address;
542         destination = (BID) to_desc->dsc_address;
543 -       id = (USHORT) field->nod_arg[e_fld_id];
544 -       rpb = &request->req_rpb[(int) field->nod_arg[e_fld_stream]];
545 +       id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
546 +       rpb = &request->req_rpb[(int)(IPTR) field->nod_arg[e_fld_stream]];
547         relation = rpb->rpb_relation;
548         record = rpb->rpb_record;
549  
550 diff -ur firebird-1.5.3.4870-orig/src/jrd/cmp.cpp firebird-1.5.3.4870/src/jrd/cmp.cpp
551 --- firebird-1.5.3.4870-orig/src/jrd/cmp.cpp    2006-03-17 01:39:04.000000000 -0500
552 +++ firebird-1.5.3.4870/src/jrd/cmp.cpp 2006-03-17 01:32:29.000000000 -0500
553 @@ -958,9 +958,9 @@
554                         FMT format;
555                         USHORT id;
556  
557 -                       id = (USHORT) node->nod_arg[e_fld_id];
558 +                       id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
559                         format =
560 -                               CMP_format(tdbb, csb, (USHORT) node->nod_arg[e_fld_stream]);
561 +                               CMP_format(tdbb, csb, (USHORT)(IPTR) node->nod_arg[e_fld_stream]);
562                         if (id >= format->fmt_count) {
563                                 desc->dsc_dtype = dtype_null;
564                                 desc->dsc_length = 0;
565 @@ -983,9 +983,9 @@
566  
567                         sub = node->nod_arg[e_scl_field];
568                         relation =
569 -                               csb->csb_rpt[(USHORT) sub->
570 +                               csb->csb_rpt[(USHORT)(IPTR) sub->
571                                                          nod_arg[e_fld_stream]].csb_relation;
572 -                       id = (USHORT) sub->nod_arg[e_fld_id];
573 +                       id = (USHORT)(IPTR) sub->nod_arg[e_fld_id];
574                         field = MET_get_field(relation, id);
575                         if (!field || !(array = field->fld_array))
576                                 IBERROR(223);   /* msg 223 argument of scalar operation must be an array */
577 @@ -1661,7 +1661,7 @@
578                 return;
579  
580         case nod_extract:
581 -               if ((ULONG) node->nod_arg[e_extract_part] == blr_extract_second) {
582 +               if ((ULONG)(IPTR) node->nod_arg[e_extract_part] == blr_extract_second) {
583                         /* QUADDATE - SECOND returns a float, or scaled! */
584                         desc->dsc_dtype = dtype_long;
585                         desc->dsc_length = sizeof(ULONG);
586 @@ -1720,7 +1720,7 @@
587  
588                         message = node->nod_arg[e_arg_message];
589                         format = (FMT) message->nod_arg[e_msg_format];
590 -                       *desc = format->fmt_desc[(int) node->nod_arg[e_arg_number]];
591 +                       *desc = format->fmt_desc[(int)(IPTR) node->nod_arg[e_arg_number]];
592                         return;
593                 }
594  
595 @@ -2653,8 +2653,8 @@
596                                 !input->nod_arg[e_fld_id] && !input->nod_arg[e_fld_stream])
597                                 --field_id;
598                         else
599 -                               field_id = (USHORT) input->nod_arg[e_fld_id];
600 -                       stream = (USHORT) input->nod_arg[e_fld_stream];
601 +                               field_id = (USHORT)(IPTR) input->nod_arg[e_fld_id];
602 +                       stream = (USHORT)(IPTR) input->nod_arg[e_fld_stream];
603                         if (remap_fld) {
604                                 JRD_REL relation;
605                                 JRD_FLD field;
606 @@ -2662,7 +2662,7 @@
607                                 relation = (*csb)->csb_rpt[stream].csb_relation;
608                                 field = MET_get_field(relation, field_id);
609                                 if (field->fld_source)
610 -                                       field_id = (USHORT) field->fld_source->nod_arg[e_fld_id];
611 +                                       field_id = (USHORT)(IPTR) field->fld_source->nod_arg[e_fld_id];
612                         }
613                         if (remap)
614                                 stream = remap[stream];
615 @@ -2773,7 +2773,7 @@
616                         node->nod_type = input->nod_type;
617                         node->nod_count = 0;
618  
619 -                       stream = (USHORT) input->nod_arg[e_rel_stream];
620 +                       stream = (USHORT)(IPTR) input->nod_arg[e_rel_stream];
621         /** 
622             Last entry in the remap contains the the original stream number.
623             Get that stream number so that the flags can be copied 
624 @@ -2853,7 +2853,7 @@
625                         node->nod_arg[e_prc_inputs] =
626                                 copy(tdbb, csb, input->nod_arg[e_prc_inputs], remap, field_id,
627                                          node->nod_arg[e_prc_in_msg], remap_fld);
628 -                       stream = (USHORT) input->nod_arg[e_prc_stream];
629 +                       stream = (USHORT)(IPTR) input->nod_arg[e_prc_stream];
630                         new_stream = (*csb)->csb_n_stream++;
631                         node->nod_arg[e_prc_stream] = (JRD_NOD) (SLONG) new_stream;
632                         /* TMN: Here we should really have the following assert */
633 @@ -2863,7 +2863,7 @@
634                         element = CMP_csb_element(csb, new_stream);
635                         // SKIDDER: Maybe we need to check if we really found a procedure ?
636                         element->csb_procedure = MET_lookup_procedure_id(tdbb,
637 -                         (SSHORT)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
638 +                         (SSHORT)(IPTR)node->nod_arg[e_prc_procedure],FALSE,FALSE,0);
639  
640                         (*csb)->csb_rpt[new_stream].csb_flags |=
641                                 (*csb)->csb_rpt[stream].csb_flags & csb_no_dbkey;
642 @@ -2876,7 +2876,7 @@
643                 node = PAR_make_node(tdbb, e_agg_length);
644                 node->nod_type = input->nod_type;
645                 node->nod_count = 0;
646 -               stream = (USHORT) input->nod_arg[e_agg_stream];
647 +               stream = (USHORT)(IPTR) input->nod_arg[e_agg_stream];
648                 assert(stream <= MAX_STREAMS);
649                 new_stream = (*csb)->csb_n_stream++;
650                 assert(new_stream <= MAX_STREAMS);
651 @@ -2905,7 +2905,7 @@
652                 node = PAR_make_node(tdbb, e_uni_length);
653                 node->nod_type = input->nod_type;
654                 node->nod_count = 2;
655 -               stream = (USHORT) input->nod_arg[e_uni_stream];
656 +               stream = (USHORT)(IPTR) input->nod_arg[e_uni_stream];
657                 new_stream = (*csb)->csb_n_stream++;
658                 node->nod_arg[e_uni_stream] = (JRD_NOD) (SLONG) new_stream;
659                 /* TMN: Here we should really have the following assert */
660 @@ -3043,7 +3043,7 @@
661                         csb_repeat *tail;
662                         JRD_REL relation;
663  
664 -                       stream = (USHORT) node->nod_arg[e_rel_stream];
665 +                       stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
666                         csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
667                         tail = &csb->csb_rpt[stream];
668                         if ( (relation = tail->csb_relation) )
669 @@ -3271,7 +3271,7 @@
670                         JRD_FLD field;
671                         UCHAR *map, local_map[MAP_LENGTH];
672  
673 -                       stream = (USHORT) node->nod_arg[e_fld_stream];
674 +                       stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
675  
676                         /* Look at all rse's which are lower in scope than the rse which this field 
677                            is referencing, and mark them as varying -- the rule is that if a field 
678 @@ -3292,7 +3292,7 @@
679                         if (!(relation = tail->csb_relation) ||
680                                 !(field =
681                                   MET_get_field(relation,
682 -                                                               (USHORT) node->nod_arg[e_fld_id]))) break;
683 +                                                               (USHORT)(IPTR) node->nod_arg[e_fld_id]))) break;
684  
685                         /* if this is a modify or store, check REFERENCES access to any foreign keys. */
686  
687 @@ -3404,9 +3404,9 @@
688  
689                         sub = node->nod_arg[e_asgn_from];
690                         if (sub->nod_type == nod_field) {
691 -                               stream = (USHORT) sub->nod_arg[e_fld_stream];
692 +                               stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
693                                 field = MET_get_field((*csb)->csb_rpt[stream].csb_relation,
694 -                                                                         (USHORT) sub->nod_arg[e_fld_id]);
695 +                                                                         (USHORT)(IPTR) sub->nod_arg[e_fld_id]);
696                                 if (field)
697                                         node->nod_arg[e_asgn_missing2] = field->fld_missing_value;
698                         }
699 @@ -3414,12 +3414,12 @@
700                         sub = node->nod_arg[e_asgn_to];
701                         if (sub->nod_type != nod_field)
702                                 break;
703 -                       stream = (USHORT) sub->nod_arg[e_fld_stream];
704 +                       stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
705                         tail = &(*csb)->csb_rpt[stream];
706                         if (!
707                                 (field =
708                                  MET_get_field(tail->csb_relation,
709 -                                                          (USHORT) sub->nod_arg[e_fld_id]))) break;
710 +                                                          (USHORT)(IPTR) sub->nod_arg[e_fld_id]))) break;
711                         if (field->fld_missing_value) {
712                                 node->nod_arg[e_asgn_missing] = field->fld_missing_value;
713                                 node->nod_count = 3;
714 @@ -3433,7 +3433,7 @@
715                 break;
716  
717         case nod_modify:
718 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
719 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
720                 tail = &(*csb)->csb_rpt[stream];
721                 tail->csb_flags |= csb_modify;
722                 pass1_modify(tdbb, csb, node);
723 @@ -3441,13 +3441,13 @@
724                 /* assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT); */
725                 if ( (node->nod_arg[e_mod_validate] =
726                         make_validation(tdbb, csb,
727 -                                                       (USHORT) node->
728 +                                                       (USHORT)(IPTR) node->
729                                                         nod_arg[e_mod_new_stream])) ) node->nod_count =
730                                 MAX(node->nod_count, (USHORT) e_mod_validate + 1);
731                 break;
732  
733         case nod_erase:
734 -               stream = (USHORT) node->nod_arg[e_erase_stream];
735 +               stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
736                 tail = &(*csb)->csb_rpt[stream];
737                 tail->csb_flags |= csb_erase;
738                 pass1_erase(tdbb, csb, node);
739 @@ -3463,12 +3463,12 @@
740  
741         case nod_store:
742                 sub = node->nod_arg[e_sto_relation];
743 -               stream = (USHORT) sub->nod_arg[e_rel_stream];
744 +               stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
745                 tail = &(*csb)->csb_rpt[stream];
746                 tail->csb_flags |= csb_store;
747                 sub = pass1_store(tdbb, csb, node);
748                 if (sub) {
749 -                       stream = (USHORT) sub->nod_arg[e_rel_stream];
750 +                       stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
751                         if ((!node->nod_arg[e_sto_sub_store]) &&
752                                 (node->nod_arg[e_sto_validate] =
753                                  make_validation(tdbb, csb, stream))) node->nod_count =
754 @@ -3495,7 +3495,7 @@
755  
756         case nod_aggregate:
757                 assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
758 -               (*csb)->csb_rpt[(USHORT) node->nod_arg[e_agg_stream]].csb_flags |=
759 +               (*csb)->csb_rpt[(USHORT)(IPTR) node->nod_arg[e_agg_stream]].csb_flags |=
760                         csb_no_dbkey;
761                 ignore_dbkey(tdbb, *csb, (RSE) node->nod_arg[e_agg_rse], view);
762                 node->nod_arg[e_agg_rse] =
763 @@ -3523,7 +3523,7 @@
764                         NOD_T type;
765  
766                         type = node->nod_type;
767 -                       stream = (USHORT) node->nod_arg[0];
768 +                       stream = (USHORT)(IPTR) node->nod_arg[0];
769  
770                         if (!(*csb)->csb_rpt[stream].csb_map) 
771                                 return node;
772 @@ -3558,7 +3558,7 @@
773                 break;
774  
775         case nod_cardinality:
776 -               stream = (USHORT) node->nod_arg[e_card_stream];
777 +               stream = (USHORT)(IPTR) node->nod_arg[e_card_stream];
778                 (*csb)->csb_rpt[stream].csb_flags |= csb_compute;
779                 break;
780  
781 @@ -3625,7 +3625,7 @@
782  /* To support views of views, loop until we hit a real relation */
783  
784         for (;;) {
785 -               stream = new_stream = (USHORT) node->nod_arg[e_erase_stream];
786 +               stream = new_stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
787                 tail = &(*csb)->csb_rpt[stream];
788                 tail->csb_flags |= csb_erase;
789                 relation = (*csb)->csb_rpt[stream].csb_relation;
790 @@ -3693,7 +3693,7 @@
791  
792                 parent = relation;
793                 parent_stream = stream;
794 -               new_stream = (USHORT) source->nod_arg[e_rel_stream];
795 +               new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
796                 node->nod_arg[e_erase_stream] = (JRD_NOD) (SLONG) map[new_stream];
797         }
798  }
799 @@ -3740,7 +3740,7 @@
800                                 field = MET_get_field(relation, id);
801                                 if (field->fld_source)
802                                         new_id =
803 -                                               (USHORT) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
804 +                                               (USHORT)(IPTR) (JRD_NOD) (field->fld_source)->nod_arg[e_fld_id];
805                                 else
806                                         new_id = id;
807                         }
808 @@ -3802,8 +3802,8 @@
809  /* To support views of views, loop until we hit a real relation */
810  
811         for (;;) {
812 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
813 -               new_stream = (USHORT) node->nod_arg[e_mod_new_stream];
814 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
815 +               new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
816                 tail = &(*csb)->csb_rpt[new_stream];
817                 tail->csb_flags |= csb_modify;
818                 relation = (*csb)->csb_rpt[stream].csb_relation;
819 @@ -3842,7 +3842,7 @@
820                         node->nod_count =
821                                 MAX(node->nod_count, (USHORT) e_mod_map_view + 1);
822                         map = (*csb)->csb_rpt[stream].csb_map;
823 -                       stream = (USHORT) source->nod_arg[e_rel_stream];
824 +                       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
825                         stream = map[stream];
826                         view_stream = new_stream;
827  
828 @@ -3850,18 +3850,18 @@
829  
830                         map =
831                                 alloc_map(tdbb, csb,
832 -                                                 (SSHORT) node->nod_arg[e_mod_new_stream]);
833 +                                                 (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
834                         source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
835                         /* TMN: Here we should really have the following assert */
836                         /* assert(source->nod_arg [e_rel_stream] <= MAX_UCHAR); */
837 -                       map[new_stream] = (UCHAR) source->nod_arg[e_rel_stream];
838 +                       map[new_stream] = (UCHAR)(IPTR) source->nod_arg[e_rel_stream];
839                         view_node = copy(tdbb, csb, node, map, 0, NULL, TRUE);
840                         view_node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) stream;
841                         view_node->nod_arg[e_mod_new_stream] =
842                                 source->nod_arg[e_rel_stream];
843                         view_node->nod_arg[e_mod_map_view] = NULL;
844                         node->nod_arg[e_mod_sub_mod] = view_node;
845 -                       new_stream = (USHORT) source->nod_arg[e_rel_stream];
846 +                       new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
847                         view_node->nod_arg[e_mod_statement] =
848                                 pass1_expand_view(tdbb, *csb, view_stream, new_stream, TRUE);
849                         node->nod_count =
850 @@ -3874,14 +3874,14 @@
851                         /* View passes muster -- do some translation.  Start with source stream */
852  
853                         map = (*csb)->csb_rpt[stream].csb_map;
854 -                       stream = (USHORT) source->nod_arg[e_rel_stream];
855 +                       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
856                         node->nod_arg[e_mod_org_stream] = (JRD_NOD) (SLONG) map[stream];
857  
858                         /* Next, do update stream */
859  
860                         map =
861                                 alloc_map(tdbb, csb,
862 -                                                 (SSHORT) node->nod_arg[e_mod_new_stream]);
863 +                                                 (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
864                         source = copy(tdbb, csb, source, map, 0, NULL, FALSE);
865                         node->nod_arg[e_mod_new_stream] = source->nod_arg[e_rel_stream];
866                 }
867 @@ -4128,7 +4128,7 @@
868  
869                 pass1(tdbb, csb, source, parent_view, view_stream, FALSE);
870                 procedure = MET_lookup_procedure_id(tdbb, 
871 -                 (SSHORT)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
872 +                 (SSHORT)(IPTR)source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
873                 post_procedure_access(tdbb, *csb, procedure);
874                 CMP_post_resource(&(*csb)->csb_resources, (BLK) procedure,
875                                                   Resource::rsc_procedure, procedure->prc_id);
876 @@ -4160,7 +4160,7 @@
877                                           view->rel_id);
878         source->nod_arg[e_rel_view] = (JRD_NOD) parent_view;
879  
880 -       stream = (USHORT) source->nod_arg[e_rel_stream];
881 +       stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
882         element = CMP_csb_element(csb, stream);
883         element->csb_view = parent_view;
884  /* TMN: Here we should really have the following assert */
885 @@ -4175,7 +4175,7 @@
886                 for (vcx_ptr = &parent_view->rel_view_contexts; *vcx_ptr;
887                          vcx_ptr = &(*vcx_ptr)->vcx_next)
888                         if ((*vcx_ptr)->vcx_context ==
889 -                               (USHORT) source->nod_arg[e_rel_context]) {
890 +                               (USHORT)(IPTR) source->nod_arg[e_rel_context]) {
891                                 element->csb_alias = (*vcx_ptr)->vcx_context_name;
892                                 break;
893                         }
894 @@ -4319,7 +4319,7 @@
895  
896         for (;;) {
897                 original = node->nod_arg[e_sto_relation];
898 -               stream = (USHORT) original->nod_arg[e_rel_stream];
899 +               stream = (USHORT)(IPTR) original->nod_arg[e_rel_stream];
900                 tail = &(*csb)->csb_rpt[stream];
901                 tail->csb_flags |= csb_store;
902                 relation = (*csb)->csb_rpt[stream].csb_relation;
903 @@ -4373,7 +4373,7 @@
904                         node->nod_arg[e_sto_relation] =
905                                 copy(tdbb, csb, source, map, 0, NULL, FALSE);
906                         new_stream =
907 -                               (USHORT) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
908 +                               (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
909                         node->nod_arg[e_sto_statement] =
910                                 pass1_expand_view(tdbb, *csb, stream, new_stream, TRUE);
911                         node->nod_arg[e_sto_statement] =
912 @@ -4721,9 +4721,9 @@
913                 /* AB: Mark the streams involved with an UPDATE statement
914                    active. So that the optimizer can use indices for 
915                    eventually used sub-selects. */
916 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
917 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
918                 csb->csb_rpt[stream].csb_flags |= csb_active;
919 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
920 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
921                 csb->csb_rpt[stream].csb_flags |= csb_active;
922         }
923  
924 @@ -4735,9 +4735,9 @@
925  
926         if (node->nod_type == nod_modify) {
927                 /* AB: Remove the previous flags */
928 -               stream = (USHORT) node->nod_arg[e_mod_org_stream];
929 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
930                 csb->csb_rpt[stream].csb_flags &= ~csb_active;
931 -               stream = (USHORT) node->nod_arg[e_mod_new_stream];
932 +               stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
933                 csb->csb_rpt[stream].csb_flags &= ~csb_active;
934         }
935  
936 @@ -4836,7 +4836,7 @@
937                         FMT format;
938                         fmt::fmt_desc_iterator desc;
939  
940 -                       stream = (USHORT) node->nod_arg[e_mod_org_stream];
941 +                       stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
942                         csb->csb_rpt[stream].csb_flags |= csb_update;
943                         format = CMP_format(tdbb, csb, stream);
944                         desc = format->fmt_desc.begin();
945 @@ -4861,13 +4861,13 @@
946                 break;
947  
948         case nod_erase:
949 -               stream = (USHORT) node->nod_arg[e_erase_stream];
950 +               stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
951                 csb->csb_rpt[stream].csb_flags |= csb_update;
952                 break;
953  
954         case nod_field:
955 -               stream = (USHORT) node->nod_arg[e_fld_stream];
956 -               id = (USHORT) node->nod_arg[e_fld_id];
957 +               stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
958 +               id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
959                 SBM_set(tdbb, &csb->csb_rpt[stream].csb_fields, id);
960                 if (node->nod_flags & nod_value) {
961                         csb->csb_impure += sizeof(struct vlux);
962 @@ -4941,7 +4941,7 @@
963                 pass2_rse(tdbb, csb, (RSE) node->nod_arg[e_agg_rse]);
964                 pass2(tdbb, csb, node->nod_arg[e_agg_map], node);
965                 pass2(tdbb, csb, node->nod_arg[e_agg_group], node);
966 -               stream = (USHORT) node->nod_arg[e_agg_stream];
967 +               stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
968                 assert(stream <= MAX_STREAMS);
969                 process_map(tdbb, csb, node->nod_arg[e_agg_map],
970                                         &csb->csb_rpt[stream].csb_format);
971 @@ -5050,7 +5050,7 @@
972  
973                 node = *ptr;
974                 if (node->nod_type == nod_relation) {
975 -                       USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
976 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
977                         csb->csb_rpt[stream].csb_flags |= csb_active;
978                         pass2(tdbb, csb, node, (JRD_NOD) rse);
979                 }
980 @@ -5058,12 +5058,12 @@
981                         pass2_rse(tdbb, csb, (RSE) node);
982                 }
983                 else if (node->nod_type == nod_procedure) {
984 -                       USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
985 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
986                         csb->csb_rpt[stream].csb_flags |= csb_active;
987                         pass2(tdbb, csb, node, (JRD_NOD) rse);
988                 }
989                 else if (node->nod_type == nod_aggregate) {
990 -                       USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
991 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
992                         assert(stream <= MAX_STREAMS);
993                         csb->csb_rpt[stream].csb_flags |= csb_active;
994                         pass2(tdbb, csb, node, (JRD_NOD) rse);
995 @@ -5118,7 +5118,7 @@
996  /* Make up a format block sufficiently large to hold instantiated record */
997  
998         clauses = node->nod_arg[e_uni_clauses];
999 -       id = (USHORT) node->nod_arg[e_uni_stream];
1000 +       id = (USHORT)(IPTR) node->nod_arg[e_uni_stream];
1001         format = &csb->csb_rpt[id].csb_format;
1002  
1003  /* Process alternating rse and map blocks */
1004 @@ -5160,7 +5160,7 @@
1005  
1006         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end;
1007                  ptr++) if ((*ptr)->nod_type == nod_relation) {
1008 -                       stream = (USHORT) (*ptr)->nod_arg[e_rel_stream];
1009 +                       stream = (USHORT)(IPTR) (*ptr)->nod_arg[e_rel_stream];
1010                         if (!(csb->csb_rpt[stream].csb_plan))
1011                                 ERR_post(gds_no_stream_plan, gds_arg_string,
1012                                                  csb->csb_rpt[stream].csb_relation->rel_name, 0);
1013 @@ -5213,7 +5213,7 @@
1014  
1015  /* find the tail for the relation specified in the rse */
1016  
1017 -       stream = (USHORT) plan_relation_node->nod_arg[e_rel_stream];
1018 +       stream = (USHORT)(IPTR) plan_relation_node->nod_arg[e_rel_stream];
1019         tail = &csb->csb_rpt[stream];
1020  
1021  /* if the plan references a view, find the real base relation 
1022 @@ -5449,15 +5449,15 @@
1023                  ptr < end; ptr++) {
1024                 node = *ptr;
1025                 if (node->nod_type == nod_relation) {
1026 -                       USHORT stream = (USHORT) node->nod_arg[e_rel_stream];
1027 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
1028                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
1029                 }
1030                 else if (node->nod_type == nod_procedure) {
1031 -                       USHORT stream = (USHORT) node->nod_arg[e_prc_stream];
1032 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
1033                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
1034                 }
1035                 else if (node->nod_type == nod_aggregate) {
1036 -                       USHORT stream = (USHORT) node->nod_arg[e_agg_stream];
1037 +                       USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
1038                         assert(stream <= MAX_STREAMS);
1039                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
1040                 }
1041 @@ -5553,7 +5553,7 @@
1042         for (end = ptr + map->nod_count; ptr < end; ptr++) {
1043                 assignment = *ptr;
1044                 field = assignment->nod_arg[e_asgn_to];
1045 -               id = (USHORT) field->nod_arg[e_fld_id];
1046 +               id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
1047                 if (id >= format->fmt_count) {
1048                         format->fmt_desc.resize(id + 1);
1049                 }
1050 @@ -5689,13 +5689,13 @@
1051                 /* for aggregates, check current rse, if not found then check 
1052                    the sub-rse */
1053                 if (sub->nod_type == nod_aggregate) {
1054 -                       if ((stream == (USHORT) sub->nod_arg[e_rel_stream]) ||
1055 +                       if ((stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]) ||
1056                                 (stream_in_rse(stream, (RSE) sub->nod_arg[e_agg_rse])))
1057                                 return TRUE;    /* do not mark as variant */
1058                 }
1059  
1060                 if ((sub->nod_type == nod_relation) &&
1061 -                       (stream == (USHORT) sub->nod_arg[e_rel_stream]))
1062 +                       (stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]))
1063                         return TRUE;            /* do not mark as variant */
1064         }
1065  
1066 diff -ur firebird-1.5.3.4870-orig/src/jrd/common.h firebird-1.5.3.4870/src/jrd/common.h
1067 --- firebird-1.5.3.4870-orig/src/jrd/common.h   2006-03-17 01:39:04.000000000 -0500
1068 +++ firebird-1.5.3.4870/src/jrd/common.h        2006-03-17 01:32:29.000000000 -0500
1069 @@ -856,8 +856,8 @@
1070  
1071  #define JRD_BUGCHK 15                  /* facility code for bugcheck messages */
1072  #ifndef OFFSET
1073 -#define OFFSET(struct,fld)      ((int) &((struct) 0)->fld)
1074 -#define OFFSETA(struct,fld)     ((int) ((struct) 0)->fld)
1075 +#define OFFSET(struct,fld)      ((int)(IPTR) &((struct) 0)->fld)
1076 +#define OFFSETA(struct,fld)     ((int)(IPTR) ((struct) 0)->fld)
1077  #endif
1078  
1079  #ifndef ODS_ALIGNMENT
1080 diff -ur firebird-1.5.3.4870-orig/src/jrd/dpm.epp firebird-1.5.3.4870/src/jrd/dpm.epp
1081 --- firebird-1.5.3.4870-orig/src/jrd/dpm.epp    2006-03-17 01:39:04.000000000 -0500
1082 +++ firebird-1.5.3.4870/src/jrd/dpm.epp 2006-03-17 01:32:29.000000000 -0500
1083 @@ -2119,7 +2119,7 @@
1084  
1085         DEBUG if (stack)
1086                 while (*stack)
1087 -                       CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
1088 +                       CCH_precedence(tdbb, &rpb->rpb_window, (SLONG)(IPTR) LLS_POP(stack));
1089  
1090         CCH_precedence(tdbb, &rpb->rpb_window, -rpb->rpb_transaction);
1091         CCH_MARK(tdbb, &rpb->rpb_window);
1092 @@ -2736,7 +2736,7 @@
1093     If the page need to be compressed, compress it. */
1094  
1095         while (*stack)
1096 -               CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack));
1097 +               CCH_precedence(tdbb, &rpb->rpb_window, (SLONG)(IPTR) LLS_POP(stack));
1098         CCH_MARK(tdbb, &rpb->rpb_window);
1099         i = page->dpg_count + ((slot) ? 0 : 1);
1100  
1101 diff -ur firebird-1.5.3.4870-orig/src/jrd/evl.cpp firebird-1.5.3.4870/src/jrd/evl.cpp
1102 --- firebird-1.5.3.4870-orig/src/jrd/evl.cpp    2006-03-17 01:39:04.000000000 -0500
1103 +++ firebird-1.5.3.4870/src/jrd/evl.cpp 2006-03-17 01:32:29.000000000 -0500
1104 @@ -248,7 +248,7 @@
1105                 arg_number = (int)(IPTR)node->nod_arg[e_arg_number];
1106                 desc = &format->fmt_desc[arg_number];
1107                 impure->vlu_desc.dsc_address =
1108 -                       (UCHAR *) request + message->nod_impure + (int) desc->dsc_address;
1109 +                       (UCHAR *) request + message->nod_impure + (int)(IPTR) desc->dsc_address;
1110                 impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
1111                 impure->vlu_desc.dsc_length = desc->dsc_length;
1112                 impure->vlu_desc.dsc_scale = desc->dsc_scale;
1113 @@ -288,8 +288,8 @@
1114                 // may happen. I checked triggers and insert/update statements.
1115                 // All seem to work fine.
1116                 record =
1117 -                       request->req_rpb[(int) node->nod_arg[e_fld_stream]].rpb_record;
1118 -               EVL_field(0, record, (USHORT) node->nod_arg[e_fld_id],
1119 +                       request->req_rpb[(int)(IPTR) node->nod_arg[e_fld_stream]].rpb_record;
1120 +               EVL_field(0, record, (USHORT)(IPTR) node->nod_arg[e_fld_id],
1121                                   &impure->vlu_desc);
1122                 if (!impure->vlu_desc.dsc_address)
1123                         ERR_post(gds_read_only_field, 0);
1124 @@ -359,7 +359,7 @@
1125                         impure = (INV) ((SCHAR *) tdbb->tdbb_request + node->nod_impure);
1126                         SBM_reset(&impure->inv_bitmap);
1127                         desc = EVL_expr(tdbb, node->nod_arg[0]);
1128 -                       id = 1 + 2 * (USHORT) node->nod_arg[1];
1129 +                       id = 1 + 2 * (USHORT)(IPTR) node->nod_arg[1];
1130                         numbers = desc->dsc_address;
1131                         numbers += id * sizeof(SLONG);
1132                         MOVE_FAST(numbers, &rel_dbkey, sizeof(SLONG));
1133 @@ -828,10 +828,10 @@
1134                         }
1135                         message = node->nod_arg[e_arg_message];
1136                         format = (FMT) message->nod_arg[e_msg_format];
1137 -                       desc = &format->fmt_desc[(int) node->nod_arg[e_arg_number]];
1138 +                       desc = &format->fmt_desc[(int)(IPTR) node->nod_arg[e_arg_number]];
1139  
1140                         impure->vlu_desc.dsc_address = (UCHAR *) request +
1141 -                               message->nod_impure + (int) desc->dsc_address;
1142 +                               message->nod_impure + (int)(IPTR) desc->dsc_address;
1143                         impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
1144                         impure->vlu_desc.dsc_length = desc->dsc_length;
1145                         impure->vlu_desc.dsc_scale = desc->dsc_scale;
1146 @@ -851,14 +851,14 @@
1147         case nod_field:
1148                 {
1149                         REC record =
1150 -                               request->req_rpb[(int)node->nod_arg[e_fld_stream]].rpb_record;
1151 +                               request->req_rpb[(int)(IPTR)node->nod_arg[e_fld_stream]].rpb_record;
1152                         /* In order to "map a null to a default" value (in EVL_field()), 
1153                          * the relation block is referenced. 
1154                          * Reference: Bug 10116, 10424 
1155                          */
1156 -                       if (!EVL_field(request->req_rpb[(USHORT) node->nod_arg[e_fld_stream]].rpb_relation,
1157 +                       if (!EVL_field(request->req_rpb[(USHORT)(IPTR) node->nod_arg[e_fld_stream]].rpb_relation,
1158                                                         record,
1159 -                                                       (USHORT) node->nod_arg[e_fld_id],
1160 +                                                       (USHORT)(IPTR) node->nod_arg[e_fld_id],
1161                                                         &impure->vlu_desc))
1162                         {
1163                                 request->req_flags |= req_null;
1164 @@ -997,7 +997,7 @@
1165                         ULONG extract_part;
1166  
1167                         impure = (VLU) ((SCHAR *) request + node->nod_impure);
1168 -                       extract_part = (ULONG) node->nod_arg[e_extract_part];
1169 +                       extract_part = (ULONG)(IPTR) node->nod_arg[e_extract_part];
1170                         value = EVL_expr(tdbb, node->nod_arg[e_extract_value]);
1171  
1172                         impure->vlu_desc.dsc_dtype = dtype_short;
1173 @@ -1173,8 +1173,8 @@
1174  
1175                 switch (node->nod_type) {
1176                 case nod_gen_id:                /* return a 32-bit generator value */
1177 -                       impure->vlu_misc.vlu_long = (SLONG) DPM_gen_id(tdbb,
1178 -                                                                                                                  (SLONG)
1179 +                       impure->vlu_misc.vlu_long = (SLONG)(IPTR) DPM_gen_id(tdbb,
1180 +                                                                                                                  (SLONG)(IPTR)
1181                                                                                                                    node->nod_arg
1182                                                                                                                    [e_gen_id], 0,
1183                                                                                                                    MOV_get_int64
1184 @@ -1189,7 +1189,7 @@
1185  
1186                 case nod_gen_id2:
1187                         impure->vlu_misc.vlu_int64 = DPM_gen_id(tdbb,
1188 -                                                                                                       (SLONG)
1189 +                                                                                                       (SLONG)(IPTR)
1190                                                                                                         node->nod_arg[e_gen_id],
1191                                                                                                         0,
1192                                                                                                         MOV_get_int64(values[0],
1193 @@ -1383,7 +1383,7 @@
1194                 return FALSE;
1195         }
1196  
1197 -       desc->dsc_address = record->rec_data + (int) desc->dsc_address;
1198 +       desc->dsc_address = record->rec_data + (int)(IPTR) desc->dsc_address;
1199  
1200         if (TEST_NULL(record, id)) {
1201                 desc->dsc_flags |= DSC_null;
1202 @@ -1725,9 +1725,9 @@
1203         {
1204                 from = (*ptr)->nod_arg[e_asgn_from];
1205                 field = (*ptr)->nod_arg[e_asgn_to];
1206 -               id = (USHORT) field->nod_arg[e_fld_id];
1207 +               id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
1208                 record =
1209 -                       request->req_rpb[(int) field->nod_arg[e_fld_stream]].rpb_record;
1210 +                       request->req_rpb[(int)(IPTR) field->nod_arg[e_fld_stream]].rpb_record;
1211                 impure = (VLUX) ((SCHAR *) request + from->nod_impure);
1212                 switch (from->nod_type)
1213                 {
1214 @@ -3395,7 +3395,7 @@
1215  
1216         request = tdbb->tdbb_request;
1217         impure = (VLU) ((SCHAR *) request + node->nod_impure);
1218 -       rpb = &request->req_rpb[(int) node->nod_arg[0]];
1219 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[0]];
1220         relation = rpb->rpb_relation;
1221  
1222  /* Format dbkey as vector of relation id, record number */
1223 @@ -4500,7 +4500,7 @@
1224  
1225         request = tdbb->tdbb_request;
1226         impure = (VLU) ((SCHAR *) request + node->nod_impure);
1227 -       rpb = &request->req_rpb[(int) node->nod_arg[0]];
1228 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[0]];
1229  
1230  /* If the current transaction has updated the record, the record version
1231   * coming in from DSQL will have the original transaction # (or current
1232 diff -ur firebird-1.5.3.4870-orig/src/jrd/exe.cpp firebird-1.5.3.4870/src/jrd/exe.cpp
1233 --- firebird-1.5.3.4870-orig/src/jrd/exe.cpp    2006-03-17 01:39:04.000000000 -0500
1234 +++ firebird-1.5.3.4870/src/jrd/exe.cpp 2006-03-17 01:32:29.000000000 -0500
1235 @@ -375,8 +375,8 @@
1236  
1237         if (to->nod_type == nod_field)
1238         {
1239 -               SSHORT id = (USHORT) to->nod_arg[e_fld_id];
1240 -               REC record = request->req_rpb[(int) to->nod_arg[e_fld_stream]].rpb_record;
1241 +               SSHORT id = (USHORT)(IPTR) to->nod_arg[e_fld_id];
1242 +               REC record = request->req_rpb[(int)(IPTR) to->nod_arg[e_fld_stream]].rpb_record;
1243                 if (null) {
1244                         SET_NULL(record, id);
1245                 } else {
1246 @@ -639,7 +639,7 @@
1247         message = request->req_message;
1248         format = (FMT) message->nod_arg[e_msg_format];
1249  
1250 -       if (msg != (USHORT) message->nod_arg[e_msg_number])
1251 +       if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
1252                 ERR_post(gds_req_sync, 0);
1253  
1254         if (length != format->fmt_length)
1255 @@ -788,7 +788,7 @@
1256                 for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
1257                          ptr++) {
1258                         message = (*ptr)->nod_arg[e_send_message];
1259 -                       if ((USHORT) message->nod_arg[e_msg_number] == msg) {
1260 +                       if ((USHORT)(IPTR) message->nod_arg[e_msg_number] == msg) {
1261                                 request->req_next = *ptr;
1262                                 break;
1263                         }
1264 @@ -798,7 +798,7 @@
1265  
1266         format = (FMT) message->nod_arg[e_msg_format];
1267  
1268 -       if (msg != (USHORT) message->nod_arg[e_msg_number])
1269 +       if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
1270                 ERR_post(gds_req_sync, 0);
1271  
1272         if (length != format->fmt_length)
1273 @@ -1049,7 +1049,7 @@
1274                 desc = &format->fmt_desc[n];
1275                 if (!desc->dsc_address)
1276                         continue;
1277 -               p = record->rec_data + (SLONG) desc->dsc_address;
1278 +               p = record->rec_data + (SLONG)(IPTR) desc->dsc_address;
1279                 if (TEST_NULL(record, n))
1280                 {
1281                         if (length = desc->dsc_length)
1282 @@ -1134,7 +1134,7 @@
1283  
1284         request = tdbb->tdbb_request;
1285         transaction = request->req_transaction;
1286 -       rpb = &request->req_rpb[(int) node->nod_arg[e_erase_stream]];
1287 +       rpb = &request->req_rpb[(int)(IPTR) node->nod_arg[e_erase_stream]];
1288         relation = rpb->rpb_relation;
1289  
1290  #ifdef PC_ENGINE
1291 @@ -2015,7 +2015,7 @@
1292                         case jrd_req::req_evaluate:
1293                                 if (transaction != dbb->dbb_sys_trans) {
1294  
1295 -                                       UCHAR operation = (UCHAR) node->nod_arg[e_sav_operation];
1296 +                                       UCHAR operation = (UCHAR)(IPTR) node->nod_arg[e_sav_operation];
1297                                         TEXT * node_savepoint_name = (TEXT*) node->nod_arg[e_sav_name]; 
1298  
1299                                         // Skip the savepoint created by EXE_start
1300 @@ -2328,7 +2328,7 @@
1301                                 break;
1302  
1303                         case jrd_req::req_unwind:
1304 -                               if ((request->req_label == (USHORT) node->nod_arg[e_lbl_label]) &&
1305 +                               if ((request->req_label == (USHORT)(IPTR) node->nod_arg[e_lbl_label]) &&
1306                                                 (request->req_flags & (req_leave | req_error_handler))) {
1307                                         request->req_flags &= ~req_leave;
1308                                         request->req_operation = jrd_req::req_return;
1309 @@ -2342,7 +2342,7 @@
1310                 case nod_leave:
1311                         request->req_flags |= req_leave;
1312                         request->req_operation = jrd_req::req_unwind;
1313 -                       request->req_label = (USHORT) node->nod_arg[0];
1314 +                       request->req_label = (USHORT)(IPTR) node->nod_arg[0];
1315                         node = node->nod_parent;
1316                         break;
1317  
1318 @@ -2652,7 +2652,7 @@
1319                                 DSC *desc;
1320  
1321                                 desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
1322 -                               (void) DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1,
1323 +                               (void) DPM_gen_id(tdbb, (SLONG)(IPTR) node->nod_arg[e_gen_id], 1,
1324                                                                   MOV_get_int64(desc, 0));
1325                                 request->req_operation = jrd_req::req_return;
1326                         }
1327 @@ -2664,7 +2664,7 @@
1328                                 DSC *desc;
1329  
1330                                 desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
1331 -                               (void) DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1,
1332 +                               (void) DPM_gen_id(tdbb, (SLONG)(IPTR) node->nod_arg[e_gen_id], 1,
1333                                                                   MOV_get_int64(desc, 0));
1334                                 request->req_operation = jrd_req::req_return;
1335                         }
1336 @@ -2794,11 +2794,11 @@
1337         transaction = request->req_transaction;
1338         impure = (STA) ((SCHAR *) request + node->nod_impure);
1339  
1340 -       org_stream = (USHORT) node->nod_arg[e_mod_org_stream];
1341 +       org_stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
1342         org_rpb = &request->req_rpb[org_stream];
1343         relation = org_rpb->rpb_relation;
1344  
1345 -       new_stream = (USHORT) node->nod_arg[e_mod_new_stream];
1346 +       new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
1347         new_rpb = &request->req_rpb[new_stream];
1348  
1349  #ifdef PC_ENGINE
1350 @@ -3795,7 +3795,7 @@
1351         JRD_REQ    request     = tdbb->tdbb_request;
1352         JRD_TRA    transaction = request->req_transaction;
1353         STA    impure      = (STA) ((SCHAR *) request + node->nod_impure);
1354 -       SSHORT stream      = (USHORT) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
1355 +       SSHORT stream      = (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
1356         RPB*   rpb         = &request->req_rpb[stream];
1357         JRD_REL    relation    = rpb->rpb_relation;
1358  
1359 @@ -4201,8 +4201,8 @@
1360  
1361                         if (node->nod_type == nod_field)
1362                         {
1363 -                               stream = (USHORT) node->nod_arg[e_fld_stream];
1364 -                               id = (USHORT) node->nod_arg[e_fld_id];
1365 +                               stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1366 +                               id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
1367                                 relation = request->req_rpb[stream].rpb_relation;
1368  
1369                                 if ((vector = relation->rel_fields) &&
1370 diff -ur firebird-1.5.3.4870-orig/src/jrd/ext.cpp firebird-1.5.3.4870/src/jrd/ext.cpp
1371 --- firebird-1.5.3.4870-orig/src/jrd/ext.cpp    2006-03-17 01:39:04.000000000 -0500
1372 +++ firebird-1.5.3.4870/src/jrd/ext.cpp 2006-03-17 01:32:29.000000000 -0500
1373 @@ -266,7 +266,7 @@
1374         record = rpb->rpb_record;
1375         format = record->rec_format;
1376  
1377 -       offset = (SSHORT) format->fmt_desc[0].dsc_address;
1378 +       offset = (SSHORT)(IPTR) format->fmt_desc[0].dsc_address;
1379         p = record->rec_data + offset;
1380         l = record->rec_length - offset;
1381  
1382 @@ -299,7 +299,7 @@
1383                         continue;
1384                 if ( (literal = (LIT) field->fld_missing_value) ) {
1385                         desc = *desc_ptr;
1386 -                       desc.dsc_address = record->rec_data + (int) desc.dsc_address;
1387 +                       desc.dsc_address = record->rec_data + (int)(IPTR) desc.dsc_address;
1388                         if (!MOV_compare(&literal->lit_desc, &desc))
1389                                 continue;
1390                 }
1391 @@ -512,7 +512,7 @@
1392                         desc_ptr->dsc_length &&
1393                         TEST_NULL(record, i))
1394                 {
1395 -                       p = record->rec_data + (int) desc_ptr->dsc_address;
1396 +                       p = record->rec_data + (int)(IPTR) desc_ptr->dsc_address;
1397                         if ( (literal = (LIT) field->fld_missing_value) ) {
1398                                 desc = *desc_ptr;
1399                                 desc.dsc_address = p;
1400 @@ -528,7 +528,7 @@
1401                 }
1402         }
1403  
1404 -       offset = (USHORT) format->fmt_desc[0].dsc_address;
1405 +       offset = (USHORT)(IPTR) format->fmt_desc[0].dsc_address;
1406         p = record->rec_data + offset;
1407         l = record->rec_length - offset;
1408  
1409 diff -ur firebird-1.5.3.4870-orig/src/jrd/gds.cpp firebird-1.5.3.4870/src/jrd/gds.cpp
1410 --- firebird-1.5.3.4870-orig/src/jrd/gds.cpp    2006-03-17 01:39:04.000000000 -0500
1411 +++ firebird-1.5.3.4870/src/jrd/gds.cpp 2006-03-17 01:32:30.000000000 -0500
1412 @@ -2304,7 +2304,7 @@
1413                 return result;
1414  
1415         if (stdio_flag)
1416 -               if (!(result = ib_fdopen((int) result, "w+")))
1417 +               if (!(result = ib_fdopen((int)(IPTR) result, "w+")))
1418                         return (void *)-1;
1419  
1420         if (expanded_string)
1421 diff -ur firebird-1.5.3.4870-orig/src/jrd/idx.cpp firebird-1.5.3.4870/src/jrd/idx.cpp
1422 --- firebird-1.5.3.4870-orig/src/jrd/idx.cpp    2006-03-17 01:39:04.000000000 -0500
1423 +++ firebird-1.5.3.4870/src/jrd/idx.cpp 2006-03-17 01:32:30.000000000 -0500
1424 @@ -1055,12 +1055,12 @@
1425                          index_number < idx->idx_foreign_primaries->count();
1426                          index_number++) {
1427                         if (idx->idx_id !=
1428 -                               (UCHAR) (*idx->idx_foreign_primaries)[index_number]) continue;
1429 +                               (UCHAR)(IPTR) (*idx->idx_foreign_primaries)[index_number]) continue;
1430                         partner_relation =
1431                                 MET_relation(tdbb,
1432 -                                                        (int) (*idx->idx_foreign_relations)[index_number]);
1433 +                                                        (int)(IPTR) (*idx->idx_foreign_relations)[index_number]);
1434                         index_id =
1435 -                               (USHORT) (*idx->idx_foreign_indexes)[index_number];
1436 +                               (USHORT)(IPTR) (*idx->idx_foreign_indexes)[index_number];
1437                         if ( (result =
1438                                 check_partner_index(tdbb, relation, record, transaction, idx,
1439                                                                         partner_relation, index_id)) )
1440 diff -ur firebird-1.5.3.4870-orig/src/jrd/inf.cpp firebird-1.5.3.4870/src/jrd/inf.cpp
1441 --- firebird-1.5.3.4870-orig/src/jrd/inf.cpp    2006-03-17 01:39:04.000000000 -0500
1442 +++ firebird-1.5.3.4870/src/jrd/inf.cpp 2006-03-17 01:32:30.000000000 -0500
1443 @@ -972,7 +972,7 @@
1444                         node = request->req_message;
1445                         if (item == gds_info_message_number)
1446                                 length =
1447 -                                       INF_convert((SLONG) node->nod_arg[e_msg_number],
1448 +                                       INF_convert((SLONG)(IPTR) node->nod_arg[e_msg_number],
1449                                                                 buffer_ptr);
1450                         else {
1451                                 format = (FMT) node->nod_arg[e_msg_format];
1452 diff -ur firebird-1.5.3.4870-orig/src/jrd/met.epp firebird-1.5.3.4870/src/jrd/met.epp
1453 --- firebird-1.5.3.4870-orig/src/jrd/met.epp    2006-03-17 01:39:04.000000000 -0500
1454 +++ firebird-1.5.3.4870/src/jrd/met.epp 2006-03-17 01:32:31.000000000 -0500
1455 @@ -932,7 +932,7 @@
1456                         if (desc->dsc_address)
1457                         {
1458                                 format->fmt_length =
1459 -                                       (ULONG) desc->dsc_address + desc->dsc_length;
1460 +                                       (ULONG)(IPTR) desc->dsc_address + desc->dsc_length;
1461                                 break;
1462                         }
1463                 }
1464 @@ -2133,13 +2133,13 @@
1465                                  index_number < references->frgn_reference_ids->count();
1466                                  index_number++)
1467                         {
1468 -                               if (idx->idx_id == (UCHAR) (*references->frgn_reference_ids)
1469 +                               if (idx->idx_id == (UCHAR)(IPTR) (*references->frgn_reference_ids)
1470                                                                                         [index_number])
1471                                 {
1472                                         idx->idx_primary_relation =
1473 -                                               (USHORT) (*references->frgn_relations)[index_number];
1474 +                                               (USHORT)(IPTR) (*references->frgn_relations)[index_number];
1475                                         idx->idx_primary_index =
1476 -                                               (UCHAR) (*references->frgn_indexes)[index_number];
1477 +                                               (UCHAR)(IPTR) (*references->frgn_indexes)[index_number];
1478                                         return TRUE;
1479                                 }
1480                         }
1481 @@ -2155,7 +2155,7 @@
1482                                  index_number < dependencies->prim_reference_ids->count();
1483                                  index_number++)
1484                         {
1485 -                               if (idx->idx_id == (UCHAR) (*dependencies->prim_reference_ids)
1486 +                               if (idx->idx_id == (UCHAR)(IPTR) (*dependencies->prim_reference_ids)
1487                                                                                         [index_number])
1488                                 {
1489                                         idx->idx_foreign_primaries =
1490 @@ -3001,10 +3001,10 @@
1491                 {
1492                         if ( (node = csb_->csb_rpt[i].csb_message) )
1493                         {
1494 -                               if ((int) node->nod_arg[e_msg_number] == 0)
1495 +                               if ((int)(IPTR) node->nod_arg[e_msg_number] == 0)
1496                                 {
1497                                         procedure->prc_input_msg = node;
1498 -                               } else if ((int) node->nod_arg[e_msg_number] == 1)
1499 +                               } else if ((int)(IPTR) node->nod_arg[e_msg_number] == 1)
1500                                 {
1501                                         procedure->prc_output_msg = node;
1502                                 }
1503 @@ -4580,7 +4580,7 @@
1504                 node = (JRD_NOD) LLS_POP(&csb->csb_dependencies);
1505                 if (!node->nod_arg[e_dep_object])
1506                         continue;
1507 -               dpdo_type = (SSHORT) node->nod_arg[e_dep_object_type];
1508 +               dpdo_type = (SSHORT)(IPTR) node->nod_arg[e_dep_object_type];
1509          relation = NULL;
1510          procedure = NULL;
1511          switch (dpdo_type) {
1512 @@ -4593,13 +4593,13 @@
1513              dpdo_name = (TEXT*) procedure->prc_name->str_data;
1514              break;
1515          case obj_exception:
1516 -            number = (SLONG) node->nod_arg [e_dep_object];
1517 +            number = (SLONG)(IPTR) node->nod_arg [e_dep_object];
1518              MET_lookup_exception (tdbb, number, name, NULL);
1519              dpdo_name = name;
1520              break;
1521              /* CVC: Here I'm going to track those pesky things named generators and UDFs. */
1522          case obj_generator:
1523 -            number = (SLONG) node->nod_arg [e_dep_object];
1524 +            number = (SLONG)(IPTR) node->nod_arg [e_dep_object];
1525              MET_lookup_generator_id (tdbb, number, name);
1526              dpdo_name = name;
1527              break;
1528 @@ -4617,7 +4617,7 @@
1529                 {
1530                         if (field_node->nod_type == nod_field)
1531                         {
1532 -                               fld_id = (SSHORT) field_node->nod_arg[0];
1533 +                               fld_id = (SSHORT)(IPTR) field_node->nod_arg[0];
1534                                 if (relation)
1535                                 {
1536                                         if ( (field = MET_get_field(relation, fld_id)) )
1537 diff -ur firebird-1.5.3.4870-orig/src/jrd/opt.cpp firebird-1.5.3.4870/src/jrd/opt.cpp
1538 --- firebird-1.5.3.4870-orig/src/jrd/opt.cpp    2006-03-17 01:39:04.000000000 -0500
1539 +++ firebird-1.5.3.4870/src/jrd/opt.cpp 2006-03-17 01:32:31.000000000 -0500
1540 @@ -380,7 +380,7 @@
1541  
1542                 if (node->nod_type != nod_rse)
1543                 {
1544 -                       stream = (USHORT) node->nod_arg[STREAM_INDEX(node)];
1545 +                       stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1546                         assert(stream <= MAX_UCHAR);
1547                         assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR);
1548                         beds[++beds[0]] = (UCHAR) stream;
1549 @@ -400,7 +400,7 @@
1550                                                   (USHORT) (key_streams[0] - i));
1551                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1552                         local_streams[++local_streams[0]] =
1553 -                               (UCHAR) node->nod_arg[e_uni_stream];
1554 +                               (UCHAR)(IPTR) node->nod_arg[e_uni_stream];
1555                 }
1556                 else if (node->nod_type == nod_aggregate) {
1557                         assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
1558 @@ -408,13 +408,13 @@
1559                         rsb = gen_aggregate(tdbb, opt_, node);
1560                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1561                         local_streams[++local_streams[0]] =
1562 -                               (UCHAR) node->nod_arg[e_agg_stream];
1563 +                               (UCHAR)(IPTR) node->nod_arg[e_agg_stream];
1564                 }
1565                 else if (node->nod_type == nod_procedure) {
1566                         rsb = gen_procedure(tdbb, opt_, node);
1567                         assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
1568                         local_streams[++local_streams[0]] =
1569 -                               (UCHAR) node->nod_arg[e_prc_stream];
1570 +                               (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
1571                 }
1572                 else if (node->nod_type == nod_rse) {
1573                         compute_rse_streams(csb, (RSE) node, beds);
1574 @@ -895,7 +895,7 @@
1575  
1576  /* Make sure we have the correct stream */
1577  
1578 -       if ((USHORT) dbkey->nod_arg[0] != stream)
1579 +       if ((USHORT)(IPTR) dbkey->nod_arg[0] != stream)
1580                 return NULL;
1581  
1582  /* If this is a dbkey for the appropriate stream, it's invertable */
1583 @@ -1687,7 +1687,7 @@
1584         switch (node->nod_type) {
1585         case nod_field:
1586  
1587 -               n = (USHORT) node->nod_arg[e_fld_stream];
1588 +               n = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1589  
1590                 if (allowOnlyCurrentStream) {
1591                         if (n != stream) {
1592 @@ -1713,7 +1713,7 @@
1593  
1594         case nod_dbkey:
1595  
1596 -               n = (USHORT) node->nod_arg[0];
1597 +               n = (USHORT)(IPTR) node->nod_arg[0];
1598  
1599                 if (allowOnlyCurrentStream) {
1600                         if (n != stream) {
1601 @@ -1784,7 +1784,7 @@
1602  
1603         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
1604                 if ((*ptr)->nod_type != nod_rse) {
1605 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1606 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1607                         csb->csb_rpt[n].csb_flags |= csb_active;
1608                 }
1609         }
1610 @@ -1821,7 +1821,7 @@
1611         {
1612                 if ((*ptr)->nod_type != nod_rse)
1613                 {
1614 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1615 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1616                         csb->csb_rpt[n].csb_flags &= ~csb_active;
1617                 }
1618         }
1619 @@ -1862,12 +1862,12 @@
1620  
1621         switch (node->nod_type) {
1622         case nod_field:
1623 -               n = (USHORT) node->nod_arg[e_fld_stream];
1624 +               n = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1625                 SET_DEP_BIT(dependencies, n);
1626                 return;
1627  
1628         case nod_dbkey:
1629 -               n = (USHORT) node->nod_arg[0];
1630 +               n = (USHORT)(IPTR) node->nod_arg[0];
1631                 SET_DEP_BIT(dependencies, n);
1632                 return;
1633  
1634 @@ -1923,7 +1923,7 @@
1635  
1636         for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
1637                 if ((*ptr)->nod_type != nod_rse) {
1638 -                       n = (USHORT) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1639 +                       n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
1640                         CLEAR_DEP_BIT(dependencies, n);
1641                 }
1642         }
1643 @@ -1951,7 +1951,7 @@
1644  
1645         if (node->nod_type == nod_relation) {
1646                 assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
1647 -               streams[++streams[0]] = (UCHAR) node->nod_arg[e_rel_stream];
1648 +               streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[e_rel_stream];
1649         }
1650         else if (node->nod_type == nod_union) {
1651                 clauses = node->nod_arg[e_uni_clauses];
1652 @@ -1991,7 +1991,7 @@
1653                 node = *ptr;
1654                 if (node->nod_type != nod_rse) {
1655                         assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
1656 -                       streams[++streams[0]] = (UCHAR) node->nod_arg[STREAM_INDEX(node)];
1657 +                       streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1658                 }
1659                 else {
1660                         compute_rse_streams(csb, (RSE) node, streams);
1661 @@ -3289,7 +3289,7 @@
1662         JRD_NOD dbkey_temp, *ptr, *end;
1663         DEV_BLKCHK(dbkey, type_nod);
1664         if (dbkey->nod_type == nod_dbkey) {
1665 -               if ((USHORT) dbkey->nod_arg[0] == stream)
1666 +               if ((USHORT)(IPTR) dbkey->nod_arg[0] == stream)
1667                         return dbkey;
1668                 else {
1669                         *position = *position + 1;
1670 @@ -3550,7 +3550,7 @@
1671  
1672                 temp[0]++;
1673                 relation_node = plan_node->nod_arg[e_retrieve_relation];
1674 -               temp[temp[0]] = (UCHAR) relation_node->nod_arg[e_rel_stream];
1675 +               temp[temp[0]] = (UCHAR)(IPTR) relation_node->nod_arg[e_rel_stream];
1676         }
1677  
1678         // just because the user specified a join does not mean that 
1679 @@ -3724,7 +3724,7 @@
1680         rsb->rsb_type = rsb_aggregate;
1681         assert((int)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
1682         assert((int)node->nod_arg[e_agg_stream] <= MAX_UCHAR);
1683 -       rsb->rsb_stream = (UCHAR) node->nod_arg[e_agg_stream];
1684 +       rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_agg_stream];
1685         rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
1686         rsb->rsb_next = OPT_compile(tdbb, csb, rse, NULL);
1687         rsb->rsb_arg[0] = (RSB) node;
1688 @@ -4088,8 +4088,8 @@
1689                  idx->idx_rpt; ptr < end; ptr++, idx_tail++) {
1690                 node = *ptr;
1691                 if (node->nod_type != nod_field
1692 -                       || (USHORT) node->nod_arg[e_fld_stream] != stream
1693 -                       || (USHORT) node->nod_arg[e_fld_id] != idx_tail->idx_field
1694 +                       || (USHORT)(IPTR) node->nod_arg[e_fld_stream] != stream
1695 +                       || (USHORT)(IPTR) node->nod_arg[e_fld_id] != idx_tail->idx_field
1696                         || ptr[2*sort->nod_count] /* do not use index if NULLS FIRST is used */
1697  #ifdef SCROLLABLE_CURSORS
1698                         )
1699 @@ -4249,7 +4249,7 @@
1700                 {
1701                         stream_ptr[i]->stream_rsb = NULL;
1702                         stream_ptr[i]->stream_num =
1703 -                               (USHORT) node->nod_arg[STREAM_INDEX(node)];
1704 +                               (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1705                 }
1706         }
1707  
1708 @@ -4327,10 +4327,10 @@
1709         SET_TDBB(tdbb);
1710         csb = opt->opt_csb;     
1711         procedure = MET_lookup_procedure_id(tdbb,
1712 -          (SSHORT)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
1713 +          (SSHORT)(IPTR)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
1714         rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) Rsb();
1715         rsb->rsb_type = rsb_procedure;
1716 -       rsb->rsb_stream = (UCHAR) node->nod_arg[e_prc_stream];
1717 +       rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
1718         rsb->rsb_procedure = procedure;
1719         rsb->rsb_format = procedure->prc_format;
1720         rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure));
1721 @@ -4943,8 +4943,8 @@
1722                         for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) {
1723                                 node = *node_ptr;
1724                                 if (node->nod_type == nod_field
1725 -                                       && (USHORT) node->nod_arg[e_fld_stream] == *ptr
1726 -                                       && (USHORT) node->nod_arg[e_fld_id] == id) {
1727 +                                       && (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
1728 +                                       && (USHORT)(IPTR) node->nod_arg[e_fld_id] == id) {
1729                                         desc = &descriptor;
1730                                         CMP_get_desc(tdbb, csb, node, desc);
1731                                         /* International type text has a computed key */
1732 @@ -5041,8 +5041,8 @@
1733                 map_item->smb_desc.dsc_address = (UCHAR *) map_length;
1734                 map_length += desc->dsc_length;
1735                 if (node->nod_type == nod_field) {
1736 -                       map_item->smb_stream = (USHORT) node->nod_arg[e_fld_stream];
1737 -                       map_item->smb_field_id = (USHORT) node->nod_arg[e_fld_id];
1738 +                       map_item->smb_stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
1739 +                       map_item->smb_field_id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
1740                 }
1741         }
1742  
1743 @@ -5054,8 +5054,8 @@
1744     field has already been mentioned as a sort key, don't bother to repeat
1745     it. */
1746         while (stream_stack) {
1747 -               id = (USHORT) LLS_POP(&id_stack);
1748 -               stream = (USHORT) LLS_POP(&stream_stack);
1749 +               id = (USHORT)(IPTR) LLS_POP(&id_stack);
1750 +               stream = (USHORT)(IPTR) LLS_POP(&stream_stack);
1751                 format = CMP_format(tdbb, csb, stream);
1752                 desc = &format->fmt_desc[id];
1753                 if (id >= format->fmt_count || desc->dsc_length == 0)
1754 @@ -5384,7 +5384,7 @@
1755         rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
1756         rsb->rsb_type = rsb_union;
1757         rsb->rsb_count = count;
1758 -       rsb->rsb_stream = (UCHAR) union_node->nod_arg[e_uni_stream];
1759 +       rsb->rsb_stream = (UCHAR)(IPTR) union_node->nod_arg[e_uni_stream];
1760         rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
1761         rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
1762         rsb_ptr = rsb->rsb_arg;
1763 @@ -5926,8 +5926,8 @@
1764         field = boolean->nod_arg[0];
1765         if (field->nod_type != nod_field)
1766                 return NULL;
1767 -       if ((USHORT) field->nod_arg[e_fld_stream] != stream ||
1768 -               (USHORT) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field)
1769 +       if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
1770 +               (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field)
1771                 return NULL;
1772         node = make_index_node(tdbb, relation, opt->opt_csb, idx);
1773         retrieval = (IRB) node->nod_arg[e_idx_retrieval];
1774 @@ -5995,8 +5995,8 @@
1775                         return NULL;
1776         }
1777  
1778 -       if ((USHORT) field->nod_arg[e_fld_stream] != stream ||
1779 -               (USHORT) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field
1780 +       if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
1781 +               (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field
1782                 || !(idx->idx_rpt[0].idx_itype == idx_string
1783                          || idx->idx_rpt[0].idx_itype == idx_byte_array
1784                          || idx->idx_rpt[0].idx_itype == idx_metadata
1785 @@ -6094,10 +6094,10 @@
1786                 if (access_type) {
1787                         for (arg = access_type->nod_arg, end = arg + plan_count;
1788                                  arg < end; arg += 3) {
1789 -                               if (relation_id != (SSHORT) * arg)
1790 +                               if (relation_id != (SSHORT)(IPTR) * arg)
1791                                         /* index %s cannot be used in the specified plan */
1792                                         ERR_post(gds_index_unused, gds_arg_string, *(arg + 2), 0);
1793 -                               if (idx->idx_id == (USHORT) * (arg + 1))
1794 +                               if (idx->idx_id == (USHORT)(IPTR) * (arg + 1))
1795                                         if (access_type->nod_type == nod_navigational)
1796                                                 idx->idx_runtime_flags |= idx_plan_navigate;
1797                                         else            /* nod_indices */
1798 @@ -6169,13 +6169,13 @@
1799                    If left side is still not a field, give up */
1800  
1801                 if (match->nod_type != nod_field ||
1802 -                       (USHORT) match->nod_arg[e_fld_stream] != stream ||
1803 +                       (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
1804                         !computable(opt->opt_csb, value, stream, true, false))
1805                 {
1806                         match = value;
1807                         value = boolean->nod_arg[0];
1808                         if (match->nod_type != nod_field ||
1809 -                               (USHORT) match->nod_arg[e_fld_stream] != stream ||
1810 +                               (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
1811                                 !computable(opt->opt_csb, value, stream, true, false))
1812                         {
1813                                 return 0;
1814 @@ -6194,7 +6194,7 @@
1815  #ifdef EXPRESSION_INDICES
1816                         (idx->idx_expression ||
1817  #endif
1818 -                        ((USHORT) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field)
1819 +                        ((USHORT)(IPTR) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field)
1820  #ifdef EXPRESSION_INDICES
1821                         )
1822  #endif
1823 @@ -6582,7 +6582,7 @@
1824                 return FALSE;
1825         for (streams = river->riv_streams, end =
1826                  streams + river->riv_count; streams < end; streams++)
1827 -               if ((USHORT) node->nod_arg[e_fld_stream] == *streams)
1828 +               if ((USHORT)(IPTR) node->nod_arg[e_fld_stream] == *streams)
1829                         return TRUE;
1830         return FALSE;
1831  }
1832 @@ -6779,7 +6779,7 @@
1833                  ptr < end; ptr++) {
1834                 node = *ptr;
1835                 if (node->nod_type != nod_rse) {
1836 -                       stream = (USHORT) node->nod_arg[STREAM_INDEX(node)];
1837 +                       stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
1838                         csb->csb_rpt[stream].csb_flags &= ~csb_active;
1839                 }
1840                 else
1841 diff -ur firebird-1.5.3.4870-orig/src/jrd/par.cpp firebird-1.5.3.4870/src/jrd/par.cpp
1842 --- firebird-1.5.3.4870-orig/src/jrd/par.cpp    2006-03-17 01:39:04.000000000 -0500
1843 +++ firebird-1.5.3.4870/src/jrd/par.cpp 2006-03-17 01:32:31.000000000 -0500
1844 @@ -2518,7 +2518,7 @@
1845                 node->nod_arg[e_agg_rse] = parse(tdbb, csb, TYPE_RSE);
1846                 node->nod_arg[e_agg_group] = parse(tdbb, csb, OTHER);
1847                 node->nod_arg[e_agg_map] =
1848 -                       par_map(tdbb, csb, (USHORT) node->nod_arg[e_agg_stream]);
1849 +                       par_map(tdbb, csb, (USHORT)(IPTR) node->nod_arg[e_agg_stream]);
1850                 break;
1851  
1852         case blr_group_by:
1853 diff -ur firebird-1.5.3.4870-orig/src/jrd/rse.cpp firebird-1.5.3.4870/src/jrd/rse.cpp
1854 --- firebird-1.5.3.4870-orig/src/jrd/rse.cpp    2006-03-17 01:39:04.000000000 -0500
1855 +++ firebird-1.5.3.4870/src/jrd/rse.cpp 2006-03-17 01:32:31.000000000 -0500
1856 @@ -730,8 +730,8 @@
1857                                 /* Initialize the record number of each stream in the union */
1858  
1859                                 ptr = &rsb->rsb_arg[rsb->rsb_count];
1860 -                               for (end = ptr + (USHORT) * ptr; ++ptr <= end;)
1861 -                                       request->req_rpb[(USHORT) * ptr].rpb_number = -1;
1862 +                               for (end = ptr + (USHORT)(IPTR) * ptr; ++ptr <= end;)
1863 +                                       request->req_rpb[(USHORT)(IPTR) * ptr].rpb_number = -1;
1864  
1865                                 rsb = rsb->rsb_arg[0];
1866                         }
1867 @@ -2914,7 +2914,7 @@
1868         request = tdbb->tdbb_request;
1869         stack = (LLS) rsb->rsb_arg[streams];
1870         for (; stack; stack = stack->lls_next) {
1871 -               rpb = &request->req_rpb[(USHORT) stack->lls_object];
1872 +               rpb = &request->req_rpb[(USHORT)(IPTR) stack->lls_object];
1873  
1874                 /* Make sure a record block has been allocated.  If there isn't
1875                    one, first find the format, then allocate the record block */
1876 @@ -2972,7 +2972,7 @@
1877                    list that contains the data to send back
1878                  */
1879                 if (IS_INTL_DATA(&item->smb_desc) &&
1880 -                       (USHORT) item->smb_desc.dsc_address <
1881 +                       (USHORT)(IPTR) item->smb_desc.dsc_address <
1882                         map->smb_key_length * sizeof(ULONG)) continue;
1883  
1884                 rpb = &request->req_rpb[item->smb_stream];
1885 @@ -3238,7 +3238,7 @@
1886                                    the sort record, then want to sort by language dependent order */
1887  
1888                                 if (IS_INTL_DATA(&item->smb_desc) &&
1889 -                                       (USHORT) item->smb_desc.dsc_address <
1890 +                                       (USHORT)(IPTR) item->smb_desc.dsc_address <
1891                                         map->smb_key_length * sizeof(ULONG)) {
1892                                         INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc),
1893                                                                            from, &to, FALSE);
1894 diff -ur firebird-1.5.3.4870-orig/src/jrd/sdl.cpp firebird-1.5.3.4870/src/jrd/sdl.cpp
1895 --- firebird-1.5.3.4870-orig/src/jrd/sdl.cpp    2006-03-17 01:39:04.000000000 -0500
1896 +++ firebird-1.5.3.4870/src/jrd/sdl.cpp 2006-03-17 01:32:31.000000000 -0500
1897 @@ -699,7 +699,7 @@
1898                         }
1899                         element_desc = array_desc->ads_rpt[value].ads_desc;
1900                         element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array +
1901 -                               (SLONG) element_desc.dsc_address +
1902 +                               (SLONG)(IPTR) element_desc.dsc_address +
1903                                 (array_desc->ads_element_length * subscript);
1904  
1905                         /* Is this element within the array bounds? */
1906 diff -ur firebird-1.5.3.4870-orig/src/qli/command.cpp firebird-1.5.3.4870/src/qli/command.cpp
1907 --- firebird-1.5.3.4870-orig/src/qli/command.cpp        2006-03-17 01:39:04.000000000 -0500
1908 +++ firebird-1.5.3.4870/src/qli/command.cpp     2006-03-17 01:32:33.000000000 -0500
1909 @@ -311,32 +311,32 @@
1910         ptr = node->syn_arg;
1911  
1912         for (i = 0; i < node->syn_count; i++) {
1913 -               foo = (USHORT) * ptr++;
1914 +               foo = (USHORT)(IPTR) * ptr++;
1915                 sw = (ENUM set_t) foo;
1916                 value = *ptr++;
1917                 switch (sw) {
1918                 case set_blr:
1919 -                       QLI_blr = (USHORT) value;
1920 +                       QLI_blr = (USHORT)(IPTR) value;
1921                         break;
1922  
1923                 case set_statistics:
1924 -                       QLI_statistics = (USHORT) value;
1925 +                       QLI_statistics = (USHORT)(IPTR) value;
1926                         break;
1927  
1928                 case set_columns:
1929 -                       QLI_name_columns = QLI_columns = (USHORT) value;
1930 +                       QLI_name_columns = QLI_columns = (USHORT)(IPTR) value;
1931                         break;
1932  
1933                 case set_lines:
1934 -                       QLI_lines = (USHORT) value;
1935 +                       QLI_lines = (USHORT)(IPTR) value;
1936                         break;
1937  
1938                 case set_semi:
1939 -                       QLI_semi = (USHORT) value;
1940 +                       QLI_semi = (USHORT)(IPTR) value;
1941                         break;
1942  
1943                 case set_echo:
1944 -                       QLI_echo = (USHORT) value;
1945 +                       QLI_echo = (USHORT)(IPTR) value;
1946                         break;
1947  
1948                 case set_form:
1949 @@ -399,7 +399,7 @@
1950                         break;
1951  
1952                 case set_count:
1953 -                       QLI_count = (USHORT) value;
1954 +                       QLI_count = (USHORT)(IPTR) value;
1955                         break;
1956  
1957                 case set_charset:
1958 diff -ur firebird-1.5.3.4870-orig/src/qli/expand.cpp firebird-1.5.3.4870/src/qli/expand.cpp
1959 --- firebird-1.5.3.4870-orig/src/qli/expand.cpp 2006-03-17 01:39:04.000000000 -0500
1960 +++ firebird-1.5.3.4870/src/qli/expand.cpp      2006-03-17 01:32:33.000000000 -0500
1961 @@ -2220,7 +2220,7 @@
1962         for (i = 0; i < node->nod_count; i++) {
1963                 expr = *syn_ptr++;
1964                 if (expr->syn_type == nod_position) {
1965 -                       position = (USHORT) expr->syn_arg[0];
1966 +                       position = (USHORT)(IPTR) expr->syn_arg[0];
1967                         if (!list || !position || position > list->nod_count)
1968                                 IBERROR(152);   /* Msg152 invalid ORDER BY ordinal */
1969                         item = (ITM) list->nod_arg[position - 1];
1970 diff -ur firebird-1.5.3.4870-orig/src/qli/meta.epp firebird-1.5.3.4870/src/qli/meta.epp
1971 --- firebird-1.5.3.4870-orig/src/qli/meta.epp   2006-03-17 01:39:04.000000000 -0500
1972 +++ firebird-1.5.3.4870/src/qli/meta.epp        2006-03-17 01:32:33.000000000 -0500
1973 @@ -3795,7 +3795,7 @@
1974         RLB rlb;
1975  
1976  
1977 -       privileges = (USHORT) node->syn_arg[s_grant_privileges];
1978 +       privileges = (USHORT)(IPTR) node->syn_arg[s_grant_privileges];
1979         relation = (QLI_REL) node->syn_arg[s_grant_relation];
1980         relation->rel_database = database = setup_update(relation->rel_database);
1981         relation_name = relation->rel_symbol->sym_string;
1982 diff -Naur firebird-1.5.3.4870.old/src/alice/alice.cpp firebird-1.5.3.4870/src/alice/alice.cpp
1983 --- firebird-1.5.3.4870.old/src/alice/alice.cpp 2006-08-06 06:47:26.000000000 +0200
1984 +++ firebird-1.5.3.4870/src/alice/alice.cpp     2006-08-06 07:59:27.000000000 +0200
1985 @@ -129,7 +129,7 @@
1986                 ALICE_gfix(     service->svc_argc,
1987                                         service->svc_argv,
1988                                         output_thread,
1989 -                                       (SLONG) service);
1990 +                                       (SLONG)(IPTR) service);
1991  
1992  //  Mark service thread as finished.
1993  //  If service is detached, cleanup memory being used by service.
1994 diff -Naur firebird-1.5.3.4870.old/src/burp/burp.cpp firebird-1.5.3.4870/src/burp/burp.cpp
1995 --- firebird-1.5.3.4870.old/src/burp/burp.cpp   2006-08-06 06:47:20.000000000 +0200
1996 +++ firebird-1.5.3.4870/src/burp/burp.cpp       2006-08-06 07:58:54.000000000 +0200
1997 @@ -181,7 +181,7 @@
1998         int exit_code;
1999  
2000         exit_code = BURP_gbak(service->svc_argc, service->svc_argv,
2001 -                                                 output_netware, (SLONG) service);
2002 +                                                 output_netware, (SLONG) (IPTR) service);
2003  
2004  /* Mark service thread as finished. */
2005  /* If service is detached, cleanup memory being used by service. */
2006 diff -Naur firebird-1.5.3.4870.old/src/burp/canonical.cpp firebird-1.5.3.4870/src/burp/canonical.cpp
2007 --- firebird-1.5.3.4870.old/src/burp/canonical.cpp      2006-08-06 06:47:20.000000000 +0200
2008 +++ firebird-1.5.3.4870/src/burp/canonical.cpp  2006-08-06 07:54:25.000000000 +0200
2009 @@ -502,7 +502,7 @@
2010         UCHAR *p;
2011         SSHORT n;
2012  
2013 -       p = buffer + (int) desc->dsc_address;
2014 +       p = buffer + (int) (IPTR)desc->dsc_address;
2015  
2016         switch (desc->dsc_dtype)
2017         {
2018 diff -Naur firebird-1.5.3.4870.old/src/dsql/ddl.cpp firebird-1.5.3.4870/src/dsql/ddl.cpp
2019 --- firebird-1.5.3.4870.old/src/dsql/ddl.cpp    2006-08-06 06:47:20.000000000 +0200
2020 +++ firebird-1.5.3.4870/src/dsql/ddl.cpp        2006-08-06 07:36:46.000000000 +0200
2021 @@ -1126,12 +1126,12 @@
2022         if (constant)
2023         {
2024                 request->append_number(gds_dyn_trg_sequence,
2025 -                                  (SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0));
2026 +                                  (SSHORT)(SLONG)(IPTR) (constant ? constant->nod_arg[0] : 0));
2027         }
2028  
2029         if ((constant = node->nod_arg[e_cnstr_type]) != NULL)
2030         {
2031 -               const SSHORT type = (SSHORT)(SLONG) constant->nod_arg[0];
2032 +               const SSHORT type = (SSHORT)(SLONG)(IPTR) constant->nod_arg[0];
2033                 request->append_number(gds_dyn_trg_type, type);
2034         }
2035  
2036 @@ -1270,7 +1270,7 @@
2037  
2038                         switch (element->nod_type) {
2039                         case nod_file_length:
2040 -                               start = (SLONG) (element->nod_arg[0]) + 1;
2041 +                               start = (SLONG) (IPTR) (element->nod_arg[0]) + 1;
2042                                 break;
2043  
2044                         default:
2045 @@ -1336,25 +1336,25 @@
2046  
2047                         case nod_group_commit_wait:
2048                                 request->append_uchar(gds_dyn_log_group_commit_wait);
2049 -                               temp_long = (SLONG) (element->nod_arg[0]);
2050 +                               temp_long = (SLONG) (IPTR) (element->nod_arg[0]);
2051                                 request->append_ulong_with_length(temp_long);
2052                                 break;
2053  
2054                         case nod_check_point_len:
2055                                 request->append_uchar(gds_dyn_log_check_point_length);
2056 -                               temp_long = (SLONG) (element->nod_arg[0]);
2057 +                               temp_long = (SLONG) (IPTR) (element->nod_arg[0]);
2058                                 request->append_ulong_with_length(temp_long);
2059                                 break;
2060  
2061                         case nod_num_log_buffers:
2062                                 request->append_uchar(gds_dyn_log_num_of_buffers);
2063 -                               temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
2064 +                               temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]);
2065                                 request->append_ushort_with_length(temp_short);
2066                                 break;
2067  
2068                         case nod_log_buffer_size:
2069                                 request->append_uchar(gds_dyn_log_buffer_size);
2070 -                               temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
2071 +                               temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]);
2072                                 request->append_ushort_with_length(temp_short);
2073                                 break;
2074  
2075 @@ -1637,11 +1637,11 @@
2076                 request->append_number(gds_dyn_def_dimension, position);
2077                 DSQL_NOD element = *ptr++;
2078                 request->append_uchar(gds_dyn_dim_lower);
2079 -               SLONG lrange = (SLONG) (element->nod_arg[0]);
2080 +               SLONG lrange = (SLONG) (IPTR) (element->nod_arg[0]);
2081                 request->append_ulong_with_length(lrange);
2082                 element = *ptr;
2083                 request->append_uchar(gds_dyn_dim_upper);
2084 -               SLONG hrange = (SLONG) (element->nod_arg[0]);
2085 +               SLONG hrange = (SLONG) (IPTR) (element->nod_arg[0]);
2086                 request->append_ulong_with_length(hrange);
2087                 request->append_uchar(gds_dyn_end);
2088                 if (lrange >= hrange)
2089 @@ -2062,9 +2062,9 @@
2090         request->append_cstring(gds_dyn_def_filter,
2091                                 ((STR) (ptr[e_filter_name]))->str_data);
2092         request->append_number(gds_dyn_filter_in_subtype,
2093 -                          (SSHORT)(SLONG) ((ptr[e_filter_in_type])->nod_arg[0]));
2094 +                          (SSHORT)(SLONG) (IPTR) ((ptr[e_filter_in_type])->nod_arg[0]));
2095         request->append_number(gds_dyn_filter_out_subtype,
2096 -                          (SSHORT)(SLONG) ((ptr[e_filter_out_type])->nod_arg[0]));
2097 +                          (SSHORT)(SLONG) (IPTR) ((ptr[e_filter_out_type])->nod_arg[0]));
2098         request->append_cstring(gds_dyn_func_entry_point,
2099                                 ((STR) (ptr[e_filter_entry_pt]))->str_data);
2100         request->append_cstring(gds_dyn_func_module_name,
2101 @@ -2670,16 +2670,16 @@
2102                                   gds_arg_gds, gds_dsql_shadow_number_err, 0);
2103         }
2104  
2105 -       request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (ptr[e_shadow_number]));
2106 +       request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (IPTR) (ptr[e_shadow_number]));
2107         request->append_cstring(gds_dyn_def_file, ((STR) (ptr[e_shadow_name]))->str_data);
2108         request->append_number(gds_dyn_shadow_man_auto,
2109 -                          (SSHORT)(SLONG) ((ptr[e_shadow_man_auto])->nod_arg[0]));
2110 +                          (SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_man_auto])->nod_arg[0]));
2111         request->append_number(gds_dyn_shadow_conditional,
2112 -                          (SSHORT)(SLONG) ((ptr[e_shadow_conditional])->nod_arg[0]));
2113 +                          (SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_conditional])->nod_arg[0]));
2114  
2115         request->append_file_start(0);
2116  
2117 -       SLONG length = (SLONG) ptr[e_shadow_length];
2118 +       SLONG length = (SLONG) (IPTR) ptr[e_shadow_length];
2119         request->append_file_length(length);
2120  
2121         request->append_uchar(gds_dyn_end);
2122 @@ -2806,15 +2806,15 @@
2123  
2124         if (constant = node->nod_arg[e_trg_active])
2125                 request->append_number(gds_dyn_trg_inactive,
2126 -                                  (SSHORT)(SLONG) constant->nod_arg[0]);
2127 +                                  (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
2128  
2129         if (constant = node->nod_arg[e_trg_position])
2130                 request->append_number(gds_dyn_trg_sequence,
2131 -                                  (SSHORT)(SLONG) constant->nod_arg[0]);
2132 +                                  (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
2133  
2134         if (constant = node->nod_arg[e_trg_type]) {
2135 -               request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) constant->nod_arg[0]);
2136 -               trig_type = (USHORT)(ULONG) constant->nod_arg[0];
2137 +               request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]);
2138 +               trig_type = (USHORT)(ULONG) (IPTR) constant->nod_arg[0];
2139         }
2140         else {
2141                 assert(node->nod_type == nod_mod_trigger);
2142 @@ -2893,7 +2893,7 @@
2143                 for (DSQL_NOD* ptr = temp->nod_arg; ptr < end; ++ptr)
2144                 {
2145                         DSQL_NOD    message = *ptr;
2146 -                       SSHORT number  = (SSHORT)(SLONG) message->nod_arg[e_msg_number];
2147 +                       SSHORT number  = (SSHORT)(SLONG) (IPTR) message->nod_arg[e_msg_number];
2148                         if (message->nod_type == nod_del_trigger_msg)
2149                         {
2150                                 request->append_number(gds_dyn_delete_trigger_msg, number);
2151 @@ -2954,7 +2954,7 @@
2152          // CVC: This is case of "returns <type> [by value|reference]"
2153                 /* Some data types can not be returned as value */
2154  
2155 -               if (((int)(SLONG) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) &&
2156 +               if (((int)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) &&
2157                         (field->fld_dtype == dtype_text ||
2158                          field->fld_dtype == dtype_varying ||
2159                          field->fld_dtype == dtype_cstring ||
2160 @@ -2998,7 +2998,7 @@
2161          // CVC: This is case of "returns parameter <N>"
2162  
2163  
2164 -               position = (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]);
2165 +               position = (SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]);
2166                 /* Function modifies an argument whose value is the function return value */
2167  
2168                 if (!arguments || position > arguments->nod_count || position < 1) {
2169 @@ -3024,7 +3024,7 @@
2170                 if (field->fld_dtype == dtype_blob)
2171                 {
2172          /* CVC: I need to test returning blobs by descriptor before allowing the        change there. For now, I ignore the return type specification. */
2173 -                       BOOLEAN free_it = ((SSHORT)(SLONG) ret_val_ptr[1]->nod_arg[0] < 0);
2174 +                       BOOLEAN free_it = ((SSHORT)(SLONG) (IPTR) ret_val_ptr[1]->nod_arg[0] < 0);
2175                         request->append_number(gds_dyn_def_function_arg, blob_position);
2176                         request->append_number(gds_dyn_func_mechanism,
2177                                            (SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct));
2178 @@ -3035,7 +3035,7 @@
2179                 {
2180                         request->append_number(gds_dyn_def_function_arg, (SSHORT) 0);
2181                         request->append_number(gds_dyn_func_mechanism,
2182 -                                          (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]));
2183 +                                          (SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]));
2184                 }
2185  
2186                 request->append_cstring(gds_dyn_function_name, udf_name);
2187 @@ -3070,7 +3070,7 @@
2188                         request->append_number(gds_dyn_def_function_arg, (SSHORT) position);
2189  
2190              if (param_node [e_udf_param_type]) {
2191 -                SSHORT arg_mechanism = (SSHORT)(SLONG) (param_node [e_udf_param_type]->nod_arg [0]);
2192 +                SSHORT arg_mechanism = (SSHORT)(SLONG) (IPTR) (param_node [e_udf_param_type]->nod_arg [0]);
2193                                 request->append_number(gds_dyn_func_mechanism, arg_mechanism);
2194              }
2195              else if (field->fld_dtype == dtype_blob) {
2196 @@ -3677,13 +3677,13 @@
2197         if (constant)
2198         {
2199                 request->append_number(gds_dyn_trg_sequence,
2200 -                                  (SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0));
2201 +                                  (SSHORT)(SLONG) (IPTR) (constant ? constant->nod_arg[0] : 0));
2202         }
2203  
2204         constant = node->nod_arg[e_cnstr_type];
2205         if (constant)
2206         {
2207 -               trig_type = (USHORT)(ULONG) constant->nod_arg[0];
2208 +               trig_type = (USHORT)(ULONG)(IPTR) constant->nod_arg[0];
2209                 request->append_number(gds_dyn_trg_type, trig_type);
2210         }
2211         else
2212 @@ -4173,7 +4173,7 @@
2213  
2214         case nod_del_shadow:
2215                 request->append_number(gds_dyn_delete_shadow,
2216 -                                  (SSHORT)(SLONG) (node->nod_arg[0]));
2217 +                                  (SSHORT)(SLONG) (IPTR) (node->nod_arg[0]));
2218                 request->append_uchar(gds_dyn_end);
2219                 break;
2220  
2221 @@ -4611,25 +4611,25 @@
2222  
2223                 case nod_group_commit_wait:
2224                         request->append_uchar(gds_dyn_log_group_commit_wait);
2225 -                       temp_long = (SLONG) (element->nod_arg[0]);
2226 +                       temp_long = (SLONG)(IPTR) (element->nod_arg[0]);
2227                         request->append_ulong_with_length(temp_long);
2228                         break;
2229  
2230                 case nod_check_point_len:
2231                         request->append_uchar(gds_dyn_log_check_point_length);
2232 -                       temp_long = (SLONG) (element->nod_arg[0]);
2233 +                       temp_long = (SLONG)(IPTR) (element->nod_arg[0]);
2234                         request->append_ulong_with_length(temp_long);
2235                         break;
2236  
2237                 case nod_num_log_buffers:
2238                         request->append_uchar(gds_dyn_log_num_of_buffers);
2239 -                       temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
2240 +                       temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]);
2241                         request->append_ushort_with_length(temp_short);
2242                         break;
2243  
2244                 case nod_log_buffer_size:
2245                         request->append_uchar(gds_dyn_log_buffer_size);
2246 -                       temp_short = (SSHORT)(SLONG) (element->nod_arg[0]);
2247 +                       temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]);
2248                         request->append_ushort_with_length(temp_short);
2249                         break;
2250                 case nod_drop_log:
2251 @@ -5095,7 +5095,7 @@
2252                                 const_node = element->nod_arg[e_mod_fld_pos_new_position];
2253  
2254                  /* CVC: Since now the parser accepts pos=1..N, let's subtract one here. */
2255 -                constant = (SSHORT)(SLONG) const_node->nod_arg [0] - 1;
2256 +                constant = (SSHORT)(SLONG) (IPTR) const_node->nod_arg [0] - 1;
2257  
2258                                 request->append_cstring(gds_dyn_rel_name,
2259                                                         relation_name->str_data);
2260 diff -Naur firebird-1.5.3.4870.old/src/dsql/dsql.cpp firebird-1.5.3.4870/src/dsql/dsql.cpp
2261 --- firebird-1.5.3.4870.old/src/dsql/dsql.cpp   2006-08-06 06:47:20.000000000 +0200
2262 +++ firebird-1.5.3.4870/src/dsql/dsql.cpp       2006-08-06 07:38:45.000000000 +0200
2263 @@ -1136,8 +1136,8 @@
2264                         parameter = request->req_blob->blb_segment;
2265                         PAR null = parameter->par_null;
2266                         USHORT* ret_length =
2267 -                               (USHORT *) (dsql_msg + (SLONG) null->par_user_desc.dsc_address);
2268 -                       UCHAR* buffer = dsql_msg + (SLONG) parameter->par_user_desc.dsc_address;
2269 +                               (USHORT *) (dsql_msg + (SLONG) (IPTR) null->par_user_desc.dsc_address);
2270 +                       UCHAR* buffer = dsql_msg + (SLONG) (IPTR) parameter->par_user_desc.dsc_address;
2271                         THREAD_EXIT;
2272                         s = isc_get_segment(tdsql->tsql_status,
2273                                                         GDS_REF(request->req_handle),
2274 @@ -1314,7 +1314,7 @@
2275                         parameter = request->req_blob->blb_segment;
2276                         buffer =
2277                                 reinterpret_cast<SCHAR*>(
2278 -                                       dsql_msg + (SLONG) parameter->par_user_desc.dsc_address);
2279 +                                       dsql_msg + (SLONG) (IPTR) parameter->par_user_desc.dsc_address);
2280                         THREAD_EXIT;
2281                         s = isc_put_segment(tdsql->tsql_status,
2282                                                         GDS_REF(request->req_handle),
2283 @@ -3210,7 +3210,7 @@
2284         PAR parameter, null;
2285  
2286         if (node->nod_type == nod_constant)
2287 -               return (SSHORT)(SLONG) node->nod_arg[0];
2288 +               return (SSHORT)(SLONG) (IPTR) node->nod_arg[0];
2289  
2290         parameter = (PAR) node->nod_arg[e_par_parameter];
2291         if (null = parameter->par_null)
2292 @@ -3976,7 +3976,7 @@
2293                          /* Make sure the message given to us is long enough */
2294  
2295                         DSC    desc   = parameter->par_user_desc;
2296 -                       USHORT length = (SLONG) desc.dsc_address + desc.dsc_length;
2297 +                       USHORT length = (SLONG) (IPTR) desc.dsc_address + desc.dsc_length;
2298                         if (length > msg_length)
2299                                 break;
2300                         if (!desc.dsc_dtype)
2301 @@ -3985,7 +3985,7 @@
2302                         flag = NULL;
2303                         if ((null = parameter->par_null) != NULL)
2304                         {
2305 -                               USHORT null_offset = (USHORT)(ULONG) (null->par_user_desc.dsc_address);
2306 +                               USHORT null_offset = (USHORT)(ULONG) (IPTR) (null->par_user_desc.dsc_address);
2307                                 length = null_offset + sizeof(SSHORT);
2308                                 if (length > msg_length)
2309                                         break;
2310 @@ -4000,7 +4000,7 @@
2311                                 }
2312                         }
2313  
2314 -                       desc.dsc_address = dsql_msg + (SLONG) desc.dsc_address;
2315 +                       desc.dsc_address = dsql_msg + (SLONG) (IPTR) desc.dsc_address;
2316                         if (!request)
2317                                 MOVD_move(&parameter->par_desc, &desc);
2318                         else if (!flag || *flag >= 0)
2319 diff -Naur firebird-1.5.3.4870.old/src/dsql/gen.cpp firebird-1.5.3.4870/src/dsql/gen.cpp
2320 --- firebird-1.5.3.4870.old/src/dsql/gen.cpp    2006-08-06 06:47:20.000000000 +0200
2321 +++ firebird-1.5.3.4870/src/dsql/gen.cpp        2006-08-06 07:41:31.000000000 +0200
2322 @@ -636,7 +636,7 @@
2323         for (parameter = message->msg_parameters; parameter;
2324                  parameter = parameter->par_next)
2325                         parameter->par_desc.dsc_address =
2326 -                       message->msg_buffer + (SLONG) parameter->par_desc.dsc_address;
2327 +                       message->msg_buffer + (SLONG) (IPTR) parameter->par_desc.dsc_address;
2328  }
2329  
2330  
2331 @@ -1021,7 +1021,7 @@
2332         case nod_exec_into:
2333                 if (node->nod_arg[e_exec_into_block]) {
2334                         STUFF(blr_label);
2335 -                       STUFF((int)(SLONG) node->nod_arg[e_exec_into_number]);
2336 +                       STUFF((int)(SLONG) (IPTR) node->nod_arg[e_exec_into_number]);
2337                 }
2338                 STUFF(blr_exec_into);
2339                 temp = node->nod_arg[e_exec_into_list];
2340 @@ -1049,12 +1049,12 @@
2341  
2342      case nod_label:
2343          STUFF(blr_label);
2344 -        STUFF((int)(SLONG) node->nod_arg[e_label_number]);
2345 +        STUFF((int)(SLONG) (IPTR) node->nod_arg[e_label_number]);
2346          return;
2347         
2348      case nod_breakleave:
2349          STUFF(blr_leave);
2350 -        STUFF((int)(SLONG) node->nod_arg[e_breakleave_number]);
2351 +        STUFF((int)(SLONG)(IPTR) node->nod_arg[e_breakleave_number]);
2352          return;
2353  
2354         case nod_store:
2355 @@ -1069,7 +1069,7 @@
2356  
2357         case nod_abort:
2358                 STUFF(blr_leave);
2359 -               STUFF((int)(SLONG) node->nod_arg[e_abrt_number]);
2360 +               STUFF((int)(SLONG) (IPTR) node->nod_arg[e_abrt_number]);
2361                 return;
2362  
2363         case nod_start_savepoint:
2364 @@ -1149,14 +1149,14 @@
2365  
2366         case nod_while:
2367                 STUFF(blr_label);
2368 -               STUFF((int)(SLONG) node->nod_arg[e_while_number]);
2369 +               STUFF((int)(SLONG) (IPTR) node->nod_arg[e_while_number]);
2370                 STUFF(blr_loop);
2371                 STUFF(blr_begin);
2372                 STUFF(blr_if);
2373                 GEN_expr(request, node->nod_arg[e_while_cond]);
2374                 GEN_statement(request, node->nod_arg[e_while_action]);
2375                 STUFF(blr_leave);
2376 -               STUFF((int)(SLONG) node->nod_arg[e_while_number]);
2377 +               STUFF((int)(SLONG) (IPTR) node->nod_arg[e_while_number]);
2378                 STUFF(blr_end);
2379                 return;
2380  
2381 @@ -1556,7 +1556,7 @@
2382         switch (node->nod_type) {
2383         case nod_sqlcode:
2384                 STUFF(blr_sql_code);
2385 -               STUFF_WORD((USHORT)(ULONG) node->nod_arg[0]);
2386 +               STUFF_WORD((USHORT)(ULONG) (IPTR) node->nod_arg[0]);
2387                 return;
2388  
2389         case nod_gdscode:
2390 @@ -1667,7 +1667,7 @@
2391         what loop is the user trying to abandon? */
2392      if (for_select->nod_arg [e_flp_action]) {
2393          STUFF (blr_label);
2394 -        STUFF ((int) for_select->nod_arg [e_flp_number]);
2395 +        STUFF ((int) (IPTR) for_select->nod_arg [e_flp_number]);
2396      }
2397  
2398  /* Generate FOR loop */
2399 @@ -2546,7 +2546,7 @@
2400         for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++) {
2401                 dsql_nod* nulls_placement = (*ptr)->nod_arg[e_order_nulls];
2402                 if (nulls_placement) {
2403 -                       switch ((SLONG)nulls_placement->nod_arg[0]) {
2404 +                       switch ((SLONG) (IPTR) nulls_placement->nod_arg[0]) {
2405                                 case NOD_NULLS_FIRST:
2406                                         STUFF(blr_nullsfirst);
2407                                         break;
2408 diff -Naur firebird-1.5.3.4870.old/src/dsql/parse.y firebird-1.5.3.4870/src/dsql/parse.y
2409 --- firebird-1.5.3.4870.old/src/dsql/parse.y    2006-08-06 06:47:21.000000000 +0200
2410 +++ firebird-1.5.3.4870/src/dsql/parse.y        2006-08-06 07:49:47.000000000 +0200
2411 @@ -551,7 +551,7 @@
2412                 | set
2413                 | update
2414                 | KW_DEBUG signed_short_integer
2415 -                       { prepare_console_debug ((int) $2, &yydebug);
2416 +                       { prepare_console_debug ((int)(IPTR) $2, &yydebug);
2417                           $$ = make_node (nod_null, (int) 0, NULL); }
2418                 ;
2419  
2420 @@ -753,7 +753,7 @@
2421                 | CSTRING '(' pos_short_integer ')' charset_clause
2422                         { 
2423                         lex.g_field->fld_dtype = dtype_cstring; 
2424 -                       lex.g_field->fld_character_length = (USHORT) $3; }
2425 +                       lex.g_field->fld_character_length = (USHORT)(size_t) $3; }
2426                 ;
2427  
2428  arg_desc_list1 : 
2429 @@ -1158,7 +1158,7 @@
2430                 ;
2431  
2432  logfile_attr   : KW_SIZE equals long_integer
2433 -                       { lex.g_file->fil_length = (SLONG) $3; }
2434 +                       { lex.g_file->fil_length = (SLONG)(IPTR) $3; }
2435  /*
2436                 | RAW_PARTITIONS equals pos_short_integer
2437                         { lex.g_file->fil_partitions = (SSHORT) $3; 
2438 @@ -1178,9 +1178,9 @@
2439                 ;
2440  
2441  file_clause    : STARTING file_clause_noise long_integer
2442 -                       { lex.g_file->fil_start = (SLONG) $3;}
2443 +                       { lex.g_file->fil_start = (SLONG)(IPTR) $3;}
2444                 | LENGTH equals long_integer page_noise
2445 -                       { lex.g_file->fil_length = (SLONG) $3;}
2446 +                       { lex.g_file->fil_length = (SLONG)(IPTR) $3;}
2447                 ;
2448  
2449  file_clause_noise :
2450 @@ -2186,7 +2186,7 @@
2451                 ;
2452  
2453  array_range    : signed_long_integer
2454 -                       { if ((SLONG) $1 < 1)
2455 +                       { if ((SLONG)(IPTR) $1 < 1)
2456                                 $$ = make_node (nod_list, (int) 2, 
2457                                         MAKE_constant ((STR) $1, CONSTANT_SLONG), 
2458                                         MAKE_constant ((STR) 1, CONSTANT_SLONG)); 
2459 @@ -2292,26 +2292,26 @@
2460                 | BLOB '(' unsigned_short_integer ')'
2461                         { 
2462                         lex.g_field->fld_dtype = dtype_blob; 
2463 -                       lex.g_field->fld_seg_length = (USHORT) $3;
2464 +                       lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
2465                         lex.g_field->fld_sub_type = 0;
2466                         }
2467                 | BLOB '(' unsigned_short_integer ',' signed_short_integer ')'
2468                         { 
2469                         lex.g_field->fld_dtype = dtype_blob; 
2470 -                       lex.g_field->fld_seg_length = (USHORT) $3;
2471 -                       lex.g_field->fld_sub_type = (USHORT) $5;
2472 +                       lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
2473 +                       lex.g_field->fld_sub_type = (USHORT)(size_t) $5;
2474                         }
2475                 | BLOB '(' ',' signed_short_integer ')'
2476                         { 
2477                         lex.g_field->fld_dtype = dtype_blob; 
2478                         lex.g_field->fld_seg_length = 80;
2479 -                       lex.g_field->fld_sub_type = (USHORT) $4;
2480 +                       lex.g_field->fld_sub_type = (USHORT)(size_t) $4;
2481                         }
2482                 ;
2483  
2484  blob_segsize   : SEGMENT KW_SIZE unsigned_short_integer
2485                         {
2486 -                       lex.g_field->fld_seg_length = (USHORT) $3;
2487 +                       lex.g_field->fld_seg_length = (USHORT)(size_t) $3;
2488                         }
2489                 |
2490                         {
2491 @@ -2321,7 +2321,7 @@
2492  
2493  blob_subtype   : SUB_TYPE signed_short_integer
2494                         {
2495 -                       lex.g_field->fld_sub_type = (USHORT) $2;
2496 +                       lex.g_field->fld_sub_type = (USHORT)(size_t) $2;
2497                         }
2498                 | SUB_TYPE symbol_blob_subtype_name
2499                         {
2500 @@ -2347,7 +2347,7 @@
2501  national_character_type        : national_character_keyword '(' pos_short_integer ')'
2502                         { 
2503                         lex.g_field->fld_dtype = dtype_text; 
2504 -                       lex.g_field->fld_character_length = (USHORT) $3; 
2505 +                       lex.g_field->fld_character_length = (USHORT)(size_t) $3; 
2506                         lex.g_field->fld_flags |= FLD_national;
2507                         }
2508                 | national_character_keyword
2509 @@ -2359,7 +2359,7 @@
2510                 | national_character_keyword VARYING '(' pos_short_integer ')'
2511                         { 
2512                         lex.g_field->fld_dtype = dtype_varying; 
2513 -                       lex.g_field->fld_character_length = (USHORT) $4; 
2514 +                       lex.g_field->fld_character_length = (USHORT)(size_t) $4; 
2515                         lex.g_field->fld_flags |= FLD_national;
2516                         }
2517                 ;
2518 @@ -2367,7 +2367,7 @@
2519  character_type : character_keyword '(' pos_short_integer ')'
2520                         { 
2521                         lex.g_field->fld_dtype = dtype_text; 
2522 -                       lex.g_field->fld_character_length = (USHORT) $3; 
2523 +                       lex.g_field->fld_character_length = (USHORT)(size_t) $3; 
2524                         }
2525                 | character_keyword
2526                         { 
2527 @@ -2377,7 +2377,7 @@
2528                 | varying_keyword '(' pos_short_integer ')'
2529                         { 
2530                         lex.g_field->fld_dtype = dtype_varying; 
2531 -                       lex.g_field->fld_character_length = (USHORT) $3; 
2532 +                       lex.g_field->fld_character_length = (USHORT)(size_t) $3; 
2533                         }
2534                 ;
2535  
2536 @@ -2429,10 +2429,10 @@
2537                         }
2538                 | '(' signed_long_integer ')'
2539                         {         
2540 -                       if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) )
2541 +                       if ( ((SLONG)(IPTR) $2 < 1) || ((SLONG)(IPTR) $2 > 18) )
2542                             yyabandon (-842, isc_precision_err);
2543                                 /* Precision most be between 1 and 18. */ 
2544 -                       if ((SLONG) $2 > 9)
2545 +                       if ((SLONG)(IPTR) $2 > 9)
2546                             {
2547                             if ( ( (client_dialect <= SQL_DIALECT_V5) &&
2548                                    (db_dialect     >  SQL_DIALECT_V5) ) ||
2549 @@ -2469,7 +2469,7 @@
2550                                 }
2551                             }
2552                         else 
2553 -                           if ((SLONG) $2 < 5)
2554 +                           if ((SLONG)(IPTR) $2 < 5)
2555                                 {
2556                                 lex.g_field->fld_dtype = dtype_short; 
2557                                 lex.g_field->fld_length = sizeof (SSHORT); 
2558 @@ -2479,17 +2479,17 @@
2559                                 lex.g_field->fld_dtype = dtype_long; 
2560                                 lex.g_field->fld_length = sizeof (SLONG); 
2561                                 }
2562 -                       lex.g_field->fld_precision = (USHORT) $2;
2563 +                       lex.g_field->fld_precision = (USHORT)(size_t) $2;
2564                         }
2565                 | '(' signed_long_integer ',' signed_long_integer ')'
2566                         { 
2567 -                       if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) )
2568 +                       if ( ((SLONG)(IPTR) $2 < 1) || ((SLONG)(IPTR) $2 > 18) )
2569                             yyabandon (-842, isc_precision_err);
2570                                 /* Precision should be between 1 and 18 */ 
2571 -                       if (((SLONG) $4 > (SLONG) $2) || ((SLONG) $4 < 0))
2572 +                       if (((SLONG)(IPTR) $4 > (SLONG)(IPTR) $2) || ((SLONG)(IPTR) $4 < 0))
2573                             yyabandon (-842, isc_scale_nogt);
2574                                 /* Scale must be between 0 and precision */
2575 -                       if ((SLONG) $2 > 9)
2576 +                       if ((SLONG)(IPTR) $2 > 9)
2577                             {
2578                             if ( ( (client_dialect <= SQL_DIALECT_V5) &&
2579                                    (db_dialect     >  SQL_DIALECT_V5) ) ||
2580 @@ -2527,7 +2527,7 @@
2581                             }
2582                         else
2583                             {
2584 -                           if ((SLONG) $2 < 5)
2585 +                           if ((SLONG)(IPTR) $2 < 5)
2586                                 {
2587                                 lex.g_field->fld_dtype = dtype_short; 
2588                                 lex.g_field->fld_length = sizeof (SSHORT); 
2589 @@ -2538,8 +2538,8 @@
2590                                 lex.g_field->fld_length = sizeof (SLONG); 
2591                                 }
2592                             }
2593 -                       lex.g_field->fld_precision = (USHORT) $2;
2594 -                       lex.g_field->fld_scale = - (SSHORT) $4;
2595 +                       lex.g_field->fld_precision = (USHORT)(size_t) $2;
2596 +                       lex.g_field->fld_scale = - (SSHORT)(size_t) $4;
2597                         }
2598                 ;
2599  
2600 @@ -2553,7 +2553,7 @@
2601  
2602  float_type     : KW_FLOAT precision_opt
2603                         { 
2604 -                       if ((SLONG) $2 > 7)
2605 +                       if ((SLONG)(IPTR) $2 > 7)
2606                             {
2607                             lex.g_field->fld_dtype = dtype_double;
2608                             lex.g_field->fld_length = sizeof (double); 
2609 @@ -2756,7 +2756,7 @@
2610                 ;
2611  
2612  table_lock     : FOR lock_type lock_mode
2613 -                       { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT) $2 | (SSHORT) $3), (SSHORT) 0, NULL); }
2614 +                       { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(size_t) $2 | (SSHORT)(size_t) $3), (SSHORT) 0, NULL); }
2615                 |
2616                         { $$ = 0; }
2617                 ;
2618 @@ -3706,32 +3706,32 @@
2619  
2620  signed_short_integer   :       nonneg_short_integer
2621                 | '-' neg_short_integer
2622 -                       { $$ = (DSQL_NOD) - (SLONG) $2; }
2623 +                       { $$ = (DSQL_NOD) - (SLONG)(IPTR) $2; }
2624                 ;
2625  
2626  nonneg_short_integer   : NUMBER
2627 -                       { if ((SLONG) $1 > SHRT_POS_MAX)
2628 +                       { if ((SLONG)(IPTR) $1 > SHRT_POS_MAX)
2629                             yyabandon (-842, isc_expec_short);
2630                                 /* Short integer expected */
2631                           $$ = $1;}
2632                 ;
2633  
2634  neg_short_integer : NUMBER
2635 -                       { if ((SLONG) $1 > SHRT_NEG_MAX)
2636 +                       { if ((SLONG)(IPTR) $1 > SHRT_NEG_MAX)
2637                             yyabandon (-842, isc_expec_short);
2638                                 /* Short integer expected */
2639                           $$ = $1;}
2640                 ;
2641  
2642  pos_short_integer : nonneg_short_integer
2643 -                       { if ((SLONG) $1 == 0)
2644 +                       { if ((SLONG)(IPTR) $1 == 0)
2645                             yyabandon (-842, isc_expec_positive);
2646                                 /* Positive number expected */
2647                           $$ = $1;}
2648                 ;
2649  
2650  unsigned_short_integer : NUMBER
2651 -                       { if ((SLONG) $1 > SHRT_UNSIGNED_MAX)
2652 +                       { if ((SLONG)(IPTR) $1 > SHRT_UNSIGNED_MAX)
2653                             yyabandon (-842, isc_expec_ushort);
2654                                 /* Unsigned short integer expected */
2655                           $$ = $1;}
2656 @@ -3739,7 +3739,7 @@
2657  
2658  signed_long_integer    :       long_integer
2659                 | '-' long_integer
2660 -                       { $$ = (DSQL_NOD) - (SLONG) $2; }
2661 +                       { $$ = (DSQL_NOD) - (SLONG)(IPTR) $2; }
2662                 ;
2663  
2664  long_integer   : NUMBER
2665 @@ -3820,14 +3820,14 @@
2666  
2667  string_value_function  :  SUBSTRING '(' value FROM pos_short_integer ')'
2668                                 { $$ = make_node (nod_substr, e_substr_count, $3,
2669 -                                       MAKE_constant ((STR) ((SLONG)($5) - 1), CONSTANT_SLONG),
2670 +                                       MAKE_constant ((STR) ((SLONG)(IPTR)($5) - 1), CONSTANT_SLONG),
2671                                         MAKE_constant ((STR) SHRT_POS_MAX, CONSTANT_SLONG)); }
2672                         /* CVC: It was easier to provide a constant with maximum value if the
2673                         third parameter -length- is ommitted than to chase and fix the functions
2674                         that treat nod_substr as an aggregate and do not expect NULL arguments. */
2675                         | SUBSTRING '(' value FROM pos_short_integer FOR nonneg_short_integer ')'
2676                                 { $$ = make_node (nod_substr, e_substr_count, $3,
2677 -                                       MAKE_constant ((STR) ((SLONG)($5) - 1), CONSTANT_SLONG),
2678 +                                       MAKE_constant ((STR) ((SLONG)(IPTR)($5) - 1), CONSTANT_SLONG),
2679                                         MAKE_constant ((STR) ($7), CONSTANT_SLONG)); }
2680                         | KW_UPPER '(' value ')'
2681                                 { $$ = make_node (nod_upcase, 1, $3); }
2682 @@ -4960,7 +4960,7 @@
2683  
2684      CHECK_BOUND(p);
2685      *p = 0;
2686 -    sym = HSHD_lookup (NULL_PTR, (TEXT *) string, (SSHORT)(p - string), SYM_keyword, parser_version);
2687 +    sym = HSHD_lookup (NULL_PTR, (TEXT *) string, (SSHORT)(size_t)(p - string), SYM_keyword, parser_version);
2688      if (sym)
2689         {
2690         /* 13 June 2003. Nickolay Samofatov
2691 diff -Naur firebird-1.5.3.4870.old/src/dsql/pass1.cpp firebird-1.5.3.4870/src/dsql/pass1.cpp
2692 --- firebird-1.5.3.4870.old/src/dsql/pass1.cpp  2006-08-06 06:47:20.000000000 +0200
2693 +++ firebird-1.5.3.4870/src/dsql/pass1.cpp      2006-08-06 07:52:09.000000000 +0200
2694 @@ -642,7 +642,7 @@
2695                                                                           TRUE, TRUE,
2696                                                                           /* Pass 0 here to restore older parameter 
2697                                                                                 ordering behavior */
2698 -                                                                         (USHORT)(ULONG) input->nod_arg[0]);
2699 +                                                                         (USHORT)(ULONG)(IPTR) input->nod_arg[0]);
2700                 return node;
2701  
2702         case nod_udf:
2703 @@ -1561,7 +1561,7 @@
2704                                 }
2705                                 else {
2706                                         // we have Count(*)
2707 -                                       if (request->req_scope_level == (ULONG) node->nod_arg[1]) {
2708 +                                       if (request->req_scope_level == (ULONG)(IPTR) node->nod_arg[1]) {
2709                                                 aggregate = TRUE;
2710                                         }
2711                                 }
2712 @@ -4426,7 +4426,7 @@
2713                                         (slist_node->nod_type == nod_list))
2714                                 {
2715                                         /* an select list is there */
2716 -                                       position = (ULONG) sub->nod_arg[0];
2717 +                                       position = (ULONG)(IPTR) sub->nod_arg[0];
2718                                         if ((position < 1) || (position > (ULONG) slist_node->nod_count)) 
2719                                         {
2720                                                 ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
2721 @@ -4819,7 +4819,7 @@
2722                 }
2723  
2724                 if (node1->nod_type == nod_constant && node1->nod_desc.dsc_dtype == dtype_long) {
2725 -                       position = (ULONG) (node1->nod_arg[0]);
2726 +                       position = (ULONG)(IPTR) (node1->nod_arg[0]);
2727                         if ((position < 1) || !s_list || 
2728                                 (position > (ULONG) s_list->nod_count)) {
2729                                 ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
2730 @@ -5082,7 +5082,7 @@
2731                                 ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
2732                                                   gds_arg_gds, gds_dsql_command_err, gds_arg_gds, gds_order_by_err,     /* invalid ORDER BY clause */
2733                                                   0);
2734 -                       number = (SLONG) position->nod_arg[0];
2735 +                       number = (SLONG)(IPTR) position->nod_arg[0];
2736                         if (number < 1 || number > union_items->nod_count)
2737                                 ERRD_post(gds_sqlerr, gds_arg_number, (SLONG) - 104,
2738                                                   gds_arg_gds, gds_dsql_command_err, gds_arg_gds, gds_order_by_err,     /* invalid ORDER BY clause */
2739 diff -Naur firebird-1.5.3.4870.old/src/dudley/generate.cpp firebird-1.5.3.4870/src/dudley/generate.cpp
2740 --- firebird-1.5.3.4870.old/src/dudley/generate.cpp     2006-08-06 06:47:26.000000000 +0200
2741 +++ firebird-1.5.3.4870/src/dudley/generate.cpp 2006-08-06 08:06:49.000000000 +0200
2742 @@ -426,7 +426,7 @@
2743         case nod_abort:
2744                 CHECK_BLR(2);
2745                 STUFF(blr_leave);
2746 -               STUFF((int) node->nod_arg[0]);
2747 +               STUFF((int) (IPTR) node->nod_arg[0]);
2748                 return;
2749  
2750         case nod_erase:
2751 diff -Naur firebird-1.5.3.4870.old/src/dudley/trn.cpp firebird-1.5.3.4870/src/dudley/trn.cpp
2752 --- firebird-1.5.3.4870.old/src/dudley/trn.cpp  2006-08-06 06:47:26.000000000 +0200
2753 +++ firebird-1.5.3.4870/src/dudley/trn.cpp      2006-08-06 08:07:12.000000000 +0200
2754 @@ -244,7 +244,7 @@
2755                                 break;
2756  
2757                         case act_d_shadow:
2758 -                               drop_shadow(dyn, (SLONG) (action->act_object));
2759 +                               drop_shadow(dyn, (SLONG)(IPTR) (action->act_object));
2760                                 break;
2761  
2762                         case act_m_trigger_msg:
2763 diff -Naur firebird-1.5.3.4870.old/src/jrd/jrd.cpp firebird-1.5.3.4870/src/jrd/jrd.cpp
2764 --- firebird-1.5.3.4870.old/src/jrd/jrd.cpp     2006-08-06 06:52:32.000000000 +0200
2765 +++ firebird-1.5.3.4870/src/jrd/jrd.cpp 2006-08-06 06:53:15.000000000 +0200
2766 @@ -3877,9 +3877,9 @@
2767         {
2768                 if ( (node = csb->csb_rpt[i].csb_message) )
2769                 {
2770 -                       if ((int) node->nod_arg[e_msg_number] == 0) {
2771 +                       if ((int) (IPTR) node->nod_arg[e_msg_number] == 0) {
2772                                 in_message = node;
2773 -                       } else if ((int) node->nod_arg[e_msg_number] == 1) {
2774 +                       } else if ((int) (IPTR) node->nod_arg[e_msg_number] == 1) {
2775                                 out_message = node;
2776                         }
2777                 }
2778 diff -Naur firebird-1.5.3.4870.old/src/jrd/jrn.cpp firebird-1.5.3.4870/src/jrd/jrn.cpp
2779 --- firebird-1.5.3.4870.old/src/jrd/jrn.cpp     2006-08-06 06:47:17.000000000 +0200
2780 +++ firebird-1.5.3.4870/src/jrd/jrn.cpp 2006-08-06 06:55:26.000000000 +0200
2781 @@ -836,7 +836,7 @@
2782         for (loop = 0; loop < 20; loop++) {
2783                 for (;;) {
2784                         journal->jrn_channel = (int *) socket(AF_INET, SOCK_STREAM, 0);
2785 -                       if ((int) journal->jrn_channel != -1)
2786 +                       if ((int) (IPTR) journal->jrn_channel != -1)
2787                                 break;
2788                         if (!SYSCALL_INTERRUPTED(errno)) {
2789                                 error(status_vector, journal, errno, "socket");
2790 @@ -859,18 +859,18 @@
2791                         return ret_val;
2792                 }
2793  
2794 -               if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
2795 +               if (!connect((int) (IPTR) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
2796                         break;
2797  
2798                 sleep(3);
2799  
2800                 if (loop < 16) {
2801 -                       close((int) journal->jrn_channel);
2802 +                       close((int) (IPTR) journal->jrn_channel);
2803                         continue;
2804                 }
2805                 if (!SYSCALL_INTERRUPTED(errno)) {
2806                         if (retry) {
2807 -                               close((int) journal->jrn_channel);
2808 +                               close((int) (IPTR) journal->jrn_channel);
2809                                 gds__free(journal);
2810                                 *ret_jrn = (JRN) NULL;
2811                                 return FB_SUCCESS;
2812 @@ -879,7 +879,7 @@
2813                         gds__free(journal);
2814                         return FB_FAILURE;
2815                 }
2816 -               close((int) journal->jrn_channel);
2817 +               close((int) (IPTR) journal->jrn_channel);
2818         }
2819  #endif
2820  
2821 @@ -939,7 +939,7 @@
2822                 if (retry)
2823                 {
2824  #ifdef BSD_SOCKETS
2825 -                       close((int) journal->jrn_channel);
2826 +                       close((int) (IPTR) journal->jrn_channel);
2827  #endif
2828  
2829  #ifdef WIN_NT
2830 @@ -1056,7 +1056,7 @@
2831      with us, so keep trying until successful.  */
2832  
2833         do {
2834 -               l = recv((int) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
2835 +               l = recv((int) (IPTR) journal->jrn_channel, (char *) reply, sizeof(struct jrnr), 0);
2836         } while (l < 0 && SYSCALL_INTERRUPTED(errno));
2837  
2838         if (l < 0) {
2839 @@ -1095,7 +1095,7 @@
2840   **************************************/
2841  
2842  #ifdef BSD_SOCKETS
2843 -       if (close((int) journal->jrn_channel) < 0) {
2844 +       if (close((int) (IPTR) journal->jrn_channel) < 0) {
2845                 error(status_vector, journal, errno, "close");
2846                 return FB_FAILURE;
2847         }
2848 @@ -1166,7 +1166,7 @@
2849      with us, so keep trying until successful.  */
2850  
2851         do {
2852 -               l = send((int) journal->jrn_channel, (char *) buffer, (int) length, 0);
2853 +               l = send((int) (IPTR) journal->jrn_channel, (char *) buffer, (int) length, 0);
2854         } while (l < 0 && SYSCALL_INTERRUPTED(errno));
2855  
2856         if (l < 0) {
2857 diff -Naur firebird-1.5.3.4870.old/src/jrd/lck.cpp firebird-1.5.3.4870/src/jrd/lck.cpp
2858 --- firebird-1.5.3.4870.old/src/jrd/lck.cpp     2006-08-06 06:47:17.000000000 +0200
2859 +++ firebird-1.5.3.4870/src/jrd/lck.cpp 2006-08-06 07:56:17.000000000 +0200
2860 @@ -87,8 +87,8 @@
2861  #ifdef SUPERSERVER
2862  
2863  #define LCK_OWNER_ID_PROCESS           (SLONG) getpid()
2864 -#define LCK_OWNER_ID_DBB               (SLONG) dbb
2865 -#define LCK_OWNER_ID_ATT               (SLONG) attachment
2866 +#define LCK_OWNER_ID_DBB               (SLONG)(IPTR) dbb
2867 +#define LCK_OWNER_ID_ATT               (SLONG)(IPTR) attachment
2868  
2869  #define LCK_OWNER_TYPE_PROCESS         LCK_OWNER_process
2870  #define LCK_OWNER_TYPE_DBB             LCK_OWNER_dbb
2871 diff -Naur firebird-1.5.3.4870.old/src/jrd/nav.cpp firebird-1.5.3.4870/src/jrd/nav.cpp
2872 --- firebird-1.5.3.4870.old/src/jrd/nav.cpp     2006-08-06 06:47:18.000000000 +0200
2873 +++ firebird-1.5.3.4870/src/jrd/nav.cpp 2006-08-06 07:00:00.000000000 +0200
2874 @@ -487,7 +487,7 @@
2875  
2876         init_fetch(impure);
2877         idx =
2878 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
2879 +               (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
2880  
2881  /* The bitmap is only valid when we are continuing on in one 
2882     direction.  It is of no help when we change direction,
2883 @@ -521,12 +521,12 @@
2884  #ifdef SCROLLABLE_CURSORS
2885                 MOVE_FAST(
2886                                   (impure->irsb_nav_data +
2887 -                                  (2 * (SLONG) rsb->rsb_arg[RSB_NAV_key_length])),
2888 +                                  (2 * (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length])),
2889                                   upper.key_data, upper.key_length);
2890  #else
2891                 MOVE_FAST(
2892                                   (impure->irsb_nav_data +
2893 -                                  (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
2894 +                                  (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
2895                                   upper.key_length);
2896  #endif
2897         }
2898 @@ -534,7 +534,7 @@
2899                 lower.key_length = impure->irsb_nav_lower_length;
2900                 MOVE_FAST(
2901                                   (impure->irsb_nav_data +
2902 -                                  (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
2903 +                                  (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
2904                                   lower.key_length);
2905         }
2906  
2907 @@ -1404,7 +1404,7 @@
2908         tdbb = GET_THREAD_DATA;
2909  
2910         idx =
2911 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
2912 +               (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
2913         page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index);
2914  
2915  /* the outer loop goes through all the sibling pages
2916 @@ -1619,7 +1619,7 @@
2917         tdbb = GET_THREAD_DATA;
2918         request = tdbb->tdbb_request;
2919         idx =
2920 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
2921 +               (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
2922  
2923         BOOLEAN result;
2924  
2925 @@ -1656,7 +1656,7 @@
2926                                 rpb->rpb_record,
2927                                 reinterpret_cast <
2928                                 struct idx *>((SCHAR *) impure +
2929 -                                                         (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]),
2930 +                                                         (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]),
2931                                 &value,
2932                                 0);
2933                 if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) {
2934 @@ -1757,7 +1757,7 @@
2935         retrieval_node = (JRD_NOD) rsb->rsb_arg[RSB_NAV_index];
2936         retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval];
2937         idx =
2938 -               (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]);
2939 +               (IDX *) ((SCHAR *) impure + (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
2940         page =
2941                 BTR_find_page(tdbb, retrieval, window, idx, &lower, &upper,
2942                                           (direction == RSE_get_backward));
2943 @@ -1802,7 +1802,7 @@
2944                         impure->irsb_nav_upper_length = upper.key_length;
2945                         MOVE_FAST(upper.key_data,
2946                                           (impure->irsb_nav_data +
2947 -                                          (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
2948 +                                          (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
2949                                           upper.key_length);
2950                 }
2951                 if (retrieval->irb_lower_count)
2952 @@ -1813,7 +1813,7 @@
2953                         impure->irsb_nav_lower_length = lower.key_length;
2954                         MOVE_FAST(lower.key_data,
2955                                           (impure->irsb_nav_data +
2956 -                                          (SLONG) rsb->rsb_arg[RSB_NAV_key_length]),
2957 +                                          (SLONG) (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
2958                                           lower.key_length);
2959                 }
2960                 if (retrieval->irb_upper_count)
2961 diff -Naur firebird-1.5.3.4870.old/src/jrd/rse.cpp firebird-1.5.3.4870/src/jrd/rse.cpp
2962 --- firebird-1.5.3.4870.old/src/jrd/rse.cpp     2006-08-06 06:47:17.000000000 +0200
2963 +++ firebird-1.5.3.4870/src/jrd/rse.cpp 2006-08-06 07:17:52.000000000 +0200
2964 @@ -2151,7 +2151,7 @@
2965         }
2966  
2967         desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
2968 -       desc.dsc_address = (UCHAR *) (om + (int) desc.dsc_address);
2969 +       desc.dsc_address = (UCHAR *) (om + (int) (IPTR) desc.dsc_address);
2970         eos_desc.dsc_dtype = dtype_short;
2971         eos_desc.dsc_scale = 0;
2972         eos_desc.dsc_length = sizeof(SSHORT);
2973 @@ -2959,7 +2959,7 @@
2974         for (item = map->smb_rpt; item < end_item; item++) {
2975                 flag = *(data + item->smb_flag_offset);
2976                 from = item->smb_desc;
2977 -               from.dsc_address = data + (ULONG) from.dsc_address;
2978 +               from.dsc_address = data + (ULONG) (IPTR) from.dsc_address;
2979                 if ((node = item->smb_node) && node->nod_type != nod_field)
2980                         continue;
2981  
2982 @@ -3211,7 +3211,7 @@
2983                 end_item = map->smb_rpt + map->smb_count;
2984                 for (item = map->smb_rpt; item < end_item; item++) {
2985                         to = item->smb_desc;
2986 -                       to.dsc_address = data + (ULONG) to.dsc_address;
2987 +                       to.dsc_address = data + (ULONG) (IPTR) to.dsc_address;
2988                         flag = FALSE;
2989                         if (item->smb_node) {
2990                                 from = EVL_expr(tdbb, item->smb_node);
2991 @@ -3301,12 +3301,12 @@
2992         desc2.dsc_flags = 0;
2993         desc2.dsc_address = (UCHAR *) & indicator;
2994         desc1 = *flag_desc;
2995 -       desc1.dsc_address = msg + (int) flag_desc->dsc_address;
2996 +       desc1.dsc_address = msg + (int) (IPTR) flag_desc->dsc_address;
2997         MOV_move(&desc1, &desc2);
2998         if (indicator) {
2999                 SET_NULL(record, to_id);
3000                 l = to_desc->dsc_length;
3001 -               p = record->rec_data + (int) to_desc->dsc_address;
3002 +               p = record->rec_data + (int) (IPTR) to_desc->dsc_address;
3003                 switch (to_desc->dsc_dtype) {
3004                 case dtype_text:
3005                         /* YYY - not necessarily the right thing to do */
3006 @@ -3336,9 +3336,9 @@
3007         else {
3008                 CLEAR_NULL(record, to_id);
3009                 desc1 = *from_desc;
3010 -               desc1.dsc_address = msg + (int) desc1.dsc_address;
3011 +               desc1.dsc_address = msg + (int) (IPTR) desc1.dsc_address;
3012                 desc2 = *to_desc;
3013 -               desc2.dsc_address = record->rec_data + (int) desc2.dsc_address;
3014 +               desc2.dsc_address = record->rec_data + (int) (IPTR) desc2.dsc_address;
3015                 if (!DSC_EQUIV((&desc1), (&desc2)))
3016                         MOV_move(&desc1, &desc2);
3017  
3018 @@ -3817,7 +3817,7 @@
3019         if (!sfb_->sfb_file_name) {
3020                 TEXT file_name[128];
3021  
3022 -               sfb_->sfb_file = (int) gds__temp_file(FALSE, SCRATCH, file_name);
3023 +               sfb_->sfb_file = (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name);
3024                 if (sfb_->sfb_file == -1)
3025                         SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error,
3026                                            errno);
3027 diff -Naur firebird-1.5.3.4870.old/src/jrd/sort.cpp firebird-1.5.3.4870/src/jrd/sort.cpp
3028 --- firebird-1.5.3.4870.old/src/jrd/sort.cpp    2006-08-06 06:47:17.000000000 +0200
3029 +++ firebird-1.5.3.4870/src/jrd/sort.cpp        2006-08-06 07:19:27.000000000 +0200
3030 @@ -1788,7 +1788,7 @@
3031                         /* Create a scratch file */
3032  
3033                         sfb->sfb_file =
3034 -                               (int) gds__temp_file(FALSE, SCRATCH, file_name,
3035 +                               (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name,
3036                                                                          sfb->sfb_dls->dls_directory, TRUE);
3037  
3038                         /* allocate the file name even if the file is not open,
3039 diff -Naur firebird-1.5.3.4870.old/src/qli/eval.cpp firebird-1.5.3.4870/src/qli/eval.cpp
3040 --- firebird-1.5.3.4870.old/src/qli/eval.cpp    2006-08-06 06:47:20.000000000 +0200
3041 +++ firebird-1.5.3.4870/src/qli/eval.cpp        2006-08-06 08:02:09.000000000 +0200
3042 @@ -200,10 +200,10 @@
3043  
3044         if (node->nod_type == nod_rpt_average && node->nod_arg[e_stt_default])
3045                 if (node->nod_desc.dsc_dtype == dtype_long)
3046 -                       *(SLONG *) node->nod_desc.dsc_address /= (SLONG) node->
3047 +                       *(SLONG *) node->nod_desc.dsc_address /= (SLONG) (IPTR) node->
3048                                 nod_arg[e_stt_default];
3049                 else
3050 -                       *(double *) node->nod_desc.dsc_address /= (SLONG) node->
3051 +                       *(double *) node->nod_desc.dsc_address /= (SLONG) (IPTR) node->
3052                                 nod_arg[e_stt_default];
3053  }
3054  
3055 @@ -241,7 +241,7 @@
3056  
3057  /* If this is the first value, just move it in. */
3058  
3059 -       count = (SLONG) node->nod_arg[e_stt_default] + 1;
3060 +       count = (SLONG) (IPTR) node->nod_arg[e_stt_default] + 1;
3061         if (count == 1) {
3062                 if (desc2->dsc_missing)
3063                         desc1->dsc_missing = DSC_missing;
3064 @@ -374,7 +374,7 @@
3065         case nod_rpt_min:
3066         case nod_rpt_total:
3067         case nod_rpt_average:
3068 -               if (!(SLONG) node->nod_arg[e_stt_default])
3069 +               if (!(SLONG) (IPTR) node->nod_arg[e_stt_default])
3070                         desc->dsc_missing = DSC_missing;
3071  
3072         case nod_rpt_count:
3073 diff -Naur firebird-1.5.3.4870.old/src/qli/expand.cpp firebird-1.5.3.4870/src/qli/expand.cpp
3074 --- firebird-1.5.3.4870.old/src/qli/expand.cpp  2006-08-06 06:47:20.000000000 +0200
3075 +++ firebird-1.5.3.4870/src/qli/expand.cpp      2006-08-06 08:02:45.000000000 +0200
3076 @@ -1830,7 +1830,7 @@
3077  
3078         }
3079  
3080 -       item->itm_count = (int) syn_item->syn_arg[0];
3081 +       item->itm_count = (int)(IPTR) syn_item->syn_arg[0];
3082         return item;
3083  }
3084  
3085 @@ -2131,7 +2131,7 @@
3086  /* Handle implicit boolean from SQL xxx IN (yyy FROM relation) */
3087  
3088         if (input->syn_arg[s_rse_outer]) {
3089 -               eql_node = MAKE_NODE((enum nod_t)(int)input->syn_arg[s_rse_op], 2);
3090 +               eql_node = MAKE_NODE((enum nod_t)(int)(IPTR)input->syn_arg[s_rse_op], 2);
3091                 eql_node->nod_arg[0] =
3092                         expand_expression(input->syn_arg[s_rse_outer], old_stack);
3093                 eql_node->nod_arg[1] =
3094 diff -Naur firebird-1.5.3.4870.old/src/qli/gener.cpp firebird-1.5.3.4870/src/qli/gener.cpp
3095 --- firebird-1.5.3.4870.old/src/qli/gener.cpp   2006-08-06 06:47:19.000000000 +0200
3096 +++ firebird-1.5.3.4870/src/qli/gener.cpp       2006-08-06 08:03:12.000000000 +0200
3097 @@ -1556,7 +1556,7 @@
3098  
3099         rlb = CHECK_RLB(request->req_blr);
3100  
3101 -       if ((NOD_T) (int) node->nod_arg[e_rse_join_type] == (NOD_T) 0)
3102 +       if ((NOD_T) (int) (IPTR) node->nod_arg[e_rse_join_type] == (NOD_T) 0)
3103                 STUFF(blr_rse);
3104         else
3105                 STUFF(blr_rs_stream);
3106 @@ -1625,7 +1625,7 @@
3107         if (list = node->nod_arg[e_rse_reduced])
3108                 gen_sort(list, request, blr_project);
3109  
3110 -       join_type = (NOD_T) (int) node->nod_arg[e_rse_join_type];
3111 +       join_type = (NOD_T) (int) (IPTR) node->nod_arg[e_rse_join_type];
3112         if (join_type != (NOD_T) 0 && join_type != nod_join_inner) {
3113                 STUFF(blr_join_type);
3114                 if (join_type == nod_join_left)
3115 diff -Naur firebird-1.5.3.4870.old/src/qli/lex.cpp firebird-1.5.3.4870/src/qli/lex.cpp
3116 --- firebird-1.5.3.4870.old/src/qli/lex.cpp     2006-08-06 06:47:19.000000000 +0200
3117 +++ firebird-1.5.3.4870/src/qli/lex.cpp 2006-08-06 08:03:26.000000000 +0200
3118 @@ -597,7 +597,7 @@
3119         for (temp = QLI_line;
3120                  temp->line_next && QLI_statements;
3121                  temp = temp->line_next)
3122 -if (temp->line_next->line_position == (SLONG) QLI_statements->lls_object) return;
3123 +if (temp->line_next->line_position == (SLONG) (IPTR) QLI_statements->lls_object) return;
3124  
3125         statement = (LLS) ALLOCP(type_lls);
3126         statement->lls_object = (BLK) temp->line_position;
3127 diff -Naur firebird-1.5.3.4870.old/src/qli/parse.cpp firebird-1.5.3.4870/src/qli/parse.cpp
3128 --- firebird-1.5.3.4870.old/src/qli/parse.cpp   2006-08-06 06:47:19.000000000 +0200
3129 +++ firebird-1.5.3.4870/src/qli/parse.cpp       2006-08-06 08:04:28.000000000 +0200
3130 @@ -1524,7 +1524,7 @@
3131                         IBERROR(176);           /* Msg176 No statements issued yet */
3132  
3133                 if (MATCH(KW_ASTERISK))
3134 -                       LEX_edit((SLONG) 0, (SLONG) statement_list->lls_object);
3135 +                       LEX_edit((SLONG) 0, (SLONG) (IPTR) statement_list->lls_object);
3136                 else {
3137                         if (KEYWORD(KW_SEMI))
3138                                 l = 1;
3139 @@ -1534,7 +1534,7 @@
3140                         for (start = stop = statement_list;
3141                                  l && start->lls_next; l--, start = start->lls_next);
3142                         command_end();
3143 -                       LEX_edit((SLONG) start->lls_object, (SLONG) stop->lls_object);
3144 +                       LEX_edit((SLONG) (IPTR) start->lls_object, (SLONG) (IPTR) stop->lls_object);
3145                 }
3146         }
3147  #ifdef PYXIS
3148 @@ -2925,7 +2925,7 @@
3149                         node->syn_arg[0] = INT_CAST 1;
3150                         if (op == nod_column || QLI_token->tok_type == tok_number)
3151                                 node->syn_arg[0] = INT_CAST parse_ordinal();
3152 -                       if ((op == nod_skip) && ((int) node->syn_arg[0] < 1))
3153 +                       if ((op == nod_skip) && ((int) (IPTR) node->syn_arg[0] < 1))
3154                                 SYNTAX_ERROR(478);      /* Msg478 number > 0 */
3155                 }
3156                 LLS_PUSH(node, &stack);
3157 diff -Naur firebird-1.5.3.4870.old/src/qli/show.epp firebird-1.5.3.4870/src/qli/show.epp
3158 --- firebird-1.5.3.4870.old/src/qli/show.epp    2006-08-06 06:47:19.000000000 +0200
3159 +++ firebird-1.5.3.4870/src/qli/show.epp        2006-08-06 08:05:12.000000000 +0200
3160 @@ -154,7 +154,7 @@
3161         ptr = node->syn_arg;
3162  
3163         for (i = 0; i < node->syn_count; i++) {
3164 -               sw = (ENUM show_t) (int) * ptr++;
3165 +               sw = (ENUM show_t) (int)(IPTR) * ptr++;
3166                 value = *ptr++;
3167                 if (sw != show_matching_language &&
3168                         sw != show_version &&
3169 diff -Naur firebird-1.5.3.4870.old/src/remote/inet_server.cpp firebird-1.5.3.4870/src/remote/inet_server.cpp
3170 --- firebird-1.5.3.4870.old/src/remote/inet_server.cpp  2006-08-06 06:47:27.000000000 +0200
3171 +++ firebird-1.5.3.4870/src/remote/inet_server.cpp      2006-08-06 07:59:49.000000000 +0200
3172 @@ -380,7 +380,7 @@
3173                 if (!debug) {
3174                         FD_ZERO(&mask);
3175                         FD_SET(2, &mask);
3176 -                       divorce_terminal((int) &mask);
3177 +                       divorce_terminal((int) (IPTR) &mask);
3178                 }
3179                 {
3180                         ISC_STATUS_ARRAY status_vector;
3181 diff -Naur firebird-1.5.3.4870.old/src/remote/interface.cpp firebird-1.5.3.4870/src/remote/interface.cpp
3182 --- firebird-1.5.3.4870.old/src/remote/interface.cpp    2006-08-06 06:47:27.000000000 +0200
3183 +++ firebird-1.5.3.4870/src/remote/interface.cpp        2006-08-06 07:53:34.000000000 +0200
3184 @@ -3231,7 +3231,7 @@
3185                 // Nickolay Samofatov: We pass this value to the server (as 32-bit value)
3186                 // then it returns it to us and we do not use it. Maybe pass zero here
3187                 // to avoid client-side security risks?
3188 -               event->p_event_ast = (SLONG) ast;
3189 +               event->p_event_ast = (SLONG)(IPTR) ast;
3190                 event->p_event_arg = (SLONG)(IPTR) arg;
3191  
3192                 event->p_event_rid = rem_event->rvnt_id;
3193 @@ -6226,8 +6226,8 @@
3194                 for (; to_desc < end_desc; from_desc++, to_desc++) {
3195                         from = *from_desc;
3196                         to = *to_desc;
3197 -                       from.dsc_address = from_msg + (SLONG) from.dsc_address;
3198 -                       to.dsc_address = to_msg + (SLONG) to.dsc_address;
3199 +                       from.dsc_address = from_msg + (SLONG)(IPTR) from.dsc_address;
3200 +                       to.dsc_address = to_msg + (SLONG)(IPTR) to.dsc_address;
3201                         CVT_move(&from, &to, (FPTR_VOID) move_error);
3202                 }
3203  
3204 diff -Naur firebird-1.5.3.4870.old/src/remote/protocol.cpp firebird-1.5.3.4870/src/remote/protocol.cpp
3205 --- firebird-1.5.3.4870.old/src/remote/protocol.cpp     2006-08-06 06:47:27.000000000 +0200
3206 +++ firebird-1.5.3.4870/src/remote/protocol.cpp 2006-08-06 07:53:50.000000000 +0200
3207 @@ -984,7 +984,7 @@
3208         BLOB_PTR *p;
3209         SSHORT n;
3210  
3211 -       p = buffer + (ULONG) desc->dsc_address;
3212 +       p = buffer + (ULONG) (IPTR) desc->dsc_address;
3213  
3214         switch (desc->dsc_dtype) {
3215         case dtype_text:
3216 diff -Naur firebird-1.5.3.4870.old/src/remote/server.cpp firebird-1.5.3.4870/src/remote/server.cpp
3217 --- firebird-1.5.3.4870.old/src/remote/server.cpp       2006-08-06 06:47:27.000000000 +0200
3218 +++ firebird-1.5.3.4870/src/remote/server.cpp   2006-08-06 08:00:17.000000000 +0200
3219 @@ -4361,7 +4361,7 @@
3220  
3221         // Nickolay Samofatov: We keep this values and even pass them to the client
3222         // (as 32-bit values) when event is fired, but client ignores them.
3223 -       p_event->p_event_ast = (SLONG) event->rvnt_ast;
3224 +       p_event->p_event_ast = (SLONG)(IPTR) event->rvnt_ast;
3225         p_event->p_event_arg = (SLONG)(IPTR) event->rvnt_arg;
3226  
3227         p_event->p_event_rid = event->rvnt_rid;
3228 diff -Naur firebird-1.5.3.4870.old/src/utilities/gsec.cpp firebird-1.5.3.4870/src/utilities/gsec.cpp
3229 --- firebird-1.5.3.4870.old/src/utilities/gsec.cpp      2006-08-06 06:47:32.000000000 +0200
3230 +++ firebird-1.5.3.4870/src/utilities/gsec.cpp  2006-08-06 07:57:42.000000000 +0200
3231 @@ -96,7 +96,7 @@
3232         int exit_code;
3233  
3234         exit_code = UTIL_gsec(service->svc_argc, service->svc_argv,
3235 -                                                 output_svc, (SLONG) service);
3236 +                                                 output_svc, (SLONG) (IPTR) service);
3237  
3238  /* Mark service thread as finished. */
3239  /* If service is detached, cleanup memory being used by service. */
3240 diff -Naur firebird-1.5.3.4870.old/src/wal/walw.cpp firebird-1.5.3.4870/src/wal/walw.cpp
3241 --- firebird-1.5.3.4870.old/src/wal/walw.cpp    2006-08-06 06:47:20.000000000 +0200
3242 +++ firebird-1.5.3.4870/src/wal/walw.cpp        2006-08-06 07:57:21.000000000 +0200
3243 @@ -199,7 +199,7 @@
3244  #ifdef SUPERSERVER
3245         int argc;
3246  
3247 -       argc = (int) argv[0];
3248 +       argc = (int) (IPTR) argv[0];
3249  #endif
3250  
3251         dbname = "";
3252 diff -Naur firebird-1.5.3.4870.old/src/dudley/exe.epp firebird-1.5.3.4870/src/dudley/exe.epp
3253 --- firebird-1.5.3.4870.old/src/dudley/exe.epp  2006-08-06 06:47:26.000000000 +0200
3254 +++ firebird-1.5.3.4870/src/dudley/exe.epp      2006-08-06 08:06:25.000000000 +0200
3255 @@ -626,7 +626,7 @@
3256                                 break;
3257  
3258                         case act_d_shadow:
3259 -                               drop_shadow((SLONG) action->act_object);
3260 +                               drop_shadow((SLONG) (IPTR) action->act_object);
3261                                 break;
3262  
3263                         case act_a_generator:
This page took 0.514738 seconds and 4 git commands to generate.