8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:03:02 +01:00

Further AMD64 fixes. Given this fixes you may start playing with databases using isql_static.

This commit is contained in:
skidder 2004-01-21 07:18:30 +00:00
parent 4a6d710f61
commit 08eee5ebaa
93 changed files with 702 additions and 1463 deletions

View File

@ -27,7 +27,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: Makefile.in.boot.gpre,v 1.18 2003-11-08 07:39:06 bellardo Exp $ # $Id: Makefile.in.boot.gpre,v 1.19 2004-01-21 07:15:58 skidder Exp $
# #
ROOT=.. ROOT=..
ObjModuleName=boot.gpre ObjModuleName=boot.gpre
@ -47,7 +47,7 @@ JRDBOOT_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(JRDBOOT_Sour
GPRECOMMON_Files += cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp \ GPRECOMMON_Files += cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp \
gpre.cpp hsh.cpp int.cpp int_cxx.cpp jrdmet.cpp movg.cpp \ gpre.cpp hsh.cpp int_cxx.cpp jrdmet.cpp movg.cpp \
msc.cpp par.cpp pat.cpp sqe.cpp sql.cpp msc.cpp par.cpp pat.cpp sqe.cpp sql.cpp
GPRE_Files = $(GPRECOMMON_Files) pretty.cpp gpre_meta_boot.cpp GPRE_Files = $(GPRECOMMON_Files) pretty.cpp gpre_meta_boot.cpp

View File

@ -27,7 +27,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: Makefile.in.client.gpre,v 1.10 2003-09-11 02:53:27 brodsom Exp $ # $Id: Makefile.in.client.gpre,v 1.11 2004-01-21 07:15:58 skidder Exp $
# #
ROOT=.. ROOT=..
ObjModuleName=client.gpre ObjModuleName=client.gpre
@ -43,7 +43,7 @@ include $(ROOT)/gen/make.shared.variables
GPRE_Files = gpre_meta.epp \ GPRE_Files = gpre_meta.epp \
cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp gpre.cpp \ cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp gpre.cpp \
hsh.cpp int.cpp int_cxx.cpp jrdmet.cpp movg.cpp msc.cpp par.cpp \ hsh.cpp int_cxx.cpp jrdmet.cpp movg.cpp msc.cpp par.cpp \
pat.cpp pretty.cpp sqe.cpp sql.cpp cob.cpp \ pat.cpp pretty.cpp sqe.cpp sql.cpp cob.cpp \
@GPRE_LANGUAGE_MODULES@ @GPRE_LANGUAGE_MODULES@

View File

@ -27,7 +27,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: Makefile.in.embed.gpre,v 1.10 2003-09-11 02:53:27 brodsom Exp $ # $Id: Makefile.in.embed.gpre,v 1.11 2004-01-21 07:15:58 skidder Exp $
# #
ROOT=.. ROOT=..
ObjModuleName=embed.gpre ObjModuleName=embed.gpre
@ -42,7 +42,7 @@ include $(ROOT)/gen/make.shared.variables
GPRE_Files = gpre_meta.epp \ GPRE_Files = gpre_meta.epp \
cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp gpre.cpp \ cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp gpre.cpp \
hsh.cpp int.cpp int_cxx.cpp jrdmet.cpp movg.cpp msc.cpp par.cpp \ hsh.cpp int_cxx.cpp jrdmet.cpp movg.cpp msc.cpp par.cpp \
pat.cpp pretty.cpp sqe.cpp sql.cpp \ pat.cpp pretty.cpp sqe.cpp sql.cpp \
@GPRE_LANGUAGE_MODULES@ @GPRE_LANGUAGE_MODULES@

View File

@ -27,7 +27,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: Makefile.in.static.gpre,v 1.13 2003-11-08 07:39:06 bellardo Exp $ # $Id: Makefile.in.static.gpre,v 1.14 2004-01-21 07:15:58 skidder Exp $
# #
ROOT=.. ROOT=..
ObjModuleName=static.gpre ObjModuleName=static.gpre
@ -42,7 +42,7 @@ include $(ROOT)/gen/make.shared.variables
GPRECOMMON_Files += cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp \ GPRECOMMON_Files += cmd.cpp cme.cpp cmp.cpp c_cxx.cpp exp.cpp \
gpre.cpp hsh.cpp int.cpp int_cxx.cpp jrdmet.cpp movg.cpp \ gpre.cpp hsh.cpp int_cxx.cpp jrdmet.cpp movg.cpp \
msc.cpp par.cpp pat.cpp sqe.cpp sql.cpp msc.cpp par.cpp pat.cpp sqe.cpp sql.cpp
GPRESTATIC_Files = $(GPRECOMMON_Files) gpre_meta.epp GPRESTATIC_Files = $(GPRECOMMON_Files) gpre_meta.epp

View File

@ -150,10 +150,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gpre\int.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gpre\int_cxx.cpp SOURCE=..\..\..\src\gpre\int_cxx.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -134,10 +134,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gpre\int.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gpre\int_cxx.cpp SOURCE=..\..\..\src\gpre\int_cxx.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -150,10 +150,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\..\src\gpre\int.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\gpre\int_cxx.cpp SOURCE=..\..\..\src\gpre\int_cxx.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -176,9 +176,6 @@
<File <File
RelativePath="..\..\..\src\gpre\hsh.cpp"> RelativePath="..\..\..\src\gpre\hsh.cpp">
</File> </File>
<File
RelativePath="..\..\..\src\gpre\int.cpp">
</File>
<File <File
RelativePath="..\..\..\src\gpre\int_cxx.cpp"> RelativePath="..\..\..\src\gpre\int_cxx.cpp">
</File> </File>

View File

@ -176,9 +176,6 @@
<File <File
RelativePath="..\..\..\src\gpre\hsh.cpp"> RelativePath="..\..\..\src\gpre\hsh.cpp">
</File> </File>
<File
RelativePath="..\..\..\src\gpre\int.cpp">
</File>
<File <File
RelativePath="..\..\..\src\gpre\int_cxx.cpp"> RelativePath="..\..\..\src\gpre\int_cxx.cpp">
</File> </File>

View File

@ -173,9 +173,6 @@
<File <File
RelativePath="..\..\..\src\gpre\hsh.cpp"> RelativePath="..\..\..\src\gpre\hsh.cpp">
</File> </File>
<File
RelativePath="..\..\..\src\gpre\int.cpp">
</File>
<File <File
RelativePath="..\..\..\src\gpre\int_cxx.cpp"> RelativePath="..\..\..\src\gpre\int_cxx.cpp">
</File> </File>

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: apifull.c,v 1.3 2003-08-13 11:06:02 robocop Exp $ $Id: apifull.c,v 1.4 2004-01-21 07:16:04 skidder Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -81,7 +81,7 @@ int main (ARG(int, argc), ARG(char **, argv))
ARGLIST(int argc) ARGLIST(int argc)
ARGLIST(char **argv) ARGLIST(char **argv)
{ {
long query[MAXLEN]; int query[MAXLEN];
XSQLDA * sqlda; XSQLDA * sqlda;
char db_name[128]; char db_name[128];
@ -161,16 +161,16 @@ process_statement (ARG(XSQLDA **, sqldap),
ARGLIST(XSQLDA **sqldap) ARGLIST(XSQLDA **sqldap)
ARGLIST(char *query) ARGLIST(char *query)
{ {
long buffer[MAXLEN]; int buffer[MAXLEN];
XSQLDA *sqlda; XSQLDA *sqlda;
XSQLVAR *var; XSQLVAR *var;
short num_cols, i; short num_cols, i;
short length, alignment, type, offset; short length, alignment, type, offset;
long fetch_stat; int fetch_stat;
static char stmt_info[] = { isc_info_sql_stmt_type }; static char stmt_info[] = { isc_info_sql_stmt_type };
char info_buffer[20]; char info_buffer[20];
short l; short l;
long statement_type; int statement_type;
sqlda = *sqldap; sqlda = *sqldap;
@ -398,7 +398,7 @@ ARGLIST(XSQLVAR *var)
field_width = 6; field_width = 6;
break; break;
case SQL_LONG: case SQL_LONG:
value = (ISC_INT64) *(long *) var->sqldata; value = (ISC_INT64) *(int *) var->sqldata;
field_width = 11; field_width = 11;
break; break;
case SQL_INT64: case SQL_INT64:

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: dynfull.e,v 1.2 2003-07-11 03:08:44 brodsom Exp $ $Id: dynfull.e,v 1.3 2004-01-21 07:16:05 skidder Exp $
*/ */
#include "example.h" #include "example.h"
@ -119,7 +119,7 @@ void process_statement(ARG(XSQLDA * *, sqldap),
ARGLIST(XSQLDA **sqldap) ARGLIST(XSQLDA **sqldap)
ARGLIST(char *query) ARGLIST(char *query)
{ {
long buffer[MAXLEN]; int buffer[MAXLEN];
XSQLVAR *var; XSQLVAR *var;
XSQLDA *sqlda; XSQLDA *sqlda;
short num_cols, i; short num_cols, i;
@ -338,7 +338,7 @@ ARGLIST(XSQLVAR *var)
field_width = 6; field_width = 6;
break; break;
case SQL_LONG: case SQL_LONG:
value = (ISC_INT64) *(long *) var->sqldata; value = (ISC_INT64) *(int *) var->sqldata;
field_width = 11; field_width = 11;
break; break;
case SQL_INT64: case SQL_INT64:

View File

@ -35,18 +35,18 @@ extern char *fn_strcat();
extern char *fn_substr(); extern char *fn_substr();
extern char *fn_trim(); extern char *fn_trim();
extern char *fn_trunc(); extern char *fn_trunc();
extern long fn_doy(); extern int fn_doy();
extern short *fn_moy(); extern short *fn_moy();
extern char *fn_dow(); extern char *fn_dow();
extern char *fn_sysdate(); extern char *fn_sysdate();
extern long fn_add2(); extern int fn_add2();
extern double fn_mul(); extern double fn_mul();
extern double fn_fact(); extern double fn_fact();
extern double fn_abs(); extern double fn_abs();
extern double fn_max(); extern double fn_max();
extern double fn_sqrt(); extern double fn_sqrt();
extern long fn_blob_linecount(); extern int fn_blob_linecount();
extern long fn_blob_bytecount(); extern int fn_blob_bytecount();
extern char *fn_blob_substr(); extern char *fn_blob_substr();
static FN isc_functions [] = { static FN isc_functions [] = {

View File

@ -186,7 +186,7 @@ return (0);
*/ */
int count_types (void) int count_types (void)
{ {
long cnt; int cnt;
EXEC SQL EXEC SQL
SELECT COUNT(DISTINCT currency) INTO :cnt FROM country; SELECT COUNT(DISTINCT currency) INTO :cnt FROM country;
@ -205,7 +205,7 @@ return (0);
*/ */
int count_records (void) int count_records (void)
{ {
long cnt; int cnt;
/* Use the database handle along with the table name. */ /* Use the database handle along with the table name. */
EXEC SQL EXEC SQL

View File

@ -42,8 +42,8 @@ char Db_name[128];
EXEC SQL EXEC SQL
SET DATABASE empdb = COMPILETIME "employee.fdb" RUNTIME :Db_name; SET DATABASE empdb = COMPILETIME "employee.fdb" RUNTIME :Db_name;
long cust_no; int cust_no;
long tot; int tot;
char ord_stat[8]; char ord_stat[8];
EXEC SQL EXEC SQL

View File

@ -43,7 +43,7 @@ EXEC SQL
int main (void) int main (void)
{ {
char dept[4]; char dept[4];
long lvl = 1; int lvl = 1;
/* Describe the new table's structure. */ /* Describe the new table's structure. */
EXEC SQL EXEC SQL
@ -102,7 +102,7 @@ return 1;
void build_tree (void) void build_tree (void)
{ {
char dept[4]; char dept[4];
long lvl = 1; int lvl = 1;
EXEC SQL EXEC SQL
WHENEVER SQLERROR GO TO Error2; WHENEVER SQLERROR GO TO Error2;

View File

@ -44,9 +44,9 @@
typedef struct blob { typedef struct blob {
short (*blob_get_segment) (); short (*blob_get_segment) ();
void *blob_handle; void *blob_handle;
long blob_number_segments; int blob_number_segments;
long blob_max_segment; int blob_max_segment;
long blob_total_length; int blob_total_length;
void (*blob_put_segment) (); void (*blob_put_segment) ();
} *BLOB; } *BLOB;
@ -60,13 +60,13 @@ char buffer[256];
char buffer2[512]; /* for string concatenation */ char buffer2[512]; /* for string concatenation */
char datebuf[12]; /* for date string */ char datebuf[12]; /* for date string */
long r_long; int r_long;
double r_double; double r_double;
float r_float; float r_float;
short r_short; short r_short;
struct tm *tbuf; struct tm *tbuf;
long time_sec; int time_sec;
ISC_QUAD newdate; ISC_QUAD newdate;
@ -209,10 +209,10 @@ char* EXPORT fn_trunc(char* s, short* m)
/* ============================================================== /* ==============================================================
fn_doy() return the nth day of the year, by value. fn_doy() return the nth day of the year, by value.
============================================================== */ ============================================================== */
long EXPORT fn_doy() int EXPORT fn_doy()
{ {
char buf[4]; /* for day */ char buf[4]; /* for day */
long i; int i;
time (&time_sec); time (&time_sec);
tbuf = localtime(&time_sec); tbuf = localtime(&time_sec);
@ -290,7 +290,7 @@ char* EXPORT fn_sysdate()
fn_add2 (a, b) - returns a + b fn_add2 (a, b) - returns a + b
=============================================== */ =============================================== */
long EXPORT fn_add2(long* a, long* b) int EXPORT fn_add2(int* a, int* b)
{ {
return (*a + *b); return (*a + *b);
} }
@ -360,7 +360,7 @@ double* EXPORT fn_sqrt(double* n)
fn_blob_linecount() returns the number of lines in a blob fn_blob_linecount() returns the number of lines in a blob
=============================================================*/ =============================================================*/
long EXPORT fn_blob_linecount(BLOB b) int EXPORT fn_blob_linecount(BLOB b)
{ {
char *buf, *p; char *buf, *p;
short length, actual_length; short length, actual_length;
@ -391,7 +391,7 @@ long EXPORT fn_blob_linecount(BLOB b)
do not count newlines, so get rid of the newlines. do not count newlines, so get rid of the newlines.
==============================================================*/ ==============================================================*/
long EXPORT fn_blob_bytecount(BLOB b) int EXPORT fn_blob_bytecount(BLOB b)
{ {
/* Null values */ /* Null values */
if (!b->blob_handle) if (!b->blob_handle)
@ -408,12 +408,12 @@ long EXPORT fn_blob_bytecount(BLOB b)
Newlines are eliminated to make for better printing. Newlines are eliminated to make for better printing.
=============================================================*/ =============================================================*/
char* EXPORT fn_blob_substr(BLOB b, long* m, long* n) char* EXPORT fn_blob_substr(BLOB b, int* m, int* n)
{ {
char *buf, *p, *q; char *buf, *p, *q;
long i = 0; int i = 0;
long curr_bytecount = 0; int curr_bytecount = 0;
long begin, end; int begin, end;
short length, actual_length; short length, actual_length;
char *buffer = (char *)malloc(256); char *buffer = (char *)malloc(256);
@ -426,12 +426,12 @@ char* EXPORT fn_blob_substr(BLOB b, long* m, long* n)
if (*m > *n || *m < 1L || *n < 1L) if (*m > *n || *m < 1L || *n < 1L)
return ""; return "";
if (b->blob_total_length < (long)*m) if (b->blob_total_length < (int)*m)
return ""; return "";
begin = *m; /* beginning position */ begin = *m; /* beginning position */
if (b->blob_total_length < (long)*n) if (b->blob_total_length < (int)*n)
end = b->blob_total_length; /* ending position */ end = b->blob_total_length; /* ending position */
else else
end = *n; end = *n;

View File

@ -37,7 +37,7 @@
*/ */
/* /*
$Id: backup.epp,v 1.48 2004-01-13 09:52:09 robocop Exp $ $Id: backup.epp,v 1.49 2004-01-21 07:16:08 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -478,7 +478,7 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
UINT64 cumul_count = MVOL_fini_write(&tdgbl->io_cnt, &tdgbl->io_ptr); UINT64 cumul_count = MVOL_fini_write(&tdgbl->io_cnt, &tdgbl->io_ptr);
if (cumul_count <= MAX_SLONG) { if (cumul_count <= MAX_SLONG) {
SLONG tempcount = cumul_count; SLONG tempcount = cumul_count;
BURP_verbose(176, (void*) tempcount, NULL, NULL, NULL, NULL); BURP_verbose(176, (void*) (IPTR)tempcount, NULL, NULL, NULL, NULL);
// msg 176 closing file, committing, and finishing. %ld bytes written // msg 176 closing file, committing, and finishing. %ld bytes written
} }
else { else {
@ -1383,7 +1383,7 @@ void put_blob( burp_fld* field, ISC_QUAD * blob_id, ULONG count)
break; break;
default: default:
BURP_error_redirect(NULL, 21, (void*) (ULONG) item, NULL); BURP_error_redirect(NULL, 21, (void*) (IPTR) item, NULL);
// msg 21 don't understand blob info item %ld // msg 21 don't understand blob info item %ld
} }
} }
@ -1489,7 +1489,7 @@ bool put_blr_blob( SCHAR attribute, ISC_QUAD * blob_id)
break; break;
default: default:
BURP_print(79, (void *) (ULONG) item, NULL, NULL, NULL, NULL); BURP_print(79, (void *) (IPTR) item, NULL, NULL, NULL, NULL);
// msg 79 don't understand blob info item %ld // msg 79 don't understand blob info item %ld
return false; return false;
} }
@ -1668,7 +1668,7 @@ void put_data(burp_rel* relation)
break; break;
default: default:
BURP_error_redirect(NULL, 26, (void *) (SLONG) field->fld_type, NULL); BURP_error_redirect(NULL, 26, (void *) (IPTR) field->fld_type, NULL);
// msg 26 datatype %ld not understood // msg 26 datatype %ld not understood
break; break;
} }
@ -1813,7 +1813,7 @@ void put_data(burp_rel* relation)
records++; records++;
// Verbose records // Verbose records
if ((records % BACKUP_VERBOSE_INTERVAL) == 0) if ((records % BACKUP_VERBOSE_INTERVAL) == 0)
BURP_verbose(108, (void *) (SLONG) records, NULL, NULL, NULL, NULL); BURP_verbose(108, (void *) (IPTR) records, NULL, NULL, NULL, NULL);
put(tdgbl, (UCHAR) (rec_data)); put(tdgbl, (UCHAR) (rec_data));
put_numeric(att_data_length, record_length); put_numeric(att_data_length, record_length);
@ -1864,7 +1864,7 @@ void put_data(burp_rel* relation)
if (xdr_buffer.lstr_address) if (xdr_buffer.lstr_address)
BURP_free(xdr_buffer.lstr_address); BURP_free(xdr_buffer.lstr_address);
BURP_verbose(108, (void *) (SLONG) records, NULL, NULL, NULL, NULL); BURP_verbose(108, (void *) (IPTR) records, NULL, NULL, NULL, NULL);
// msg 108 %ld records written // msg 108 %ld records written
if (isc_release_request(status_vector, &request)) if (isc_release_request(status_vector, &request))
@ -2774,7 +2774,7 @@ void write_database( const TEXT* dbb_file)
put_asciz(att_file_name, dbb_file); put_asciz(att_file_name, dbb_file);
BURP_verbose(77, dbb_file, (void *) (ULONG) page_size, NULL, NULL, NULL); BURP_verbose(77, dbb_file, (void *) (IPTR) page_size, NULL, NULL, NULL);
// msg 77 database %s has a page size of %ld bytes. // msg 77 database %s has a page size of %ld bytes.
put(tdgbl, (UCHAR) (att_end)); put(tdgbl, (UCHAR) (att_end));
@ -3129,7 +3129,7 @@ void write_generators(void)
put(tdgbl, att_end); put(tdgbl, att_end);
MISC_terminate (X.RDB$GENERATOR_NAME, temp, l, sizeof(temp)); MISC_terminate (X.RDB$GENERATOR_NAME, temp, l, sizeof(temp));
#pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG") #pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG")
BURP_verbose (165, temp, (void*) (SLONG) value, NULL, NULL, NULL); BURP_verbose (165, temp, (void*) (IPTR) value, NULL, NULL, NULL);
// msg 165 writing generator %s value %ld // msg 165 writing generator %s value %ld
END_FOR; END_FOR;
ON_ERROR ON_ERROR

View File

@ -1099,8 +1099,8 @@ int common_main(int argc,
// msg 3 Page size specified (%ld) greater than limit (MAX_PAGE_SIZE bytes) // msg 3 Page size specified (%ld) greater than limit (MAX_PAGE_SIZE bytes)
} }
if (temp != tdgbl->gbl_sw_page_size) { if (temp != tdgbl->gbl_sw_page_size) {
BURP_print(103, (void*)(ULONG) tdgbl->gbl_sw_page_size, BURP_print(103, (void*)(IPTR) tdgbl->gbl_sw_page_size,
(void*)(SLONG) temp, 0, 0, 0); (void*)(IPTR) temp, 0, 0, 0);
// msg 103 page size specified (%ld bytes) rounded up to %ld bytes // msg 103 page size specified (%ld bytes) rounded up to %ld bytes
tdgbl->gbl_sw_page_size = temp; tdgbl->gbl_sw_page_size = temp;
} }

View File

@ -28,7 +28,7 @@
* *
*/ */
/* /*
$Id: canonical.cpp,v 1.32 2004-01-13 09:52:09 robocop Exp $ $Id: canonical.cpp,v 1.33 2004-01-21 07:16:08 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -486,7 +486,7 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer)
**************************************/ **************************************/
SSHORT n; SSHORT n;
UCHAR* p = buffer + (int) desc->dsc_address; UCHAR* p = buffer + (IPTR) desc->dsc_address;
switch (desc->dsc_dtype) switch (desc->dsc_dtype)
{ {
@ -654,7 +654,7 @@ static bool_t xdr_slice(XDR* xdrs,
* Move a slice of an array under * Move a slice of an array under
* *
**************************************/ **************************************/
if (!xdr_long(xdrs, reinterpret_cast<long*>(&slice->lstr_length))) if (!xdr_long(xdrs, reinterpret_cast<SLONG*>(&slice->lstr_length)))
return FALSE; return FALSE;
// Handle operation specific stuff, particularly memory allocation/deallocation // Handle operation specific stuff, particularly memory allocation/deallocation

View File

@ -617,7 +617,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
tdgbl->action->act_file->fil_fd = INVALID_HANDLE_VALUE; tdgbl->action->act_file->fil_fd = INVALID_HANDLE_VALUE;
BURP_print(272, BURP_print(272,
tdgbl->action->act_file->fil_name, tdgbl->action->act_file->fil_name,
(void*) tdgbl->action->act_file->fil_length, (void*)(IPTR)tdgbl->action->act_file->fil_length,
tdgbl->action->act_file->fil_next->fil_name, tdgbl->action->act_file->fil_next->fil_name,
0, 0); // msg 272 Warning -- free disk space exhausted for file %s, the rest of the bytes (%d) will be written to file %s 0, 0); // msg 272 Warning -- free disk space exhausted for file %s, the rest of the bytes (%d) will be written to file %s
tdgbl->action->act_file->fil_next->fil_length += tdgbl->action->act_file->fil_next->fil_length +=
@ -755,7 +755,7 @@ static void bad_attribute(USHORT attribute, USHORT type)
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = GET_THREAD_DATA;
gds__msg_format(0, 12, type, sizeof(name), name, 0, 0, 0, 0, 0); gds__msg_format(0, 12, type, sizeof(name), name, 0, 0, 0, 0, 0);
BURP_print(80, name, (void*) (ULONG) attribute, NULL, NULL, NULL); BURP_print(80, name, (void*) (IPTR) attribute, NULL, NULL, NULL);
// msg 80 don't recognize %s attribute %ld -- continuing // msg 80 don't recognize %s attribute %ld -- continuing
SSHORT l = get(tdgbl); SSHORT l = get(tdgbl);
if (l) if (l)
@ -910,7 +910,7 @@ static DESC next_volume( DESC handle, int mode, bool full_buffer)
} }
else else
{ {
BURP_msg_put(261, (void*) (SLONG) (tdgbl->mvol_volume_count), BURP_msg_put(261, (void*) (IPTR) (tdgbl->mvol_volume_count),
new_file, 0, 0, 0); new_file, 0, 0, 0);
// Starting with volume #vol_count, new_file // Starting with volume #vol_count, new_file
BURP_verbose(75, new_file, 0, 0, 0, 0); // msg 75 creating file %s BURP_verbose(75, new_file, 0, 0, 0, 0); // msg 75 creating file %s
@ -929,7 +929,7 @@ static DESC next_volume( DESC handle, int mode, bool full_buffer)
} }
else else
{ {
BURP_msg_put(261, (void*) (SLONG) (tdgbl->mvol_volume_count), BURP_msg_put(261, (void*) (IPTR) (tdgbl->mvol_volume_count),
new_file, 0, 0, 0); new_file, 0, 0, 0);
// Starting with volume #vol_count, new_file // Starting with volume #vol_count, new_file
BURP_verbose(100, new_file, 0, 0, 0, 0); // msg 100 opened file %s BURP_verbose(100, new_file, 0, 0, 0, 0); // msg 100 opened file %s
@ -977,7 +977,7 @@ static void prompt_for_name(SCHAR* name, int length)
if (strlen(tdgbl->mvol_old_file) > 0) if (strlen(tdgbl->mvol_old_file) > 0)
{ {
BURP_msg_get(225, msg, (void*) (SLONG) (tdgbl->mvol_volume_count - 1), BURP_msg_get(225, msg, (void*) (IPTR) (tdgbl->mvol_volume_count - 1),
tdgbl->mvol_old_file, 0, 0, 0); tdgbl->mvol_old_file, 0, 0, 0);
ib_fprintf(term_out, msg); ib_fprintf(term_out, msg);
BURP_msg_get(226, msg, 0, 0, 0, 0, 0); BURP_msg_get(226, msg, 0, 0, 0, 0, 0);
@ -1209,8 +1209,8 @@ static bool read_header(DESC handle,
if (temp != tdgbl->mvol_volume_count) if (temp != tdgbl->mvol_volume_count)
{ {
BURP_msg_get(232, msg, BURP_msg_get(232, msg,
(void*) (SLONG) (tdgbl->mvol_volume_count), (void*) (IPTR) (tdgbl->mvol_volume_count),
(void*) (SLONG) temp, 0, 0, 0); (void*) (IPTR) temp, 0, 0, 0);
// Expected volume number %d, found volume %d\n // Expected volume number %d, found volume %d\n
ib_printf(msg); ib_printf(msg);
return false; return false;

View File

@ -24,7 +24,7 @@
* 2003.08.17 Claudio Valderrama: Fix SF Bug #750659. * 2003.08.17 Claudio Valderrama: Fix SF Bug #750659.
*/ */
/* /*
$Id: restore.epp,v 1.61 2004-01-13 09:52:09 robocop Exp $ $Id: restore.epp,v 1.62 2004-01-21 07:16:08 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -685,7 +685,7 @@ void add_files (const UCHAR* file_name)
general_on_error (); general_on_error ();
END_ERROR; END_ERROR;
MISC_release_request_silent(req_handle1); MISC_release_request_silent(req_handle1);
BURP_verbose (57, file->fil_name, (void*) start, NULL, NULL, NULL); BURP_verbose (57, file->fil_name, (void*)(IPTR)start, NULL, NULL, NULL);
// msg 57 adding file %s, starting at page %ld // msg 57 adding file %s, starting at page %ld
} }
else if (((signed long )file->fil_length) >= start - 1) else if (((signed long )file->fil_length) >= start - 1)
@ -1028,7 +1028,7 @@ void create_database (const TEXT* file_name)
isc_version(&DB, BURP_output_version, (void*)"\t%s\n"); isc_version(&DB, BURP_output_version, (void*)"\t%s\n");
} }
BURP_verbose (74, file_name, (void*) page_size, NULL, NULL, NULL); BURP_verbose (74, file_name, (void*) (IPTR)page_size, NULL, NULL, NULL);
// msg 74 created database %s, page_size %ld bytes // msg 74 created database %s, page_size %ld bytes
} }
@ -2399,7 +2399,7 @@ rec_type get_data (burp_rel* relation)
break; break;
default: default:
BURP_error (26, true, isc_arg_number, (void*) (SLONG) field->fld_type, BURP_error (26, true, isc_arg_number, (void*) (IPTR) field->fld_type,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
// msg 26 datatype %ld not understood // msg 26 datatype %ld not understood
break; break;
@ -2515,8 +2515,8 @@ rec_type get_data (burp_rel* relation)
old_length = recompute_length (relation); old_length = recompute_length (relation);
if (l != old_length) if (l != old_length)
{ {
BURP_error(40, true, isc_arg_number, (void*)length, BURP_error(40, true, isc_arg_number, (void*)(IPTR)length,
isc_arg_number, (void*) (ULONG) l, isc_arg_number, (void*) (IPTR) l,
0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL);
// msg 40 wrong length record, expected %ld encountered %ld // msg 40 wrong length record, expected %ld encountered %ld
} }
@ -2566,7 +2566,7 @@ rec_type get_data (burp_rel* relation)
records++; records++;
if ((records % RESTORE_VERBOSE_INTERVAL) == 0) if ((records % RESTORE_VERBOSE_INTERVAL) == 0)
BURP_verbose(107, (void*) (SLONG) records, NULL, NULL, NULL, NULL); BURP_verbose(107, (void*) (IPTR) records, NULL, NULL, NULL, NULL);
for (field = relation->rel_fields; field; field = field->fld_next) for (field = relation->rel_fields; field; field = field->fld_next)
if ((field->fld_type == blr_blob) || (field->fld_flags & FLD_array)) if ((field->fld_type == blr_blob) || (field->fld_flags & FLD_array))
@ -2690,7 +2690,7 @@ rec_type get_data (burp_rel* relation)
if (gds_status[1]) if (gds_status[1])
EXEC SQL SET TRANSACTION; EXEC SQL SET TRANSACTION;
} }
BURP_verbose (107, (void*) (SLONG) records, NULL, NULL, NULL, NULL); BURP_verbose (107, (void*) (IPTR) records, NULL, NULL, NULL, NULL);
// msg 107 %ld records restored // msg 107 %ld records restored
return record; return record;
@ -4806,7 +4806,7 @@ bool get_relation()
break; break;
default: default:
BURP_error(43, true, isc_arg_number, (void*) record, BURP_error(43, true, isc_arg_number, (void*) (IPTR) record,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
// msg 43 don't recognize record type %ld // msg 43 don't recognize record type %ld
break; break;
@ -6157,7 +6157,7 @@ rec_type ignore_data (burp_rel* relation)
break; break;
} }
BURP_verbose (106, (void*) records, NULL, NULL, NULL, NULL); BURP_verbose (106, (void*)(IPTR) records, NULL, NULL, NULL, NULL);
// msg 106 %ld records ignored // msg 106 %ld records ignored
return record; return record;
@ -6325,7 +6325,7 @@ bool restore (const TEXT* file_name,
if (tdgbl->RESTORE_format < 1 || tdgbl->RESTORE_format > ATT_BACKUP_FORMAT) if (tdgbl->RESTORE_format < 1 || tdgbl->RESTORE_format > ATT_BACKUP_FORMAT)
{ {
BURP_error(44, true, isc_arg_number, (void*)(ULONG)tdgbl->RESTORE_format, BURP_error(44, true, isc_arg_number, (void*)(IPTR)tdgbl->RESTORE_format,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
// msg 44 Expected backup version 1, 2, or 3. Found %ld // msg 44 Expected backup version 1, 2, or 3. Found %ld
} }
@ -6346,7 +6346,7 @@ bool restore (const TEXT* file_name,
USHORT db_version = check_db_version(); USHORT db_version = check_db_version();
if (db_version < DB_VERSION_CURRENT) if (db_version < DB_VERSION_CURRENT)
{ {
BURP_error(51, true, isc_arg_number, (void*) (ULONG) db_version, BURP_error(51, true, isc_arg_number, (void*) (IPTR) db_version,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
// msg 51 database format %ld is too old to restore to // msg 51 database format %ld is too old to restore to
} }
@ -6568,7 +6568,7 @@ bool restore (const TEXT* file_name,
break; break;
default: default:
BURP_error(43, true, isc_arg_number, (void*) record, BURP_error(43, true, isc_arg_number, (void*) (IPTR) record,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
// msg 43 don't recognize record type %ld // msg 43 don't recognize record type %ld
break; break;
@ -6751,7 +6751,7 @@ void store_blr_gen_id (const TEXT* gen_name, // TEXT GDS_NAME[GDS_NAME_LEN]
if (!value) if (!value)
{ {
#pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG") #pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG")
BURP_verbose (185, gen_name, (void*) (SLONG) value, NULL, NULL, NULL); BURP_verbose (185, gen_name, (void*) (IPTR) value, NULL, NULL, NULL);
// msg 185 restoring generator %s value: %ld // msg 185 restoring generator %s value: %ld
return; return;
} }
@ -6831,7 +6831,7 @@ void store_blr_gen_id (const TEXT* gen_name, // TEXT GDS_NAME[GDS_NAME_LEN]
} }
#pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG") #pragma FB_COMPILER_MESSAGE("BRS: casting SINT64 to SLONG")
BURP_verbose (185, gen_name, (void*) (SLONG) value, NULL, NULL, NULL); BURP_verbose (185, gen_name, (void*) (IPTR) value, NULL, NULL, NULL);
// msg 185 restoring generator %s value: %ld // msg 185 restoring generator %s value: %ld
isc_release_request (status_vector, &gen_id_reqh); isc_release_request (status_vector, &gen_id_reqh);

View File

@ -50,7 +50,7 @@ class ConfigImpl : public ConfigRoot
}; };
typedef char* ConfigKey; typedef char* ConfigKey;
typedef void* ConfigValue; typedef IPTR ConfigValue;
struct ConfigEntry struct ConfigEntry
{ {

View File

@ -20,7 +20,7 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* *
* $Id: ddl.cpp,v 1.84 2004-01-16 10:43:20 hvlad Exp $ * $Id: ddl.cpp,v 1.85 2004-01-21 07:16:11 skidder Exp $
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash, * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
* *
@ -1091,13 +1091,13 @@ static void define_constraint_trigger(dsql_req* request, dsql_nod* node)
if (constant) if (constant)
{ {
request->append_number(isc_dyn_trg_sequence, request->append_number(isc_dyn_trg_sequence,
(SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0)); (SSHORT) (constant ? (IPTR) constant->nod_arg[0] : 0));
} }
constant = node->nod_arg[e_cnstr_type]; constant = node->nod_arg[e_cnstr_type];
if (constant != NULL) if (constant != NULL)
{ {
const SSHORT type = (SSHORT)(SLONG) constant->nod_arg[0]; const SSHORT type = (SSHORT)(IPTR) constant->nod_arg[0];
request->append_number(isc_dyn_trg_type, type); request->append_number(isc_dyn_trg_type, type);
} }
@ -1232,7 +1232,7 @@ request->append_number(isc_dyn_rel_sql_protection, 1);
switch (element->nod_type) { switch (element->nod_type) {
case nod_file_length: case nod_file_length:
start = (SLONG) (element->nod_arg[0]) + 1; start = (IPTR) (element->nod_arg[0]) + 1;
break; break;
default: default:
@ -1309,25 +1309,25 @@ request->append_number(isc_dyn_rel_sql_protection, 1);
case nod_group_commit_wait: case nod_group_commit_wait:
request->append_uchar(isc_dyn_log_group_commit_wait); request->append_uchar(isc_dyn_log_group_commit_wait);
temp_long = (SLONG) (element->nod_arg[0]); temp_long = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(temp_long); request->append_ulong_with_length(temp_long);
break; break;
case nod_check_point_len: case nod_check_point_len:
request->append_uchar(isc_dyn_log_check_point_length); request->append_uchar(isc_dyn_log_check_point_length);
temp_long = (SLONG) (element->nod_arg[0]); temp_long = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(temp_long); request->append_ulong_with_length(temp_long);
break; break;
case nod_num_log_buffers: case nod_num_log_buffers:
request->append_uchar(isc_dyn_log_num_of_buffers); request->append_uchar(isc_dyn_log_num_of_buffers);
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); temp_short = (SSHORT)(IPTR) (element->nod_arg[0]);
request->append_ushort_with_length(temp_short); request->append_ushort_with_length(temp_short);
break; break;
case nod_log_buffer_size: case nod_log_buffer_size:
request->append_uchar(isc_dyn_log_buffer_size); request->append_uchar(isc_dyn_log_buffer_size);
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); temp_short = (SSHORT)(IPTR) (element->nod_arg[0]);
request->append_ushort_with_length(temp_short); request->append_ushort_with_length(temp_short);
break; break;
@ -1613,11 +1613,11 @@ static void define_dimensions( dsql_req* request, const dsql_fld* field)
request->append_number(isc_dyn_def_dimension, position); request->append_number(isc_dyn_def_dimension, position);
const dsql_nod* element = *ptr++; const dsql_nod* element = *ptr++;
request->append_uchar(isc_dyn_dim_lower); request->append_uchar(isc_dyn_dim_lower);
const SLONG lrange = (SLONG) (element->nod_arg[0]); const SLONG lrange = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(lrange); request->append_ulong_with_length(lrange);
element = *ptr; element = *ptr;
request->append_uchar(isc_dyn_dim_upper); request->append_uchar(isc_dyn_dim_upper);
const SLONG hrange = (SLONG) (element->nod_arg[0]); const SLONG hrange = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(hrange); request->append_ulong_with_length(hrange);
request->append_uchar(isc_dyn_end); request->append_uchar(isc_dyn_end);
if (lrange >= hrange) if (lrange >= hrange)
@ -2009,9 +2009,9 @@ static void define_filter( dsql_req* request)
request->append_cstring(isc_dyn_def_filter, request->append_cstring(isc_dyn_def_filter,
((dsql_str*) (ptr[e_filter_name]))->str_data); ((dsql_str*) (ptr[e_filter_name]))->str_data);
request->append_number(isc_dyn_filter_in_subtype, request->append_number(isc_dyn_filter_in_subtype,
(SSHORT)(SLONG) ((ptr[e_filter_in_type])->nod_arg[0])); (SSHORT)(IPTR) ((ptr[e_filter_in_type])->nod_arg[0]));
request->append_number(isc_dyn_filter_out_subtype, request->append_number(isc_dyn_filter_out_subtype,
(SSHORT)(SLONG) ((ptr[e_filter_out_type])->nod_arg[0])); (SSHORT)(IPTR) ((ptr[e_filter_out_type])->nod_arg[0]));
request->append_cstring(isc_dyn_func_entry_point, request->append_cstring(isc_dyn_func_entry_point,
((dsql_str*) (ptr[e_filter_entry_pt]))->str_data); ((dsql_str*) (ptr[e_filter_entry_pt]))->str_data);
request->append_cstring(isc_dyn_func_module_name, request->append_cstring(isc_dyn_func_module_name,
@ -2817,16 +2817,16 @@ static void define_shadow(dsql_req* request)
isc_arg_gds, isc_dsql_shadow_number_err, 0); isc_arg_gds, isc_dsql_shadow_number_err, 0);
} }
request->append_number(isc_dyn_def_shadow, (SSHORT)(SLONG) (ptr[e_shadow_number])); request->append_number(isc_dyn_def_shadow, (SSHORT)(IPTR) (ptr[e_shadow_number]));
request->append_cstring(isc_dyn_def_file, ((dsql_str*) (ptr[e_shadow_name]))->str_data); request->append_cstring(isc_dyn_def_file, ((dsql_str*) (ptr[e_shadow_name]))->str_data);
request->append_number(isc_dyn_shadow_man_auto, request->append_number(isc_dyn_shadow_man_auto,
(SSHORT)(SLONG) ((ptr[e_shadow_man_auto])->nod_arg[0])); (SSHORT)(IPTR) ((ptr[e_shadow_man_auto])->nod_arg[0]));
request->append_number(isc_dyn_shadow_conditional, request->append_number(isc_dyn_shadow_conditional,
(SSHORT)(SLONG) ((ptr[e_shadow_conditional])->nod_arg[0])); (SSHORT)(IPTR) ((ptr[e_shadow_conditional])->nod_arg[0]));
request->append_file_start(0); request->append_file_start(0);
SLONG length = (SLONG) ptr[e_shadow_length]; SLONG length = (IPTR) ptr[e_shadow_length];
request->append_file_length(length); request->append_file_length(length);
request->append_uchar(isc_dyn_end); request->append_uchar(isc_dyn_end);
@ -2846,7 +2846,7 @@ static void define_shadow(dsql_req* request)
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607, ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
isc_arg_gds, isc_dsql_command_err, isc_arg_gds, isc_dsql_command_err,
isc_arg_gds, isc_dsql_file_length_err, isc_arg_gds, isc_dsql_file_length_err,
isc_arg_number, (SLONG) file->fil_name->str_data, isc_arg_number, (ISC_STATUS) file->fil_name->str_data,
// Preceding file did not specify length, so %s must include starting page number // Preceding file did not specify length, so %s must include starting page number
0); 0);
} }
@ -2952,15 +2952,15 @@ static void define_trigger( dsql_req* request, dsql_nod* node)
dsql_nod* constant = node->nod_arg[e_trg_active]; dsql_nod* constant = node->nod_arg[e_trg_active];
if (constant) if (constant)
request->append_number(isc_dyn_trg_inactive, request->append_number(isc_dyn_trg_inactive,
(SSHORT)(SLONG) constant->nod_arg[0]); (SSHORT)(IPTR) constant->nod_arg[0]);
if (constant = node->nod_arg[e_trg_position]) if (constant = node->nod_arg[e_trg_position])
request->append_number(isc_dyn_trg_sequence, request->append_number(isc_dyn_trg_sequence,
(SSHORT)(SLONG) constant->nod_arg[0]); (SSHORT)(IPTR) constant->nod_arg[0]);
if (constant = node->nod_arg[e_trg_type]) { if (constant = node->nod_arg[e_trg_type]) {
request->append_number(isc_dyn_trg_type, (SSHORT)(SLONG) constant->nod_arg[0]); request->append_number(isc_dyn_trg_type, (SSHORT)(IPTR) constant->nod_arg[0]);
trig_type = (USHORT)(ULONG) constant->nod_arg[0]; trig_type = (USHORT)(IPTR) constant->nod_arg[0];
} }
else { else {
fb_assert(node->nod_type == nod_mod_trigger); fb_assert(node->nod_type == nod_mod_trigger);
@ -3041,7 +3041,7 @@ static void define_trigger( dsql_req* request, dsql_nod* node)
for (const dsql_nod* const* ptr = temp->nod_arg; ptr < end; ++ptr) for (const dsql_nod* const* ptr = temp->nod_arg; ptr < end; ++ptr)
{ {
const dsql_nod* message = *ptr; const dsql_nod* message = *ptr;
const SSHORT number = (SSHORT)(SLONG) message->nod_arg[e_msg_number]; const SSHORT number = (SSHORT)(IPTR) message->nod_arg[e_msg_number];
if (message->nod_type == nod_del_trigger_msg) if (message->nod_type == nod_del_trigger_msg)
{ {
request->append_number(isc_dyn_delete_trigger_msg, number); request->append_number(isc_dyn_delete_trigger_msg, number);
@ -3143,7 +3143,7 @@ static void define_udf( dsql_req* request)
// CVC: This is case of "returns parameter <N>" // CVC: This is case of "returns parameter <N>"
position = (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]); position = (SSHORT)(IPTR) (ret_val_ptr[1]->nod_arg[0]);
// Function modifies an argument whose value is the function return value // Function modifies an argument whose value is the function return value
if (!arguments || position > arguments->nod_count || position < 1) { if (!arguments || position > arguments->nod_count || position < 1) {
@ -3170,7 +3170,7 @@ static void define_udf( dsql_req* request)
{ {
/* CVC: I need to test returning blobs by descriptor before allowing the /* CVC: I need to test returning blobs by descriptor before allowing the
change there. For now, I ignore the return type specification. */ change there. For now, I ignore the return type specification. */
bool free_it = ((SSHORT)(SLONG) ret_val_ptr[1]->nod_arg[0] < 0); bool free_it = ((SSHORT)(IPTR) ret_val_ptr[1]->nod_arg[0] < 0);
request->append_number(isc_dyn_def_function_arg, blob_position); request->append_number(isc_dyn_def_function_arg, blob_position);
request->append_number(isc_dyn_func_mechanism, request->append_number(isc_dyn_func_mechanism,
(SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct)); (SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct));
@ -3181,7 +3181,7 @@ static void define_udf( dsql_req* request)
{ {
request->append_number(isc_dyn_def_function_arg, (SSHORT) 0); request->append_number(isc_dyn_def_function_arg, (SSHORT) 0);
request->append_number(isc_dyn_func_mechanism, request->append_number(isc_dyn_func_mechanism,
(SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0])); (SSHORT)(IPTR) (ret_val_ptr[1]->nod_arg[0]));
} }
request->append_cstring(isc_dyn_function_name, udf_name); request->append_cstring(isc_dyn_function_name, udf_name);
@ -3217,7 +3217,7 @@ static void define_udf( dsql_req* request)
request->append_number(isc_dyn_def_function_arg, (SSHORT) position); request->append_number(isc_dyn_def_function_arg, (SSHORT) position);
if (param_node[e_udf_param_type]) { if (param_node[e_udf_param_type]) {
SSHORT arg_mechanism = (SSHORT)(SLONG) (param_node[e_udf_param_type]->nod_arg[0]); SSHORT arg_mechanism = (SSHORT)(IPTR) (param_node[e_udf_param_type]->nod_arg[0]);
request->append_number(isc_dyn_func_mechanism, arg_mechanism); request->append_number(isc_dyn_func_mechanism, arg_mechanism);
} }
else if (field->fld_dtype == dtype_blob) { else if (field->fld_dtype == dtype_blob) {
@ -3815,14 +3815,14 @@ static void define_view_trigger( dsql_req* request, dsql_nod* node, dsql_nod* rs
if (constant) if (constant)
{ {
request->append_number(isc_dyn_trg_sequence, request->append_number(isc_dyn_trg_sequence,
(SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0)); (SSHORT)(IPTR) (constant ? constant->nod_arg[0] : 0));
} }
constant = node->nod_arg[e_cnstr_type]; constant = node->nod_arg[e_cnstr_type];
USHORT trig_type; USHORT trig_type;
if (constant) if (constant)
{ {
trig_type = (USHORT)(ULONG) constant->nod_arg[0]; trig_type = (USHORT)(IPTR) constant->nod_arg[0];
request->append_number(isc_dyn_trg_type, trig_type); request->append_number(isc_dyn_trg_type, trig_type);
} }
else else
@ -4288,7 +4288,7 @@ static void generate_dyn( dsql_req* request, dsql_nod* node)
case nod_del_shadow: case nod_del_shadow:
request->append_number(isc_dyn_delete_shadow, request->append_number(isc_dyn_delete_shadow,
(SSHORT)(SLONG) (node->nod_arg[0])); (SSHORT)(IPTR) (node->nod_arg[0]));
request->append_uchar(isc_dyn_end); request->append_uchar(isc_dyn_end);
break; break;
@ -4733,25 +4733,25 @@ request->append_number(isc_dyn_rel_sql_protection, 1);
case nod_group_commit_wait: case nod_group_commit_wait:
request->append_uchar(isc_dyn_log_group_commit_wait); request->append_uchar(isc_dyn_log_group_commit_wait);
temp_long = (SLONG) (element->nod_arg[0]); temp_long = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(temp_long); request->append_ulong_with_length(temp_long);
break; break;
case nod_check_point_len: case nod_check_point_len:
request->append_uchar(isc_dyn_log_check_point_length); request->append_uchar(isc_dyn_log_check_point_length);
temp_long = (SLONG) (element->nod_arg[0]); temp_long = (IPTR) (element->nod_arg[0]);
request->append_ulong_with_length(temp_long); request->append_ulong_with_length(temp_long);
break; break;
case nod_num_log_buffers: case nod_num_log_buffers:
request->append_uchar(isc_dyn_log_num_of_buffers); request->append_uchar(isc_dyn_log_num_of_buffers);
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); temp_short = (SSHORT)(IPTR) (element->nod_arg[0]);
request->append_ushort_with_length(temp_short); request->append_ushort_with_length(temp_short);
break; break;
case nod_log_buffer_size: case nod_log_buffer_size:
request->append_uchar(isc_dyn_log_buffer_size); request->append_uchar(isc_dyn_log_buffer_size);
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); temp_short = (SSHORT)(IPTR) (element->nod_arg[0]);
request->append_ushort_with_length(temp_short); request->append_ushort_with_length(temp_short);
break; break;
case nod_difference_file: case nod_difference_file:
@ -5216,7 +5216,7 @@ static void modify_relation( dsql_req* request)
const_node = element->nod_arg[e_mod_fld_pos_new_position]; const_node = element->nod_arg[e_mod_fld_pos_new_position];
/* CVC: Since now the parser accepts pos=1..N, let's subtract one here. */ /* CVC: Since now the parser accepts pos=1..N, let's subtract one here. */
constant = (SSHORT)(SLONG) const_node->nod_arg[0] - 1; constant = (SSHORT)(IPTR) const_node->nod_arg[0] - 1;
request->append_cstring(isc_dyn_rel_name, request->append_cstring(isc_dyn_rel_name,
relation_name->str_data); relation_name->str_data);

View File

@ -99,8 +99,8 @@ nested FOR loops are added.
#endif #endif
static void cleanup(void*); static void cleanup(void*);
static void cleanup_database(FRBRD**, SLONG); static void cleanup_database(FRBRD**, void*);
static void cleanup_transaction(FRBRD*, SLONG); static void cleanup_transaction(FRBRD*, void*);
static void close_cursor(dsql_req*); static void close_cursor(dsql_req*);
static USHORT convert(SLONG, UCHAR*); static USHORT convert(SLONG, UCHAR*);
static ISC_STATUS error(); static ISC_STATUS error();
@ -603,7 +603,7 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
gds__transaction_cleanup(local_status, gds__transaction_cleanup(local_status,
trans_handle, trans_handle,
cleanup_transaction, 0); cleanup_transaction, NULL);
THREAD_ENTER; THREAD_ENTER;
} }
@ -1055,7 +1055,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
desc.dsc_scale = 0; desc.dsc_scale = 0;
desc.dsc_length = sizeof(USHORT); desc.dsc_length = sizeof(USHORT);
desc.dsc_flags = 0; desc.dsc_flags = 0;
desc.dsc_address = (UCHAR *) & direction; desc.dsc_address = (UCHAR*) & direction;
offset_parameter = message->msg_parameters; offset_parameter = message->msg_parameters;
parameter = offset_parameter->par_next; parameter = offset_parameter->par_next;
@ -1065,7 +1065,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
desc.dsc_scale = 0; desc.dsc_scale = 0;
desc.dsc_length = sizeof(SLONG); desc.dsc_length = sizeof(SLONG);
desc.dsc_flags = 0; desc.dsc_flags = 0;
desc.dsc_address = (UCHAR *) & offset; desc.dsc_address = (UCHAR*) & offset;
MOVD_move(&desc, &offset_parameter->par_desc); MOVD_move(&desc, &offset_parameter->par_desc);
@ -1098,8 +1098,8 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
parameter = request->req_blob->blb_segment; parameter = request->req_blob->blb_segment;
par* null = parameter->par_null; par* null = parameter->par_null;
USHORT* ret_length = USHORT* ret_length =
(USHORT *) (dsql_msg_buf + (SLONG) null->par_user_desc.dsc_address); (USHORT *) (dsql_msg_buf + (IPTR) null->par_user_desc.dsc_address);
UCHAR* buffer = dsql_msg_buf + (SLONG) parameter->par_user_desc.dsc_address; UCHAR* buffer = dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address;
THREAD_EXIT; THREAD_EXIT;
s = isc_get_segment(tdsql->tsql_status, &request->req_handle, s = isc_get_segment(tdsql->tsql_status, &request->req_handle,
ret_length, parameter->par_user_desc.dsc_length, ret_length, parameter->par_user_desc.dsc_length,
@ -1270,7 +1270,7 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
par* parameter = request->req_blob->blb_segment; par* parameter = request->req_blob->blb_segment;
const SCHAR* buffer = const SCHAR* buffer =
reinterpret_cast<const SCHAR*>( reinterpret_cast<const SCHAR*>(
dsql_msg_buf + (SLONG) parameter->par_user_desc.dsc_address); dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address);
THREAD_EXIT; THREAD_EXIT;
const ISC_STATUS s = const ISC_STATUS s =
isc_put_segment(tdsql->tsql_status, &request->req_handle, isc_put_segment(tdsql->tsql_status, &request->req_handle,
@ -1832,7 +1832,7 @@ void DSQL_pretty(const dsql_nod* node, int column)
TEXT s[64]; TEXT s[64];
TEXT* p = buffer; TEXT* p = buffer;
p += sprintf(p, "%.7X ", (unsigned int) node); p += sprintf(p, "%p ", node);
if (column) { if (column) {
USHORT l = column * 3; USHORT l = column * 3;
@ -2736,7 +2736,7 @@ void DSQL_pretty(const dsql_nod* node, int column)
case nod_parameter: case nod_parameter:
if (node->nod_column) { if (node->nod_column) {
trace_line("%sparameter: %d\n", buffer, trace_line("%sparameter: %d\n", buffer,
(USHORT)(ULONG)node->nod_arg[e_par_parameter]); (USHORT)(IPTR)node->nod_arg[e_par_parameter]);
} }
else { else {
const par* param = (par*) node->nod_arg[e_par_parameter]; const par* param = (par*) node->nod_arg[e_par_parameter];
@ -2834,7 +2834,7 @@ static void cleanup( void *arg)
@param flag @param flag
**/ **/
static void cleanup_database(FRBRD ** db_handle, SLONG flag) static void cleanup_database(FRBRD ** db_handle, void* flag)
{ {
DBB *dbb_ptr, dbb; DBB *dbb_ptr, dbb;
@ -2895,7 +2895,7 @@ static void cleanup_database(FRBRD ** db_handle, SLONG flag)
@param arg @param arg
**/ **/
static void cleanup_transaction (FRBRD * tra_handle, SLONG arg) static void cleanup_transaction (FRBRD * tra_handle, void* arg)
{ {
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
OPN *open_cursor_ptr, open_cursor; OPN *open_cursor_ptr, open_cursor;
@ -3498,7 +3498,7 @@ static ISC_STATUS execute_request(dsql_req* request,
static SSHORT filter_sub_type( dsql_req* request, const dsql_nod* node) static SSHORT filter_sub_type( dsql_req* request, const dsql_nod* node)
{ {
if (node->nod_type == nod_constant) if (node->nod_type == nod_constant)
return (SSHORT)(SLONG) node->nod_arg[0]; return (SSHORT)(IPTR) node->nod_arg[0];
const par* parameter = (par*) node->nod_arg[e_par_parameter]; const par* parameter = (par*) node->nod_arg[e_par_parameter];
const par* null = parameter->par_null; const par* null = parameter->par_null;
@ -4299,7 +4299,7 @@ static void map_in_out( dsql_req* request,
// Make sure the message given to us is long enough // Make sure the message given to us is long enough
DSC desc = parameter->par_user_desc; DSC desc = parameter->par_user_desc;
USHORT length = (SLONG) desc.dsc_address + desc.dsc_length; USHORT length = (IPTR) desc.dsc_address + desc.dsc_length;
if (length > msg_length) if (length > msg_length)
break; break;
if (!desc.dsc_dtype) if (!desc.dsc_dtype)
@ -4309,8 +4309,7 @@ static void map_in_out( dsql_req* request,
par* null = parameter->par_null; par* null = parameter->par_null;
if (null != NULL) if (null != NULL)
{ {
const USHORT null_offset = const USHORT null_offset = (IPTR) null->par_user_desc.dsc_address;
(USHORT)(ULONG) (null->par_user_desc.dsc_address);
length = null_offset + sizeof(SSHORT); length = null_offset + sizeof(SSHORT);
if (length > msg_length) if (length > msg_length)
break; break;
@ -4325,7 +4324,7 @@ static void map_in_out( dsql_req* request,
} }
} }
desc.dsc_address = dsql_msg_buf + (SLONG) desc.dsc_address; desc.dsc_address = dsql_msg_buf + (IPTR) desc.dsc_address;
if (!request) if (!request)
MOVD_move(&parameter->par_desc, &desc); MOVD_move(&parameter->par_desc, &desc);
else if (!flag || *flag >= 0) else if (!flag || *flag >= 0)
@ -4555,7 +4554,7 @@ static USHORT parse_blr(
USHORT align = type_alignments[desc.dsc_dtype]; USHORT align = type_alignments[desc.dsc_dtype];
if (align) if (align)
offset = FB_ALIGN(offset, align); offset = FB_ALIGN(offset, align);
desc.dsc_address = (UCHAR *) (ULONG) offset; desc.dsc_address = (UCHAR*)(IPTR) offset;
offset += desc.dsc_length; offset += desc.dsc_length;
if (*blr++ != blr_short || *blr++ != 0) if (*blr++ != blr_short || *blr++ != 0)
@ -4577,7 +4576,7 @@ static USHORT parse_blr(
null->par_user_desc.dsc_dtype = dtype_short; null->par_user_desc.dsc_dtype = dtype_short;
null->par_user_desc.dsc_scale = 0; null->par_user_desc.dsc_scale = 0;
null->par_user_desc.dsc_length = sizeof(SSHORT); null->par_user_desc.dsc_length = sizeof(SSHORT);
null->par_user_desc.dsc_address = (UCHAR*)(ULONG) null_offset; null->par_user_desc.dsc_address = (UCHAR*)(IPTR) null_offset;
} }
} }
} }

View File

@ -627,8 +627,7 @@ void GEN_port( dsql_req* request, dsql_msg* message)
const USHORT align = type_alignments[parameter->par_desc.dsc_dtype]; const USHORT align = type_alignments[parameter->par_desc.dsc_dtype];
if (align) if (align)
message->msg_length = FB_ALIGN(message->msg_length, align); message->msg_length = FB_ALIGN(message->msg_length, align);
parameter->par_desc.dsc_address = parameter->par_desc.dsc_address = (UCHAR*)(IPTR)message->msg_length;
(UCHAR *) (SLONG) message->msg_length;
// CVC: No check for overflow here? Should be < 64K // CVC: No check for overflow here? Should be < 64K
message->msg_length += parameter->par_desc.dsc_length; message->msg_length += parameter->par_desc.dsc_length;
if (request->req_blr_string) if (request->req_blr_string)
@ -647,8 +646,8 @@ void GEN_port( dsql_req* request, dsql_msg* message)
for (parameter = message->msg_parameters; parameter; for (parameter = message->msg_parameters; parameter;
parameter = parameter->par_next) parameter = parameter->par_next)
{ {
parameter->par_desc.dsc_address = parameter->par_desc.dsc_address = message->msg_buffer +
message->msg_buffer + (SLONG) parameter->par_desc.dsc_address; (IPTR)parameter->par_desc.dsc_address;
} }
} }
@ -1635,7 +1634,7 @@ static void gen_error_condition( dsql_req* request, const dsql_nod* node)
switch (node->nod_type) { switch (node->nod_type) {
case nod_sqlcode: case nod_sqlcode:
stuff(request, blr_sql_code); stuff(request, blr_sql_code);
stuff_word(request, (USHORT)(ULONG) node->nod_arg[0]); stuff_word(request, (USHORT)(IPTR) node->nod_arg[0]);
return; return;
case nod_gdscode: case nod_gdscode:
@ -2293,7 +2292,7 @@ static void gen_select( dsql_req* request, dsql_nod* rse)
constant_desc.dsc_sub_type = 0; constant_desc.dsc_sub_type = 0;
constant_desc.dsc_flags = 0; constant_desc.dsc_flags = 0;
constant_desc.dsc_length = sizeof(SSHORT); constant_desc.dsc_length = sizeof(SSHORT);
constant_desc.dsc_address = (UCHAR *) & constant; constant_desc.dsc_address = (UCHAR*) & constant;
// Set up parameter for things in the select list // Set up parameter for things in the select list
dsql_nod* list = rse->nod_arg[e_rse_items]; dsql_nod* list = rse->nod_arg[e_rse_items];
@ -2710,7 +2709,7 @@ static void gen_sort( dsql_req* request, dsql_nod* list)
{ {
dsql_nod* nulls_placement = (*ptr)->nod_arg[e_order_nulls]; dsql_nod* nulls_placement = (*ptr)->nod_arg[e_order_nulls];
if (nulls_placement) { if (nulls_placement) {
switch ((SLONG)nulls_placement->nod_arg[0]) { switch ((IPTR)nulls_placement->nod_arg[0]) {
case NOD_NULLS_FIRST: case NOD_NULLS_FIRST:
stuff(request, blr_nullsfirst); stuff(request, blr_nullsfirst);
break; break;

View File

@ -101,7 +101,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_length = sizeof(SLONG); node->nod_desc.dsc_length = sizeof(SLONG);
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_address = (UCHAR *) node->nod_arg; node->nod_desc.dsc_address = (UCHAR*) node->nod_arg;
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
break; break;
@ -119,7 +119,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_scale = static_cast < char >(constant->str_length); node->nod_desc.dsc_scale = static_cast < char >(constant->str_length);
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_length = sizeof(double); node->nod_desc.dsc_length = sizeof(double);
node->nod_desc.dsc_address = reinterpret_cast<UCHAR*>(constant->str_data); node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = ttype_ascii; node->nod_desc.dsc_ttype = ttype_ascii;
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
break; break;
@ -137,7 +137,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_length = sizeof(SINT64); node->nod_desc.dsc_length = sizeof(SINT64);
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_address = (UCHAR *) node->nod_arg; node->nod_desc.dsc_address = (UCHAR*) node->nod_arg;
/* Now convert the string to an int64. We can omit testing for /* Now convert the string to an int64. We can omit testing for
overflow, because we would never have gotten here if yylex overflow, because we would never have gotten here if yylex
@ -182,7 +182,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = type_lengths[node->nod_desc.dsc_dtype]; node->nod_desc.dsc_length = type_lengths[node->nod_desc.dsc_dtype];
node->nod_desc.dsc_address = (UCHAR *) node->nod_arg; node->nod_desc.dsc_address = (UCHAR*) node->nod_arg;
// Set up a descriptor to point to the string // Set up a descriptor to point to the string
@ -192,7 +192,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
tmp.dsc_flags = 0; tmp.dsc_flags = 0;
tmp.dsc_ttype = ttype_ascii; tmp.dsc_ttype = ttype_ascii;
tmp.dsc_length = static_cast<USHORT>(constant->str_length); tmp.dsc_length = static_cast<USHORT>(constant->str_length);
tmp.dsc_address = reinterpret_cast<UCHAR*>(constant->str_data); tmp.dsc_address = (UCHAR*) constant->str_data;
// Now invoke the string_to_date/time/timestamp routines // Now invoke the string_to_date/time/timestamp routines
@ -209,7 +209,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = node->nod_desc.dsc_length =
static_cast<USHORT>(constant->str_length); static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = reinterpret_cast<UCHAR*>(constant->str_data); node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = ttype_dynamic; node->nod_desc.dsc_ttype = ttype_dynamic;
// carry a pointer to the constant to resolve character set in pass1 // carry a pointer to the constant to resolve character set in pass1
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;
@ -245,7 +245,7 @@ dsql_nod* MAKE_str_constant(dsql_str* constant, SSHORT character_set)
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = static_cast<USHORT>(constant->str_length); node->nod_desc.dsc_length = static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = reinterpret_cast<UCHAR*>(constant->str_data); node->nod_desc.dsc_address = (UCHAR*) constant->str_data;
node->nod_desc.dsc_ttype = character_set; node->nod_desc.dsc_ttype = character_set;
// carry a pointer to the constant to resolve character set in pass1 // carry a pointer to the constant to resolve character set in pass1
node->nod_arg[0] = (dsql_nod*) constant; node->nod_arg[0] = (dsql_nod*) constant;

View File

@ -1027,7 +1027,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name)
if (d->dsc_dtype == dtype_varying) { if (d->dsc_dtype == dtype_varying) {
d->dsc_length += sizeof (USHORT); d->dsc_length += sizeof (USHORT);
} }
d->dsc_address = 0; d->dsc_address = NULL;
if (!X.RDB$CHARACTER_SET_ID.NULL) { if (!X.RDB$CHARACTER_SET_ID.NULL) {
if (d->dsc_dtype != dtype_blob) { if (d->dsc_dtype != dtype_blob) {

View File

@ -555,7 +555,7 @@ statement : alter
| set | set
| update | update
| KW_DEBUG signed_short_integer | KW_DEBUG signed_short_integer
{ prepare_console_debug ((int) $2, &yydebug); { prepare_console_debug ((IPTR) $2, &yydebug);
$$ = make_node (nod_null, (int) 0, NULL); } $$ = make_node (nod_null, (int) 0, NULL); }
; ;
@ -757,7 +757,7 @@ udf_data_type : simple_type
| CSTRING '(' pos_short_integer ')' charset_clause | CSTRING '(' pos_short_integer ')' charset_clause
{ {
lex.g_field->fld_dtype = dtype_cstring; lex.g_field->fld_dtype = dtype_cstring;
lex.g_field->fld_character_length = (USHORT)(ULONG) $3; } lex.g_field->fld_character_length = (USHORT)(IPTR) $3; }
; ;
arg_desc_list1 : arg_desc_list1 :
@ -1125,7 +1125,7 @@ db_cache : CACHE sql_string cache_length
yyabandon (-260, isc_cache_redef); yyabandon (-260, isc_cache_redef);
*/ /* Cache redefined */ /* */ /* Cache redefined */ /*
lex.g_file = make_file(); lex.g_file = make_file();
lex.g_file->fil_length = (SLONG) $3; lex.g_file->fil_length = (IPTR) $3;
lex.g_file->fil_name = (dsql_str*) $2; lex.g_file->fil_name = (dsql_str*) $2;
lex.cache_defined = TRUE; lex.cache_defined = TRUE;
$$ = (dsql_nod*) make_node (nod_cache_file_desc, (int) 1, $$ = (dsql_nod*) make_node (nod_cache_file_desc, (int) 1,
@ -1163,7 +1163,7 @@ logfile_attrs :
; ;
logfile_attr : KW_SIZE equals long_integer logfile_attr : KW_SIZE equals long_integer
{ lex.g_file->fil_length = (SLONG) $3; } { lex.g_file->fil_length = (IPTR) $3; }
/* /*
| RAW_PARTITIONS equals pos_short_integer | RAW_PARTITIONS equals pos_short_integer
{ lex.g_file->fil_partitions = (SSHORT) $3; { lex.g_file->fil_partitions = (SSHORT) $3;
@ -1183,9 +1183,9 @@ file_desc : file_clause
; ;
file_clause : STARTING file_clause_noise long_integer file_clause : STARTING file_clause_noise long_integer
{ lex.g_file->fil_start = (SLONG) $3;} { lex.g_file->fil_start = (IPTR) $3;}
| LENGTH equals long_integer page_noise | LENGTH equals long_integer page_noise
{ lex.g_file->fil_length = (SLONG) $3;} { lex.g_file->fil_length = (IPTR) $3;}
; ;
file_clause_noise : file_clause_noise :
@ -1977,35 +1977,35 @@ trigger_type_prefix : BEFORE
; ;
trigger_type_suffix : INSERT trigger_type_suffix : INSERT
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (1, 0, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 0, 0), CONSTANT_SLONG); }
| UPDATE | UPDATE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (2, 0, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 0, 0), CONSTANT_SLONG); }
| KW_DELETE | KW_DELETE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (3, 0, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 0, 0), CONSTANT_SLONG); }
| INSERT OR UPDATE | INSERT OR UPDATE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (1, 2, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 2, 0), CONSTANT_SLONG); }
| INSERT OR KW_DELETE | INSERT OR KW_DELETE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (1, 3, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 3, 0), CONSTANT_SLONG); }
| UPDATE OR INSERT | UPDATE OR INSERT
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (2, 1, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 1, 0), CONSTANT_SLONG); }
| UPDATE OR KW_DELETE | UPDATE OR KW_DELETE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (2, 3, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 3, 0), CONSTANT_SLONG); }
| KW_DELETE OR INSERT | KW_DELETE OR INSERT
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (3, 1, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 1, 0), CONSTANT_SLONG); }
| KW_DELETE OR UPDATE | KW_DELETE OR UPDATE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (3, 2, 0), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 2, 0), CONSTANT_SLONG); }
| INSERT OR UPDATE OR KW_DELETE | INSERT OR UPDATE OR KW_DELETE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (1, 2, 3), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 2, 3), CONSTANT_SLONG); }
| INSERT OR KW_DELETE OR UPDATE | INSERT OR KW_DELETE OR UPDATE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (1, 3, 2), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 3, 2), CONSTANT_SLONG); }
| UPDATE OR INSERT OR KW_DELETE | UPDATE OR INSERT OR KW_DELETE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (2, 1, 3), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 1, 3), CONSTANT_SLONG); }
| UPDATE OR KW_DELETE OR INSERT | UPDATE OR KW_DELETE OR INSERT
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (2, 3, 1), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 3, 1), CONSTANT_SLONG); }
| KW_DELETE OR INSERT OR UPDATE | KW_DELETE OR INSERT OR UPDATE
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (3, 1, 2), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 1, 2), CONSTANT_SLONG); }
| KW_DELETE OR UPDATE OR INSERT | KW_DELETE OR UPDATE OR INSERT
{ $$ = MAKE_constant ((dsql_str*) trigger_type_suffix (3, 2, 1), CONSTANT_SLONG); } { $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 2, 1), CONSTANT_SLONG); }
; ;
trigger_position : POSITION nonneg_short_integer trigger_position : POSITION nonneg_short_integer
@ -2312,7 +2312,7 @@ array_spec : array_range
; ;
array_range : signed_long_integer array_range : signed_long_integer
{ if ((SLONG) $1 < 1) { if ((IPTR) $1 < 1)
$$ = make_node (nod_list, (int) 2, $$ = make_node (nod_list, (int) 2,
MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG), MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG),
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)); MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG));
@ -2418,26 +2418,26 @@ blob_type : BLOB blob_subtype blob_segsize charset_clause
| BLOB '(' unsigned_short_integer ')' | BLOB '(' unsigned_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_blob; lex.g_field->fld_dtype = dtype_blob;
lex.g_field->fld_seg_length = (USHORT)(ULONG) $3; lex.g_field->fld_seg_length = (USHORT)(IPTR) $3;
lex.g_field->fld_sub_type = 0; lex.g_field->fld_sub_type = 0;
} }
| BLOB '(' unsigned_short_integer ',' signed_short_integer ')' | BLOB '(' unsigned_short_integer ',' signed_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_blob; lex.g_field->fld_dtype = dtype_blob;
lex.g_field->fld_seg_length = (USHORT)(ULONG) $3; lex.g_field->fld_seg_length = (USHORT)(IPTR) $3;
lex.g_field->fld_sub_type = (USHORT)(ULONG) $5; lex.g_field->fld_sub_type = (USHORT)(IPTR) $5;
} }
| BLOB '(' ',' signed_short_integer ')' | BLOB '(' ',' signed_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_blob; lex.g_field->fld_dtype = dtype_blob;
lex.g_field->fld_seg_length = 80; lex.g_field->fld_seg_length = 80;
lex.g_field->fld_sub_type = (USHORT)(ULONG) $4; lex.g_field->fld_sub_type = (USHORT)(IPTR) $4;
} }
; ;
blob_segsize : SEGMENT KW_SIZE unsigned_short_integer blob_segsize : SEGMENT KW_SIZE unsigned_short_integer
{ {
lex.g_field->fld_seg_length = (USHORT)(ULONG) $3; lex.g_field->fld_seg_length = (USHORT)(IPTR) $3;
} }
| |
{ {
@ -2447,7 +2447,7 @@ blob_segsize : SEGMENT KW_SIZE unsigned_short_integer
blob_subtype : SUB_TYPE signed_short_integer blob_subtype : SUB_TYPE signed_short_integer
{ {
lex.g_field->fld_sub_type = (USHORT)(ULONG) $2; lex.g_field->fld_sub_type = (USHORT)(IPTR) $2;
} }
| SUB_TYPE symbol_blob_subtype_name | SUB_TYPE symbol_blob_subtype_name
{ {
@ -2473,7 +2473,7 @@ charset_clause : CHARACTER SET symbol_character_set_name
national_character_type : national_character_keyword '(' pos_short_integer ')' national_character_type : national_character_keyword '(' pos_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_text; lex.g_field->fld_dtype = dtype_text;
lex.g_field->fld_character_length = (USHORT)(ULONG) $3; lex.g_field->fld_character_length = (USHORT)(IPTR) $3;
lex.g_field->fld_flags |= FLD_national; lex.g_field->fld_flags |= FLD_national;
} }
| national_character_keyword | national_character_keyword
@ -2485,7 +2485,7 @@ national_character_type : national_character_keyword '(' pos_short_integer ')'
| national_character_keyword VARYING '(' pos_short_integer ')' | national_character_keyword VARYING '(' pos_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_varying; lex.g_field->fld_dtype = dtype_varying;
lex.g_field->fld_character_length = (USHORT)(ULONG) $4; lex.g_field->fld_character_length = (USHORT)(IPTR) $4;
lex.g_field->fld_flags |= FLD_national; lex.g_field->fld_flags |= FLD_national;
} }
; ;
@ -2493,7 +2493,7 @@ national_character_type : national_character_keyword '(' pos_short_integer ')'
character_type : character_keyword '(' pos_short_integer ')' character_type : character_keyword '(' pos_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_text; lex.g_field->fld_dtype = dtype_text;
lex.g_field->fld_character_length = (USHORT)(ULONG) $3; lex.g_field->fld_character_length = (USHORT)(IPTR) $3;
} }
| character_keyword | character_keyword
{ {
@ -2503,7 +2503,7 @@ character_type : character_keyword '(' pos_short_integer ')'
| varying_keyword '(' pos_short_integer ')' | varying_keyword '(' pos_short_integer ')'
{ {
lex.g_field->fld_dtype = dtype_varying; lex.g_field->fld_dtype = dtype_varying;
lex.g_field->fld_character_length = (USHORT)(ULONG) $3; lex.g_field->fld_character_length = (USHORT)(IPTR) $3;
} }
; ;
@ -2548,10 +2548,10 @@ prec_scale :
} }
| '(' signed_long_integer ')' | '(' signed_long_integer ')'
{ {
if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) ) if ( ((IPTR) $2 < 1) || ((IPTR) $2 > 18) )
yyabandon (-842, isc_precision_err); yyabandon (-842, isc_precision_err);
/* Precision most be between 1 and 18. */ /* Precision most be between 1 and 18. */
if ((SLONG) $2 > 9) if ((IPTR) $2 > 9)
{ {
if ( ( (client_dialect <= SQL_DIALECT_V5) && if ( ( (client_dialect <= SQL_DIALECT_V5) &&
(db_dialect > SQL_DIALECT_V5) ) || (db_dialect > SQL_DIALECT_V5) ) ||
@ -2588,7 +2588,7 @@ prec_scale :
} }
} }
else else
if ((SLONG) $2 < 5) if ((IPTR) $2 < 5)
{ {
lex.g_field->fld_dtype = dtype_short; lex.g_field->fld_dtype = dtype_short;
lex.g_field->fld_length = sizeof (SSHORT); lex.g_field->fld_length = sizeof (SSHORT);
@ -2598,17 +2598,17 @@ prec_scale :
lex.g_field->fld_dtype = dtype_long; lex.g_field->fld_dtype = dtype_long;
lex.g_field->fld_length = sizeof (SLONG); lex.g_field->fld_length = sizeof (SLONG);
} }
lex.g_field->fld_precision = (USHORT)(ULONG) $2; lex.g_field->fld_precision = (USHORT)(IPTR) $2;
} }
| '(' signed_long_integer ',' signed_long_integer ')' | '(' signed_long_integer ',' signed_long_integer ')'
{ {
if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) ) if ( ((IPTR) $2 < 1) || ((IPTR) $2 > 18) )
yyabandon (-842, isc_precision_err); yyabandon (-842, isc_precision_err);
/* Precision should be between 1 and 18 */ /* Precision should be between 1 and 18 */
if (((SLONG) $4 > (SLONG) $2) || ((SLONG) $4 < 0)) if (((IPTR) $4 > (IPTR) $2) || ((IPTR) $4 < 0))
yyabandon (-842, isc_scale_nogt); yyabandon (-842, isc_scale_nogt);
/* Scale must be between 0 and precision */ /* Scale must be between 0 and precision */
if ((SLONG) $2 > 9) if ((IPTR) $2 > 9)
{ {
if ( ( (client_dialect <= SQL_DIALECT_V5) && if ( ( (client_dialect <= SQL_DIALECT_V5) &&
(db_dialect > SQL_DIALECT_V5) ) || (db_dialect > SQL_DIALECT_V5) ) ||
@ -2646,7 +2646,7 @@ prec_scale :
} }
else else
{ {
if ((SLONG) $2 < 5) if ((IPTR) $2 < 5)
{ {
lex.g_field->fld_dtype = dtype_short; lex.g_field->fld_dtype = dtype_short;
lex.g_field->fld_length = sizeof (SSHORT); lex.g_field->fld_length = sizeof (SSHORT);
@ -2657,8 +2657,8 @@ prec_scale :
lex.g_field->fld_length = sizeof (SLONG); lex.g_field->fld_length = sizeof (SLONG);
} }
} }
lex.g_field->fld_precision = (USHORT)(ULONG) $2; lex.g_field->fld_precision = (USHORT)(IPTR) $2;
lex.g_field->fld_scale = - (SSHORT)(SLONG) $4; lex.g_field->fld_scale = - (SSHORT)(IPTR) $4;
} }
; ;
@ -2672,7 +2672,7 @@ decimal_keyword : DECIMAL
float_type : KW_FLOAT precision_opt float_type : KW_FLOAT precision_opt
{ {
if ((SLONG) $2 > 7) if ((IPTR) $2 > 7)
{ {
lex.g_field->fld_dtype = dtype_double; lex.g_field->fld_dtype = dtype_double;
lex.g_field->fld_length = sizeof (double); lex.g_field->fld_length = sizeof (double);
@ -2875,7 +2875,7 @@ restr_option : table_list table_lock
; ;
table_lock : FOR lock_type lock_mode table_lock : FOR lock_type lock_mode
{ $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(SLONG) $2 | (SSHORT)(SLONG) $3), (SSHORT) 0, NULL); } { $$ = make_flag_node (nod_lock_mode, (SSHORT) ((SSHORT)(IPTR) $2 | (SSHORT)(IPTR) $3), (SSHORT) 0, NULL); }
| |
{ $$ = 0; } { $$ = 0; }
; ;
@ -3851,32 +3851,32 @@ sql_string : STRING /* string in current charset */
signed_short_integer : nonneg_short_integer signed_short_integer : nonneg_short_integer
| '-' neg_short_integer | '-' neg_short_integer
{ $$ = (dsql_nod*) - (SLONG) $2; } { $$ = (dsql_nod*) - (IPTR) $2; }
; ;
nonneg_short_integer : NUMBER nonneg_short_integer : NUMBER
{ if ((SLONG) $1 > SHRT_POS_MAX) { if ((IPTR) $1 > SHRT_POS_MAX)
yyabandon (-842, isc_expec_short); yyabandon (-842, isc_expec_short);
/* Short integer expected */ /* Short integer expected */
$$ = $1;} $$ = $1;}
; ;
neg_short_integer : NUMBER neg_short_integer : NUMBER
{ if ((SLONG) $1 > SHRT_NEG_MAX) { if ((IPTR) $1 > SHRT_NEG_MAX)
yyabandon (-842, isc_expec_short); yyabandon (-842, isc_expec_short);
/* Short integer expected */ /* Short integer expected */
$$ = $1;} $$ = $1;}
; ;
pos_short_integer : nonneg_short_integer pos_short_integer : nonneg_short_integer
{ if ((SLONG) $1 == 0) { if ((IPTR) $1 == 0)
yyabandon (-842, isc_expec_positive); yyabandon (-842, isc_expec_positive);
/* Positive number expected */ /* Positive number expected */
$$ = $1;} $$ = $1;}
; ;
unsigned_short_integer : NUMBER unsigned_short_integer : NUMBER
{ if ((SLONG) $1 > SHRT_UNSIGNED_MAX) { if ((IPTR) $1 > SHRT_UNSIGNED_MAX)
yyabandon (-842, isc_expec_ushort); yyabandon (-842, isc_expec_ushort);
/* Unsigned short integer expected */ /* Unsigned short integer expected */
$$ = $1;} $$ = $1;}
@ -3884,7 +3884,7 @@ unsigned_short_integer : NUMBER
signed_long_integer : long_integer signed_long_integer : long_integer
| '-' long_integer | '-' long_integer
{ $$ = (dsql_nod*) - (SLONG) $2; } { $$ = (dsql_nod*) - (IPTR) $2; }
; ;
long_integer : NUMBER long_integer : NUMBER
@ -4409,7 +4409,7 @@ static dsql_nod* make_parameter (void)
node->nod_line = (USHORT) lex.lines_bk; node->nod_line = (USHORT) lex.lines_bk;
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1); node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[0] = (dsql_nod*)(ULONG) lex.param_number++; node->nod_arg[0] = (dsql_nod*)(IPTR) lex.param_number++;
return node; return node;
} }
@ -4964,7 +4964,7 @@ int LexerState::yylex (
if (!have_decimal && (number <= MAX_SLONG)) if (!have_decimal && (number <= MAX_SLONG))
{ {
yylval = (dsql_nod*) (ULONG) number; yylval = (dsql_nod*) (IPTR) number;
return NUMBER; return NUMBER;
} }
else else

View File

@ -693,7 +693,7 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag)
true, true, true, true,
// Pass 0 here to restore older parameter // Pass 0 here to restore older parameter
// ordering behavior unconditionally. // ordering behavior unconditionally.
(USHORT)(ULONG) input->nod_arg[0]); (USHORT)(IPTR) input->nod_arg[0]);
return node; return node;
case nod_param_val: case nod_param_val:
@ -2150,7 +2150,7 @@ static void explode_asterisk(dsql_req* request, dsql_nod* node,
dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count); dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_derived_field_value]; derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_derived_field_value];
derived_field->nod_arg[e_derived_field_name] = select_item->nod_arg[e_derived_field_name]; derived_field->nod_arg[e_derived_field_name] = select_item->nod_arg[e_derived_field_name];
derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(ULONG) request->req_scope_level; derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(IPTR) request->req_scope_level;
derived_field->nod_desc = select_item->nod_desc; derived_field->nod_desc = select_item->nod_desc;
LLS_PUSH(derived_field, stack); LLS_PUSH(derived_field, stack);
} }
@ -3646,7 +3646,7 @@ static dsql_nod* pass1_derived_table(dsql_req* request, dsql_nod* input, bool pr
dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count); dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
derived_field->nod_arg[e_derived_field_value] = select_item; derived_field->nod_arg[e_derived_field_value] = select_item;
derived_field->nod_arg[e_derived_field_name] = list->nod_arg[count]; derived_field->nod_arg[e_derived_field_name] = list->nod_arg[count];
derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(ULONG) request->req_scope_level; derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(IPTR) request->req_scope_level;
derived_field->nod_desc = select_item->nod_desc; derived_field->nod_desc = select_item->nod_desc;
rse->nod_arg[e_rse_items]->nod_arg[count] = derived_field; rse->nod_arg[e_rse_items]->nod_arg[count] = derived_field;
@ -4477,7 +4477,7 @@ static dsql_nod* pass1_group_by_list(dsql_req* request, dsql_nod* input, dsql_no
} }
} }
else if ((sub->nod_type == nod_constant) && (sub->nod_desc.dsc_dtype == dtype_long)) { else if ((sub->nod_type == nod_constant) && (sub->nod_desc.dsc_dtype == dtype_long)) {
const ULONG position = (ULONG) (sub->nod_arg[0]); const ULONG position = (IPTR) (sub->nod_arg[0]);
if ((position < 1) || !select_list || if ((position < 1) || !select_list ||
(position > (ULONG) select_list->nod_count)) (position > (ULONG) select_list->nod_count))
{ {
@ -4818,7 +4818,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, TSQL tdsql, dsql_no
dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count); dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
derived_field->nod_arg[e_derived_field_value] = select_item; derived_field->nod_arg[e_derived_field_value] = select_item;
derived_field->nod_arg[e_derived_field_name] = (dsql_nod*) alias; derived_field->nod_arg[e_derived_field_name] = (dsql_nod*) alias;
derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(ULONG) request->req_scope_level; derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(IPTR) request->req_scope_level;
derived_field->nod_desc = select_item->nod_desc; derived_field->nod_desc = select_item->nod_desc;
return derived_field; return derived_field;
} }
@ -4836,7 +4836,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, TSQL tdsql, dsql_no
dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count); dsql_nod* derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_alias_value]; derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_alias_value];
derived_field->nod_arg[e_derived_field_name] = (dsql_nod*) alias; derived_field->nod_arg[e_derived_field_name] = (dsql_nod*) alias;
derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(ULONG) request->req_scope_level; derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(IPTR) request->req_scope_level;
derived_field->nod_desc = select_item->nod_desc; derived_field->nod_desc = select_item->nod_desc;
return derived_field; return derived_field;
} }
@ -4851,7 +4851,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, TSQL tdsql, dsql_no
// with orginal map. // with orginal map.
if (derived_field->nod_type == nod_derived_field) { if (derived_field->nod_type == nod_derived_field) {
derived_field->nod_arg[e_derived_field_value] = select_item; derived_field->nod_arg[e_derived_field_value] = select_item;
derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(ULONG) request->req_scope_level; derived_field->nod_arg[e_derived_field_scope] = (dsql_nod*)(IPTR) request->req_scope_level;
derived_field->nod_desc = select_item->nod_desc; derived_field->nod_desc = select_item->nod_desc;
return derived_field; return derived_field;
} }
@ -5851,7 +5851,7 @@ static dsql_nod* pass1_sort( dsql_req* request, dsql_nod* input, dsql_nod* s_lis
} }
if (node1->nod_type == nod_constant && node1->nod_desc.dsc_dtype == dtype_long) { if (node1->nod_type == nod_constant && node1->nod_desc.dsc_dtype == dtype_long) {
const ULONG position = (ULONG) (node1->nod_arg[0]); const ULONG position = (IPTR) (node1->nod_arg[0]);
if ((position < 1) || !s_list || if ((position < 1) || !s_list ||
(position > (ULONG) s_list->nod_count)) (position > (ULONG) s_list->nod_count))
{ {
@ -6123,7 +6123,7 @@ static dsql_nod* pass1_union( dsql_req* request, dsql_nod* input,
isc_arg_gds, isc_order_by_err, // invalid ORDER BY clause. isc_arg_gds, isc_order_by_err, // invalid ORDER BY clause.
0); 0);
} }
const SLONG number = (SLONG) position->nod_arg[0]; const SLONG number = (IPTR) position->nod_arg[0];
if (number < 1 || number > union_items->nod_count) { if (number < 1 || number > union_items->nod_count) {
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104, ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_dsql_command_err, isc_arg_gds, isc_dsql_command_err,

View File

@ -88,7 +88,7 @@ struct dsql_name
static void cleanup(void*); static void cleanup(void*);
static void cleanup_database(FRBRD**, SLONG); static void cleanup_database(FRBRD**, void*);
static ISC_STATUS error(); static ISC_STATUS error();
static void error_post(ISC_STATUS, ...); static void error_post(ISC_STATUS, ...);
static dsql_name* lookup_name(const SCHAR*, dsql_name*); static dsql_name* lookup_name(const SCHAR*, dsql_name*);
@ -1343,7 +1343,7 @@ static void cleanup(void* arg)
// //
// the cleanup handler called when a database is closed // the cleanup handler called when a database is closed
// //
static void cleanup_database(FRBRD** db_handle, SLONG dummy) static void cleanup_database(FRBRD** db_handle, void* dummy)
{ {
if (!db_handle || !databases) { if (!db_handle || !databases) {
return; return;

View File

@ -363,7 +363,7 @@ static CON make_numeric_constant( TEXT * string, USHORT length)
constant->con_desc.dsc_dtype = dtype_long; constant->con_desc.dsc_dtype = dtype_long;
constant->con_desc.dsc_length = sizeof(SLONG); constant->con_desc.dsc_length = sizeof(SLONG);
number = (SLONG *) constant->con_data; number = (SLONG *) constant->con_data;
constant->con_desc.dsc_address = (UCHAR *) number; constant->con_desc.dsc_address = (UCHAR*) (IPTR) number;
scale = 0; scale = 0;
do { do {
@ -673,7 +673,7 @@ static CON parse_literal(void)
constant->con_desc.dsc_dtype = dtype_text; constant->con_desc.dsc_dtype = dtype_text;
constant->con_desc.dsc_ttype = ttype_ascii; constant->con_desc.dsc_ttype = ttype_ascii;
p = (TEXT *) constant->con_data; p = (TEXT *) constant->con_data;
constant->con_desc.dsc_address = (UCHAR *) p; constant->con_desc.dsc_address = (UCHAR*) p;
if (constant->con_desc.dsc_length = l) if (constant->con_desc.dsc_length = l)
do do
*p++ = *q++; *p++ = *q++;

View File

@ -27,7 +27,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: c_cxx.cpp,v 1.39 2003-11-28 06:48:11 robocop Exp $ // $Id: c_cxx.cpp,v 1.40 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -140,8 +140,8 @@ static TEXT* global_status_name;
const int INDENT = 3; const int INDENT = 3;
static const char* const NULL_STRING = "(char *)0"; static const char* const NULL_STRING = "(char *)0";
static const char* const NULL_STATUS = "(long*) 0L"; static const char* const NULL_STATUS = "NULL";
static const char* const NULL_SQLDA = "(XSQLDA*) 0L"; static const char* const NULL_SQLDA = "NULL";
#ifdef VMS #ifdef VMS
static const char* const GDS_INCLUDE = "\"interbase:[syslib]ibase.h\""; static const char* const GDS_INCLUDE = "\"interbase:[syslib]ibase.h\"";
@ -151,7 +151,7 @@ static const char* const GDS_INCLUDE = "<Firebird/ibase.h>";
static const char* const GDS_INCLUDE = "<ibase.h>"; static const char* const GDS_INCLUDE = "<ibase.h>";
#endif #endif
static const char* const DCL_LONG = "long"; static const char* const DCL_LONG = "int";
static const char* const DCL_QUAD = "ISC_QUAD"; static const char* const DCL_QUAD = "ISC_QUAD";
static inline void begin(const int column) static inline void begin(const int column)
@ -1978,7 +1978,7 @@ static SSHORT gen_event_block( const act* action)
SYM event_name = (SYM) init->nod_arg[0]; SYM event_name = (SYM) init->nod_arg[0];
int ident = CMP_next_ident(); int ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD) ident; init->nod_arg[2] = (GPRE_NOD)(IPTR)ident;
printa(0, "static %schar\n *isc_%da, *isc_%db;", CONST_STR, ident, printa(0, "static %schar\n *isc_%da, *isc_%db;", CONST_STR, ident,
ident); ident);
@ -2016,7 +2016,7 @@ static void gen_event_init( const act* action, int column)
args.pat_database = (DBB) init->nod_arg[3]; args.pat_database = (DBB) init->nod_arg[3];
args.pat_vector1 = status_vector(action); args.pat_vector1 = status_vector(action);
args.pat_value1 = (int) init->nod_arg[2]; args.pat_value1 = (IPTR) init->nod_arg[2];
args.pat_value2 = (int) event_list->nod_count; args.pat_value2 = (int) event_list->nod_count;
// generate call to dynamically generate event blocks // generate call to dynamically generate event blocks
@ -2081,7 +2081,7 @@ static void gen_event_wait( const act* action, int column)
GPRE_NOD event_init = (GPRE_NOD) event_action->act_object; GPRE_NOD event_init = (GPRE_NOD) event_action->act_object;
SYM stack_name = (SYM) event_init->nod_arg[0]; SYM stack_name = (SYM) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (int) event_init->nod_arg[2]; ident = (IPTR) event_init->nod_arg[2];
database = (DBB) event_init->nod_arg[3]; database = (DBB) event_init->nod_arg[3];
} }
} }
@ -3461,7 +3461,7 @@ static void gen_trans( const act* action, int column)
static void gen_type( const act* action, int column) static void gen_type( const act* action, int column)
{ {
printa(column, "%ld", (SLONG) action->act_object); printa(column, "%"SLONGFORMAT, (SLONG)(IPTR)action->act_object);
} }

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cmd.cpp,v 1.26 2004-01-06 10:33:11 robocop Exp $ // $Id: cmd.cpp,v 1.27 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -215,7 +215,7 @@ int CMD_compile_ddl(GPRE_REQ request)
case ACT_drop_shadow: case ACT_drop_shadow:
put_numeric(request, isc_dyn_delete_shadow, put_numeric(request, isc_dyn_delete_shadow,
(SSHORT) (SLONG) action->act_object); (SSHORT) (IPTR) action->act_object);
STUFF_END; STUFF_END;
break; break;

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cme.cpp,v 1.21 2003-12-22 10:00:14 robocop Exp $ // $Id: cme.cpp,v 1.22 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -253,7 +253,7 @@ void CME_expr(GPRE_NOD node, GPRE_REQ request)
// ** Begin date/time/timestamp support * // ** Begin date/time/timestamp support *
case nod_extract: case nod_extract:
STUFF(blr_extract); STUFF(blr_extract);
switch ((KWWORDS) (int) node->nod_arg[0]) switch ((KWWORDS) (IPTR) node->nod_arg[0])
{ {
case KW_YEAR: case KW_YEAR:
STUFF(blr_extract_year); STUFF(blr_extract_year);
@ -480,7 +480,7 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f)
// ** Begin date/time/timestamp support * // ** Begin date/time/timestamp support *
case nod_extract: case nod_extract:
{ {
KWWORDS kw_word = (KWWORDS) (int) node->nod_arg[0]; KWWORDS kw_word = (KWWORDS) (IPTR) node->nod_arg[0];
CME_get_dtype(node->nod_arg[1], f); CME_get_dtype(node->nod_arg[1], f);
switch (f->fld_dtype) switch (f->fld_dtype)
{ {
@ -1514,7 +1514,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request)
from.dsc_flags = 0; from.dsc_flags = 0;
from.dsc_dtype = dtype_text; from.dsc_dtype = dtype_text;
from.dsc_length = length; from.dsc_length = length;
from.dsc_address = (UCHAR *) buffer; from.dsc_address = (UCHAR*) buffer;
dsc to; dsc to;
to.dsc_sub_type = 0; to.dsc_sub_type = 0;
to.dsc_flags = 0; to.dsc_flags = 0;
@ -1524,7 +1524,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request)
STUFF(blr_sql_date); STUFF(blr_sql_date);
to.dsc_dtype = dtype_sql_date; to.dsc_dtype = dtype_sql_date;
to.dsc_length = sizeof(ISC_DATE); to.dsc_length = sizeof(ISC_DATE);
to.dsc_address = (UCHAR *) & dt; to.dsc_address = (UCHAR*) & dt;
MOVG_move(&from, &to); MOVG_move(&from, &to);
STUFF_WORD(dt); STUFF_WORD(dt);
STUFF_WORD(dt >> 16); STUFF_WORD(dt >> 16);
@ -1536,7 +1536,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request)
STUFF(blr_timestamp); STUFF(blr_timestamp);
to.dsc_dtype = dtype_timestamp; to.dsc_dtype = dtype_timestamp;
to.dsc_length = sizeof(ISC_TIMESTAMP); to.dsc_length = sizeof(ISC_TIMESTAMP);
to.dsc_address = (UCHAR *) & ts; to.dsc_address = (UCHAR*) & ts;
MOVG_move(&from, &to); MOVG_move(&from, &to);
STUFF_WORD(ts.timestamp_date); STUFF_WORD(ts.timestamp_date);
STUFF_WORD(ts.timestamp_date >> 16); STUFF_WORD(ts.timestamp_date >> 16);
@ -1550,7 +1550,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request)
STUFF(blr_sql_time); STUFF(blr_sql_time);
to.dsc_dtype = dtype_sql_time; to.dsc_dtype = dtype_sql_time;
to.dsc_length = sizeof(ISC_DATE); to.dsc_length = sizeof(ISC_DATE);
to.dsc_address = (UCHAR *) & itim; to.dsc_address = (UCHAR*) & itim;
MOVG_move(&from, &to); MOVG_move(&from, &to);
STUFF_WORD(itim); STUFF_WORD(itim);
STUFF_WORD(itim >> 16); STUFF_WORD(itim >> 16);

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exp.cpp,v 1.28 2003-12-03 08:19:09 robocop Exp $ // $Id: exp.cpp,v 1.29 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -778,7 +778,7 @@ GPRE_RSE EXP_rse(GPRE_REQ request, SYM initial_symbol)
upcase->nod_arg[0] = item; upcase->nod_arg[0] = item;
} }
count++; count++;
MSC_push((GPRE_NOD) (ULONG) ((direction) ? 1 : 0), &directions); MSC_push((GPRE_NOD) (IPTR) ((direction) ? 1 : 0), &directions);
if (insensitive) if (insensitive)
MSC_push(upcase, &items); MSC_push(upcase, &items);
else else

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: gpre.cpp,v 1.48 2004-01-03 10:59:38 robocop Exp $ // $Id: gpre.cpp,v 1.49 2004-01-21 07:16:15 skidder Exp $
// Revision 1.2 2000/11/16 15:54:29 fsg // Revision 1.2 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump // Added new switch -verbose to gpre that will dump
// parsed lines to stderr // parsed lines to stderr
@ -619,7 +619,7 @@ int main(int argc, char* argv[])
case IN_SW_GPRE_G: case IN_SW_GPRE_G:
sw_language = lang_internal; sw_language = lang_internal;
gen_routine = INT_action; gen_routine = INT_CXX_action;
sw_cstring = false; sw_cstring = false;
transaction_name = "dbb->dbb_sys_trans"; transaction_name = "dbb->dbb_sys_trans";
sw_know_interp = TRUE; sw_know_interp = TRUE;

View File

@ -1,744 +0,0 @@
//____________________________________________________________
//
// PROGRAM: C preprocess
// MODULE: int.cpp
// DESCRIPTION: Code generate for internal JRD modules
//
// The contents of this file are subject to the Interbase Public
// License Version 1.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy
// of the License at http://www.Inprise.com/IPL.html
//
// Software distributed under the License is distributed on an
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
// or implied. See the License for the specific language governing
// rights and limitations under the License.
//
// The Original Code was created by Inprise Corporation
// and its predecessors. Portions created by Inprise Corporation are
// Copyright (C) Inprise Corporation.
//
// All Rights Reserved.
// Contributor(s): ______________________________________.
// TMN (Mike Nordell) 11.APR.2001 - Reduce compiler warnings in generated code
//
//
//____________________________________________________________
//
// $Id: int.cpp,v 1.27 2004-01-03 10:59:38 robocop Exp $
//
#include "firebird.h"
#include "../jrd/ib_stdio.h"
#include "../jrd/common.h"
#include <stdarg.h>
#include "../jrd/y_ref.h"
#include "../jrd/ibase.h"
#include "../gpre/gpre.h"
#include "../gpre/gpre_proto.h"
#include "../gpre/lang_proto.h"
#include "../jrd/gds_proto.h"
static void align(const int);
static void asgn_from(const ref*, int);
#ifdef NOT_USED_OR_REPLACED
static void asgn_to(const ref*);
#endif
static void gen_at_end(const act*, int);
static void gen_blr(void*, SSHORT, const char*);
static void gen_compile(const gpre_req*, int);
static void gen_database(const act*, int);
static void gen_emodify(const act*, int);
static void gen_estore(const act*, int, bool);
static void gen_endfor(const act*, int);
static void gen_erase(const act*, int);
static void gen_for(const act*, int);
static TEXT* gen_name(TEXT*, const ref*);
static void gen_raw(const gpre_req*);
static void gen_receive(const gpre_req*, const por*);
static void gen_request(const gpre_req*);
static void gen_routine(const act*, int);
static void gen_s_end(const act*, int);
static void gen_s_fetch(const act*, int);
static void gen_s_start(const act*, int);
static void gen_send(const gpre_req*, const por*, int, bool);
static void gen_start(const gpre_req*, const por*, int, bool);
static void gen_type(const act*, int);
static void gen_variable(const act*, int);
static void make_port(const por*, int);
static void printa(const int, const TEXT*, ...) ATTRIBUTE_FORMAT(2,3);
static bool global_first_flag = false;
const int INDENT = 3;
static const char* const GDS_VTOV = "gds__vtov";
static const char* const JRD_VTOF = "jrd_vtof";
static const char* const VTO_CALL = "%s ((const char*)%s, (char*)%s, %d);";
static inline void begin(const int column)
{
printa(column, "{");
}
static inline void endp(const int column)
{
printa(column, "}");
}
//____________________________________________________________
//
//
void INT_action( const act* action, int column)
{
// Put leading braces where required
switch (action->act_type) {
case ACT_for:
case ACT_insert:
case ACT_modify:
case ACT_store:
case ACT_s_fetch:
case ACT_s_start:
begin(column);
align(column);
}
switch (action->act_type) {
case ACT_at_end:
gen_at_end(action, column);
return;
case ACT_b_declare:
case ACT_database:
gen_database(action, column);
return;
case ACT_endfor:
gen_endfor(action, column);
break;
case ACT_endmodify:
gen_emodify(action, column);
break;
case ACT_endstore:
gen_estore(action, column, false);
break;
case ACT_endstore_special:
gen_estore(action, column, true);
break;
case ACT_erase:
gen_erase(action, column);
return;
case ACT_for:
gen_for(action, column);
return;
case ACT_hctef:
break;
case ACT_insert:
case ACT_routine:
gen_routine(action, column);
return;
case ACT_s_end:
gen_s_end(action, column);
return;
case ACT_s_fetch:
gen_s_fetch(action, column);
return;
case ACT_s_start:
gen_s_start(action, column);
break;
case ACT_type_number:
gen_type(action, column);
return;
case ACT_variable:
gen_variable(action, column);
return;
default:
return;
}
// Put in a trailing brace for those actions still with us
endp(column);
}
//____________________________________________________________
//
// Align output to a specific column for output.
//
static void align(const int column)
{
int i;
if (column < 0)
return;
ib_putc('\n', out_file);
for (i = column / 8; i; --i)
ib_putc('\t', out_file);
for (i = column % 8; i; --i)
ib_putc(' ', out_file);
}
//____________________________________________________________
//
// Build an assignment from a host language variable to
// a port variable.
//
static void asgn_from(const ref* reference, int column)
{
TEXT variable[20], temp[20];
for (; reference; reference = reference->ref_next)
{
const gpre_fld* field = reference->ref_field;
align(column);
gen_name(variable, reference);
const TEXT* value;
if (reference->ref_source)
value = gen_name(temp, reference->ref_source);
else
value = reference->ref_value;
// To avoid chopping off a double byte kanji character in between
// the two bytes, generate calls to gds__ftof2 gds$_vtof2,
// gds$_vtov2 and jrd_vtof2 wherever necessary
if (!field || field->fld_dtype == dtype_text)
ib_fprintf(out_file, VTO_CALL,
JRD_VTOF,
value, variable,
field ? field->fld_length : 0);
else if (!field || field->fld_dtype == dtype_cstring)
ib_fprintf(out_file, VTO_CALL,
GDS_VTOV,
value, variable,
field ? field->fld_length: 0);
else
ib_fprintf(out_file, "%s = %s;", variable, value);
}
}
//____________________________________________________________
//
// Build an assignment to a host language variable from
// a port variable.
//
#ifdef NOT_USED_OR_REPLACED
static void asgn_to( const ref* reference)
{
TEXT s[20];
const ref* source = reference->ref_friend;
const gpre_fld* field = source->ref_field;
gen_name(s, source);
// Repeated later down in function gen_emodify, but then
// emitting jrd_ftof call.
if (!field || field->fld_dtype == dtype_text)
ib_fprintf(out_file, "gds__ftov (%s, %d, %s, sizeof (%s));",
s,
field ? field->fld_length : 0,
reference->ref_value, reference->ref_value);
else if (!field || field->fld_dtype == dtype_cstring)
ib_fprintf(out_file, "gds__vtov((const char*)%s, (char*)%s, sizeof (%s));",
s, reference->ref_value, reference->ref_value);
else
ib_fprintf(out_file, "%s = %s;", reference->ref_value, s);
}
#endif
//____________________________________________________________
//
// Generate code for AT END clause of FETCH.
//
static void gen_at_end( const act* action, int column)
{
TEXT s[20];
GPRE_REQ request = action->act_request;
printa(column, "if (!%s) ", gen_name(s, request->req_eof));
}
//____________________________________________________________
//
// Callback routine for BLR pretty printer.
//
static void gen_blr(void* user_arg, SSHORT offset, const char* string)
{
ib_fprintf(out_file, "%s\n", string);
}
//____________________________________________________________
//
// Generate text to compile a request.
//
static void gen_compile(const gpre_req* request, int column)
{
column += INDENT;
const dbb* db = request->req_database;
const sym* symbol = db->dbb_name;
ib_fprintf(out_file, "if (!%s)", request->req_handle);
align(column);
ib_fprintf(out_file,
"%s = (BLK) CMP_compile2 (tdbb, (UCHAR*)jrd_%d, TRUE);",
request->req_handle, request->req_ident);
}
//____________________________________________________________
//
// Generate insertion text for the database statement.
//
static void gen_database( const act* action, int column)
{
if (global_first_flag)
return;
global_first_flag = true;
align(0);
for (GPRE_REQ request = requests; request; request = request->req_next)
gen_request(request);
}
//____________________________________________________________
//
// Generate substitution text for END_MODIFY.
//
static void gen_emodify( const act* action, int column)
{
TEXT s1[20], s2[20];
UPD modify = (UPD) action->act_object;
for (REF reference = modify->upd_port->por_references; reference;
reference = reference->ref_next)
{
REF source = reference->ref_source;
if (!source)
continue;
GPRE_FLD field = reference->ref_field;
align(column);
if (field->fld_dtype == dtype_text)
ib_fprintf(out_file, "jrd_ftof (%s, %d, %s, %d);",
gen_name(s1, source),
field->fld_length,
gen_name(s2, reference), field->fld_length);
else if (field->fld_dtype == dtype_cstring)
ib_fprintf(out_file, "gds__vtov((const char*)%s, (char*)%s, %d);",
gen_name(s1, source),
gen_name(s2, reference), field->fld_length);
else
ib_fprintf(out_file, "%s = %s;",
gen_name(s1, reference), gen_name(s2, source));
}
gen_send(action->act_request, modify->upd_port, column, false);
}
//____________________________________________________________
//
// Generate substitution text for END_STORE.
//
static void gen_estore( const act* action, int column, bool special)
{
GPRE_REQ request = action->act_request;
align(column);
gen_compile(request, column);
gen_start(request, request->req_primary, column, special);
}
//____________________________________________________________
//
// Generate definitions associated with a single request.
//
static void gen_endfor( const act* action, int column)
{
GPRE_REQ request = action->act_request;
column += INDENT;
if (request->req_sync)
gen_send(request, request->req_sync, column, false);
endp(column);
}
//____________________________________________________________
//
// Generate substitution text for ERASE.
//
static void gen_erase( const act* action, int column)
{
UPD erase = (UPD) action->act_object;
gen_send(erase->upd_request, erase->upd_port, column, false);
}
//____________________________________________________________
//
// Generate substitution text for FOR statement.
//
static void gen_for( const act* action, int column)
{
TEXT s[20];
gen_s_start(action, column);
align(column);
GPRE_REQ request = action->act_request;
ib_fprintf(out_file, "while (1)");
column += INDENT;
begin(column);
align(column);
gen_receive(action->act_request, request->req_primary);
align(column);
ib_fprintf(out_file, "if (!%s) break;", gen_name(s, request->req_eof));
}
//____________________________________________________________
//
// Generate a name for a reference. Name is constructed from
// port and parameter idents.
//
static TEXT* gen_name(TEXT* string, const ref* reference)
{
sprintf(string, "jrd_%d.jrd_%d",
reference->ref_port->por_ident, reference->ref_ident);
return string;
}
//____________________________________________________________
//
// Generate BLR in raw, numeric form. Ugly but dense.
//
static void gen_raw( const gpre_req* request)
{
TEXT buffer[80];
const UCHAR* blr = request->req_blr;
int blr_length = request->req_length;
TEXT* p = buffer;
align(0);
while (--blr_length) {
const UCHAR c = *blr++;
if ((c >= 'A' && c <= 'Z') || c == '$' || c == '_')
sprintf(p, "'%c',", c);
else
sprintf(p, "%d,", c);
while (*p)
p++;
if (p - buffer > 60) {
ib_fprintf(out_file, "%s\n", buffer);
p = buffer;
*p = 0;
}
}
ib_fprintf(out_file, "%s%d", buffer, blr_eoc);
}
//____________________________________________________________
//
// Generate a send or receive call for a port.
//
static void gen_receive( const gpre_req* request, const por* port)
{
ib_fprintf(out_file,
"EXE_receive (tdbb, (jrd_req*)%s, %d, %d, (UCHAR*)&jrd_%d);",
request->req_handle, port->por_msg_number, port->por_length,
port->por_ident);
}
//____________________________________________________________
//
// Generate definitions associated with a single request.
//
static void gen_request( const gpre_req* request)
{
if (!(request->req_flags & REQ_exp_hand))
ib_fprintf(out_file, "static void\t*%s;\t/* request handle */\n",
request->req_handle);
ib_fprintf(out_file, "static const UCHAR\tjrd_%d [%d] =",
request->req_ident, request->req_length);
align(INDENT);
ib_fprintf(out_file, "{\t/* blr string */\n");
if (sw_raw)
gen_raw(request);
else
gds__print_blr(request->req_blr, gen_blr, 0, 0);
printa(INDENT, "};\t/* end of blr string */\n");
}
//____________________________________________________________
//
// Process routine head. If there are requests in the
// routine, insert local definitions.
//
static void gen_routine( const act* action, int column)
{
for (GPRE_REQ request = (GPRE_REQ) action->act_object; request;
request = request->req_routine)
{
for (POR port = request->req_ports; port; port = port->por_next)
make_port(port, column + INDENT);
}
}
//____________________________________________________________
//
// Generate substitution text for END_STREAM.
//
static void gen_s_end( const act* action, int column)
{
GPRE_REQ request = action->act_request;
printa(column, "EXE_unwind (tdbb, %s);", request->req_handle);
}
//____________________________________________________________
//
// Generate substitution text for FETCH.
//
static void gen_s_fetch( const act* action, int column)
{
GPRE_REQ request = action->act_request;
if (request->req_sync)
gen_send(request, request->req_sync, column, false);
gen_receive(action->act_request, request->req_primary);
}
//____________________________________________________________
//
// Generate text to compile and start a stream. This is
// used both by START_STREAM and FOR
//
static void gen_s_start( const act* action, int column)
{
GPRE_REQ request = action->act_request;
gen_compile(request, column);
const por* port = request->req_vport;
if (port)
asgn_from(port->por_references, column);
gen_start(request, port, column, false);
}
//____________________________________________________________
//
// Generate a send or receive call for a port.
//
static void gen_send(const gpre_req* request, const por* port, int column,
bool special)
{
if (special) {
align(column);
ib_fprintf(out_file, "if (ignore_perm)");
align(column);
ib_fprintf(out_file, "\t((jrd_req*)request)->req_flags |= req_ignore_perm;");
}
align(column);
ib_fprintf(out_file, "EXE_send (tdbb, (jrd_req*)%s, %d, %d, (UCHAR*)&jrd_%d);",
request->req_handle,
port->por_msg_number, port->por_length, port->por_ident);
}
//____________________________________________________________
//
// Generate a START.
//
static void gen_start(const gpre_req* request, const por* port, int column,
bool special)
{
align(column);
ib_fprintf(out_file, "EXE_start (tdbb, (jrd_req*)%s, %s);",
request->req_handle, request->req_trans);
if (port)
gen_send(request, port, column, special);
}
//____________________________________________________________
//
// Substitute for a variable reference.
//
static void gen_type( const act* action, int column)
{
printa(column, "%ld", (SLONG) action->act_object);
}
//____________________________________________________________
//
// Substitute for a variable reference.
//
static void gen_variable( const act* action, int column)
{
TEXT s[20];
align(column);
ib_fprintf(out_file, gen_name(s, action->act_object));
}
//____________________________________________________________
//
// Insert a port record description in output.
//
static void make_port( const por* port, int column)
{
printa(column, "struct {");
for (const ref* reference = port->por_references; reference;
reference = reference->ref_next)
{
align(column + INDENT);
const gpre_fld* field = reference->ref_field;
const sym* symbol = field->fld_symbol;
const TEXT* name = symbol->sym_string;
switch (field->fld_dtype) {
case dtype_short:
ib_fprintf(out_file, " SSHORT jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_long:
ib_fprintf(out_file, " SLONG jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
// ** Begin sql date/time/timestamp *
case dtype_sql_date:
ib_fprintf(out_file, " ISC_DATE jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_sql_time:
ib_fprintf(out_file, " ISC_TIME jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_timestamp:
ib_fprintf(out_file, " ISC_TIMESTAMP jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
// ** End sql date/time/timestamp *
case dtype_int64:
ib_fprintf(out_file, " ISC_INT64 jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_quad:
case dtype_blob:
ib_fprintf(out_file, " ISC_QUAD jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_cstring:
case dtype_text:
ib_fprintf(out_file, " TEXT jrd_%d [%d];\t/* %s */",
reference->ref_ident, field->fld_length, name);
break;
case dtype_real:
ib_fprintf(out_file, " float jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
case dtype_double:
ib_fprintf(out_file, " double jrd_%d;\t/* %s */",
reference->ref_ident, name);
break;
default:
{
TEXT s[80];
sprintf(s, "datatype %d unknown for field %s, msg %d",
field->fld_dtype, name, port->por_msg_number);
CPR_error(s);
return;
}
}
}
align(column);
ib_fprintf(out_file, "} jrd_%d;", port->por_ident);
}
//____________________________________________________________
//
// Print a fixed string at a particular column.
//
static void printa(const int column, const TEXT* string, ...)
{
va_list ptr;
VA_START(ptr, string);
align(column);
ib_vfprintf(out_file, string, ptr);
}

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: int_cxx.cpp,v 1.26 2004-01-03 10:59:38 robocop Exp $ // $Id: int_cxx.cpp,v 1.27 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -693,11 +693,15 @@ static void make_port( POR port, int column)
break; break;
case dtype_quad: case dtype_quad:
case dtype_blob:
ib_fprintf(out_file, " ISC_QUAD jrd_%d;\t// %s ", ib_fprintf(out_file, " ISC_QUAD jrd_%d;\t// %s ",
reference->ref_ident, name); reference->ref_ident, name);
break; break;
case dtype_blob:
ib_fprintf(out_file, " bid jrd_%d;\t// %s ",
reference->ref_ident, name);
break;
case dtype_cstring: case dtype_cstring:
case dtype_text: case dtype_text:
ib_fprintf(out_file, " TEXT jrd_%d [%d];\t// %s ", ib_fprintf(out_file, " TEXT jrd_%d [%d];\t// %s ",

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: par.cpp,v 1.40 2003-11-28 06:48:12 robocop Exp $ // $Id: par.cpp,v 1.41 2004-01-21 07:16:15 skidder Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg // Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms // Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through // and allow edit.e and fred.e to go through
@ -3077,7 +3077,7 @@ static ACT par_type()
PAR_get_token(); PAR_get_token();
action = MSC_action(0, ACT_type_number); action = MSC_action(0, ACT_type_number);
action->act_object = (REF) (ULONG) type; action->act_object = (REF) (IPTR) type;
return action; return action;
} }

View File

@ -37,7 +37,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: sqe.cpp,v 1.25 2003-11-28 06:48:12 robocop Exp $ // $Id: sqe.cpp,v 1.26 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
#include <stdio.h> #include <stdio.h>
@ -2197,7 +2197,7 @@ static void par_order(GPRE_REQ request,
else if (MSC_match(KW_DESCENDING)) else if (MSC_match(KW_DESCENDING))
direction = TRUE; direction = TRUE;
count++; count++;
MSC_push((GPRE_NOD) direction, &directions); MSC_push((GPRE_NOD)(IPTR)direction, &directions);
MSC_push(sort, &items); MSC_push(sort, &items);
if (!MSC_match(KW_COMMA)) if (!MSC_match(KW_COMMA))
break; break;

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: sql.cpp,v 1.38 2004-01-06 10:33:11 robocop Exp $ // $Id: sql.cpp,v 1.39 2004-01-21 07:16:15 skidder Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -2851,7 +2851,7 @@ static ACT act_drop(void)
SLONG num = EXP_USHORT_ordinal(true); SLONG num = EXP_USHORT_ordinal(true);
if (!range_positive_short_integer(num)) if (!range_positive_short_integer(num))
PAR_error("Shadow number out of range"); PAR_error("Shadow number out of range");
action->act_object = (REF) num; action->act_object = (REF)(IPTR)num;
} }
return action; return action;

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: extract.epp,v 1.23 2003-12-31 05:35:49 robocop Exp $ * $Id: extract.epp,v 1.24 2004-01-21 07:16:17 skidder Exp $
* Revision 1.3 2000/11/22 17:07:25 patrickgriffin * Revision 1.3 2000/11/22 17:07:25 patrickgriffin
* In get_procedure_args change comment style from // to c style * In get_procedure_args change comment style from // to c style
* *
@ -1197,7 +1197,7 @@ static void list_all_procs()
END_FOR END_FOR
ON_ERROR ON_ERROR
ISQL_msg_get(GEN_ERR, msg, (TEXT*) isc_sqlcode(gds_status), NULL, ISQL_msg_get(GEN_ERR, msg, (TEXT*) (IPTR) isc_sqlcode(gds_status), NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
STDERROUT(msg, 1); /* Statement failed, SQLCODE = %d\n\n */ STDERROUT(msg, 1); /* Statement failed, SQLCODE = %d\n\n */
ISQL_errmsg(gds_status); ISQL_errmsg(gds_status);

View File

@ -881,7 +881,7 @@ void ISQL_errmsg(const ISC_STATUS* status)
return; return;
} }
gds__msg_format(NULL, ISQL_MSG_FAC, 0, sizeof(errbuf), errbuf, gds__msg_format(NULL, ISQL_MSG_FAC, 0, sizeof(errbuf), errbuf,
(TEXT*) isc_sqlcode(status), NULL, NULL, NULL, NULL); (TEXT*)(IPTR)isc_sqlcode(status), NULL, NULL, NULL, NULL);
TRANSLATE_CP; TRANSLATE_CP;
STDERROUT(errbuf, 1); STDERROUT(errbuf, 1);
gds_interprete_cpp(errbuf, &vec); gds_interprete_cpp(errbuf, &vec);
@ -6028,8 +6028,8 @@ static processing_state print_item_blob(IB_FILE* fp,
return CONT; return CONT;
if ((var->sqlsubtype != Doblob) && (Doblob != ALL_BLOBS)) { if ((var->sqlsubtype != Doblob) && (Doblob != ALL_BLOBS)) {
ISQL_msg_get(BLOB_SUBTYPE, msg, (TEXT*) (SLONG) Doblob, ISQL_msg_get(BLOB_SUBTYPE, msg, (TEXT*) (IPTR) Doblob,
(TEXT*) (SLONG) var->sqlsubtype, NULL, NULL, NULL); (TEXT*) (IPTR) var->sqlsubtype, NULL, NULL, NULL);
/* Blob display set to subtype %d. This blob: subtype = %d\n */ /* Blob display set to subtype %d. This blob: subtype = %d\n */
ISQL_printf(fp, msg); ISQL_printf(fp, msg);
if (buffer) if (buffer)

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: show.epp,v 1.32 2003-12-31 05:35:49 robocop Exp $ * $Id: show.epp,v 1.33 2004-01-21 07:16:17 skidder Exp $
* Revision 1.2 2000/11/19 07:02:49 fsg * Revision 1.2 2000/11/19 07:02:49 fsg
* Change in show.e to use CHARACTER_LENGTH instead of FIELD_LENGTH in * Change in show.e to use CHARACTER_LENGTH instead of FIELD_LENGTH in
* SHOW PROCEDURE * SHOW PROCEDURE
@ -349,7 +349,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_db_size_in_pages: case isc_info_db_size_in_pages:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(NUMBER_PAGES, msg, (TEXT*) value_out, NULL, ISQL_msg_get(NUMBER_PAGES, msg, (TEXT*) (IPTR)value_out, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -361,7 +361,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_sweep_interval: case isc_info_sweep_interval:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(SWEEP_INTERV, msg, (TEXT*) value_out, NULL, ISQL_msg_get(SWEEP_INTERV, msg, (TEXT*)(IPTR) value_out, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -397,7 +397,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_num_wal_buffers: case isc_info_num_wal_buffers:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(NUM_WAL_BUFF, msg, (TEXT*) value_out, NULL, ISQL_msg_get(NUM_WAL_BUFF, msg, (TEXT*)(IPTR)value_out, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -409,7 +409,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_wal_buffer_size: case isc_info_wal_buffer_size:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(WAL_BUFF_SIZE, msg, (TEXT*) value_out, NULL, ISQL_msg_get(WAL_BUFF_SIZE, msg, (TEXT*)(IPTR)value_out, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -420,7 +420,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_wal_ckpt_length: case isc_info_wal_ckpt_length:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(CKPT_LENGTH, msg, (TEXT*) value_out, NULL, NULL, ISQL_msg_get(CKPT_LENGTH, msg, (TEXT*)(IPTR)value_out, NULL, NULL,
NULL, NULL); NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -432,7 +432,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_wal_cur_ckpt_interval: case isc_info_wal_cur_ckpt_interval:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(CKPT_INTERV, msg, (TEXT*) value_out, NULL, NULL, ISQL_msg_get(CKPT_INTERV, msg, (TEXT*)(IPTR)value_out, NULL, NULL,
NULL, NULL); NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -444,7 +444,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_wal_grpc_wait_usecs: case isc_info_wal_grpc_wait_usecs:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(WAL_GRPC_WAIT, msg, (TEXT*) value_out, NULL, ISQL_msg_get(WAL_GRPC_WAIT, msg, (TEXT*)(IPTR)value_out, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -456,7 +456,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_base_level: case isc_info_base_level:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(BASE_LEVEL, msg, (TEXT*) value_out, NULL, NULL, ISQL_msg_get(BASE_LEVEL, msg, (TEXT*)(IPTR)value_out, NULL, NULL,
NULL, NULL); NULL, NULL);
sprintf(info, msg); sprintf(info, msg);
} }
@ -467,7 +467,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle,
case isc_info_limbo: case isc_info_limbo:
value_out = isc_vax_integer(d, length); value_out = isc_vax_integer(d, length);
if (translate) { if (translate) {
ISQL_msg_get(LIMBO, msg, (TEXT*) value_out, NULL, NULL, NULL, ISQL_msg_get(LIMBO, msg, (TEXT*)(IPTR)value_out, NULL, NULL, NULL,
NULL); NULL);
sprintf(info, msg); sprintf(info, msg);
} }

View File

@ -379,11 +379,11 @@ ISC_STATUS API_ROUTINE gds__create_database(ISC_STATUS* status_vector,
ISC_STATUS API_ROUTINE gds__database_cleanup(ISC_STATUS * status_vector, ISC_STATUS API_ROUTINE gds__database_cleanup(ISC_STATUS * status_vector,
FRBRD **db_handle, FRBRD **db_handle,
DatabaseCleanupRoutine *routine, SLONG arg) DatabaseCleanupRoutine *routine, void* arg)
{ {
return isc_database_cleanup(status_vector, (FRBRD **) db_handle, return isc_database_cleanup(status_vector, (FRBRD **) db_handle,
routine, (SCHAR*) arg); routine, arg);
} }
ISC_STATUS API_ROUTINE gds__database_info(ISC_STATUS* status_vector, ISC_STATUS API_ROUTINE gds__database_info(ISC_STATUS* status_vector,

View File

@ -33,7 +33,7 @@
* *
*/ */
/* /*
$Id: blb.cpp,v 1.48 2004-01-13 09:52:13 robocop Exp $ $Id: blb.cpp,v 1.49 2004-01-21 07:16:18 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -241,7 +241,7 @@ BLB BLB_create2(TDBB tdbb,
if (BLF_create_blob(tdbb, if (BLF_create_blob(tdbb,
transaction, transaction,
&blob->blb_filter, &blob->blb_filter,
reinterpret_cast<SLONG*>(blob_id), (SLONG*)blob_id,
bpb_length, bpb_length,
bpb, bpb,
// CVC: This cast is very suspicious to me. // CVC: This cast is very suspicious to me.
@ -268,7 +268,7 @@ BLB BLB_create2(TDBB tdbb,
/* Format blob id and return blob handle */ /* Format blob id and return blob handle */
blob_id->bid_stuff.bid_blob = blob; blob_id->bid_stuff.bid_temp_id = blob->blb_temp_id;
blob_id->bid_relation_id = 0; blob_id->bid_relation_id = 0;
return blob; return blob;
@ -850,8 +850,8 @@ void BLB_move(TDBB tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
bid* source = (bid*) from_desc->dsc_address; bid* source = (bid*) from_desc->dsc_address;
bid* destination = (bid*) to_desc->dsc_address; bid* destination = (bid*) to_desc->dsc_address;
const USHORT id = (USHORT) (ULONG) field->nod_arg[e_fld_id]; const USHORT id = (USHORT) (IPTR) field->nod_arg[e_fld_id];
RPB* rpb = &request->req_rpb[(int) field->nod_arg[e_fld_stream]]; RPB* rpb = &request->req_rpb[(IPTR)field->nod_arg[e_fld_stream]];
jrd_rel* relation = rpb->rpb_relation; jrd_rel* relation = rpb->rpb_relation;
rec* record = rpb->rpb_record; rec* record = rpb->rpb_record;
@ -867,8 +867,7 @@ void BLB_move(TDBB tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
/* If either the source value is null or the blob id itself is null (all /* If either the source value is null or the blob id itself is null (all
zeros, then the blob is null. */ zeros, then the blob is null. */
if ((request->req_flags & req_null) || (!source->bid_relation_id && if ((request->req_flags & req_null) || source->isEmpty())
!source->bid_stuff.bid_blob))
{ {
SET_NULL(record, id); SET_NULL(record, id);
destination->bid_relation_id = 0; destination->bid_relation_id = 0;
@ -912,7 +911,7 @@ void BLB_move(TDBB tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
} }
else { else {
for (blob = transaction->tra_blobs; blob; blob = blob->blb_next) for (blob = transaction->tra_blobs; blob; blob = blob->blb_next)
if (blob == source->bid_stuff.bid_blob) if (blob->blb_temp_id == source->bid_stuff.bid_temp_id)
{ {
materialized_blob = true; materialized_blob = true;
break; break;
@ -1117,7 +1116,7 @@ BLB BLB_open2(TDBB tdbb,
for (new_blob = transaction->tra_blobs; new_blob; for (new_blob = transaction->tra_blobs; new_blob;
new_blob = new_blob->blb_next) new_blob = new_blob->blb_next)
{ {
if (new_blob == blob_id->bid_stuff.bid_blob) { if (new_blob->blb_temp_id == blob_id->bid_stuff.bid_temp_id) {
break; break;
} }
} }
@ -1143,7 +1142,7 @@ BLB BLB_open2(TDBB tdbb,
(UCHAR *) ((BLP) new_blob->blb_data)->blp_data; (UCHAR *) ((BLP) new_blob->blb_data)->blp_data;
} }
return blob; return blob;
} }
/* Ordinarily, we would call MET_relation to get the relation id. /* Ordinarily, we would call MET_relation to get the relation id.
However, since the blob id must be consider suspect, this is However, since the blob id must be consider suspect, this is
@ -1430,7 +1429,7 @@ void BLB_put_slice( TDBB tdbb,
(array->arr_blob)->blb_blob_id = *blob_id; (array->arr_blob)->blb_blob_id = *blob_id;
} }
} }
else if (blob_id->bid_stuff.bid_blob) else if (blob_id->bid_stuff.bid_temp_id)
{ {
array = find_array(transaction, blob_id); array = find_array(transaction, blob_id);
if (!array) { if (!array) {
@ -1476,7 +1475,7 @@ void BLB_put_slice( TDBB tdbb,
array->arr_effective_length = length; array->arr_effective_length = length;
} }
blob_id->bid_stuff.bid_blob = (BLB) array; blob_id->bid_stuff.bid_temp_id = array->arr_temp_id;
blob_id->bid_relation_id = 0; blob_id->bid_relation_id = 0;
} }
@ -1621,6 +1620,7 @@ static ARR alloc_array(jrd_tra* transaction, ADS proto_desc)
,__FILE__, __LINE__ ,__FILE__, __LINE__
#endif #endif
); );
array->arr_temp_id = transaction->tra_next_blob_id++;
return array; return array;
} }
@ -1659,6 +1659,7 @@ static BLB allocate_blob(TDBB tdbb, jrd_tra* transaction)
sizeof(blh); sizeof(blh);
blob->blb_max_pages = blob->blb_clump_size >> SHIFTLONG; blob->blb_max_pages = blob->blb_clump_size >> SHIFTLONG;
blob->blb_pointers = (dbb->dbb_page_size - BLP_SIZE) >> SHIFTLONG; blob->blb_pointers = (dbb->dbb_page_size - BLP_SIZE) >> SHIFTLONG;
blob->blb_temp_id = transaction->tra_next_blob_id++;
return blob; return blob;
} }
@ -1784,8 +1785,11 @@ static void check_BID_validity(const blb* blob, TDBB tdbb)
**************************************/ **************************************/
if (!blob || if (!blob ||
MemoryPool::blk_type(blob) != type_blb || // Nickolay Samofatov. This checks are now unnecessary since we
blob->blb_attachment != tdbb->tdbb_attachment || // look up blob using temp_id inside the transaction blobs only.
// They were unreliable, anyway.
// MemoryPool::blk_type(blob) != type_blb ||
// blob->blb_attachment != tdbb->tdbb_attachment ||
blob->blb_level > 2 || !(blob->blb_flags & BLB_temporary)) blob->blb_level > 2 || !(blob->blb_flags & BLB_temporary))
{ {
ERR_post(isc_bad_segstr_id, 0); ERR_post(isc_bad_segstr_id, 0);
@ -1937,7 +1941,7 @@ static void delete_blob_id(
/* If the blob is null, don't bother to delete it. Reasonable? */ /* If the blob is null, don't bother to delete it. Reasonable? */
if (!blob_id->bid_stuff.bid_number && !blob_id->bid_relation_id) if (blob_id->isEmpty())
return; return;
if (blob_id->bid_relation_id != relation->rel_id) if (blob_id->bid_relation_id != relation->rel_id)
@ -1973,7 +1977,7 @@ static ARR find_array(jrd_tra* transaction, const bid* blob_id)
arr* array = transaction->tra_arrays; arr* array = transaction->tra_arrays;
for (; array; array = array->arr_next) { for (; array; array = array->arr_next) {
if (array == (ARR) blob_id->bid_stuff.bid_blob) { if (array->arr_temp_id == blob_id->bid_stuff.bid_temp_id) {
break; break;
} }
} }
@ -2134,9 +2138,9 @@ static void get_replay_blob(TDBB tdbb, bid* blob_id)
for (map* map_ptr = dbb->dbb_blob_map; map_ptr; map_ptr = map_ptr->map_next) for (map* map_ptr = dbb->dbb_blob_map; map_ptr; map_ptr = map_ptr->map_next)
{ {
if (blob_id->bid_stuff.bid_blob == map_ptr->map_old_blob) if (blob_id->bid_stuff.bid_temp_id == map_ptr->map_old_blob)
{ {
blob_id->bid_stuff.bid_blob = map_ptr->map_new_blob; blob_id->bid_stuff.bid_temp_id = map_ptr->map_new_blob;
break; break;
} }
} }

View File

@ -38,9 +38,10 @@
typedef struct bid { typedef struct bid {
ULONG bid_relation_id; /* Relation id (or null) */ ULONG bid_relation_id; /* Relation id (or null) */
union { union {
class blb *bid_blob; /* Pointer to blob block */ ULONG bid_temp_id; /* Temporary ID of blob or array. Used for newly created objects (bid_relation_id==0) */
ULONG bid_number; /* Record number */ ULONG bid_number; /* Record number */
} bid_stuff; } bid_stuff;
bool isEmpty() const { return bid_relation_id == 0 && bid_stuff.bid_number == 0; }
} *BID; } *BID;
/* Your basic blob block. */ /* Your basic blob block. */
@ -74,6 +75,7 @@ class blb : public pool_alloc_rpt<UCHAR, type_blb>
ULONG blb_length; /* Total length of data sans segments */ ULONG blb_length; /* Total length of data sans segments */
ULONG blb_lead_page; /* First page number */ ULONG blb_lead_page; /* First page number */
ULONG blb_seek; /* Seek location */ ULONG blb_seek; /* Seek location */
ULONG blb_temp_id; // ID of newly created blob in transaction
/* blb_data must be longword aligned */ /* blb_data must be longword aligned */
UCHAR blb_data[1]; /* A page's worth of blob */ UCHAR blb_data[1]; /* A page's worth of blob */
}; };

View File

@ -4576,8 +4576,8 @@ static SSHORT lock_buffer(
error, and log it to firebird.log. */ error, and log it to firebird.log. */
gds__msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg, gds__msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg,
(TEXT *) bdb->bdb_page, (TEXT *) (IPTR) bdb->bdb_page,
(TEXT *) (SLONG) page_type, 0, 0, 0); (TEXT *) (IPTR) page_type, 0, 0, 0);
IBERR_append_status(status, isc_random, isc_arg_string, IBERR_append_status(status, isc_random, isc_arg_string,
ERR_cstring(errmsg), 0); ERR_cstring(errmsg), 0);
ERR_log(JRD_BUGCHK, 215, errmsg); /* msg 215 page %ld, page type %ld lock conversion denied */ ERR_log(JRD_BUGCHK, 215, errmsg); /* msg 215 page %ld, page type %ld lock conversion denied */
@ -4625,8 +4625,8 @@ static SSHORT lock_buffer(
error, and log it to firebird.log. */ error, and log it to firebird.log. */
gds__msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg, gds__msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg,
(TEXT*) bdb->bdb_page, (TEXT*) (IPTR) bdb->bdb_page,
(TEXT*) (SLONG) page_type, 0, 0, 0); (TEXT*) (IPTR) page_type, 0, 0, 0);
IBERR_append_status(status, isc_random, isc_arg_string, IBERR_append_status(status, isc_random, isc_arg_string,
ERR_cstring(errmsg), 0); ERR_cstring(errmsg), 0);
ERR_log(JRD_BUGCHK, 216, errmsg); /* msg 216 page %ld, page type %ld lock denied */ ERR_log(JRD_BUGCHK, 216, errmsg); /* msg 216 page %ld, page type %ld lock denied */

View File

@ -756,9 +756,9 @@ void CMP_get_desc(TDBB tdbb, Csb* csb, jrd_nod* node, DSC * desc)
case nod_field: case nod_field:
{ {
const USHORT id = (USHORT) (ULONG) node->nod_arg[e_fld_id]; const USHORT id = (USHORT) (IPTR) node->nod_arg[e_fld_id];
const fmt* format = const fmt* format =
CMP_format(tdbb, csb, (USHORT) (ULONG) node->nod_arg[e_fld_stream]); CMP_format(tdbb, csb, (USHORT) (IPTR) node->nod_arg[e_fld_stream]);
if (id >= format->fmt_count) { if (id >= format->fmt_count) {
desc->dsc_dtype = dtype_unknown; desc->dsc_dtype = dtype_unknown;
desc->dsc_length = 0; desc->dsc_length = 0;
@ -776,9 +776,9 @@ void CMP_get_desc(TDBB tdbb, Csb* csb, jrd_nod* node, DSC * desc)
{ {
jrd_nod* sub = node->nod_arg[e_scl_field]; jrd_nod* sub = node->nod_arg[e_scl_field];
jrd_rel* relation = jrd_rel* relation =
csb->csb_rpt[(USHORT)(ULONG) sub-> csb->csb_rpt[(USHORT)(IPTR) sub->
nod_arg[e_fld_stream]].csb_relation; nod_arg[e_fld_stream]].csb_relation;
const USHORT id = (USHORT)(ULONG) sub->nod_arg[e_fld_id]; const USHORT id = (USHORT)(IPTR) sub->nod_arg[e_fld_id];
const jrd_fld* field = MET_get_field(relation, id); const jrd_fld* field = MET_get_field(relation, id);
const arr* array; const arr* array;
if (!field || !(array = field->fld_array)) { if (!field || !(array = field->fld_array)) {
@ -1513,7 +1513,7 @@ void CMP_get_desc(TDBB tdbb, Csb* csb, jrd_nod* node, DSC * desc)
return; return;
case nod_extract: case nod_extract:
if ((ULONG) node->nod_arg[e_extract_part] == blr_extract_second) { if ((IPTR) node->nod_arg[e_extract_part] == blr_extract_second) {
// QUADDATE - SECOND returns a float, or scaled! // QUADDATE - SECOND returns a float, or scaled!
desc->dsc_dtype = dtype_long; desc->dsc_dtype = dtype_long;
desc->dsc_length = sizeof(ULONG); desc->dsc_length = sizeof(ULONG);
@ -1570,7 +1570,7 @@ void CMP_get_desc(TDBB tdbb, Csb* csb, jrd_nod* node, DSC * desc)
{ {
const jrd_nod* message = node->nod_arg[e_arg_message]; const jrd_nod* message = node->nod_arg[e_arg_message];
const fmt* format = (FMT) message->nod_arg[e_msg_format]; const fmt* format = (FMT) message->nod_arg[e_msg_format];
*desc = format->fmt_desc[(int) node->nod_arg[e_arg_number]]; *desc = format->fmt_desc[(IPTR) node->nod_arg[e_arg_number]];
return; return;
} }
@ -2534,14 +2534,14 @@ static jrd_nod* copy(TDBB tdbb,
--field_id; --field_id;
} }
else { else {
field_id = (USHORT)(ULONG) input->nod_arg[e_fld_id]; field_id = (USHORT)(IPTR) input->nod_arg[e_fld_id];
} }
stream = (USHORT)(ULONG) input->nod_arg[e_fld_stream]; stream = (USHORT)(IPTR) input->nod_arg[e_fld_stream];
if (remap_fld) { if (remap_fld) {
jrd_rel* relation = csb->csb_rpt[stream].csb_relation; jrd_rel* relation = csb->csb_rpt[stream].csb_relation;
jrd_fld* field = MET_get_field(relation, field_id); jrd_fld* field = MET_get_field(relation, field_id);
if (field->fld_source) if (field->fld_source)
field_id = (USHORT)(ULONG) field->fld_source->nod_arg[e_fld_id]; field_id = (USHORT)(IPTR) field->fld_source->nod_arg[e_fld_id];
} }
if (remap) if (remap)
stream = remap[stream]; stream = remap[stream];
@ -2652,7 +2652,7 @@ static jrd_nod* copy(TDBB tdbb,
node->nod_type = input->nod_type; node->nod_type = input->nod_type;
node->nod_count = 0; node->nod_count = 0;
stream = (USHORT)(ULONG) input->nod_arg[e_rel_stream]; stream = (USHORT)(IPTR) input->nod_arg[e_rel_stream];
// Last entry in the remap contains the the original stream number. // Last entry in the remap contains the the original stream number.
// Get that stream number so that the flags can be copied // Get that stream number so that the flags can be copied
@ -2661,7 +2661,7 @@ static jrd_nod* copy(TDBB tdbb,
const int relative_stream = (stream) ? remap[stream - 1] : stream; const int relative_stream = (stream) ? remap[stream - 1] : stream;
new_stream = csb->csb_n_stream++; new_stream = csb->csb_n_stream++;
fb_assert(new_stream <= MAX_STREAMS); fb_assert(new_stream <= MAX_STREAMS);
node->nod_arg[e_rel_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) new_stream;
remap[stream] = (UCHAR) new_stream; remap[stream] = (UCHAR) new_stream;
node->nod_arg[e_rel_context] = input->nod_arg[e_rel_context]; node->nod_arg[e_rel_context] = input->nod_arg[e_rel_context];
@ -2731,16 +2731,16 @@ static jrd_nod* copy(TDBB tdbb,
copy(tdbb, csb, input->nod_arg[e_prc_inputs], remap, field_id, copy(tdbb, csb, input->nod_arg[e_prc_inputs], remap, field_id,
node->nod_arg[e_prc_in_msg], remap_fld); node->nod_arg[e_prc_in_msg], remap_fld);
stream = (USHORT)(ULONG) input->nod_arg[e_prc_stream]; stream = (USHORT)(IPTR) input->nod_arg[e_prc_stream];
new_stream = csb->csb_n_stream++; new_stream = csb->csb_n_stream++;
fb_assert(new_stream <= MAX_STREAMS); fb_assert(new_stream <= MAX_STREAMS);
node->nod_arg[e_prc_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_prc_stream] = (jrd_nod*) (IPTR) new_stream;
remap[stream] = (UCHAR) new_stream; remap[stream] = (UCHAR) new_stream;
node->nod_arg[e_prc_procedure] = input->nod_arg[e_prc_procedure]; node->nod_arg[e_prc_procedure] = input->nod_arg[e_prc_procedure];
csb_repeat* element = CMP_csb_element(csb, new_stream); csb_repeat* element = CMP_csb_element(csb, new_stream);
// SKIDDER: Maybe we need to check if we really found a procedure? // SKIDDER: Maybe we need to check if we really found a procedure?
element->csb_procedure = MET_lookup_procedure_id(tdbb, element->csb_procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(SLONG) node->nod_arg[e_prc_procedure], FALSE, FALSE, 0); (SSHORT)(IPTR) node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
csb->csb_rpt[new_stream].csb_flags |= csb->csb_rpt[new_stream].csb_flags |=
csb->csb_rpt[stream].csb_flags & csb_no_dbkey; csb->csb_rpt[stream].csb_flags & csb_no_dbkey;
@ -2754,11 +2754,11 @@ static jrd_nod* copy(TDBB tdbb,
node = PAR_make_node(tdbb, e_agg_length); node = PAR_make_node(tdbb, e_agg_length);
node->nod_type = input->nod_type; node->nod_type = input->nod_type;
node->nod_count = 0; node->nod_count = 0;
stream = (USHORT)(ULONG) input->nod_arg[e_agg_stream]; stream = (USHORT)(IPTR) input->nod_arg[e_agg_stream];
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
new_stream = csb->csb_n_stream++; new_stream = csb->csb_n_stream++;
fb_assert(new_stream <= MAX_STREAMS); fb_assert(new_stream <= MAX_STREAMS);
node->nod_arg[e_agg_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_agg_stream] = (jrd_nod*) (IPTR) new_stream;
// fb_assert(new_stream <= MAX_UCHAR); // fb_assert(new_stream <= MAX_UCHAR);
remap[stream] = (UCHAR) new_stream; remap[stream] = (UCHAR) new_stream;
CMP_csb_element(csb, new_stream); CMP_csb_element(csb, new_stream);
@ -2782,11 +2782,11 @@ static jrd_nod* copy(TDBB tdbb,
node = PAR_make_node(tdbb, e_uni_length); node = PAR_make_node(tdbb, e_uni_length);
node->nod_type = input->nod_type; node->nod_type = input->nod_type;
node->nod_count = 2; node->nod_count = 2;
stream = (USHORT)(ULONG) input->nod_arg[e_uni_stream]; stream = (USHORT)(IPTR) input->nod_arg[e_uni_stream];
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
new_stream = csb->csb_n_stream++; new_stream = csb->csb_n_stream++;
fb_assert(new_stream <= MAX_STREAMS); fb_assert(new_stream <= MAX_STREAMS);
node->nod_arg[e_uni_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_uni_stream] = (jrd_nod*) (IPTR) new_stream;
remap[stream] = (UCHAR) new_stream; remap[stream] = (UCHAR) new_stream;
CMP_csb_element(csb, new_stream); CMP_csb_element(csb, new_stream);
@ -2893,7 +2893,7 @@ static void expand_view_nodes(TDBB tdbb,
jrd_nod* node = PAR_make_node(tdbb, 1); jrd_nod* node = PAR_make_node(tdbb, 1);
node->nod_count = 0; node->nod_count = 0;
node->nod_type = type; node->nod_type = type;
node->nod_arg[0] = (jrd_nod*) (SLONG) stream; node->nod_arg[0] = (jrd_nod*) (IPTR) stream;
LLS_PUSH(node, stack); LLS_PUSH(node, stack);
} }
} }
@ -2922,7 +2922,7 @@ static void ignore_dbkey(TDBB tdbb, Csb* csb, RSE rse, jrd_rel* view)
for (const jrd_nod* const* const end = ptr + rse->rse_count; ptr < end;) { for (const jrd_nod* const* const end = ptr + rse->rse_count; ptr < end;) {
jrd_nod* node = *ptr++; jrd_nod* node = *ptr++;
if (node->nod_type == nod_relation) { if (node->nod_type == nod_relation) {
const USHORT stream = (USHORT)(ULONG) node->nod_arg[e_rel_stream]; const USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
csb->csb_rpt[stream].csb_flags |= csb_no_dbkey; csb->csb_rpt[stream].csb_flags |= csb_no_dbkey;
const csb_repeat* tail = &csb->csb_rpt[stream]; const csb_repeat* tail = &csb->csb_rpt[stream];
const jrd_rel* relation = tail->csb_relation; const jrd_rel* relation = tail->csb_relation;
@ -3176,7 +3176,7 @@ static jrd_nod* pass1(TDBB tdbb,
jrd_fld* field; jrd_fld* field;
UCHAR *map, local_map[MAP_LENGTH]; UCHAR *map, local_map[MAP_LENGTH];
stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
// Look at all rse's which are lower in scope than the rse which this field // Look at all rse's which are lower in scope than the rse which this field
// is referencing, and mark them as varying - the rule is that if a field // is referencing, and mark them as varying - the rule is that if a field
@ -3202,7 +3202,7 @@ static jrd_nod* pass1(TDBB tdbb,
if (!(relation = tail->csb_relation) || if (!(relation = tail->csb_relation) ||
!(field = !(field =
MET_get_field(relation, MET_get_field(relation,
(USHORT)(ULONG) node->nod_arg[e_fld_id]))) (USHORT)(IPTR) node->nod_arg[e_fld_id])))
{ {
break; break;
} }
@ -3312,9 +3312,9 @@ static jrd_nod* pass1(TDBB tdbb,
{ {
sub = node->nod_arg[e_asgn_from]; sub = node->nod_arg[e_asgn_from];
if (sub->nod_type == nod_field) { if (sub->nod_type == nod_field) {
stream = (USHORT)(ULONG) sub->nod_arg[e_fld_stream]; stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
jrd_fld* field = MET_get_field(csb->csb_rpt[stream].csb_relation, jrd_fld* field = MET_get_field(csb->csb_rpt[stream].csb_relation,
(USHORT)(ULONG) sub->nod_arg[e_fld_id]); (USHORT)(IPTR) sub->nod_arg[e_fld_id]);
if (field) if (field)
node->nod_arg[e_asgn_missing2] = field->fld_missing_value; node->nod_arg[e_asgn_missing2] = field->fld_missing_value;
} }
@ -3322,10 +3322,10 @@ static jrd_nod* pass1(TDBB tdbb,
sub = node->nod_arg[e_asgn_to]; sub = node->nod_arg[e_asgn_to];
if (sub->nod_type != nod_field) if (sub->nod_type != nod_field)
break; break;
stream = (USHORT)(ULONG) sub->nod_arg[e_fld_stream]; stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream];
tail = &csb->csb_rpt[stream]; tail = &csb->csb_rpt[stream];
jrd_fld* field = MET_get_field(tail->csb_relation, jrd_fld* field = MET_get_field(tail->csb_relation,
(USHORT)(ULONG) sub->nod_arg[e_fld_id]); (USHORT)(IPTR) sub->nod_arg[e_fld_id]);
if (!field) { if (!field) {
break; break;
} }
@ -3337,13 +3337,13 @@ static jrd_nod* pass1(TDBB tdbb,
break; break;
case nod_modify: case nod_modify:
stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
tail = &csb->csb_rpt[stream]; tail = &csb->csb_rpt[stream];
tail->csb_flags |= csb_modify; tail->csb_flags |= csb_modify;
pass1_modify(tdbb, csb, node); pass1_modify(tdbb, csb, node);
// fb_assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT); // fb_assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT);
if ( (node->nod_arg[e_mod_validate] = make_validation(tdbb, csb, if ( (node->nod_arg[e_mod_validate] = make_validation(tdbb, csb,
(USHORT)(ULONG) node-> (USHORT)(IPTR) node->
nod_arg[e_mod_new_stream])) ) nod_arg[e_mod_new_stream])) )
{ {
node->nod_count = node->nod_count =
@ -3352,7 +3352,7 @@ static jrd_nod* pass1(TDBB tdbb,
break; break;
case nod_erase: case nod_erase:
stream = (USHORT)(ULONG) node->nod_arg[e_erase_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
tail = &csb->csb_rpt[stream]; tail = &csb->csb_rpt[stream];
tail->csb_flags |= csb_erase; tail->csb_flags |= csb_erase;
pass1_erase(tdbb, csb, node); pass1_erase(tdbb, csb, node);
@ -3367,12 +3367,12 @@ static jrd_nod* pass1(TDBB tdbb,
case nod_store: case nod_store:
sub = node->nod_arg[e_sto_relation]; sub = node->nod_arg[e_sto_relation];
stream = (USHORT)(ULONG) sub->nod_arg[e_rel_stream]; stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
tail = &csb->csb_rpt[stream]; tail = &csb->csb_rpt[stream];
tail->csb_flags |= csb_store; tail->csb_flags |= csb_store;
sub = pass1_store(tdbb, csb, node); sub = pass1_store(tdbb, csb, node);
if (sub) { if (sub) {
stream = (USHORT)(ULONG) sub->nod_arg[e_rel_stream]; stream = (USHORT)(IPTR) sub->nod_arg[e_rel_stream];
if ((!node->nod_arg[e_sto_sub_store]) && if ((!node->nod_arg[e_sto_sub_store]) &&
(node->nod_arg[e_sto_validate] = (node->nod_arg[e_sto_validate] =
make_validation(tdbb, csb, stream))) make_validation(tdbb, csb, stream)))
@ -3402,7 +3402,7 @@ static jrd_nod* pass1(TDBB tdbb,
case nod_aggregate: case nod_aggregate:
fb_assert((int) (IPTR) node->nod_arg[e_agg_stream] <= MAX_STREAMS); fb_assert((int) (IPTR) node->nod_arg[e_agg_stream] <= MAX_STREAMS);
csb->csb_rpt[(USHORT)(ULONG) node->nod_arg[e_agg_stream]].csb_flags |= csb->csb_rpt[(USHORT)(IPTR) node->nod_arg[e_agg_stream]].csb_flags |=
csb_no_dbkey; csb_no_dbkey;
ignore_dbkey(tdbb, csb, (RSE) node->nod_arg[e_agg_rse], view); ignore_dbkey(tdbb, csb, (RSE) node->nod_arg[e_agg_rse], view);
node->nod_arg[e_agg_rse] = node->nod_arg[e_agg_rse] =
@ -3427,7 +3427,7 @@ static jrd_nod* pass1(TDBB tdbb,
case nod_dbkey: case nod_dbkey:
{ {
const NOD_T type = node->nod_type; const NOD_T type = node->nod_type;
stream = (USHORT)(ULONG) node->nod_arg[0]; stream = (USHORT)(IPTR) node->nod_arg[0];
if (!csb->csb_rpt[stream].csb_map) if (!csb->csb_rpt[stream].csb_map)
return node; return node;
@ -3443,7 +3443,7 @@ static jrd_nod* pass1(TDBB tdbb,
node->nod_count = 0; node->nod_count = 0;
node->nod_type = type; node->nod_type = type;
node->nod_flags |= nod_agg_dbkey; node->nod_flags |= nod_agg_dbkey;
node->nod_arg[0] = (jrd_nod*) (SLONG) stream; node->nod_arg[0] = (jrd_nod*) (IPTR) stream;
return node; return node;
} }
@ -3466,7 +3466,7 @@ static jrd_nod* pass1(TDBB tdbb,
break; break;
case nod_cardinality: case nod_cardinality:
stream = (USHORT)(ULONG) node->nod_arg[e_card_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_card_stream];
csb->csb_rpt[stream].csb_flags |= csb_compute; csb->csb_rpt[stream].csb_flags |= csb_compute;
break; break;
@ -3529,7 +3529,7 @@ static void pass1_erase(TDBB tdbb, Csb* csb, jrd_nod* node)
// to support views of views, loop until we hit a real relation // to support views of views, loop until we hit a real relation
for (;;) { for (;;) {
USHORT new_stream = (USHORT)(ULONG) node->nod_arg[e_erase_stream]; USHORT new_stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
USHORT stream = new_stream; USHORT stream = new_stream;
csb_repeat* tail = &csb->csb_rpt[stream]; csb_repeat* tail = &csb->csb_rpt[stream];
tail->csb_flags |= csb_erase; tail->csb_flags |= csb_erase;
@ -3548,7 +3548,7 @@ static void pass1_erase(TDBB tdbb, Csb* csb, jrd_nod* node)
if (relation->rel_view_rse && trigger) { if (relation->rel_view_rse && trigger) {
new_stream = csb->csb_n_stream++; new_stream = csb->csb_n_stream++;
node->nod_arg[e_erase_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_erase_stream] = (jrd_nod*) (IPTR) new_stream;
CMP_csb_element(csb, new_stream)->csb_relation = relation; CMP_csb_element(csb, new_stream)->csb_relation = relation;
} }
@ -3595,8 +3595,8 @@ static void pass1_erase(TDBB tdbb, Csb* csb, jrd_nod* node)
parent = relation; parent = relation;
parent_stream = stream; parent_stream = stream;
new_stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
node->nod_arg[e_erase_stream] = (jrd_nod*) (SLONG) map[new_stream]; node->nod_arg[e_erase_stream] = (jrd_nod*) (IPTR) map[new_stream];
} }
} }
@ -3638,7 +3638,7 @@ static jrd_nod* pass1_expand_view(TDBB tdbb,
const jrd_fld* field = MET_get_field(relation, id); const jrd_fld* field = MET_get_field(relation, id);
if (field->fld_source) { if (field->fld_source) {
new_id = new_id =
(USHORT)(ULONG) (field->fld_source)->nod_arg[e_fld_id]; (USHORT)(IPTR) (field->fld_source)->nod_arg[e_fld_id];
} }
else { else {
new_id = id; new_id = id;
@ -3697,8 +3697,8 @@ static void pass1_modify(TDBB tdbb, Csb* csb, jrd_nod* node)
// to support views of views, loop until we hit a real relation // to support views of views, loop until we hit a real relation
for (;;) { for (;;) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
USHORT new_stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; USHORT new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
csb_repeat* tail = &csb->csb_rpt[new_stream]; csb_repeat* tail = &csb->csb_rpt[new_stream];
tail->csb_flags |= csb_modify; tail->csb_flags |= csb_modify;
jrd_rel* relation = csb->csb_rpt[stream].csb_relation; jrd_rel* relation = csb->csb_rpt[stream].csb_relation;
@ -3738,7 +3738,7 @@ static void pass1_modify(TDBB tdbb, Csb* csb, jrd_nod* node)
node->nod_count = node->nod_count =
MAX(node->nod_count, (USHORT) e_mod_map_view + 1); MAX(node->nod_count, (USHORT) e_mod_map_view + 1);
UCHAR* map = csb->csb_rpt[stream].csb_map; UCHAR* map = csb->csb_rpt[stream].csb_map;
stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
stream = map[stream]; stream = map[stream];
const USHORT view_stream = new_stream; const USHORT view_stream = new_stream;
@ -3746,17 +3746,17 @@ static void pass1_modify(TDBB tdbb, Csb* csb, jrd_nod* node)
map = map =
alloc_map(tdbb, csb, alloc_map(tdbb, csb,
(SSHORT)(SLONG) node->nod_arg[e_mod_new_stream]); (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
source = copy(tdbb, csb, source, map, 0, NULL, false); source = copy(tdbb, csb, source, map, 0, NULL, false);
fb_assert((int) (IPTR) source->nod_arg[e_rel_stream] <= MAX_STREAMS); fb_assert((int) (IPTR) source->nod_arg[e_rel_stream] <= MAX_STREAMS);
map[new_stream] = (UCHAR)(ULONG) source->nod_arg[e_rel_stream]; map[new_stream] = (UCHAR)(IPTR) source->nod_arg[e_rel_stream];
jrd_nod* view_node = copy(tdbb, csb, node, map, 0, NULL, true); jrd_nod* view_node = copy(tdbb, csb, node, map, 0, NULL, true);
view_node->nod_arg[e_mod_org_stream] = (jrd_nod*) (SLONG) stream; view_node->nod_arg[e_mod_org_stream] = (jrd_nod*) (IPTR) stream;
view_node->nod_arg[e_mod_new_stream] = view_node->nod_arg[e_mod_new_stream] =
source->nod_arg[e_rel_stream]; source->nod_arg[e_rel_stream];
view_node->nod_arg[e_mod_map_view] = NULL; view_node->nod_arg[e_mod_map_view] = NULL;
node->nod_arg[e_mod_sub_mod] = view_node; node->nod_arg[e_mod_sub_mod] = view_node;
new_stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
view_node->nod_arg[e_mod_statement] = view_node->nod_arg[e_mod_statement] =
pass1_expand_view(tdbb, csb, view_stream, new_stream, true); pass1_expand_view(tdbb, csb, view_stream, new_stream, true);
node->nod_count = node->nod_count =
@ -3769,14 +3769,14 @@ static void pass1_modify(TDBB tdbb, Csb* csb, jrd_nod* node)
// View passes muster - do some translation. Start with source stream. // View passes muster - do some translation. Start with source stream.
UCHAR* map = csb->csb_rpt[stream].csb_map; UCHAR* map = csb->csb_rpt[stream].csb_map;
stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
node->nod_arg[e_mod_org_stream] = (jrd_nod*) (SLONG) map[stream]; node->nod_arg[e_mod_org_stream] = (jrd_nod*) (IPTR) map[stream];
// next, do update stream // next, do update stream
map = map =
alloc_map(tdbb, csb, alloc_map(tdbb, csb,
(SSHORT)(SLONG) node->nod_arg[e_mod_new_stream]); (SSHORT)(IPTR) node->nod_arg[e_mod_new_stream]);
source = copy(tdbb, csb, source, map, 0, NULL, false); source = copy(tdbb, csb, source, map, 0, NULL, false);
node->nod_arg[e_mod_new_stream] = source->nod_arg[e_rel_stream]; node->nod_arg[e_mod_new_stream] = source->nod_arg[e_rel_stream];
} }
@ -4024,7 +4024,7 @@ static void pass1_source(TDBB tdbb,
if (source->nod_type == nod_procedure) { if (source->nod_type == nod_procedure) {
pass1(tdbb, csb, source, parent_view, view_stream, false); pass1(tdbb, csb, source, parent_view, view_stream, false);
jrd_prc* procedure = MET_lookup_procedure_id(tdbb, jrd_prc* procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(SLONG) source->nod_arg[e_prc_procedure], FALSE, FALSE, 0); (SSHORT)(IPTR) source->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
post_procedure_access(tdbb, csb, procedure); post_procedure_access(tdbb, csb, procedure);
CMP_post_resource(tdbb, &csb->csb_resources, (BLK) procedure, CMP_post_resource(tdbb, &csb->csb_resources, (BLK) procedure,
rsc_procedure, procedure->prc_id); rsc_procedure, procedure->prc_id);
@ -4056,7 +4056,7 @@ static void pass1_source(TDBB tdbb,
view->rel_id); view->rel_id);
source->nod_arg[e_rel_view] = (jrd_nod*) parent_view; source->nod_arg[e_rel_view] = (jrd_nod*) parent_view;
const USHORT stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; const USHORT stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream];
csb_repeat* element = CMP_csb_element(csb, stream); csb_repeat* element = CMP_csb_element(csb, stream);
element->csb_view = parent_view; element->csb_view = parent_view;
fb_assert(view_stream <= MAX_STREAMS); fb_assert(view_stream <= MAX_STREAMS);
@ -4069,7 +4069,7 @@ static void pass1_source(TDBB tdbb,
vcx_ptr = &(*vcx_ptr)->vcx_next) vcx_ptr = &(*vcx_ptr)->vcx_next)
{ {
if ((*vcx_ptr)->vcx_context == if ((*vcx_ptr)->vcx_context ==
(USHORT)(ULONG) source->nod_arg[e_rel_context]) (USHORT)(IPTR) source->nod_arg[e_rel_context])
{ {
element->csb_alias = (*vcx_ptr)->vcx_context_name; element->csb_alias = (*vcx_ptr)->vcx_context_name;
break; break;
@ -4215,7 +4215,7 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node)
for (;;) { for (;;) {
jrd_nod* original = node->nod_arg[e_sto_relation]; jrd_nod* original = node->nod_arg[e_sto_relation];
USHORT stream = (USHORT)(ULONG) original->nod_arg[e_rel_stream]; USHORT stream = (USHORT)(IPTR) original->nod_arg[e_rel_stream];
csb_repeat* tail = &csb->csb_rpt[stream]; csb_repeat* tail = &csb->csb_rpt[stream];
tail->csb_flags |= csb_store; tail->csb_flags |= csb_store;
jrd_rel* relation = csb->csb_rpt[stream].csb_relation; jrd_rel* relation = csb->csb_rpt[stream].csb_relation;
@ -4272,7 +4272,7 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node)
node->nod_arg[e_sto_relation] = node->nod_arg[e_sto_relation] =
copy(tdbb, csb, source, map, 0, NULL, false); copy(tdbb, csb, source, map, 0, NULL, false);
const USHORT new_stream = const USHORT new_stream =
(USHORT)(ULONG) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream]; (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
node->nod_arg[e_sto_statement] = node->nod_arg[e_sto_statement] =
pass1_expand_view(tdbb, csb, stream, new_stream, true); pass1_expand_view(tdbb, csb, stream, new_stream, true);
node->nod_arg[e_sto_statement] = node->nod_arg[e_sto_statement] =
@ -4632,9 +4632,9 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent)
// AB: Mark the streams involved with an UPDATE statement // AB: Mark the streams involved with an UPDATE statement
// active. So that the optimizer can use indices for // active. So that the optimizer can use indices for
// eventually used sub-selects. // eventually used sub-selects.
stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
csb->csb_rpt[stream].csb_flags |= csb_active; csb->csb_rpt[stream].csb_flags |= csb_active;
stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
csb->csb_rpt[stream].csb_flags |= csb_active; csb->csb_rpt[stream].csb_flags |= csb_active;
} }
@ -4648,9 +4648,9 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent)
if (node->nod_type == nod_modify) { if (node->nod_type == nod_modify) {
// AB: Remove the previous flags // AB: Remove the previous flags
stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
} }
@ -4742,7 +4742,7 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent)
case nod_modify: case nod_modify:
{ {
stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
csb->csb_rpt[stream].csb_flags |= csb_update; csb->csb_rpt[stream].csb_flags |= csb_update;
const fmt* format = CMP_format(tdbb, csb, stream); const fmt* format = CMP_format(tdbb, csb, stream);
fmt::fmt_desc_const_iterator desc = format->fmt_desc.begin(); fmt::fmt_desc_const_iterator desc = format->fmt_desc.begin();
@ -4772,15 +4772,15 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent)
break; break;
case nod_erase: case nod_erase:
stream = (USHORT)(ULONG) node->nod_arg[e_erase_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_erase_stream];
csb->csb_rpt[stream].csb_flags |= csb_update; csb->csb_rpt[stream].csb_flags |= csb_update;
break; break;
case nod_field: case nod_field:
{ {
stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
// SMB_set uses SLONG, not USHORT // SMB_set uses SLONG, not USHORT
SLONG id = (SLONG)(ULONG) node->nod_arg[e_fld_id]; SLONG id = (SLONG)(IPTR) node->nod_arg[e_fld_id];
SBM_set(tdbb, &csb->csb_rpt[stream].csb_fields, id); SBM_set(tdbb, &csb->csb_rpt[stream].csb_fields, id);
if (node->nod_flags & nod_value) { if (node->nod_flags & nod_value) {
csb->csb_impure += sizeof(vlux); csb->csb_impure += sizeof(vlux);
@ -4854,7 +4854,7 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent)
pass2_rse(tdbb, csb, (RSE) node->nod_arg[e_agg_rse]); pass2_rse(tdbb, csb, (RSE) node->nod_arg[e_agg_rse]);
pass2(tdbb, csb, node->nod_arg[e_agg_map], node); pass2(tdbb, csb, node->nod_arg[e_agg_map], node);
pass2(tdbb, csb, node->nod_arg[e_agg_group], node); pass2(tdbb, csb, node->nod_arg[e_agg_group], node);
stream = (USHORT)(ULONG) node->nod_arg[e_agg_stream]; stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
process_map(tdbb, csb, node->nod_arg[e_agg_map], process_map(tdbb, csb, node->nod_arg[e_agg_map],
&csb->csb_rpt[stream].csb_format); &csb->csb_rpt[stream].csb_format);
@ -4969,7 +4969,7 @@ static void pass2_rse(TDBB tdbb, Csb* csb, RSE rse)
{ {
jrd_nod* node = *ptr; jrd_nod* node = *ptr;
if (node->nod_type == nod_relation) { if (node->nod_type == nod_relation) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_rel_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
csb->csb_rpt[stream].csb_flags |= csb_active; csb->csb_rpt[stream].csb_flags |= csb_active;
pass2(tdbb, csb, node, (jrd_nod*) rse); pass2(tdbb, csb, node, (jrd_nod*) rse);
} }
@ -4977,12 +4977,12 @@ static void pass2_rse(TDBB tdbb, Csb* csb, RSE rse)
pass2_rse(tdbb, csb, (RSE) node); pass2_rse(tdbb, csb, (RSE) node);
} }
else if (node->nod_type == nod_procedure) { else if (node->nod_type == nod_procedure) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_prc_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
csb->csb_rpt[stream].csb_flags |= csb_active; csb->csb_rpt[stream].csb_flags |= csb_active;
pass2(tdbb, csb, node, (jrd_nod*) rse); pass2(tdbb, csb, node, (jrd_nod*) rse);
} }
else if (node->nod_type == nod_aggregate) { else if (node->nod_type == nod_aggregate) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_agg_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
csb->csb_rpt[stream].csb_flags |= csb_active; csb->csb_rpt[stream].csb_flags |= csb_active;
pass2(tdbb, csb, node, (jrd_nod*) rse); pass2(tdbb, csb, node, (jrd_nod*) rse);
@ -5038,7 +5038,7 @@ static jrd_nod* pass2_union(TDBB tdbb, Csb* csb, jrd_nod* node)
// make up a format block sufficiently large to hold instantiated record // make up a format block sufficiently large to hold instantiated record
jrd_nod* clauses = node->nod_arg[e_uni_clauses]; jrd_nod* clauses = node->nod_arg[e_uni_clauses];
const USHORT id = (USHORT)(ULONG) node->nod_arg[e_uni_stream]; const USHORT id = (USHORT)(IPTR) node->nod_arg[e_uni_stream];
fmt** format = &csb->csb_rpt[id].csb_format; fmt** format = &csb->csb_rpt[id].csb_format;
// process alternating rse and map blocks // process alternating rse and map blocks
@ -5082,7 +5082,7 @@ static void plan_check(Csb* csb, RSE rse)
ptr < end; ptr++) ptr < end; ptr++)
{ {
if ((*ptr)->nod_type == nod_relation) { if ((*ptr)->nod_type == nod_relation) {
const USHORT stream = (USHORT)(ULONG) (*ptr)->nod_arg[e_rel_stream]; const USHORT stream = (USHORT)(IPTR) (*ptr)->nod_arg[e_rel_stream];
if (!(csb->csb_rpt[stream].csb_plan)) { if (!(csb->csb_rpt[stream].csb_plan)) {
ERR_post(isc_no_stream_plan, isc_arg_string, ERR_post(isc_no_stream_plan, isc_arg_string,
csb->csb_rpt[stream].csb_relation->rel_name, 0); csb->csb_rpt[stream].csb_relation->rel_name, 0);
@ -5134,7 +5134,7 @@ static void plan_set(Csb* csb, RSE rse, jrd_nod* plan)
// find the tail for the relation specified in the rse // find the tail for the relation specified in the rse
const USHORT stream = (USHORT)(ULONG) plan_relation_node->nod_arg[e_rel_stream]; const USHORT stream = (USHORT)(IPTR) plan_relation_node->nod_arg[e_rel_stream];
csb_repeat* tail = &csb->csb_rpt[stream]; csb_repeat* tail = &csb->csb_rpt[stream];
// if the plan references a view, find the real base relation // if the plan references a view, find the real base relation
@ -5276,7 +5276,7 @@ static void plan_set(Csb* csb, RSE rse, jrd_nod* plan)
plan_relation->rel_name, 0); plan_relation->rel_name, 0);
} }
plan_relation_node->nod_arg[e_rel_stream] = (jrd_nod*) (SLONG) *map; plan_relation_node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) *map;
} }
// make some validity checks // make some validity checks
@ -5405,15 +5405,15 @@ static RSB post_rse(TDBB tdbb, Csb* csb, RSE rse)
{ {
jrd_nod* node = *ptr; jrd_nod* node = *ptr;
if (node->nod_type == nod_relation) { if (node->nod_type == nod_relation) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_rel_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_rel_stream];
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
} }
else if (node->nod_type == nod_procedure) { else if (node->nod_type == nod_procedure) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_prc_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_prc_stream];
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
} }
else if (node->nod_type == nod_aggregate) { else if (node->nod_type == nod_aggregate) {
USHORT stream = (USHORT)(ULONG) node->nod_arg[e_agg_stream]; USHORT stream = (USHORT)(IPTR) node->nod_arg[e_agg_stream];
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
} }
@ -5612,7 +5612,7 @@ static void process_map(TDBB tdbb, Csb* csb, jrd_nod* map, fmt** input_format)
{ {
jrd_nod* assignment = *ptr; jrd_nod* assignment = *ptr;
jrd_nod* field = assignment->nod_arg[e_asgn_to]; jrd_nod* field = assignment->nod_arg[e_asgn_to];
const USHORT id = (USHORT)(ULONG) field->nod_arg[e_fld_id]; const USHORT id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
if (id >= format->fmt_count) { if (id >= format->fmt_count) {
format->fmt_desc.resize(id + 1); format->fmt_desc.resize(id + 1);
} }
@ -5686,7 +5686,7 @@ static void process_map(TDBB tdbb, Csb* csb, jrd_nod* map, fmt** input_format)
if (align) { if (align) {
format->fmt_length = FB_ALIGN(format->fmt_length, align); format->fmt_length = FB_ALIGN(format->fmt_length, align);
} }
desc3->dsc_address = (UCHAR *) (SLONG) format->fmt_length; desc3->dsc_address = (UCHAR *) (IPTR) format->fmt_length;
format->fmt_length += desc3->dsc_length; format->fmt_length += desc3->dsc_length;
} }
} }
@ -5751,7 +5751,7 @@ static bool stream_in_rse(USHORT stream, RSE rse)
// for aggregates, check current rse, if not found then check // for aggregates, check current rse, if not found then check
// the sub-rse // the sub-rse
if (sub->nod_type == nod_aggregate) { if (sub->nod_type == nod_aggregate) {
if ((stream == (USHORT)(ULONG) sub->nod_arg[e_rel_stream]) || if ((stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]) ||
(stream_in_rse(stream, (RSE) sub->nod_arg[e_agg_rse]))) (stream_in_rse(stream, (RSE) sub->nod_arg[e_agg_rse])))
{ {
return true; // do not mark as variant return true; // do not mark as variant
@ -5759,7 +5759,7 @@ static bool stream_in_rse(USHORT stream, RSE rse)
} }
if ((sub->nod_type == nod_relation) && if ((sub->nod_type == nod_relation) &&
(stream == (USHORT)(ULONG) sub->nod_arg[e_rel_stream])) (stream == (USHORT)(IPTR) sub->nod_arg[e_rel_stream]))
{ {
return true; // do not mark as variant return true; // do not mark as variant
} }

View File

@ -49,7 +49,7 @@
* *
*/ */
/* /*
$Id: common.h,v 1.97 2004-01-12 06:58:26 skidder Exp $ $Id: common.h,v 1.98 2004-01-21 07:18:25 skidder Exp $
*/ */
#ifndef JRD_COMMON_H #ifndef JRD_COMMON_H
@ -98,10 +98,14 @@ $Id: common.h,v 1.97 2004-01-12 06:58:26 skidder Exp $
#ifdef LINUX #ifdef LINUX
#define QUADFORMAT "ll" #define QUADFORMAT "ll"
#define QUADCONST(n) (n##LL) #define QUADCONST(n) (n##LL)
// SLONG is a 32-bit integer on 64-bit platforms
#if SIZEOF_LONG == 4
#define SLONGFORMAT "ld" #define SLONGFORMAT "ld"
#define ULONGFORMAT "lu" #define ULONGFORMAT "lu"
#define XLONGFORMAT "lX" #define XLONGFORMAT "lX"
#define xLONGFORMAT "lx" #define xLONGFORMAT "lx"
#endif
//format for __LINE__ //format for __LINE__
@ -275,7 +279,6 @@ static inline int sinixz_sigaction(int sig, const struct sinixz_sigaction *act,
#define QUADFORMAT "q" #define QUADFORMAT "q"
#define MAP_ANONYMOUS #define MAP_ANONYMOUS
#define MAP_ANNON #define MAP_ANNON
#define LSEEK_OFFSET_CAST (off_t)
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t)length) #define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t)length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length)) #define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
@ -386,10 +389,6 @@ static inline int sinixz_sigaction(int sig, const struct sinixz_sigaction *act,
#error "need to use SFIO" #error "need to use SFIO"
#endif #endif
#ifdef SOLX86
#define LSEEK_OFFSET_CAST (off_t)
#endif
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length) #define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
/********* Reason for introducing MEMMOVE macro. /********* Reason for introducing MEMMOVE macro.
@ -865,8 +864,8 @@ typedef struct
#define JRD_BUGCHK 15 /* facility code for bugcheck messages */ #define JRD_BUGCHK 15 /* facility code for bugcheck messages */
#ifndef OFFSET #ifndef OFFSET
#define OFFSET(struct,fld) ((int) &((struct) NULL)->fld) #define OFFSET(struct,fld) ((IPTR) &((struct) NULL)->fld)
#define OFFSETA(struct,fld) ((int) ((struct) NULL)->fld) #define OFFSETA(struct,fld) ((IPTR) ((struct) NULL)->fld)
#endif #endif
#ifndef ODS_ALIGNMENT #ifndef ODS_ALIGNMENT

View File

@ -549,8 +549,8 @@ SSHORT CVT2_blob_compare(const dsc* arg1, const dsc* arg2, FPTR_ERROR err)
/* Second test for blob id, checking relation and slot. */ /* Second test for blob id, checking relation and slot. */
BID bid1 = (BID) arg1->dsc_address, bid2 = (BID) arg2->dsc_address; BID bid1 = (BID) arg1->dsc_address, bid2 = (BID) arg2->dsc_address;
if (bid1->bid_relation_id == bid2->bid_relation_id && if (bid1->bid_relation_id == bid2->bid_relation_id &&
(!bid1->bid_relation_id && bid1->bid_stuff.bid_blob == bid1->bid_stuff.bid_blob || ((!bid1->bid_relation_id && bid1->bid_stuff.bid_temp_id == bid2->bid_stuff.bid_temp_id) ||
bid1->bid_relation_id && bid1->bid_stuff.bid_number == bid2->bid_stuff.bid_number)) (bid1->bid_relation_id && bid1->bid_stuff.bid_number == bid2->bid_stuff.bid_number)))
return 0; return 0;
} }

View File

@ -138,12 +138,6 @@ typedef enum rids
#define COMPUTED_FLAG 128 #define COMPUTED_FLAG 128
#define WAIT_PERIOD -1 #define WAIT_PERIOD -1
inline bool NULL_BLOB(const ISC_QUAD& id)
{
return (!id.gds_quad_high && !id.gds_quad_low);
}
DATABASE DB = FILENAME "ODS.RDB"; DATABASE DB = FILENAME "ODS.RDB";
/*================================================================== /*==================================================================
@ -196,7 +190,7 @@ static void load_trigs(TDBB, jrd_rel*, TRIG_VEC *);
static FMT make_format(TDBB, jrd_rel*, USHORT *, TFB); static FMT make_format(TDBB, jrd_rel*, USHORT *, TFB);
static USHORT name_length(const TEXT*); static USHORT name_length(const TEXT*);
static DFW post_work(jrd_tra*, SLONG, DFW *, enum dfw_t, DSC *, USHORT); static DFW post_work(jrd_tra*, SLONG, DFW *, enum dfw_t, DSC *, USHORT);
static void put_summary_blob(BLB, enum rsr_t, SLONG[2]); static void put_summary_blob(BLB, enum rsr_t, BID);
static void put_summary_record(BLB, enum rsr_t, const UCHAR*, USHORT); static void put_summary_record(BLB, enum rsr_t, const UCHAR*, USHORT);
static void setup_array(TDBB, blb*, const TEXT*, USHORT, TFB); static void setup_array(TDBB, blb*, const TEXT*, USHORT, TFB);
static blb* setup_triggers(TDBB, jrd_rel*, bool, TRIG_VEC*, blb*); static blb* setup_triggers(TDBB, jrd_rel*, bool, TRIG_VEC*, blb*);
@ -1849,7 +1843,7 @@ static bool create_relation(TDBB tdbb,
BLK request; BLK request;
jrd_rel* relation; jrd_rel* relation;
USHORT rel_id, external_flag; USHORT rel_id, external_flag;
ISC_QUAD blob_id; bid blob_id;
BLK handle; BLK handle;
LCK lock; LCK lock;
@ -1945,7 +1939,7 @@ static bool create_relation(TDBB tdbb,
local_min_relation_id : rel_id; local_min_relation_id : rel_id;
MODIFY Y USING MODIFY Y USING
Y.RDB$RELATION_ID = --rel_id; Y.RDB$RELATION_ID = --rel_id;
if (NULL_BLOB(blob_id)) if (blob_id.isEmpty())
Y.RDB$DBKEY_LENGTH = 8; Y.RDB$DBKEY_LENGTH = 8;
else else
{ {
@ -1989,7 +1983,7 @@ static bool create_relation(TDBB tdbb,
/* if this is not a view, create the relation */ /* if this is not a view, create the relation */
if (NULL_BLOB(blob_id)) if (blob_id.isEmpty())
{ {
if (!external_flag) if (!external_flag)
DPM_create_relation(tdbb, relation); DPM_create_relation(tdbb, relation);
@ -3159,7 +3153,7 @@ static void get_procedure_dependencies(DFW work)
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
jrd_prc* procedure = NULL; jrd_prc* procedure = NULL;
ISC_QUAD blob_id = {0, 0}; bid blob_id = {0, 0};
blk* handle = (BLK) CMP_find_request(tdbb, irq_c_prc_dpd, IRQ_REQUESTS); blk* handle = (BLK) CMP_find_request(tdbb, irq_c_prc_dpd, IRQ_REQUESTS);
@ -3182,13 +3176,13 @@ static void get_procedure_dependencies(DFW work)
/* get any dependencies now by parsing the blr */ /* get any dependencies now by parsing the blr */
if (procedure && !NULL_BLOB(blob_id)) if (procedure && !blob_id.isEmpty())
{ {
JrdMemoryPool* old_pool = tdbb->tdbb_default; JrdMemoryPool* old_pool = tdbb->tdbb_default;
/* Nickolay Samofatov: allocate statement memory pool... */ /* Nickolay Samofatov: allocate statement memory pool... */
tdbb->tdbb_default = JrdMemoryPool::createPool(); tdbb->tdbb_default = JrdMemoryPool::createPool();
jrd_req* request; jrd_req* request;
MET_get_dependencies(tdbb, NULL, NULL, NULL, (SLONG*)&blob_id, &request, MET_get_dependencies(tdbb, NULL, NULL, NULL, &blob_id, &request,
NULL, work->dfw_name, obj_procedure); NULL, work->dfw_name, obj_procedure);
if (request) if (request)
CMP_release(tdbb, request); CMP_release(tdbb, request);
@ -3224,7 +3218,7 @@ static void get_trigger_dependencies( DFW work)
jrd_rel* relation = NULL; jrd_rel* relation = NULL;
blk* handle = (BLK) CMP_find_request(tdbb, irq_c_trigger, IRQ_REQUESTS); blk* handle = (BLK) CMP_find_request(tdbb, irq_c_trigger, IRQ_REQUESTS);
ISC_QUAD blob_id = {0, 0}; bid blob_id = {0, 0};
FOR(REQUEST_HANDLE handle) FOR(REQUEST_HANDLE handle)
X IN RDB$TRIGGERS WITH X IN RDB$TRIGGERS WITH
X.RDB$TRIGGER_NAME EQ work->dfw_name X.RDB$TRIGGER_NAME EQ work->dfw_name
@ -3240,13 +3234,13 @@ static void get_trigger_dependencies( DFW work)
/* get any dependencies now by parsing the blr */ /* get any dependencies now by parsing the blr */
if (relation && !NULL_BLOB(blob_id)) if (relation && !blob_id.isEmpty())
{ {
JrdMemoryPool* old_pool = tdbb->tdbb_default; JrdMemoryPool* old_pool = tdbb->tdbb_default;
/* Nickolay Samofatov: allocate statement memory pool... */ /* Nickolay Samofatov: allocate statement memory pool... */
tdbb->tdbb_default = JrdMemoryPool::createPool(); tdbb->tdbb_default = JrdMemoryPool::createPool();
jrd_req* request; jrd_req* request;
MET_get_dependencies(tdbb, relation, NULL, NULL, (SLONG*)&blob_id, MET_get_dependencies(tdbb, relation, NULL, NULL, &blob_id,
&request, NULL, work->dfw_name, obj_trigger); &request, NULL, work->dfw_name, obj_trigger);
if (request) if (request)
CMP_release(tdbb, request); CMP_release(tdbb, request);
@ -3375,7 +3369,7 @@ static FMT make_format(TDBB tdbb, jrd_rel* relation, USHORT * version, TFB stack
offset += 65536L; offset += 65536L;
break; break;
} }
desc2->dsc_address = (UCHAR *) (SLONG) offset; desc2->dsc_address = (UCHAR *) (IPTR) offset;
offset += desc2->dsc_length; offset += desc2->dsc_length;
} }
} }
@ -3430,7 +3424,7 @@ static FMT make_format(TDBB tdbb, jrd_rel* relation, USHORT * version, TFB stack
REQUEST(irq_format3) = (BLK) request; REQUEST(irq_format3) = (BLK) request;
FMT.RDB$FORMAT = format->fmt_version; FMT.RDB$FORMAT = format->fmt_version;
FMT.RDB$RELATION_ID = relation->rel_id; FMT.RDB$RELATION_ID = relation->rel_id;
blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&FMT.RDB$DESCRIPTOR); blob = BLB_create(tdbb, dbb->dbb_sys_trans, &FMT.RDB$DESCRIPTOR);
BLB_put_segment(tdbb, BLB_put_segment(tdbb,
blob, blob,
// (UCHAR*) &*(format->fmt_desc.begin()), // (UCHAR*) &*(format->fmt_desc.begin()),
@ -3467,7 +3461,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
TFB stack, external, tfb_; TFB stack, external, tfb_;
jrd_rel* relation; jrd_rel* relation;
BLB blob; BLB blob;
ISC_QUAD blob_id; bid blob_id;
BLK temp; BLK temp;
USHORT version, n, external_flag; USHORT version, n, external_flag;
BOOLEAN computed_field; BOOLEAN computed_field;
@ -3510,7 +3504,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
return false; return false;
} }
blob_id = REL.RDB$VIEW_BLR; blob_id = REL.RDB$VIEW_BLR;
null_view = NULL_BLOB(blob_id); null_view = blob_id.isEmpty();
external_flag = REL.RDB$EXTERNAL_FILE[0]; external_flag = REL.RDB$EXTERNAL_FILE[0];
if (REL.RDB$FORMAT == 255) if (REL.RDB$FORMAT == 255)
{ {
@ -3525,7 +3519,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
MODIFY REL USING MODIFY REL USING
blob = BLB_create(tdbb, blob = BLB_create(tdbb,
dbb->dbb_sys_trans, dbb->dbb_sys_trans,
(BID)&REL.RDB$RUNTIME); &REL.RDB$RUNTIME);
request_fmtx = request_fmtx =
(BLK) CMP_find_request(tdbb, irq_format2, IRQ_REQUESTS); (BLK) CMP_find_request(tdbb, irq_format2, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request_fmtx) FOR(REQUEST_HANDLE request_fmtx)
@ -3566,7 +3560,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
{ {
RFR.RDB$UPDATE_FLAG.NULL = FALSE; RFR.RDB$UPDATE_FLAG.NULL = FALSE;
RFR.RDB$UPDATE_FLAG = 1; RFR.RDB$UPDATE_FLAG = 1;
if (!NULL_BLOB(FLD.RDB$COMPUTED_BLR)) if (!FLD.RDB$COMPUTED_BLR.isEmpty())
{ {
RFR.RDB$UPDATE_FLAG = 0; RFR.RDB$UPDATE_FLAG = 0;
computed_field = TRUE; computed_field = TRUE;
@ -3592,12 +3586,12 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
put_summary_record(blob, RSR_field_name, put_summary_record(blob, RSR_field_name,
(UCHAR*) RFR.RDB$FIELD_NAME, (UCHAR*) RFR.RDB$FIELD_NAME,
name_length(RFR.RDB$FIELD_NAME)); name_length(RFR.RDB$FIELD_NAME));
if (!NULL_BLOB(FLD.RDB$COMPUTED_BLR) if (!FLD.RDB$COMPUTED_BLR.isEmpty()
&& !RFR.RDB$VIEW_CONTEXT) && !RFR.RDB$VIEW_CONTEXT)
{ {
put_summary_blob(blob, put_summary_blob(blob,
RSR_computed_blr, RSR_computed_blr,
(SLONG*)&FLD.RDB$COMPUTED_BLR); &FLD.RDB$COMPUTED_BLR);
} }
else if (!null_view) else if (!null_view)
{ {
@ -3611,13 +3605,13 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
name_length(RFR.RDB$BASE_FIELD)); name_length(RFR.RDB$BASE_FIELD));
} }
put_summary_blob(blob, RSR_missing_value, put_summary_blob(blob, RSR_missing_value,
(SLONG*)&FLD.RDB$MISSING_VALUE); &FLD.RDB$MISSING_VALUE);
put_summary_blob(blob, RSR_default_value, put_summary_blob(blob, RSR_default_value,
(SLONG*)((NULL_BLOB(RFR.RDB$DEFAULT_VALUE)) ? (RFR.RDB$DEFAULT_VALUE.isEmpty() ?
&FLD.RDB$DEFAULT_VALUE : &FLD.RDB$DEFAULT_VALUE :
&RFR.RDB$DEFAULT_VALUE)); &RFR.RDB$DEFAULT_VALUE));
put_summary_blob(blob, RSR_validation_blr, put_summary_blob(blob, RSR_validation_blr,
(SLONG*)&FLD.RDB$VALIDATION_BLR); &FLD.RDB$VALIDATION_BLR);
if (FLD.RDB$NULL_FLAG || RFR.RDB$NULL_FLAG) if (FLD.RDB$NULL_FLAG || RFR.RDB$NULL_FLAG)
{ {
put_summary_record(blob, put_summary_record(blob,
@ -3668,7 +3662,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction
} }
// dimitr: view fields shoudn't be marked as computed // dimitr: view fields shoudn't be marked as computed
if (null_view && !NULL_BLOB(FLD.RDB$COMPUTED_BLR)) if (null_view && !FLD.RDB$COMPUTED_BLR.isEmpty())
tfb_->tfb_flags |= TFB_computed; tfb_->tfb_flags |= TFB_computed;
tfb_->tfb_id = RFR.RDB$FIELD_ID; tfb_->tfb_id = RFR.RDB$FIELD_ID;
@ -4093,7 +4087,7 @@ static DFW post_work(jrd_tra* transaction,
} }
static void put_summary_blob(BLB blob, RSR_T type, SLONG blob_id[2]) static void put_summary_blob(BLB blob, RSR_T type, BID blob_id)
{ {
/************************************** /**************************************
* *
@ -4113,13 +4107,12 @@ static void put_summary_blob(BLB blob, RSR_T type, SLONG blob_id[2])
/* If blob is null, don't both */ /* If blob is null, don't both */
if (!blob_id[0] && !blob_id[1]) { if (blob_id->isEmpty())
return; return;
}
// Go ahead and open blob // Go ahead and open blob
BLB blr = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id); BLB blr = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
fb_assert(blr->blb_length <= MAX_USHORT); fb_assert(blr->blb_length <= MAX_USHORT);
USHORT length = (USHORT)blr->blb_length; USHORT length = (USHORT)blr->blb_length;
UCHAR* buffer = (length > sizeof(temp)) ? UCHAR* buffer = (length > sizeof(temp)) ?

View File

@ -1943,7 +1943,7 @@ SLONG DPM_store_blob(TDBB tdbb, BLB blob, REC record)
if (blob->blb_level > 0) { if (blob->blb_level > 0) {
vcl::iterator ptr, end; vcl::iterator ptr, end;
for (ptr = vector->begin(), end = vector->end(); ptr < end;) { for (ptr = vector->begin(), end = vector->end(); ptr < end;) {
LLS_PUSH((BLK) * ptr++, &stack); LLS_PUSH((BLK)(IPTR)*ptr++, &stack);
} }
} }
@ -2079,7 +2079,7 @@ void DPM_update( TDBB tdbb, RPB * rpb, LLS * stack, jrd_tra* transaction)
DEBUG if (stack) { DEBUG if (stack) {
while (*stack) { while (*stack) {
CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack)); CCH_precedence(tdbb, &rpb->rpb_window, (IPTR) LLS_POP(stack));
} }
} }
@ -2681,7 +2681,7 @@ static UCHAR* find_space(TDBB tdbb,
If the page need to be compressed, compress it. */ If the page need to be compressed, compress it. */
while (*stack) { while (*stack) {
CCH_precedence(tdbb, &rpb->rpb_window, (SLONG) LLS_POP(stack)); CCH_precedence(tdbb, &rpb->rpb_window, (SLONG)(IPTR)LLS_POP(stack));
} }
CCH_MARK(tdbb, &rpb->rpb_window); CCH_MARK(tdbb, &rpb->rpb_window);
@ -2706,7 +2706,7 @@ static UCHAR* find_space(TDBB tdbb,
(SLONG) page->dpg_sequence * dbb->dbb_max_records + slot; (SLONG) page->dpg_sequence * dbb->dbb_max_records + slot;
if (record) { if (record) {
LLS_PUSH((BLK) rpb->rpb_page, &record->rec_precedence); LLS_PUSH((BLK)(IPTR)rpb->rpb_page, &record->rec_precedence);
} }
return (UCHAR *) page + space; return (UCHAR *) page + space;
@ -2917,7 +2917,7 @@ static RHD locate_space(
} }
if (record) { if (record) {
LLS_PUSH((BLK) window->win_page, &record->rec_precedence); LLS_PUSH((BLK)(IPTR)window->win_page, &record->rec_precedence);
} }
#ifdef VIO_DEBUG #ifdef VIO_DEBUG

View File

@ -51,7 +51,7 @@ typedef struct dsc
USHORT dsc_length; USHORT dsc_length;
SSHORT dsc_sub_type; SSHORT dsc_sub_type;
USHORT dsc_flags; USHORT dsc_flags;
UCHAR* dsc_address; UCHAR* dsc_address; // Used either as offset in a message or as a pointer
} DSC; } DSC;
/* values for dsc_flags */ /* values for dsc_flags */

View File

@ -665,7 +665,7 @@ USHORT DYN_get_string(const TEXT** ptr, TEXT* field, USHORT size, bool err_flag)
return length; return length;
} }
USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id) USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
{ {
/************************************** /**************************************
* *
@ -689,7 +689,7 @@ USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id)
} }
try { try {
BLB blob = BLB_create(tdbb, gbl->gbl_transaction, (BID)blob_id); BLB blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
BLB_put_segment(tdbb, blob, p, length); BLB_put_segment(tdbb, blob, p, length);
BLB_close(tdbb, blob); BLB_close(tdbb, blob);
} }
@ -703,7 +703,7 @@ USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id)
return length; return length;
} }
USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id) USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, BID blob_id)
{ {
/************************************** /**************************************
* *
@ -730,7 +730,7 @@ USHORT DYN_put_text_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id)
const UCHAR* end = NULL; const UCHAR* end = NULL;
try { try {
BLB blob = BLB_create(tdbb, gbl->gbl_transaction, (BID)blob_id); BLB blob = BLB_create(tdbb, gbl->gbl_transaction, blob_id);
for (end = p + length; p < end; p += TEXT_BLOB_LENGTH) for (end = p + length; p < end; p += TEXT_BLOB_LENGTH)
{ {

View File

@ -76,12 +76,12 @@ USHORT DYN_get_string(const TEXT**, TEXT*, USHORT, bool);
// This function doesn't need to be exported currently. // This function doesn't need to be exported currently.
bool DYN_is_it_sql_role(GBL, const TEXT*, TEXT*, TDBB); bool DYN_is_it_sql_role(GBL, const TEXT*, TEXT*, TDBB);
USHORT DYN_put_blr_blob(GBL, const UCHAR**, ISC_QUAD *); USHORT DYN_put_blr_blob(GBL, const UCHAR**, struct bid*);
// This function is not defined anywhere. // This function is not defined anywhere.
//USHORT DYN_put_blr_blob2(GBL, const UCHAR**, ISC_QUAD *); //USHORT DYN_put_blr_blob2(GBL, const UCHAR**, ISC_QUAD *);
USHORT DYN_put_text_blob(GBL, const UCHAR**, ISC_QUAD *); USHORT DYN_put_text_blob(GBL, const UCHAR**, struct bid*);
// This function is not defined anywhere. // This function is not defined anywhere.
//USHORT DYN_put_text_blob2(GBL, const UCHAR**, ISC_QUAD *); //USHORT DYN_put_text_blob2(GBL, const UCHAR**, ISC_QUAD *);

View File

@ -3796,7 +3796,7 @@ void DYN_define_shadow( GBL gbl, const UCHAR** ptr)
} }
if (found) { if (found) {
DYN_error_punt(false, 165, (TEXT*) shadow_number, NULL, NULL, NULL, DYN_error_punt(false, 165, (TEXT*)(IPTR)shadow_number, NULL, NULL, NULL,
NULL); NULL);
/* msg 165: "Shadow %ld already exists" */ /* msg 165: "Shadow %ld already exists" */
} }

View File

@ -2955,7 +2955,7 @@ static void modify_err_punt(TDBB tdbb,
DYN_error_punt(false, DYN_error_punt(false,
208, 208,
orig_fld_def->dyn_fld_name, orig_fld_def->dyn_fld_name,
(TEXT*)DSC_string_length(&orig_fld_def->dyn_dsc), (TEXT*)(IPTR)DSC_string_length(&orig_fld_def->dyn_dsc),
NULL, NULL,
NULL, NULL,
NULL); NULL);

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.59 2004-01-13 09:52:13 robocop Exp $ * $Id: evl.cpp,v 1.60 2004-01-21 07:18:25 skidder Exp $
*/ */
/* /*
@ -247,7 +247,7 @@ dsc* EVL_assign_to(TDBB tdbb, jrd_nod* node)
arg_number = (int) (IPTR)node->nod_arg[e_arg_number]; arg_number = (int) (IPTR)node->nod_arg[e_arg_number];
desc = &format->fmt_desc[arg_number]; desc = &format->fmt_desc[arg_number];
impure->vlu_desc.dsc_address = impure->vlu_desc.dsc_address =
(UCHAR *) request + message->nod_impure + (int) desc->dsc_address; (UCHAR *) request + message->nod_impure + (IPTR) desc->dsc_address;
impure->vlu_desc.dsc_dtype = desc->dsc_dtype; impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
impure->vlu_desc.dsc_length = desc->dsc_length; impure->vlu_desc.dsc_length = desc->dsc_length;
impure->vlu_desc.dsc_scale = desc->dsc_scale; impure->vlu_desc.dsc_scale = desc->dsc_scale;
@ -288,7 +288,7 @@ dsc* EVL_assign_to(TDBB tdbb, jrd_nod* node)
// All seem to work fine. // All seem to work fine.
record = record =
request->req_rpb[(int) (IPTR) node->nod_arg[e_fld_stream]].rpb_record; request->req_rpb[(int) (IPTR) node->nod_arg[e_fld_stream]].rpb_record;
EVL_field(0, record, (USHORT)(ULONG) node->nod_arg[e_fld_id], EVL_field(0, record, (USHORT)(IPTR) node->nod_arg[e_fld_id],
&impure->vlu_desc); &impure->vlu_desc);
if (!impure->vlu_desc.dsc_address) if (!impure->vlu_desc.dsc_address)
ERR_post(isc_read_only_field, 0); ERR_post(isc_read_only_field, 0);
@ -352,7 +352,7 @@ SBM* EVL_bitmap(TDBB tdbb, jrd_nod* node)
inv* impure = (INV) ((SCHAR *) tdbb->tdbb_request + node->nod_impure); inv* impure = (INV) ((SCHAR *) tdbb->tdbb_request + node->nod_impure);
SBM_reset(&impure->inv_bitmap); SBM_reset(&impure->inv_bitmap);
const dsc* desc = EVL_expr(tdbb, node->nod_arg[0]); const dsc* desc = EVL_expr(tdbb, node->nod_arg[0]);
const USHORT id = 1 + 2 * (USHORT)(ULONG) node->nod_arg[1]; const USHORT id = 1 + 2 * (USHORT)(IPTR) node->nod_arg[1];
const UCHAR* numbers = desc->dsc_address; const UCHAR* numbers = desc->dsc_address;
numbers += id * sizeof(SLONG); numbers += id * sizeof(SLONG);
SLONG rel_dbkey; SLONG rel_dbkey;
@ -822,10 +822,10 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
} }
const jrd_nod* message = node->nod_arg[e_arg_message]; const jrd_nod* message = node->nod_arg[e_arg_message];
const fmt* format = (FMT) message->nod_arg[e_msg_format]; const fmt* format = (FMT) message->nod_arg[e_msg_format];
desc = &format->fmt_desc[(int)(ULONG) node->nod_arg[e_arg_number]]; desc = &format->fmt_desc[(int)(IPTR) node->nod_arg[e_arg_number]];
impure->vlu_desc.dsc_address = (UCHAR *) request + impure->vlu_desc.dsc_address = (UCHAR *) request +
message->nod_impure + (int) desc->dsc_address; message->nod_impure + (IPTR) desc->dsc_address;
impure->vlu_desc.dsc_dtype = desc->dsc_dtype; impure->vlu_desc.dsc_dtype = desc->dsc_dtype;
impure->vlu_desc.dsc_length = desc->dsc_length; impure->vlu_desc.dsc_length = desc->dsc_length;
impure->vlu_desc.dsc_scale = desc->dsc_scale; impure->vlu_desc.dsc_scale = desc->dsc_scale;
@ -850,9 +850,9 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
* the relation block is referenced. * the relation block is referenced.
* Reference: Bug 10116, 10424 * Reference: Bug 10116, 10424
*/ */
if (!EVL_field(request->req_rpb[(USHORT)(ULONG) node->nod_arg[e_fld_stream]].rpb_relation, if (!EVL_field(request->req_rpb[(USHORT)(IPTR) node->nod_arg[e_fld_stream]].rpb_relation,
record, record,
(USHORT)(ULONG) node->nod_arg[e_fld_id], (USHORT)(IPTR) node->nod_arg[e_fld_id],
&impure->vlu_desc)) &impure->vlu_desc))
{ {
request->req_flags |= req_null; request->req_flags |= req_null;
@ -984,7 +984,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
case nod_extract: case nod_extract:
{ {
impure = (VLU) ((SCHAR *) request + node->nod_impure); impure = (VLU) ((SCHAR *) request + node->nod_impure);
const ULONG extract_part = (ULONG) node->nod_arg[e_extract_part]; const ULONG extract_part = (IPTR) node->nod_arg[e_extract_part];
const dsc* value = EVL_expr(tdbb, node->nod_arg[e_extract_value]); const dsc* value = EVL_expr(tdbb, node->nod_arg[e_extract_value]);
impure->vlu_desc.dsc_dtype = dtype_short; impure->vlu_desc.dsc_dtype = dtype_short;
@ -1162,7 +1162,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
switch (node->nod_type) { switch (node->nod_type) {
case nod_gen_id: /* return a 32-bit generator value */ case nod_gen_id: /* return a 32-bit generator value */
impure->vlu_misc.vlu_long = (SLONG) DPM_gen_id(tdbb, impure->vlu_misc.vlu_long = (SLONG) DPM_gen_id(tdbb,
(SLONG) (SLONG)(IPTR)
node->nod_arg node->nod_arg
[e_gen_id], 0, [e_gen_id], 0,
MOV_get_int64 MOV_get_int64
@ -1177,11 +1177,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node)
case nod_gen_id2: case nod_gen_id2:
impure->vlu_misc.vlu_int64 = DPM_gen_id(tdbb, impure->vlu_misc.vlu_int64 = DPM_gen_id(tdbb,
(SLONG) (IPTR) node->nod_arg[e_gen_id], 0, MOV_get_int64(values[0], 0));
node->nod_arg[e_gen_id],
0,
MOV_get_int64(values[0],
0));
impure->vlu_desc.dsc_dtype = dtype_int64; impure->vlu_desc.dsc_dtype = dtype_int64;
impure->vlu_desc.dsc_length = sizeof(SINT64); impure->vlu_desc.dsc_length = sizeof(SINT64);
impure->vlu_desc.dsc_scale = 0; impure->vlu_desc.dsc_scale = 0;
@ -1368,7 +1364,7 @@ bool EVL_field(jrd_rel* relation, REC record, USHORT id, dsc* desc)
return false; return false;
} }
desc->dsc_address = record->rec_data + (int) desc->dsc_address; desc->dsc_address = record->rec_data + (IPTR) desc->dsc_address;
if (TEST_NULL(record, id)) { if (TEST_NULL(record, id)) {
desc->dsc_flags |= DSC_null; desc->dsc_flags |= DSC_null;
@ -1710,7 +1706,7 @@ USHORT EVL_group(TDBB tdbb, Rsb* rsb, jrd_nod* node, USHORT state)
{ {
jrd_nod* from = (*ptr)->nod_arg[e_asgn_from]; jrd_nod* from = (*ptr)->nod_arg[e_asgn_from];
jrd_nod* field = (*ptr)->nod_arg[e_asgn_to]; jrd_nod* field = (*ptr)->nod_arg[e_asgn_to];
id = (USHORT)(ULONG) field->nod_arg[e_fld_id]; id = (USHORT)(IPTR) field->nod_arg[e_fld_id];
record = record =
request->req_rpb[(int) (IPTR) field->nod_arg[e_fld_stream]].rpb_record; request->req_rpb[(int) (IPTR) field->nod_arg[e_fld_stream]].rpb_record;
vlux* impure = (vlux*) ((SCHAR *) request + from->nod_impure); vlux* impure = (vlux*) ((SCHAR *) request + from->nod_impure);

View File

@ -404,7 +404,7 @@ void EXE_assignment(TDBB tdbb, jrd_nod* node)
if (to->nod_type == nod_field) if (to->nod_type == nod_field)
{ {
const SSHORT id = (USHORT)(ULONG) to->nod_arg[e_fld_id]; const SSHORT id = (USHORT)(IPTR) to->nod_arg[e_fld_id];
REC record = request->req_rpb[(int) (IPTR) to->nod_arg[e_fld_stream]].rpb_record; REC record = request->req_rpb[(int) (IPTR) to->nod_arg[e_fld_stream]].rpb_record;
if (null) { if (null) {
SET_NULL(record, id); SET_NULL(record, id);
@ -650,7 +650,7 @@ void EXE_receive(TDBB tdbb,
const jrd_nod* message = request->req_message; const jrd_nod* message = request->req_message;
const fmt* format = (FMT) message->nod_arg[e_msg_format]; const fmt* format = (FMT) message->nod_arg[e_msg_format];
if (msg != (USHORT)(ULONG) message->nod_arg[e_msg_number]) if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
ERR_post(isc_req_sync, 0); ERR_post(isc_req_sync, 0);
if (length != format->fmt_length) { if (length != format->fmt_length) {
@ -795,7 +795,7 @@ void EXE_send(TDBB tdbb,
ptr++) ptr++)
{ {
message = (*ptr)->nod_arg[e_send_message]; message = (*ptr)->nod_arg[e_send_message];
if ((USHORT)(ULONG) message->nod_arg[e_msg_number] == msg) { if ((USHORT)(IPTR) message->nod_arg[e_msg_number] == msg) {
request->req_next = *ptr; request->req_next = *ptr;
break; break;
} }
@ -806,7 +806,7 @@ void EXE_send(TDBB tdbb,
const fmt* format = (FMT) message->nod_arg[e_msg_format]; const fmt* format = (FMT) message->nod_arg[e_msg_format];
if (msg != (USHORT)(ULONG) message->nod_arg[e_msg_number]) if (msg != (USHORT)(IPTR) message->nod_arg[e_msg_number])
ERR_post(isc_req_sync, 0); ERR_post(isc_req_sync, 0);
if (length != format->fmt_length) { if (length != format->fmt_length) {
@ -1050,7 +1050,7 @@ static void cleanup_rpb(TDBB tdbb, RPB *rpb)
const dsc* desc = &format->fmt_desc[n]; const dsc* desc = &format->fmt_desc[n];
if (!desc->dsc_address) if (!desc->dsc_address)
continue; continue;
UCHAR* p = record->rec_data + (SLONG) desc->dsc_address; UCHAR* p = record->rec_data + (IPTR) desc->dsc_address;
if (TEST_NULL(record, n)) if (TEST_NULL(record, n))
{ {
USHORT length = desc->dsc_length; USHORT length = desc->dsc_length;
@ -2106,7 +2106,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case jrd_req::req_evaluate: case jrd_req::req_evaluate:
if (transaction != dbb->dbb_sys_trans) { if (transaction != dbb->dbb_sys_trans) {
UCHAR operation = (UCHAR) (ULONG) node->nod_arg[e_sav_operation]; UCHAR operation = (UCHAR) (IPTR) node->nod_arg[e_sav_operation];
TEXT * node_savepoint_name = (TEXT*) node->nod_arg[e_sav_name]; TEXT * node_savepoint_name = (TEXT*) node->nod_arg[e_sav_name];
// Skip the savepoint created by EXE_start // Skip the savepoint created by EXE_start
@ -2420,7 +2420,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
break; break;
case jrd_req::req_unwind: case jrd_req::req_unwind:
if ((request->req_label == (USHORT)(ULONG) node->nod_arg[e_lbl_label]) && if ((request->req_label == (USHORT)(IPTR) node->nod_arg[e_lbl_label]) &&
(request->req_flags & (req_leave | req_error_handler))) { (request->req_flags & (req_leave | req_error_handler))) {
request->req_flags &= ~req_leave; request->req_flags &= ~req_leave;
request->req_operation = jrd_req::req_return; request->req_operation = jrd_req::req_return;
@ -2434,7 +2434,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case nod_leave: case nod_leave:
request->req_flags |= req_leave; request->req_flags |= req_leave;
request->req_operation = jrd_req::req_unwind; request->req_operation = jrd_req::req_unwind;
request->req_label = (USHORT)(ULONG) node->nod_arg[0]; request->req_label = (USHORT)(IPTR) node->nod_arg[0];
node = node->nod_parent; node = node->nod_parent;
break; break;
@ -2743,7 +2743,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case nod_set_generator: case nod_set_generator:
if (request->req_operation == jrd_req::req_evaluate) { if (request->req_operation == jrd_req::req_evaluate) {
dsc* desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]); dsc* desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1, DPM_gen_id(tdbb, (IPTR) node->nod_arg[e_gen_id], 1,
MOV_get_int64(desc, 0)); MOV_get_int64(desc, 0));
request->req_operation = jrd_req::req_return; request->req_operation = jrd_req::req_return;
} }
@ -2753,7 +2753,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node)
case nod_set_generator2: case nod_set_generator2:
if (request->req_operation == jrd_req::req_evaluate) { if (request->req_operation == jrd_req::req_evaluate) {
dsc* desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]); dsc* desc = EVL_expr(tdbb, node->nod_arg[e_gen_value]);
DPM_gen_id(tdbb, (SLONG) node->nod_arg[e_gen_id], 1, DPM_gen_id(tdbb, (IPTR) node->nod_arg[e_gen_id], 1,
MOV_get_int64(desc, 0)); MOV_get_int64(desc, 0));
request->req_operation = jrd_req::req_return; request->req_operation = jrd_req::req_return;
} }
@ -2874,11 +2874,11 @@ static jrd_nod* modify(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
jrd_tra* transaction = request->req_transaction; jrd_tra* transaction = request->req_transaction;
sta* impure = (STA) ((SCHAR *) request + node->nod_impure); sta* impure = (STA) ((SCHAR *) request + node->nod_impure);
const SSHORT org_stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; const SSHORT org_stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream];
RPB* org_rpb = &request->req_rpb[org_stream]; RPB* org_rpb = &request->req_rpb[org_stream];
jrd_rel* relation = org_rpb->rpb_relation; jrd_rel* relation = org_rpb->rpb_relation;
const SSHORT new_stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; const SSHORT new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream];
RPB* new_rpb = &request->req_rpb[new_stream]; RPB* new_rpb = &request->req_rpb[new_stream];
#ifdef PC_ENGINE #ifdef PC_ENGINE
@ -3837,7 +3837,7 @@ static jrd_nod* store(TDBB tdbb, jrd_nod* node, SSHORT which_trig)
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
jrd_tra* transaction = request->req_transaction; jrd_tra* transaction = request->req_transaction;
STA impure = (STA) ((SCHAR *) request + node->nod_impure); STA impure = (STA) ((SCHAR *) request + node->nod_impure);
SSHORT stream = (USHORT)(ULONG) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream]; SSHORT stream = (USHORT)(IPTR) node->nod_arg[e_sto_relation]->nod_arg[e_rel_stream];
RPB* rpb = &request->req_rpb[stream]; RPB* rpb = &request->req_rpb[stream];
jrd_rel* relation = rpb->rpb_relation; jrd_rel* relation = rpb->rpb_relation;
@ -4189,8 +4189,8 @@ static void validate(TDBB tdbb, jrd_nod* list)
const TEXT* name = 0; const TEXT* name = 0;
if (node->nod_type == nod_field) if (node->nod_type == nod_field)
{ {
const USHORT stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; const USHORT stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
const USHORT id = (USHORT)(ULONG) node->nod_arg[e_fld_id]; const USHORT id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
const jrd_rel* relation = request->req_rpb[stream].rpb_relation; const jrd_rel* relation = request->req_rpb[stream].rpb_relation;
const jrd_fld* field; const jrd_fld* field;

View File

@ -244,7 +244,7 @@ int EXT_get(RSB rsb)
rec* record = rpb->rpb_record; rec* record = rpb->rpb_record;
const fmt* format = record->rec_format; const fmt* format = record->rec_format;
const SSHORT offset = (SSHORT) (SLONG) format->fmt_desc[0].dsc_address; const SSHORT offset = (SSHORT) (IPTR) format->fmt_desc[0].dsc_address;
UCHAR* p = record->rec_data + offset; UCHAR* p = record->rec_data + offset;
SSHORT l = record->rec_length - offset; SSHORT l = record->rec_length - offset;
@ -283,7 +283,7 @@ int EXT_get(RSB rsb)
const lit* literal = (LIT) field->fld_missing_value; const lit* literal = (LIT) field->fld_missing_value;
if (literal) { if (literal) {
desc = *desc_ptr; desc = *desc_ptr;
desc.dsc_address = record->rec_data + (int) desc.dsc_address; desc.dsc_address = record->rec_data + (IPTR) desc.dsc_address;
if (!MOV_compare(&literal->lit_desc, &desc)) if (!MOV_compare(&literal->lit_desc, &desc))
continue; continue;
} }
@ -475,7 +475,7 @@ void EXT_store(RPB * rpb, int *transaction)
desc_ptr->dsc_length && desc_ptr->dsc_length &&
TEST_NULL(record, i)) TEST_NULL(record, i))
{ {
UCHAR* p = record->rec_data + (int) desc_ptr->dsc_address; UCHAR* p = record->rec_data + (IPTR) desc_ptr->dsc_address;
const lit* literal = (LIT) field->fld_missing_value; const lit* literal = (LIT) field->fld_missing_value;
if (literal) { if (literal) {
desc = *desc_ptr; desc = *desc_ptr;
@ -492,7 +492,7 @@ void EXT_store(RPB * rpb, int *transaction)
} }
} }
const USHORT offset = (USHORT) (ULONG) format->fmt_desc[0].dsc_address; const USHORT offset = (USHORT) (IPTR) format->fmt_desc[0].dsc_address;
const UCHAR* p = record->rec_data + offset; const UCHAR* p = record->rec_data + offset;
USHORT l = record->rec_length - offset; USHORT l = record->rec_length - offset;

View File

@ -486,7 +486,7 @@ ISC_STATUS filter_text(USHORT action, ctl* control)
case ACTION_close: case ACTION_close:
if (control->ctl_data[1]) { if (control->ctl_data[1]) {
gds__free((SLONG *) control->ctl_data[1]); gds__free((SLONG *) control->ctl_data[1]);
control->ctl_data[1] = (IPTR) NULL; control->ctl_data[1] = 0;
} }
return FB_SUCCESS; return FB_SUCCESS;
@ -570,7 +570,7 @@ ISC_STATUS filter_text(USHORT action, ctl* control)
&& (control->ctl_data[0] > control->ctl_data[3])) && (control->ctl_data[0] > control->ctl_data[3]))
{ {
gds__free((SLONG *) control->ctl_data[1]); gds__free((SLONG *) control->ctl_data[1]);
control->ctl_data[1] = (IPTR) NULL; control->ctl_data[1] = 0;
control->ctl_data[3] = 0; control->ctl_data[3] = 0;
} }
@ -820,7 +820,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, ctl* control)
} }
if (aux) { if (aux) {
gds__free(aux); gds__free(aux);
control->ctl_data[0] = (IPTR) NULL; control->ctl_data[0] = 0;
aux = NULL; aux = NULL;
} }
return FB_SUCCESS; return FB_SUCCESS;

View File

@ -30,7 +30,7 @@
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839. * 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839.
*/ */
/* /*
$Id: fun.epp,v 1.32 2004-01-13 09:52:14 robocop Exp $ $Id: fun.epp,v 1.33 2004-01-21 07:18:25 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -65,6 +65,7 @@ $Id: fun.epp,v 1.32 2004-01-13 09:52:14 robocop Exp $
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../jrd/sch_proto.h" #include "../jrd/sch_proto.h"
#include "../jrd/isc_s_proto.h" #include "../jrd/isc_s_proto.h"
#include "../jrd/blb.h"
#ifdef VMS #ifdef VMS
#define CALL_UDF(ptr, udftype) (*(udftype (*)(SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG))(ptr)) (args [0], args[1], args[2], args[3], args [4], args [5], args [6], args [7], args [8], args [9]) #define CALL_UDF(ptr, udftype) (*(udftype (*)(SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG, SLONG))(ptr)) (args [0], args[1], args[2], args[3], args [4], args [5], args [6], args [7], args [8], args [9])
@ -425,18 +426,14 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
{ {
blob = blob =
BLB_create(tdbb, tdbb->tdbb_request->req_transaction, BLB_create(tdbb, tdbb->tdbb_request->req_transaction,
(BID) & value->vlu_misc); (BID)&value->vlu_misc);
return_blob_struct = blob_desc; return_blob_struct = blob_desc;
} }
else else
{ {
SLONG* blob_id; bid blob_id;
if (request->req_flags & req_null) if (request->req_flags & req_null)
{ memset(&blob_id, 0, sizeof(bid));
SLONG null_quad[2];
null_quad[0] = null_quad[1] = 0;
blob_id = null_quad;
}
else else
{ {
if (input->dsc_dtype != dtype_quad && if (input->dsc_dtype != dtype_quad &&
@ -446,11 +443,11 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value)
isc_arg_gds, isc_blobnotsup, isc_arg_gds, isc_blobnotsup,
isc_arg_string, "conversion", 0); isc_arg_string, "conversion", 0);
} }
blob_id = (SLONG *) input->dsc_address; blob_id = *(BID) input->dsc_address;
} }
blob = BLB_open(tdbb, blob = BLB_open(tdbb,
tdbb->tdbb_request->req_transaction, tdbb->tdbb_request->req_transaction,
(BID)blob_id); &blob_id);
} }
LLS_PUSH(blob, &blob_stack); LLS_PUSH(blob, &blob_stack);
blob_desc->blob_get_segment = blob_get_segment; blob_desc->blob_get_segment = blob_get_segment;

View File

@ -2394,7 +2394,7 @@ void* API_ROUTINE gds__temp_file(
strcat(file_name, TEMP_PATTERN); strcat(file_name, TEMP_PATTERN);
#ifdef HAVE_MKSTEMP #ifdef HAVE_MKSTEMP
result = (void *)mkstemp(file_name); result = (void *)(IPTR)mkstemp(file_name);
#else #else
if (mktemp(file_name) == (char *)0) if (mktemp(file_name) == (char *)0)
return (void *)-1; return (void *)-1;
@ -2407,7 +2407,7 @@ void* API_ROUTINE gds__temp_file(
return result; return result;
if (stdio_flag) if (stdio_flag)
if (!(result = ib_fdopen((int) result, "w+"))) if (!(result = ib_fdopen((int)(IPTR)result, "w+")))
return (void *)-1; return (void *)-1;
if (expanded_string) if (expanded_string)

View File

@ -510,8 +510,7 @@ static void get_object_info(
strcpy(default_class, REL.RDB$DEFAULT_CLASS); strcpy(default_class, REL.RDB$DEFAULT_CLASS);
fb_utils::fb_exact_name_limit(REL.RDB$OWNER_NAME, sizeof(REL.RDB$OWNER_NAME)); fb_utils::fb_exact_name_limit(REL.RDB$OWNER_NAME, sizeof(REL.RDB$OWNER_NAME));
strcpy(owner, REL.RDB$OWNER_NAME); strcpy(owner, REL.RDB$OWNER_NAME);
*view = (REL.RDB$VIEW_BLR.gds_quad_high || *view = !REL.RDB$VIEW_BLR.isEmpty();
REL.RDB$VIEW_BLR.gds_quad_low) ? true : false;
END_FOR; END_FOR;
if (!REQUEST(irq_grant1)) if (!REQUEST(irq_grant1))
@ -1065,8 +1064,8 @@ static void save_security_class(TDBB tdbb,
SET_TDBB(tdbb); SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
ISC_QUAD blob_id; bid blob_id;
blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id); blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, &blob_id);
BLB_put_segment(tdbb, blob, buffer, length); BLB_put_segment(tdbb, blob, buffer, length);
BLB_close(tdbb, blob); BLB_close(tdbb, blob);

View File

@ -33,7 +33,7 @@
* *
*/ */
/* /*
$Id: ibase.h,v 1.64 2004-01-12 06:58:26 skidder Exp $ $Id: ibase.h,v 1.65 2004-01-21 07:18:25 skidder Exp $
*/ */
#ifndef JRD_IBASE_H #ifndef JRD_IBASE_H
@ -53,13 +53,16 @@ $Id: ibase.h,v 1.64 2004-01-12 06:58:26 skidder Exp $
#define ISC_FAR #define ISC_FAR
#if SIZEOF_LONG == 8 // It is difficult to detect 64-bit long from the redistributable header
// we do not care of 16-bit platforms anymore thus we may use plain "int"
// which is 32-bit on all platforms we support
//#if SIZEOF_LONG == 8
typedef int ISC_LONG; typedef int ISC_LONG;
typedef unsigned int ISC_ULONG; typedef unsigned int ISC_ULONG;
#else //#else
typedef signed long ISC_LONG; //typedef signed long ISC_LONG;
typedef unsigned long ISC_ULONG; //typedef unsigned long ISC_ULONG;
#endif //#endif
typedef signed short ISC_SHORT; typedef signed short ISC_SHORT;
typedef unsigned short ISC_USHORT; typedef unsigned short ISC_USHORT;
@ -93,8 +96,8 @@ typedef ISC_LONG isc_resv_handle;
/*******************************************************************/ /*******************************************************************/
#ifndef ISC_TIMESTAMP_DEFINED #ifndef ISC_TIMESTAMP_DEFINED
typedef long ISC_DATE; typedef int ISC_DATE;
typedef unsigned long ISC_TIME; typedef unsigned int ISC_TIME;
typedef struct typedef struct
{ {
ISC_DATE timestamp_date; ISC_DATE timestamp_date;

View File

@ -1001,15 +1001,15 @@ static IDX_E check_foreign_key(
index_number++) index_number++)
{ {
if (idx->idx_id != if (idx->idx_id !=
(UCHAR)(ULONG) (*idx->idx_foreign_primaries)[index_number]) (UCHAR)(IPTR) (*idx->idx_foreign_primaries)[index_number])
{ {
continue; continue;
} }
partner_relation = partner_relation =
MET_relation(tdbb, MET_relation(tdbb,
(int) (*idx->idx_foreign_relations)[index_number]); (IPTR) (*idx->idx_foreign_relations)[index_number]);
index_id = index_id =
(USHORT)(ULONG) (*idx->idx_foreign_indexes)[index_number]; (USHORT)(IPTR) (*idx->idx_foreign_indexes)[index_number];
if ( (result = if ( (result =
check_partner_index(tdbb, relation, record, transaction, idx, check_partner_index(tdbb, relation, record, transaction, idx,
partner_relation, index_id)) ) partner_relation, index_id)) )

View File

@ -927,7 +927,7 @@ int INF_request_info(const jrd_req* request,
node = request->req_message; node = request->req_message;
if (item == isc_info_message_number) if (item == isc_info_message_number)
length = length =
INF_convert((SLONG) node->nod_arg[e_msg_number], INF_convert((IPTR) node->nod_arg[e_msg_number],
buffer_ptr); buffer_ptr);
else { else {
format = (FMT) node->nod_arg[e_msg_format]; format = (FMT) node->nod_arg[e_msg_format];

View File

@ -693,7 +693,7 @@ void INI_init2(void)
if (n-- > 0) if (n-- > 0)
{ {
format->fmt_length = (USHORT)MET_align(&*desc, format->fmt_length); format->fmt_length = (USHORT)MET_align(&*desc, format->fmt_length);
desc->dsc_address = (UCHAR*) (SLONG) format->fmt_length; desc->dsc_address = (UCHAR*) (IPTR) format->fmt_length;
format->fmt_length += desc->dsc_length; format->fmt_length += desc->dsc_length;
} }
} }
@ -1150,13 +1150,13 @@ static void add_security_to_sys_rel(TDBB tdbb,
strcpy(sec_class_name, "SQL$"); strcpy(sec_class_name, "SQL$");
strcat(sec_class_name, rel_name); strcat(sec_class_name, rel_name);
ISC_QUAD blob_id_1; bid blob_id_1;
blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id_1); blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, &blob_id_1);
BLB_put_segment(tdbb, blob, acl, acl_length); BLB_put_segment(tdbb, blob, acl, acl_length);
BLB_close(tdbb, blob); BLB_close(tdbb, blob);
ISC_QUAD blob_id_2; bid blob_id_2;
blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id_2); blob = BLB_create(tdbb, dbb->dbb_sys_trans, &blob_id_2);
BLB_put_segment(tdbb, blob, acl, acl_length); BLB_put_segment(tdbb, blob, acl, acl_length);
BLB_close(tdbb, blob); BLB_close(tdbb, blob);
@ -1366,7 +1366,7 @@ static void store_global_field(TDBB tdbb, GFLD* gfield, BLK* handle)
jrd_tra* trans = dbb->dbb_sys_trans; jrd_tra* trans = dbb->dbb_sys_trans;
STORE(REQUEST_HANDLE * handle) X IN RDB$FIELDS STORE(REQUEST_HANDLE * handle) X IN RDB$FIELDS
PAD(names[gfield->gfld_name], X.RDB$FIELD_NAME); PAD(names[(USHORT)gfield->gfld_name], X.RDB$FIELD_NAME);
X.RDB$FIELD_LENGTH = gfield->gfld_length; X.RDB$FIELD_LENGTH = gfield->gfld_length;
X.RDB$FIELD_SCALE = 0; X.RDB$FIELD_SCALE = 0;
X.RDB$SYSTEM_FLAG = RDB_system; X.RDB$SYSTEM_FLAG = RDB_system;
@ -1376,7 +1376,7 @@ static void store_global_field(TDBB tdbb, GFLD* gfield, BLK* handle)
X.RDB$SEGMENT_LENGTH.NULL = TRUE; X.RDB$SEGMENT_LENGTH.NULL = TRUE;
if (gfield->gfld_dflt_blr) if (gfield->gfld_dflt_blr)
{ {
blb* blob = BLB_create(tdbb, trans, (BID)&X.RDB$DEFAULT_VALUE); blb* blob = BLB_create(tdbb, trans, &X.RDB$DEFAULT_VALUE);
BLB_put_segment(tdbb, BLB_put_segment(tdbb,
blob, blob,
gfield->gfld_dflt_blr, gfield->gfld_dflt_blr,
@ -1623,7 +1623,7 @@ static void store_trigger(TDBB tdbb, const jrd_trg* trigger, BLK* handle)
X.RDB$SYSTEM_FLAG = RDB_system; X.RDB$SYSTEM_FLAG = RDB_system;
X.RDB$TRIGGER_TYPE = trigger->trg_type; X.RDB$TRIGGER_TYPE = trigger->trg_type;
X.RDB$FLAGS = trigger->trg_flags; X.RDB$FLAGS = trigger->trg_flags;
blb* blob = BLB_create(tdbb, trans, (BID)&X.RDB$TRIGGER_BLR); blb* blob = BLB_create(tdbb, trans, &X.RDB$TRIGGER_BLR);
BLB_put_segment(tdbb, BLB_put_segment(tdbb,
blob, blob,
trigger->trg_blr, trigger->trg_blr,

View File

@ -367,7 +367,7 @@ public:
SSHORT err_code; SSHORT err_code;
USHORT err_pos; USHORT err_pos;
SSHORT out_len = obj.to_wc(NULL, 0, str, len, &err_code, &err_pos); SSHORT out_len = obj.to_wc(NULL, 0, str, len, &err_code, &err_pos);
if (out_len > sizeof(tempBuffer)) if (out_len > (int) sizeof(tempBuffer))
out_str = FB_NEW(*tdbb->tdbb_default) UCS2_CHAR[out_len/2]; out_str = FB_NEW(*tdbb->tdbb_default) UCS2_CHAR[out_len/2];
else else
out_str = tempBuffer; out_str = tempBuffer;
@ -392,7 +392,7 @@ public:
UpcaseConverter(TDBB tdbb, TextType obj, const UCHAR* &str, SSHORT &len) : UpcaseConverter(TDBB tdbb, TextType obj, const UCHAR* &str, SSHORT &len) :
PrevConverter(tdbb, obj, str, len) PrevConverter(tdbb, obj, str, len)
{ {
if (len > sizeof(tempBuffer)) if (len > (int) sizeof(tempBuffer))
out_str = FB_NEW(*tdbb->tdbb_default) UCHAR[len]; out_str = FB_NEW(*tdbb->tdbb_default) UCHAR[len];
else else
out_str = tempBuffer; out_str = tempBuffer;

View File

@ -1659,7 +1659,7 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM #ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
LOG_call(log_handle_returned, *blob_handle); LOG_call(log_handle_returned, *blob_handle);
LOG_call(log_handle_returned, blob_id->bid_stuff.bid_blob); LOG_call(log_handle_returned, blob_id->bid_stuff.bid_temp_id);
#endif #endif
} }
catch (const std::exception&) catch (const std::exception&)
@ -3776,7 +3776,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
jrd_nod* in_message = NULL; jrd_nod* in_message = NULL;
jrd_nod* out_message = NULL; jrd_nod* out_message = NULL;
jrd_nod* node; jrd_nod* node;
for (size_t i = 0; i < csb->csb_rpt.getCount(); i++) for (int i = 0; i < csb->csb_rpt.getCount(); i++)
{ {
if ( (node = csb->csb_rpt[i].csb_message) ) if ( (node = csb->csb_rpt[i].csb_message) )
{ {

View File

@ -37,7 +37,7 @@
* 2004.01.16 Vlad Horsun: added support for default parameters * 2004.01.16 Vlad Horsun: added support for default parameters
*/ */
/* /*
$Id: met.epp,v 1.88 2004-01-16 12:59:15 hvlad Exp $ $Id: met.epp,v 1.89 2004-01-21 07:18:25 skidder Exp $
*/ */
// This MUST be at the top of the file // This MUST be at the top of the file
#ifdef DARWIN #ifdef DARWIN
@ -124,21 +124,19 @@ typedef enum rids {
#undef END_RELATION #undef END_RELATION
#define BLR_BYTE *(csb->csb_running)++ #define BLR_BYTE *(csb->csb_running)++
#define NULL_BLOB(id) (!id.gds_quad_high && !id.gds_quad_low)
#define BLANK '\040' #define BLANK '\040'
DATABASE DB = FILENAME "ODS.RDB"; DATABASE DB = FILENAME "ODS.RDB";
static int blocking_ast_procedure(void* ast_object); static int blocking_ast_procedure(void* ast_object);
static int blocking_ast_relation(void* ast_object); static int blocking_ast_relation(void* ast_object);
static void get_trigger(TDBB, jrd_rel*, SLONG[2], TRIG_VEC*, const TEXT*, bool, USHORT); static void get_trigger(TDBB, jrd_rel*, BID, TRIG_VEC*, const TEXT*, bool, USHORT);
static bool get_type(TDBB, SSHORT*, const UCHAR*, const TEXT*); static bool get_type(TDBB, SSHORT*, const UCHAR*, const TEXT*);
static void lookup_view_contexts(TDBB, jrd_rel*); static void lookup_view_contexts(TDBB, jrd_rel*);
static void name_copy(TEXT*, const TEXT*); static void name_copy(TEXT*, const TEXT*);
static USHORT name_length(const TEXT *); static USHORT name_length(const TEXT *);
static jrd_nod* parse_param_blr(TDBB, jrd_prc*, SLONG[2], Csb*); static jrd_nod* parse_param_blr(TDBB, jrd_prc*, BID, Csb*);
static jrd_nod* parse_procedure_blr(TDBB, jrd_prc*, SLONG[2], Csb*); static jrd_nod* parse_procedure_blr(TDBB, jrd_prc*, BID, Csb*);
static BOOLEAN par_messages(TDBB, const UCHAR*, USHORT, jrd_prc*, Csb*); static BOOLEAN par_messages(TDBB, const UCHAR*, USHORT, jrd_prc*, Csb*);
static BOOLEAN resolve_charset_and_collation(TDBB, SSHORT*, const UCHAR*, static BOOLEAN resolve_charset_and_collation(TDBB, SSHORT*, const UCHAR*,
const UCHAR*); const UCHAR*);
@ -831,7 +829,7 @@ FMT MET_format(TDBB tdbb, jrd_rel* relation, USHORT number)
{ {
REQUEST(irq_r_format) = request; REQUEST(irq_r_format) = request;
} }
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)&X.RDB$DESCRIPTOR); blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, &X.RDB$DESCRIPTOR);
const USHORT count = blob->blb_length / sizeof(struct dsc); const USHORT count = blob->blb_length / sizeof(struct dsc);
format = fmt::newFmt(*dbb->dbb_permanent, count); format = fmt::newFmt(*dbb->dbb_permanent, count);
format->fmt_count = count; format->fmt_count = count;
@ -845,7 +843,7 @@ FMT MET_format(TDBB tdbb, jrd_rel* relation, USHORT number)
if (desc->dsc_address) if (desc->dsc_address)
{ {
format->fmt_length = format->fmt_length =
(ULONG) desc->dsc_address + desc->dsc_length; (IPTR) desc->dsc_address + desc->dsc_length;
break; break;
} }
} }
@ -940,7 +938,7 @@ jrd_nod* MET_get_dependencies(TDBB tdbb,
jrd_rel* relation, jrd_rel* relation,
TEXT* blob, TEXT* blob,
Csb* view_csb, Csb* view_csb,
SLONG blob_id[2], BID blob_id,
jrd_req** request, jrd_req** request,
Csb** csb_ptr, Csb** csb_ptr,
const TEXT* object_name, const TEXT* object_name,
@ -1176,7 +1174,7 @@ void MET_load_trigger(
{ {
get_trigger(tdbb, get_trigger(tdbb,
relation, relation,
(SLONG*)&TRG.RDB$TRIGGER_BLR, &TRG.RDB$TRIGGER_BLR,
triggers + trigger_action, triggers + trigger_action,
TRG.RDB$TRIGGER_NAME, TRG.RDB$TRIGGER_NAME,
(bool) TRG.RDB$SYSTEM_FLAG, (bool) TRG.RDB$SYSTEM_FLAG,
@ -1796,21 +1794,21 @@ bool MET_lookup_partner(
index_number + 1); index_number + 1);
(*references->frgn_reference_ids)[index_number] = (*references->frgn_reference_ids)[index_number] =
(BLK) (IDX.RDB$INDEX_ID - 1); (BLK)(IPTR)(IDX.RDB$INDEX_ID - 1);
references->frgn_relations = references->frgn_relations =
vec::newVector(*dbb->dbb_permanent, references->frgn_relations, vec::newVector(*dbb->dbb_permanent, references->frgn_relations,
index_number + 1); index_number + 1);
(*references->frgn_relations)[index_number] = (*references->frgn_relations)[index_number] =
(BLK) (ULONG) partner_relation->rel_id; (BLK) (IPTR) partner_relation->rel_id;
references->frgn_indexes = references->frgn_indexes =
vec::newVector(*dbb->dbb_permanent, references->frgn_indexes, vec::newVector(*dbb->dbb_permanent, references->frgn_indexes,
index_number + 1); index_number + 1);
(*references->frgn_indexes)[index_number] = (*references->frgn_indexes)[index_number] =
(BLK) (IND.RDB$INDEX_ID - 1); (BLK) (IPTR) (IND.RDB$INDEX_ID - 1);
index_number++; index_number++;
} }
@ -1875,21 +1873,21 @@ bool MET_lookup_partner(
index_number + 1); index_number + 1);
(*dependencies->prim_reference_ids)[index_number] = (*dependencies->prim_reference_ids)[index_number] =
(BLK) (IDX.RDB$INDEX_ID - 1); (BLK) (IPTR) (IDX.RDB$INDEX_ID - 1);
dependencies->prim_relations = dependencies->prim_relations =
vec::newVector(*dbb->dbb_permanent, dependencies->prim_relations, vec::newVector(*dbb->dbb_permanent, dependencies->prim_relations,
index_number+1); index_number+1);
(*dependencies->prim_relations)[index_number] = (*dependencies->prim_relations)[index_number] =
(BLK) (ULONG) partner_relation->rel_id; (BLK) (IPTR) partner_relation->rel_id;
dependencies->prim_indexes = dependencies->prim_indexes =
vec::newVector(*dbb->dbb_permanent, dependencies->prim_indexes, vec::newVector(*dbb->dbb_permanent, dependencies->prim_indexes,
index_number+1); index_number+1);
(*dependencies->prim_indexes)[index_number] = (*dependencies->prim_indexes)[index_number] =
(BLK) (IND.RDB$INDEX_ID - 1); (BLK) (IPTR) (IND.RDB$INDEX_ID - 1);
index_number++; index_number++;
} }
@ -1943,13 +1941,13 @@ bool MET_lookup_partner(
index_number < (int) references->frgn_reference_ids->count(); index_number < (int) references->frgn_reference_ids->count();
index_number++) index_number++)
{ {
if (idx->idx_id == (UCHAR)(ULONG) (*references->frgn_reference_ids) if (idx->idx_id == (UCHAR)(IPTR) (*references->frgn_reference_ids)
[index_number]) [index_number])
{ {
idx->idx_primary_relation = idx->idx_primary_relation =
(USHORT)(ULONG) (*references->frgn_relations)[index_number]; (USHORT)(IPTR) (*references->frgn_relations)[index_number];
idx->idx_primary_index = idx->idx_primary_index =
(UCHAR)(ULONG) (*references->frgn_indexes)[index_number]; (UCHAR)(IPTR) (*references->frgn_indexes)[index_number];
return true; return true;
} }
} }
@ -1965,7 +1963,7 @@ bool MET_lookup_partner(
index_number < (int) dependencies->prim_reference_ids->count(); index_number < (int) dependencies->prim_reference_ids->count();
index_number++) index_number++)
{ {
if (idx->idx_id == (UCHAR)(ULONG) (*dependencies->prim_reference_ids) if (idx->idx_id == (UCHAR)(IPTR) (*dependencies->prim_reference_ids)
[index_number]) [index_number])
{ {
idx->idx_foreign_primaries = idx->idx_foreign_primaries =
@ -2323,7 +2321,7 @@ jrd_rel* MET_lookup_relation_id(TDBB tdbb, SLONG id, BOOLEAN return_deleted)
jrd_nod* MET_parse_blob(TDBB tdbb, jrd_nod* MET_parse_blob(TDBB tdbb,
jrd_rel* relation, jrd_rel* relation,
SLONG blob_id[2], BID blob_id,
Csb** csb_ptr, Csb** csb_ptr,
jrd_req** request_ptr, jrd_req** request_ptr,
BOOLEAN trigger, BOOLEAN trigger,
@ -2347,7 +2345,7 @@ jrd_nod* MET_parse_blob(TDBB tdbb,
SET_TDBB(tdbb); SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id); blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
const SLONG length = blob->blb_length + 10; const SLONG length = blob->blb_length + 10;
str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str(); str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
BLB_get_data(tdbb, blob, temp->str_data, length); BLB_get_data(tdbb, blob, temp->str_data, length);
@ -2519,7 +2517,7 @@ void MET_prepare( TDBB tdbb, jrd_tra* transaction, USHORT length,
RDB$TRANSACTIONS.RDB$TRANSACTION_STATE.LIMBO; RDB$TRANSACTIONS.RDB$TRANSACTION_STATE.LIMBO;
blb* blob = blb* blob =
BLB_create(tdbb, dbb->dbb_sys_trans, BLB_create(tdbb, dbb->dbb_sys_trans,
(BID)&X.RDB$TRANSACTION_DESCRIPTION); &X.RDB$TRANSACTION_DESCRIPTION);
BLB_put_segment(tdbb, blob, msg, length); BLB_put_segment(tdbb, blob, msg, length);
BLB_close(tdbb, blob); BLB_close(tdbb, blob);
END_STORE; END_STORE;
@ -2729,7 +2727,7 @@ jrd_prc* MET_procedure(TDBB tdbb, int id, BOOLEAN noscan, USHORT flags)
Csb *csb_ = Csb::newCsb(*tdbb->tdbb_default, 5); Csb *csb_ = Csb::newCsb(*tdbb->tdbb_default, 5);
parameter->prm_default_val = parameter->prm_default_val =
parse_param_blr(tdbb, procedure, (SLONG*)&F.RDB$DEFAULT_VALUE, csb_); parse_param_blr(tdbb, procedure, &F.RDB$DEFAULT_VALUE, csb_);
delete csb_; delete csb_;
tdbb->tdbb_default = old_pool; tdbb->tdbb_default = old_pool;
@ -2761,7 +2759,7 @@ jrd_prc* MET_procedure(TDBB tdbb, int id, BOOLEAN noscan, USHORT flags)
{ {
*desc = parameter->prm_desc; *desc = parameter->prm_desc;
length = MET_align(&*desc, length); length = MET_align(&*desc, length);
desc->dsc_address = (UCHAR *) length; desc->dsc_address = (UCHAR *) (IPTR) length;
length += desc->dsc_length; length += desc->dsc_length;
} }
} }
@ -2771,7 +2769,7 @@ jrd_prc* MET_procedure(TDBB tdbb, int id, BOOLEAN noscan, USHORT flags)
old_pool = tdbb->tdbb_default; old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = JrdMemoryPool::createPool(); tdbb->tdbb_default = JrdMemoryPool::createPool();
Csb* csb_ = Csb::newCsb(*tdbb->tdbb_default, 5); Csb* csb_ = Csb::newCsb(*tdbb->tdbb_default, 5);
parse_procedure_blr(tdbb, procedure, (SLONG*)&P.RDB$PROCEDURE_BLR, csb_); parse_procedure_blr(tdbb, procedure, &P.RDB$PROCEDURE_BLR, csb_);
procedure->prc_request->req_procedure = procedure; procedure->prc_request->req_procedure = procedure;
for (i = 0; i < csb_->csb_rpt.getCount(); i++) for (i = 0; i < csb_->csb_rpt.getCount(); i++)
{ {
@ -3303,7 +3301,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation)
{ {
relation->rel_flags |= REL_sql_relation; relation->rel_flags |= REL_sql_relation;
} }
if (!NULL_BLOB(REL.RDB$VIEW_BLR)) if (!REL.RDB$VIEW_BLR.isEmpty())
{ {
/* parse the view blr, getting dependencies on relations, etc. at the same time */ /* parse the view blr, getting dependencies on relations, etc. at the same time */
@ -3311,7 +3309,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation)
{ {
relation->rel_view_rse = relation->rel_view_rse =
(RSE) MET_get_dependencies(tdbb, relation, NULL, NULL, (RSE) MET_get_dependencies(tdbb, relation, NULL, NULL,
(SLONG*)&REL.RDB$VIEW_BLR, NULL, &REL.RDB$VIEW_BLR, NULL,
&csb_, REL.RDB$RELATION_NAME, &csb_, REL.RDB$RELATION_NAME,
obj_view); obj_view);
} }
@ -3319,7 +3317,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation)
{ {
relation->rel_view_rse = relation->rel_view_rse =
(RSE) MET_parse_blob(tdbb, relation, (RSE) MET_parse_blob(tdbb, relation,
(SLONG*)&REL.RDB$VIEW_BLR, &csb_, &REL.RDB$VIEW_BLR, &csb_,
NULL, FALSE, FALSE); NULL, FALSE, FALSE);
} }
@ -3339,7 +3337,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation)
/* Pick up field specific stuff */ /* Pick up field specific stuff */
UCHAR* buffer; UCHAR* buffer;
blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)&REL.RDB$RUNTIME); blob = BLB_open(tdbb, dbb->dbb_sys_trans, &REL.RDB$RUNTIME);
if (blob->blb_max_segment < sizeof(temp)) if (blob->blb_max_segment < sizeof(temp))
{ {
buffer = temp; buffer = temp;
@ -3751,7 +3749,7 @@ static int blocking_ast_relation(void* ast_object)
static void get_trigger( static void get_trigger(
TDBB tdbb, TDBB tdbb,
jrd_rel* relation, jrd_rel* relation,
SLONG blob_id[2], BID blob_id,
TRIG_VEC* ptr, TRIG_VEC* ptr,
const TEXT* name, bool sys_trigger, USHORT flags) const TEXT* name, bool sys_trigger, USHORT flags)
{ {
@ -3767,12 +3765,11 @@ static void get_trigger(
**************************************/ **************************************/
SET_TDBB(tdbb); SET_TDBB(tdbb);
if (!blob_id[0] && !blob_id[1]) { if (blob_id->isEmpty())
return; return;
}
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
BLB blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id); BLB blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
SLONG length = blob->blb_length + 10; SLONG length = blob->blb_length + 10;
STR blr = FB_NEW_RPT(*dbb->dbb_permanent,length) str(); STR blr = FB_NEW_RPT(*dbb->dbb_permanent,length) str();
BLB_get_data(tdbb, blob, blr->str_data, length); BLB_get_data(tdbb, blob, blr->str_data, length);
@ -3939,12 +3936,12 @@ static USHORT name_length(const TEXT* name)
} }
static jrd_nod* parse_param_blr(TDBB tdbb, static jrd_nod* parse_param_blr(TDBB tdbb,
jrd_prc* procedure, SLONG blob_id[2], Csb* csb) jrd_prc* procedure, BID blob_id, Csb* csb)
{ {
SET_TDBB(tdbb); SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
BLB blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id); BLB blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
SLONG length = blob->blb_length + 10; SLONG length = blob->blb_length + 10;
STR temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str(); STR temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
@ -3960,7 +3957,7 @@ static jrd_nod* parse_param_blr(TDBB tdbb,
static jrd_nod* parse_procedure_blr( static jrd_nod* parse_procedure_blr(
TDBB tdbb, TDBB tdbb,
jrd_prc* procedure, SLONG blob_id[2], Csb* csb) jrd_prc* procedure, BID blob_id, Csb* csb)
{ {
/************************************** /**************************************
* *
@ -3975,7 +3972,7 @@ static jrd_nod* parse_procedure_blr(
SET_TDBB(tdbb); SET_TDBB(tdbb);
DBB dbb = tdbb->tdbb_database; DBB dbb = tdbb->tdbb_database;
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id); blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id);
const SLONG length = blob->blb_length + 10; const SLONG length = blob->blb_length + 10;
// CVC: Warning: the str class is limited by 64K // CVC: Warning: the str class is limited by 64K
str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str(); str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
@ -4035,7 +4032,7 @@ static BOOLEAN par_messages(TDBB tdbb,
if (align) { if (align) {
offset = FB_ALIGN(offset, align); offset = FB_ALIGN(offset, align);
} }
desc->dsc_address = (UCHAR *) (ULONG) offset; desc->dsc_address = (UCHAR *) (IPTR) offset;
offset += desc->dsc_length; offset += desc->dsc_length;
} }
format->fmt_length = offset; format->fmt_length = offset;
@ -4317,7 +4314,7 @@ static void store_dependencies(TDBB tdbb,
jrd_nod* node = (jrd_nod*) LLS_POP(&csb->csb_dependencies); jrd_nod* node = (jrd_nod*) LLS_POP(&csb->csb_dependencies);
if (!node->nod_arg[e_dep_object]) if (!node->nod_arg[e_dep_object])
continue; continue;
const SSHORT dpdo_type = (SSHORT) (SLONG) node->nod_arg[e_dep_object_type]; const SSHORT dpdo_type = (SSHORT) (IPTR) node->nod_arg[e_dep_object_type];
jrd_rel* relation = NULL; jrd_rel* relation = NULL;
jrd_prc* procedure = NULL; jrd_prc* procedure = NULL;
const TEXT* dpdo_name; const TEXT* dpdo_name;
@ -4332,7 +4329,7 @@ static void store_dependencies(TDBB tdbb,
break; break;
case obj_exception: case obj_exception:
{ {
const SLONG number = (SLONG) node->nod_arg [e_dep_object]; const SLONG number = (IPTR) node->nod_arg [e_dep_object];
MET_lookup_exception (tdbb, number, name, NULL); MET_lookup_exception (tdbb, number, name, NULL);
dpdo_name = name; dpdo_name = name;
break; break;
@ -4340,7 +4337,7 @@ static void store_dependencies(TDBB tdbb,
/* CVC: Here I'm going to track those pesky things named generators and UDFs. */ /* CVC: Here I'm going to track those pesky things named generators and UDFs. */
case obj_generator: case obj_generator:
{ {
const SLONG number = (SLONG) node->nod_arg [e_dep_object]; const SLONG number = (IPTR) node->nod_arg [e_dep_object];
MET_lookup_generator_id (tdbb, number, name); MET_lookup_generator_id (tdbb, number, name);
dpdo_name = name; dpdo_name = name;
break; break;
@ -4360,7 +4357,7 @@ static void store_dependencies(TDBB tdbb,
{ {
if (field_node->nod_type == nod_field) if (field_node->nod_type == nod_field)
{ {
const SSHORT fld_id = (SSHORT) (SLONG) field_node->nod_arg[0]; const SSHORT fld_id = (SSHORT) (IPTR) field_node->nod_arg[0];
if (relation) if (relation)
{ {
const jrd_fld* field = MET_get_field(relation, fld_id); const jrd_fld* field = MET_get_field(relation, fld_id);

View File

@ -37,7 +37,7 @@ void MET_error(const TEXT*, ...);
struct fmt* MET_format(TDBB, struct jrd_rel *, USHORT); struct fmt* MET_format(TDBB, struct jrd_rel *, USHORT);
BOOLEAN MET_get_char_subtype(TDBB, SSHORT*, const UCHAR*, USHORT); BOOLEAN MET_get_char_subtype(TDBB, SSHORT*, const UCHAR*, USHORT);
struct jrd_nod* MET_get_dependencies(TDBB, struct jrd_rel*, TEXT*, struct jrd_nod* MET_get_dependencies(TDBB, struct jrd_rel*, TEXT*,
class Csb*, SLONG[2], struct jrd_req**, class Csb*, struct bid*, struct jrd_req**,
class Csb **, const TEXT*, USHORT); class Csb **, const TEXT*, USHORT);
struct jrd_fld* MET_get_field(struct jrd_rel *, USHORT); struct jrd_fld* MET_get_field(struct jrd_rel *, USHORT);
void MET_get_shadow_files(TDBB, bool); void MET_get_shadow_files(TDBB, bool);
@ -57,7 +57,7 @@ struct jrd_prc* MET_lookup_procedure(TDBB, SCHAR *, BOOLEAN);
struct jrd_prc* MET_lookup_procedure_id(TDBB, SSHORT, BOOLEAN, BOOLEAN, USHORT); struct jrd_prc* MET_lookup_procedure_id(TDBB, SSHORT, BOOLEAN, BOOLEAN, USHORT);
struct jrd_rel* MET_lookup_relation(TDBB, const char*); struct jrd_rel* MET_lookup_relation(TDBB, const char*);
struct jrd_rel* MET_lookup_relation_id(TDBB, SLONG, BOOLEAN); struct jrd_rel* MET_lookup_relation_id(TDBB, SLONG, BOOLEAN);
struct jrd_nod* MET_parse_blob(TDBB, struct jrd_rel *, SLONG[2], class Csb **, struct jrd_nod* MET_parse_blob(TDBB, struct jrd_rel *, struct bid*, class Csb **,
struct jrd_req **, BOOLEAN, BOOLEAN); struct jrd_req **, BOOLEAN, BOOLEAN);
void MET_parse_sys_trigger(TDBB, struct jrd_rel *); void MET_parse_sys_trigger(TDBB, struct jrd_rel *);
int MET_post_existence(TDBB, struct jrd_rel *); int MET_post_existence(TDBB, struct jrd_rel *);

View File

@ -459,7 +459,7 @@ BOOLEAN NAV_get_record(TDBB tdbb,
#endif #endif
init_fetch(impure); init_fetch(impure);
IDX *idx = (IDX*) ((SCHAR*) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]); IDX *idx = (IDX*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
// The bitmap is only valid when we are continuing on in one // The bitmap is only valid when we are continuing on in one
// direction. It is of no help when we change direction, // direction. It is of no help when we change direction,
@ -502,7 +502,7 @@ BOOLEAN NAV_get_record(TDBB tdbb,
#else #else
MOVE_FAST( MOVE_FAST(
(impure->irsb_nav_data + (impure->irsb_nav_data +
(SLONG) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data, (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_data,
upper.key_length); upper.key_length);
#endif #endif
} }
@ -510,7 +510,7 @@ BOOLEAN NAV_get_record(TDBB tdbb,
lower.key_length = impure->irsb_nav_lower_length; lower.key_length = impure->irsb_nav_lower_length;
MOVE_FAST( MOVE_FAST(
(impure->irsb_nav_data + (impure->irsb_nav_data +
(SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data, (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data,
lower.key_length); lower.key_length);
} }
@ -1352,7 +1352,7 @@ static bool find_saved_node(RSB rsb, IRSB_NAV impure,
**************************************/ **************************************/
TDBB tdbb = GET_THREAD_DATA; TDBB tdbb = GET_THREAD_DATA;
IDX *idx = (IDX*) ((SCHAR*) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]); IDX *idx = (IDX*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
BTR page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index); BTR page = (BTR) CCH_FETCH(tdbb, window, LCK_read, pag_index);
// the outer loop goes through all the sibling pages // the outer loop goes through all the sibling pages
@ -1570,7 +1570,7 @@ static BOOLEAN get_record(
TDBB tdbb = GET_THREAD_DATA; TDBB tdbb = GET_THREAD_DATA;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
IDX *idx = (IDX*) ((SCHAR*) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]); IDX *idx = (IDX*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
KEY value; KEY value;
USHORT old_att_flags; USHORT old_att_flags;
@ -1606,7 +1606,7 @@ static BOOLEAN get_record(
{ {
BTR_key(tdbb, rpb->rpb_relation, rpb->rpb_record, BTR_key(tdbb, rpb->rpb_relation, rpb->rpb_record,
reinterpret_cast<struct idx *>((SCHAR*) impure + reinterpret_cast<struct idx *>((SCHAR*) impure +
(SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]), (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]),
&value, 0); &value, 0);
if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) { if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) {
result = FALSE; result = FALSE;
@ -1702,7 +1702,7 @@ static UCHAR* nav_open(
// Find the starting leaf page // Find the starting leaf page
retrieval_node = (jrd_nod*) rsb->rsb_arg[RSB_NAV_index]; retrieval_node = (jrd_nod*) rsb->rsb_arg[RSB_NAV_index];
retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval]; retrieval = (IRB) retrieval_node->nod_arg[e_idx_retrieval];
IDX *idx = (IDX *) ((SCHAR *) impure + (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]); IDX *idx = (IDX *) ((SCHAR *) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
BTR page = BTR_find_page(tdbb, retrieval, window, idx, &lower, BTR page = BTR_find_page(tdbb, retrieval, window, idx, &lower,
&upper, (direction == RSE_get_backward)); &upper, (direction == RSE_get_backward));
impure->irsb_nav_page = window->win_page; impure->irsb_nav_page = window->win_page;
@ -1744,7 +1744,7 @@ static UCHAR* nav_open(
if (retrieval->irb_upper_count) { if (retrieval->irb_upper_count) {
impure->irsb_nav_upper_length = upper.key_length; impure->irsb_nav_upper_length = upper.key_length;
MOVE_FAST(upper.key_data, (impure->irsb_nav_data + MOVE_FAST(upper.key_data, (impure->irsb_nav_data +
(SLONG) rsb->rsb_arg[RSB_NAV_key_length]), (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
upper.key_length); upper.key_length);
} }
if (retrieval->irb_lower_count) { if (retrieval->irb_lower_count) {
@ -1755,7 +1755,7 @@ static UCHAR* nav_open(
if (retrieval->irb_lower_count) { if (retrieval->irb_lower_count) {
impure->irsb_nav_lower_length = lower.key_length; impure->irsb_nav_lower_length = lower.key_length;
MOVE_FAST(lower.key_data, (impure->irsb_nav_data + MOVE_FAST(lower.key_data, (impure->irsb_nav_data +
(SLONG) rsb->rsb_arg[RSB_NAV_key_length]), (IPTR) rsb->rsb_arg[RSB_NAV_key_length]),
lower.key_length); lower.key_length);
} }
if (retrieval->irb_upper_count) { if (retrieval->irb_upper_count) {

View File

@ -377,7 +377,7 @@ RSB OPT_compile(TDBB tdbb,
if (node->nod_type != nod_rse) if (node->nod_type != nod_rse)
{ {
stream = (USHORT)(ULONG) node->nod_arg[STREAM_INDEX(node)]; stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
fb_assert(stream <= MAX_UCHAR); fb_assert(stream <= MAX_UCHAR);
fb_assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR); fb_assert(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR);
beds[++beds[0]] = (UCHAR) stream; beds[++beds[0]] = (UCHAR) stream;
@ -397,7 +397,7 @@ RSB OPT_compile(TDBB tdbb,
(USHORT) (key_streams[0] - i)); (USHORT) (key_streams[0] - i));
fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
local_streams[++local_streams[0]] = local_streams[++local_streams[0]] =
(UCHAR)(ULONG) node->nod_arg[e_uni_stream]; (UCHAR)(IPTR) node->nod_arg[e_uni_stream];
} }
else if (node->nod_type == nod_aggregate) { else if (node->nod_type == nod_aggregate) {
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS); fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
@ -405,13 +405,13 @@ RSB OPT_compile(TDBB tdbb,
rsb = gen_aggregate(tdbb, opt_, node); rsb = gen_aggregate(tdbb, opt_, node);
fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
local_streams[++local_streams[0]] = local_streams[++local_streams[0]] =
(UCHAR)(ULONG) node->nod_arg[e_agg_stream]; (UCHAR)(IPTR) node->nod_arg[e_agg_stream];
} }
else if (node->nod_type == nod_procedure) { else if (node->nod_type == nod_procedure) {
rsb = gen_procedure(tdbb, opt_, node); rsb = gen_procedure(tdbb, opt_, node);
fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR);
local_streams[++local_streams[0]] = local_streams[++local_streams[0]] =
(UCHAR)(ULONG) node->nod_arg[e_prc_stream]; (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
} }
else if (node->nod_type == nod_rse) { else if (node->nod_type == nod_rse) {
compute_rse_streams(csb, (RSE) node, beds); compute_rse_streams(csb, (RSE) node, beds);
@ -820,7 +820,7 @@ jrd_nod* OPT_make_dbkey(OPT opt_, jrd_nod* boolean, USHORT stream)
/* Make sure we have the correct stream */ /* Make sure we have the correct stream */
if ((USHORT)(ULONG) dbkey->nod_arg[0] != stream) if ((USHORT)(IPTR) dbkey->nod_arg[0] != stream)
return NULL; return NULL;
/* If this is a dbkey for the appropriate stream, it's invertable */ /* If this is a dbkey for the appropriate stream, it's invertable */
@ -829,7 +829,7 @@ jrd_nod* OPT_make_dbkey(OPT opt_, jrd_nod* boolean, USHORT stream)
dbkey->nod_count = 1; dbkey->nod_count = 1;
dbkey->nod_type = nod_bit_dbkey; dbkey->nod_type = nod_bit_dbkey;
dbkey->nod_arg[0] = value; dbkey->nod_arg[0] = value;
dbkey->nod_arg[1] = (jrd_nod*) n; dbkey->nod_arg[1] = (jrd_nod*) (IPTR) n;
dbkey->nod_impure = CMP_impure(csb, sizeof(struct inv)); dbkey->nod_impure = CMP_impure(csb, sizeof(struct inv));
return dbkey; return dbkey;
@ -1107,7 +1107,7 @@ void OPT_set_index(TDBB tdbb,
/* go out to the vector which stores all rsbs for the /* go out to the vector which stores all rsbs for the
request, and replace the old with the new */ request, and replace the old with the new */
for (size_t i = 0; i < request->req_fors.getCount(); i++) { for (int i = 0; i < request->req_fors.getCount(); i++) {
if (request->req_fors[i] == old_rsb) { if (request->req_fors[i] == old_rsb) {
request->req_fors[i] = new_rsb; request->req_fors[i] = new_rsb;
break; break;
@ -1601,7 +1601,7 @@ static bool computable(Csb* csb,
switch (node->nod_type) { switch (node->nod_type) {
case nod_field: case nod_field:
if ((n = (USHORT)(ULONG) node->nod_arg[e_fld_stream]) == stream) { if ((n = (USHORT)(IPTR) node->nod_arg[e_fld_stream]) == stream) {
return false; return false;
} }
// AB: cbs_made_river has been replaced by find_used_streams() // AB: cbs_made_river has been replaced by find_used_streams()
@ -1610,7 +1610,7 @@ static bool computable(Csb* csb,
return csb->csb_rpt[n].csb_flags & csb_active; return csb->csb_rpt[n].csb_flags & csb_active;
case nod_dbkey: case nod_dbkey:
if ((n = (USHORT)(ULONG) node->nod_arg[0]) == stream) { if ((n = (USHORT)(IPTR) node->nod_arg[0]) == stream) {
return false; return false;
} }
// AB: cbs_made_river has been replaced by find_used_streams() // AB: cbs_made_river has been replaced by find_used_streams()
@ -1665,7 +1665,7 @@ static bool computable(Csb* csb,
for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) { for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
if ((*ptr)->nod_type != nod_rse) { if ((*ptr)->nod_type != nod_rse) {
n = (USHORT)(ULONG) (*ptr)->nod_arg[STREAM_INDEX((*ptr))]; n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
csb->csb_rpt[n].csb_flags |= csb_active; csb->csb_rpt[n].csb_flags |= csb_active;
} }
} }
@ -1702,7 +1702,7 @@ static bool computable(Csb* csb,
{ {
if ((*ptr)->nod_type != nod_rse) if ((*ptr)->nod_type != nod_rse)
{ {
n = (USHORT)(ULONG) (*ptr)->nod_arg[STREAM_INDEX((*ptr))]; n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
csb->csb_rpt[n].csb_flags &= ~csb_active; csb->csb_rpt[n].csb_flags &= ~csb_active;
} }
} }
@ -1743,12 +1743,12 @@ static void compute_dependencies(jrd_nod* node, ULONG * dependencies)
switch (node->nod_type) { switch (node->nod_type) {
case nod_field: case nod_field:
n = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; n = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
SET_DEP_BIT(dependencies, n); SET_DEP_BIT(dependencies, n);
return; return;
case nod_dbkey: case nod_dbkey:
n = (USHORT)(ULONG) node->nod_arg[0]; n = (USHORT)(IPTR) node->nod_arg[0];
SET_DEP_BIT(dependencies, n); SET_DEP_BIT(dependencies, n);
return; return;
@ -1804,7 +1804,7 @@ static void compute_dependencies(jrd_nod* node, ULONG * dependencies)
for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) { for (ptr = rse->rse_relation, end = ptr + rse->rse_count; ptr < end; ptr++) {
if ((*ptr)->nod_type != nod_rse) { if ((*ptr)->nod_type != nod_rse) {
n = (USHORT)(ULONG) (*ptr)->nod_arg[STREAM_INDEX((*ptr))]; n = (USHORT)(IPTR) (*ptr)->nod_arg[STREAM_INDEX((*ptr))];
CLEAR_DEP_BIT(dependencies, n); CLEAR_DEP_BIT(dependencies, n);
} }
} }
@ -1832,7 +1832,7 @@ static void compute_dbkey_streams(Csb* csb, jrd_nod* node, UCHAR * streams)
if (node->nod_type == nod_relation) { if (node->nod_type == nod_relation) {
fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR); fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
streams[++streams[0]] = (UCHAR)(ULONG) node->nod_arg[e_rel_stream]; streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[e_rel_stream];
} }
else if (node->nod_type == nod_union) { else if (node->nod_type == nod_union) {
jrd_nod* clauses = node->nod_arg[e_uni_clauses]; jrd_nod* clauses = node->nod_arg[e_uni_clauses];
@ -1872,7 +1872,7 @@ static void compute_rse_streams(Csb* csb, RSE rse, UCHAR * streams)
jrd_nod* node = *ptr; jrd_nod* node = *ptr;
if (node->nod_type != nod_rse) { if (node->nod_type != nod_rse) {
fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR); fb_assert(streams[0] < MAX_STREAMS && streams[0] < MAX_UCHAR);
streams[++streams[0]] = (UCHAR)(ULONG) node->nod_arg[STREAM_INDEX(node)]; streams[++streams[0]] = (UCHAR)(IPTR) node->nod_arg[STREAM_INDEX(node)];
} }
else { else {
compute_rse_streams(csb, (RSE) node, streams); compute_rse_streams(csb, (RSE) node, streams);
@ -2986,7 +2986,7 @@ static jrd_nod* find_dbkey(jrd_nod* dbkey, USHORT stream, SLONG * position)
jrd_nod* dbkey_temp, **ptr, **end; jrd_nod* dbkey_temp, **ptr, **end;
DEV_BLKCHK(dbkey, type_nod); DEV_BLKCHK(dbkey, type_nod);
if (dbkey->nod_type == nod_dbkey) { if (dbkey->nod_type == nod_dbkey) {
if ((USHORT)(ULONG) dbkey->nod_arg[0] == stream) if ((USHORT)(IPTR) dbkey->nod_arg[0] == stream)
return dbkey; return dbkey;
else { else {
*position = *position + 1; *position = *position + 1;
@ -3101,7 +3101,7 @@ static void find_rsbs(RSB rsb, LLS * stream_list, LLS * rsb_list)
case rsb_ext_sequential: case rsb_ext_sequential:
case rsb_ext_indexed: case rsb_ext_indexed:
// No need to go any farther down with these. // No need to go any farther down with these.
LLS_PUSH((BLK)(ULONG) rsb->rsb_stream, stream_list); LLS_PUSH((BLK)(IPTR) rsb->rsb_stream, stream_list);
return; return;
case rsb_cross: case rsb_cross:
@ -3261,7 +3261,7 @@ static void form_rivers(TDBB tdbb,
// the stream into the river. // the stream into the river.
temp[0]++; temp[0]++;
const jrd_nod* relation_node = plan_node->nod_arg[e_retrieve_relation]; const jrd_nod* relation_node = plan_node->nod_arg[e_retrieve_relation];
temp[temp[0]] = (UCHAR)(ULONG) relation_node->nod_arg[e_rel_stream]; temp[temp[0]] = (UCHAR)(IPTR) relation_node->nod_arg[e_rel_stream];
} }
// just because the user specified a join does not mean that // just because the user specified a join does not mean that
@ -3433,7 +3433,7 @@ static RSB gen_aggregate(TDBB tdbb, OPT opt, jrd_nod* node)
rsb->rsb_type = rsb_aggregate; rsb->rsb_type = rsb_aggregate;
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS); fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_UCHAR); fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_UCHAR);
rsb->rsb_stream = (UCHAR) (ULONG) node->nod_arg[e_agg_stream]; rsb->rsb_stream = (UCHAR) (IPTR) node->nod_arg[e_agg_stream];
rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format; rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
rsb->rsb_next = OPT_compile(tdbb, csb, rse, NULL); rsb->rsb_next = OPT_compile(tdbb, csb, rse, NULL);
rsb->rsb_arg[0] = (RSB) node; rsb->rsb_arg[0] = (RSB) node;
@ -3878,7 +3878,7 @@ static RSB gen_nav_rsb(TDBB tdbb,
rsb->rsb_stream = (UCHAR) stream; rsb->rsb_stream = (UCHAR) stream;
rsb->rsb_alias = alias; rsb->rsb_alias = alias;
rsb->rsb_arg[RSB_NAV_index] = (RSB) OPT_make_index(tdbb, opt, relation, idx); rsb->rsb_arg[RSB_NAV_index] = (RSB) OPT_make_index(tdbb, opt, relation, idx);
rsb->rsb_arg[RSB_NAV_key_length] = (RSB) (SLONG) key_length; rsb->rsb_arg[RSB_NAV_key_length] = (RSB) (IPTR) key_length;
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
// indicate that the index needs to be navigated in a mirror-image // indicate that the index needs to be navigated in a mirror-image
@ -3964,7 +3964,7 @@ static RSB gen_outer(TDBB tdbb,
else { else {
stream_ptr[i]->stream_rsb = NULL; stream_ptr[i]->stream_rsb = NULL;
stream_ptr[i]->stream_num = stream_ptr[i]->stream_num =
(USHORT)(ULONG) node->nod_arg[STREAM_INDEX(node)]; (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
} }
} }
@ -4043,10 +4043,10 @@ static RSB gen_procedure(TDBB tdbb, OPT opt, jrd_nod* node)
Csb* csb = opt->opt_csb; Csb* csb = opt->opt_csb;
jrd_prc* procedure = MET_lookup_procedure_id(tdbb, jrd_prc* procedure = MET_lookup_procedure_id(tdbb,
(SSHORT)(SLONG)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0); (SSHORT)(IPTR)node->nod_arg[e_prc_procedure], FALSE, FALSE, 0);
RSB rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) Rsb(); RSB rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) Rsb();
rsb->rsb_type = rsb_procedure; rsb->rsb_type = rsb_procedure;
rsb->rsb_stream = (UCHAR)(ULONG) node->nod_arg[e_prc_stream]; rsb->rsb_stream = (UCHAR)(IPTR) node->nod_arg[e_prc_stream];
rsb->rsb_procedure = procedure; rsb->rsb_procedure = procedure;
rsb->rsb_format = procedure->prc_format; rsb->rsb_format = procedure->prc_format;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure)); rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure));
@ -4653,13 +4653,13 @@ static RSB gen_sort(TDBB tdbb,
id = -1; id = -1;
while (SBM_next(csb->csb_rpt[*ptr].csb_fields, &id, RSE_get_forward)) { while (SBM_next(csb->csb_rpt[*ptr].csb_fields, &id, RSE_get_forward)) {
items++; items++;
LLS_PUSH((BLK) id, &id_stack); LLS_PUSH((BLK)(IPTR)id, &id_stack);
LLS_PUSH((BLK)(ULONG) * ptr, &stream_stack); LLS_PUSH((BLK)(IPTR) * ptr, &stream_stack);
for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) { for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) {
node = *node_ptr; node = *node_ptr;
if (node->nod_type == nod_field if (node->nod_type == nod_field
&& (USHORT)(ULONG) node->nod_arg[e_fld_stream] == *ptr && (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
&& (USHORT)(ULONG) node->nod_arg[e_fld_id] == id) { && (USHORT)(IPTR) node->nod_arg[e_fld_id] == id) {
desc = &descriptor; desc = &descriptor;
CMP_get_desc(tdbb, csb, node, desc); CMP_get_desc(tdbb, csb, node, desc);
/* International type text has a computed key */ /* International type text has a computed key */
@ -4766,11 +4766,11 @@ static RSB gen_sort(TDBB tdbb,
++sort_key; ++sort_key;
map_item->smb_node = node; map_item->smb_node = node;
map_item->smb_desc = *desc; map_item->smb_desc = *desc;
map_item->smb_desc.dsc_address = (UCHAR *) map_length; map_item->smb_desc.dsc_address = (UCHAR *) (IPTR) map_length;
map_length += desc->dsc_length; map_length += desc->dsc_length;
if (node->nod_type == nod_field) { if (node->nod_type == nod_field) {
map_item->smb_stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; map_item->smb_stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream];
map_item->smb_field_id = (USHORT)(ULONG) node->nod_arg[e_fld_id]; map_item->smb_field_id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
} }
} }
@ -4782,8 +4782,8 @@ static RSB gen_sort(TDBB tdbb,
field has already been mentioned as a sort key, don't bother to repeat field has already been mentioned as a sort key, don't bother to repeat
it. */ it. */
while (stream_stack) { while (stream_stack) {
id = (USHORT)(ULONG) LLS_POP(&id_stack); id = (USHORT)(IPTR) LLS_POP(&id_stack);
stream = (USHORT)(ULONG) LLS_POP(&stream_stack); stream = (USHORT)(IPTR) LLS_POP(&stream_stack);
format = CMP_format(tdbb, csb, stream); format = CMP_format(tdbb, csb, stream);
desc = &format->fmt_desc[id]; desc = &format->fmt_desc[id];
if (id >= format->fmt_count || desc->dsc_length == 0) if (id >= format->fmt_count || desc->dsc_length == 0)
@ -4795,7 +4795,7 @@ static RSB gen_sort(TDBB tdbb,
map_item->smb_stream = stream; map_item->smb_stream = stream;
map_item->smb_flag_offset = flag_offset++; map_item->smb_flag_offset = flag_offset++;
map_item->smb_desc = *desc; map_item->smb_desc = *desc;
map_item->smb_desc.dsc_address = (UCHAR *) map_length; map_item->smb_desc.dsc_address = (UCHAR *) (IPTR)map_length;
map_length += desc->dsc_length; map_length += desc->dsc_length;
map_item++; map_item++;
} }
@ -4809,7 +4809,7 @@ static RSB gen_sort(TDBB tdbb,
desc = &map_item->smb_desc; desc = &map_item->smb_desc;
desc->dsc_dtype = dtype_long; desc->dsc_dtype = dtype_long;
desc->dsc_length = sizeof(SLONG); desc->dsc_length = sizeof(SLONG);
desc->dsc_address = (UCHAR *) map_length; desc->dsc_address = (UCHAR *)(IPTR)map_length;
map_length += desc->dsc_length; map_length += desc->dsc_length;
} }
@ -4821,7 +4821,7 @@ static RSB gen_sort(TDBB tdbb,
desc = &map_item->smb_desc; desc = &map_item->smb_desc;
desc->dsc_dtype = dtype_long; desc->dsc_dtype = dtype_long;
desc->dsc_length = sizeof(SLONG); desc->dsc_length = sizeof(SLONG);
desc->dsc_address = (UCHAR *) map_length; desc->dsc_address = (UCHAR *) (IPTR)map_length;
map_length += desc->dsc_length; map_length += desc->dsc_length;
} }
@ -4834,7 +4834,7 @@ static RSB gen_sort(TDBB tdbb,
desc = &map_item->smb_desc; desc = &map_item->smb_desc;
desc->dsc_dtype = dtype_long; desc->dsc_dtype = dtype_long;
desc->dsc_length = sizeof(SLONG); desc->dsc_length = sizeof(SLONG);
desc->dsc_address = (UCHAR *) map_length; desc->dsc_address = (UCHAR *)(IPTR)map_length;
map_length += desc->dsc_length; map_length += desc->dsc_length;
} }
@ -5115,7 +5115,7 @@ static RSB gen_union(TDBB tdbb,
rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb(); rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
rsb->rsb_type = rsb_union; rsb->rsb_type = rsb_union;
rsb->rsb_count = count; rsb->rsb_count = count;
rsb->rsb_stream = (UCHAR)(ULONG) union_node->nod_arg[e_uni_stream]; rsb->rsb_stream = (UCHAR)(IPTR) union_node->nod_arg[e_uni_stream];
rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format; rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb)); rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
rsb_ptr = rsb->rsb_arg; rsb_ptr = rsb->rsb_arg;
@ -5126,9 +5126,9 @@ static RSB gen_union(TDBB tdbb,
/* Save the count and numbers of the streams that make up the union */ /* Save the count and numbers of the streams that make up the union */
*rsb_ptr++ = (RSB)(ULONG) nstreams; *rsb_ptr++ = (RSB)(IPTR) nstreams;
while (nstreams--) { while (nstreams--) {
*rsb_ptr++ = (RSB)(ULONG) * streams++; *rsb_ptr++ = (RSB)(IPTR) * streams++;
} }
return rsb; return rsb;
} }
@ -5649,8 +5649,8 @@ static jrd_nod* make_missing(TDBB tdbb,
jrd_nod* field = boolean->nod_arg[0]; jrd_nod* field = boolean->nod_arg[0];
if (field->nod_type != nod_field) if (field->nod_type != nod_field)
return NULL; return NULL;
if ((USHORT)(ULONG) field->nod_arg[e_fld_stream] != stream || if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
(USHORT)(ULONG) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field) (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field)
{ {
return NULL; return NULL;
} }
@ -5731,8 +5731,8 @@ static jrd_nod* make_starts(TDBB tdbb,
} }
} }
if ((USHORT)(ULONG) field->nod_arg[e_fld_stream] != stream || if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream ||
(USHORT)(ULONG) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field
|| !(idx->idx_rpt[0].idx_itype == idx_string || !(idx->idx_rpt[0].idx_itype == idx_string
|| idx->idx_rpt[0].idx_itype == idx_byte_array || idx->idx_rpt[0].idx_itype == idx_byte_array
|| idx->idx_rpt[0].idx_itype == idx_metadata || idx->idx_rpt[0].idx_itype == idx_metadata
@ -5845,11 +5845,11 @@ static void mark_indices(csb_repeat* csb_tail, SSHORT relation_id)
const jrd_nod* const* arg = access_type->nod_arg; const jrd_nod* const* arg = access_type->nod_arg;
const jrd_nod* const* const end = arg + plan_count; const jrd_nod* const* const end = arg + plan_count;
for (; arg < end; arg += 3) { for (; arg < end; arg += 3) {
if (relation_id != (SSHORT)(SLONG) * arg) { if (relation_id != (SSHORT)(IPTR) * arg) {
/* index %s cannot be used in the specified plan */ /* index %s cannot be used in the specified plan */
ERR_post(isc_index_unused, isc_arg_string, *(arg + 2), 0); ERR_post(isc_index_unused, isc_arg_string, *(arg + 2), 0);
} }
if (idx->idx_id == (USHORT)(ULONG) * (arg + 1)) { if (idx->idx_id == (USHORT)(IPTR) * (arg + 1)) {
if (access_type->nod_type == nod_navigational && if (access_type->nod_type == nod_navigational &&
arg == access_type->nod_arg) arg == access_type->nod_arg)
{ {
@ -5927,13 +5927,13 @@ static SSHORT match_index(TDBB tdbb,
If left side is still not a field, give up */ If left side is still not a field, give up */
if (match->nod_type != nod_field || if (match->nod_type != nod_field ||
(USHORT)(ULONG) match->nod_arg[e_fld_stream] != stream || (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
!computable(opt->opt_csb, value, stream, true)) !computable(opt->opt_csb, value, stream, true))
{ {
match = value; match = value;
value = boolean->nod_arg[0]; value = boolean->nod_arg[0];
if (match->nod_type != nod_field || if (match->nod_type != nod_field ||
(USHORT)(ULONG) match->nod_arg[e_fld_stream] != stream || (USHORT)(IPTR) match->nod_arg[e_fld_stream] != stream ||
!computable(opt->opt_csb, value, stream, true)) !computable(opt->opt_csb, value, stream, true))
{ {
return 0; return 0;
@ -5956,7 +5956,7 @@ static SSHORT match_index(TDBB tdbb,
#ifdef EXPRESSION_INDICES #ifdef EXPRESSION_INDICES
(idx->idx_expression || (idx->idx_expression ||
#endif #endif
((USHORT)(ULONG) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field) ((USHORT)(IPTR) match->nod_arg[e_fld_id] == idx->idx_rpt[i].idx_field)
#ifdef EXPRESSION_INDICES #ifdef EXPRESSION_INDICES
) )
#endif #endif
@ -6087,7 +6087,7 @@ static USHORT nav_rsb_size(RSB rsb, USHORT key_length, USHORT size)
/* make room for an idx structure to describe the index /* make room for an idx structure to describe the index
that was used to generate this rsb */ that was used to generate this rsb */
if (rsb->rsb_type == rsb_navigate) if (rsb->rsb_type == rsb_navigate)
rsb->rsb_arg[RSB_NAV_idx_offset] = (RSB) (SLONG) size; rsb->rsb_arg[RSB_NAV_idx_offset] = (RSB) (IPTR) size;
size += sizeof(struct idx); size += sizeof(struct idx);
return size; return size;
} }
@ -6381,7 +6381,7 @@ static bool river_reference(const riv* river, const jrd_nod* node, bool* field_f
for (const UCHAR* const end = streams + river->riv_count; for (const UCHAR* const end = streams + river->riv_count;
streams < end; streams++) streams < end; streams++)
{ {
if ((USHORT)(ULONG) node->nod_arg[e_fld_stream] == *streams) { if ((USHORT)(IPTR) node->nod_arg[e_fld_stream] == *streams) {
*field_found = true; *field_found = true;
return true; return true;
} }
@ -6626,7 +6626,7 @@ static void set_rse_inactive(Csb* csb, RSE rse)
{ {
jrd_nod* node = *ptr; jrd_nod* node = *ptr;
if (node->nod_type != nod_rse) { if (node->nod_type != nod_rse) {
const SSHORT stream = (USHORT)(ULONG) node->nod_arg[STREAM_INDEX(node)]; const SSHORT stream = (USHORT)(IPTR) node->nod_arg[STREAM_INDEX(node)];
csb->csb_rpt[stream].csb_flags &= ~csb_active; csb->csb_rpt[stream].csb_flags &= ~csb_active;
} }
else else

View File

@ -910,7 +910,7 @@ static FIL seek_file(FIL file, BDB bdb, UINT64 * offset, ISC_STATUS * status_vec
break; break;
if (file->fil_desc == -1) if (file->fil_desc == -1)
return (FIL)(ULONG) unix_error("lseek", file, isc_io_access_err, return (FIL)(IPTR) unix_error("lseek", file, isc_io_access_err,
status_vector); status_vector);
page -= file->fil_min_page - file->fil_fudge; page -= file->fil_min_page - file->fil_fudge;
@ -918,11 +918,9 @@ static FIL seek_file(FIL file, BDB bdb, UINT64 * offset, ISC_STATUS * status_vec
lseek_offset = page; lseek_offset = page;
lseek_offset *= dbb->dbb_page_size; lseek_offset *= dbb->dbb_page_size;
#if _FILE_OFFSET_BITS != 64 if (lseek_offset != LSEEK_OFFSET_CAST lseek_offset) {
if (lseek_offset > MAX_SLONG) { return (FIL)(IPTR) unix_error ("lseek", file, isc_io_32bit_exceeded_err, status_vector);
return (FIL)(ULONG) unix_error ("lseek", file, isc_io_32bit_exceeded_err, status_vector);
} }
#endif
#ifdef PREAD_PWRITE #ifdef PREAD_PWRITE
*offset = lseek_offset; *offset = lseek_offset;
@ -931,7 +929,7 @@ static FIL seek_file(FIL file, BDB bdb, UINT64 * offset, ISC_STATUS * status_vec
if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST lseek_offset, 0)) == (off_t)-1) { if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST lseek_offset, 0)) == (off_t)-1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_MUTEX_UNLOCK(file->fil_mutex);
return (FIL)(ULONG) unix_error("lseek", file, isc_io_access_err, return (FIL)(IPTR) unix_error("lseek", file, isc_io_access_err,
status_vector); status_vector);
} }
#endif #endif

View File

@ -379,8 +379,8 @@ jrd_nod* PAR_gen_field(TDBB tdbb, USHORT stream, USHORT id)
jrd_nod* node = FB_NEW_RPT(*tdbb->tdbb_default, e_fld_length) jrd_nod(); jrd_nod* node = FB_NEW_RPT(*tdbb->tdbb_default, e_fld_length) jrd_nod();
node->nod_type = nod_field; node->nod_type = nod_field;
node->nod_arg[e_fld_id] = (jrd_nod*) (SLONG) id; node->nod_arg[e_fld_id] = (jrd_nod*) (IPTR) id;
node->nod_arg[e_fld_stream] = (jrd_nod*) (SLONG) stream; node->nod_arg[e_fld_stream] = (jrd_nod*) (IPTR) stream;
return node; return node;
} }
@ -806,7 +806,7 @@ static XCP par_condition(TDBB tdbb, Csb* csb)
dep_node = PAR_make_node(tdbb, e_dep_length); dep_node = PAR_make_node(tdbb, e_dep_length);
dep_node->nod_type = nod_dependency; dep_node->nod_type = nod_dependency;
dep_node->nod_arg[e_dep_object] = dep_node->nod_arg[e_dep_object] =
(jrd_nod*) exception_list->xcp_rpt[0].xcp_code; (jrd_nod*)(IPTR) exception_list->xcp_rpt[0].xcp_code;
dep_node->nod_arg[e_dep_object_type] = (jrd_nod*) obj_exception; dep_node->nod_arg[e_dep_object_type] = (jrd_nod*) obj_exception;
LLS_PUSH(dep_node, &csb->csb_dependencies); LLS_PUSH(dep_node, &csb->csb_dependencies);
break; break;
@ -874,7 +874,7 @@ static XCP par_conditions(TDBB tdbb, Csb* csb)
dep_node = PAR_make_node(tdbb, e_dep_length); dep_node = PAR_make_node(tdbb, e_dep_length);
dep_node->nod_type = nod_dependency; dep_node->nod_type = nod_dependency;
dep_node->nod_arg[e_dep_object] = dep_node->nod_arg[e_dep_object] =
(jrd_nod*) exception_list->xcp_rpt[0].xcp_code; (jrd_nod*) (IPTR)exception_list->xcp_rpt[0].xcp_code;
dep_node->nod_arg[e_dep_object_type] = (jrd_nod*) obj_exception; dep_node->nod_arg[e_dep_object_type] = (jrd_nod*) obj_exception;
LLS_PUSH(dep_node, &csb->csb_dependencies); LLS_PUSH(dep_node, &csb->csb_dependencies);
break; break;
@ -981,7 +981,7 @@ static void par_dependency(TDBB tdbb,
jrd_nod* field_node = PAR_make_node(tdbb, 1); jrd_nod* field_node = PAR_make_node(tdbb, 1);
node->nod_arg[e_dep_field] = field_node; node->nod_arg[e_dep_field] = field_node;
field_node->nod_type = nod_field; field_node->nod_type = nod_field;
field_node->nod_arg[0] = (jrd_nod*) (SLONG) id; field_node->nod_arg[0] = (jrd_nod*) (IPTR) id;
} }
LLS_PUSH(node, &csb->csb_dependencies); LLS_PUSH(node, &csb->csb_dependencies);
@ -1442,7 +1442,7 @@ static jrd_nod* par_message(TDBB tdbb, Csb* csb)
jrd_nod* node = PAR_make_node(tdbb, e_msg_length); jrd_nod* node = PAR_make_node(tdbb, e_msg_length);
tail->csb_message = node; tail->csb_message = node;
node->nod_count = 0; node->nod_count = 0;
node->nod_arg[e_msg_number] = (jrd_nod*) (SLONG) n; node->nod_arg[e_msg_number] = (jrd_nod*) (IPTR) n;
if (n > csb->csb_msg_number) if (n > csb->csb_msg_number)
csb->csb_msg_number = n; csb->csb_msg_number = n;
@ -1460,7 +1460,7 @@ static jrd_nod* par_message(TDBB tdbb, Csb* csb)
const USHORT alignment = PAR_desc(csb, &*desc); const USHORT alignment = PAR_desc(csb, &*desc);
if (alignment) if (alignment)
offset = FB_ALIGN(offset, alignment); offset = FB_ALIGN(offset, alignment);
desc->dsc_address = (UCHAR *) (SLONG) offset; desc->dsc_address = (UCHAR *) (IPTR) offset;
offset += desc->dsc_length; offset += desc->dsc_length;
} }
@ -1513,8 +1513,8 @@ static jrd_nod* par_modify(TDBB tdbb, Csb* csb)
jrd_nod* node = PAR_make_node(tdbb, e_mod_length); jrd_nod* node = PAR_make_node(tdbb, e_mod_length);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[e_mod_org_stream] = (jrd_nod*) (SLONG) org_stream; node->nod_arg[e_mod_org_stream] = (jrd_nod*) (IPTR) org_stream;
node->nod_arg[e_mod_new_stream] = (jrd_nod*) (SLONG) new_stream; node->nod_arg[e_mod_new_stream] = (jrd_nod*) (IPTR) new_stream;
node->nod_arg[e_mod_statement] = parse(tdbb, csb, STATEMENT); node->nod_arg[e_mod_statement] = parse(tdbb, csb, STATEMENT);
return node; return node;
@ -1611,8 +1611,8 @@ static jrd_nod* par_plan(TDBB tdbb, Csb* csb)
error(csb, isc_ctxnotdef, 0); error(csb, isc_ctxnotdef, 0);
const SSHORT stream = csb->csb_rpt[n].csb_stream; const SSHORT stream = csb->csb_rpt[n].csb_stream;
relation_node->nod_arg[e_rel_stream] = (jrd_nod*) (SLONG) stream; relation_node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) stream;
relation_node->nod_arg[e_rel_context] = (jrd_nod*) (SLONG) n; relation_node->nod_arg[e_rel_context] = (jrd_nod*) (IPTR) n;
/* Access plan types (sequential is default) */ /* Access plan types (sequential is default) */
@ -1656,8 +1656,8 @@ static jrd_nod* par_plan(TDBB tdbb, Csb* csb)
the relation could be a base relation of a view; the relation could be a base relation of a view;
save the index name also, for convenience */ save the index name also, for convenience */
access_type->nod_arg[0] = (jrd_nod*) relation_id; access_type->nod_arg[0] = (jrd_nod*) (IPTR) relation_id;
access_type->nod_arg[1] = (jrd_nod*) index_id; access_type->nod_arg[1] = (jrd_nod*) (IPTR) index_id;
access_type->nod_arg[2] = (jrd_nod*) ALL_cstring(name); access_type->nod_arg[2] = (jrd_nod*) ALL_cstring(name);
if (BLR_PEEK == blr_indices) if (BLR_PEEK == blr_indices)
@ -1711,8 +1711,8 @@ static jrd_nod* par_plan(TDBB tdbb, Csb* csb)
the relation could be a base relation of a view; the relation could be a base relation of a view;
save the index name also, for convenience */ save the index name also, for convenience */
*arg++ = (jrd_nod*) relation_id; *arg++ = (jrd_nod*) (IPTR) relation_id;
*arg++ = (jrd_nod*) index_id; *arg++ = (jrd_nod*) (IPTR) index_id;
*arg++ = (jrd_nod*) ALL_cstring(name); *arg++ = (jrd_nod*) ALL_cstring(name);
} }
break; break;
@ -1766,10 +1766,10 @@ static jrd_nod* par_procedure(TDBB tdbb, Csb* csb, SSHORT operator_)
jrd_nod* node = PAR_make_node(tdbb, e_prc_length); jrd_nod* node = PAR_make_node(tdbb, e_prc_length);
node->nod_type = nod_procedure; node->nod_type = nod_procedure;
node->nod_count = count_table[blr_procedure]; node->nod_count = count_table[blr_procedure];
node->nod_arg[e_prc_procedure] = (jrd_nod*) (SLONG) procedure->prc_id; node->nod_arg[e_prc_procedure] = (jrd_nod*) (IPTR) procedure->prc_id;
const USHORT stream = par_context(csb, 0); const USHORT stream = par_context(csb, 0);
node->nod_arg[e_prc_stream] = (jrd_nod*) (SLONG) stream; node->nod_arg[e_prc_stream] = (jrd_nod*) (IPTR) stream;
csb->csb_rpt[stream].csb_procedure = procedure; csb->csb_rpt[stream].csb_procedure = procedure;
par_procedure_parms(tdbb, csb, procedure, &node->nod_arg[e_prc_in_msg], par_procedure_parms(tdbb, csb, procedure, &node->nod_arg[e_prc_in_msg],
@ -1833,7 +1833,7 @@ static void par_procedure_parms(
message->nod_count = count_table[blr_message]; message->nod_count = count_table[blr_message];
*message_ptr = message; *message_ptr = message;
message->nod_count = 0; message->nod_count = 0;
message->nod_arg[e_msg_number] = (jrd_nod*)(ULONG) n; message->nod_arg[e_msg_number] = (jrd_nod*)(IPTR) n;
const fmt* format = const fmt* format =
input_flag ? procedure->prc_input_fmt : procedure->prc_output_fmt; input_flag ? procedure->prc_input_fmt : procedure->prc_output_fmt;
/* dimitr: procedure (with its parameter formats) is allocated out of /* dimitr: procedure (with its parameter formats) is allocated out of
@ -1898,13 +1898,13 @@ static void par_procedure_parms(
prm->nod_type = nod_argument; prm->nod_type = nod_argument;
prm->nod_count = 1; prm->nod_count = 1;
prm->nod_arg[e_arg_message] = message; prm->nod_arg[e_arg_message] = message;
prm->nod_arg[e_arg_number] = (jrd_nod*)(ULONG) i++; prm->nod_arg[e_arg_number] = (jrd_nod*)(IPTR) i++;
jrd_nod* prm_f = prm->nod_arg[e_arg_flag] = jrd_nod* prm_f = prm->nod_arg[e_arg_flag] =
PAR_make_node(tdbb, e_arg_length); PAR_make_node(tdbb, e_arg_length);
prm_f->nod_type = nod_argument; prm_f->nod_type = nod_argument;
prm_f->nod_count = 0; prm_f->nod_count = 0;
prm_f->nod_arg[e_arg_message] = message; prm_f->nod_arg[e_arg_message] = message;
prm_f->nod_arg[e_arg_number] = (jrd_nod*)(ULONG) i++; prm_f->nod_arg[e_arg_number] = (jrd_nod*)(IPTR) i++;
} }
} }
else if ((input_flag ? procedure->prc_inputs : procedure->prc_outputs) && else if ((input_flag ? procedure->prc_inputs : procedure->prc_outputs) &&
@ -1996,8 +1996,8 @@ static jrd_nod* par_relation(
SSHORT context; SSHORT context;
const SSHORT stream = par_context(csb, &context); const SSHORT stream = par_context(csb, &context);
fb_assert(stream <= MAX_STREAMS); fb_assert(stream <= MAX_STREAMS);
node->nod_arg[e_rel_stream] = (jrd_nod*) (SLONG) stream; node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) stream;
node->nod_arg[e_rel_context] = (jrd_nod*) (SLONG) context; node->nod_arg[e_rel_context] = (jrd_nod*) (IPTR) context;
csb->csb_rpt[stream].csb_relation = relation; csb->csb_rpt[stream].csb_relation = relation;
csb->csb_rpt[stream].csb_alias = alias_string; csb->csb_rpt[stream].csb_alias = alias_string;
@ -2236,7 +2236,7 @@ static jrd_nod* par_union(TDBB tdbb, Csb* csb)
jrd_nod* node = PAR_make_node(tdbb, e_uni_length); jrd_nod* node = PAR_make_node(tdbb, e_uni_length);
node->nod_count = 2; node->nod_count = 2;
const USHORT stream = par_context(csb, 0); const USHORT stream = par_context(csb, 0);
node->nod_arg[e_uni_stream] = (jrd_nod*) (SLONG) stream; node->nod_arg[e_uni_stream] = (jrd_nod*) (IPTR) stream;
SSHORT count = (unsigned int) BLR_BYTE; SSHORT count = (unsigned int) BLR_BYTE;
/* Pick up the sub-rse's and maps */ /* Pick up the sub-rse's and maps */
@ -2420,7 +2420,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
break; break;
case blr_user_savepoint: case blr_user_savepoint:
*arg++ = (jrd_nod*) (ULONG) BLR_BYTE; *arg++ = (jrd_nod*) (IPTR) BLR_BYTE;
par_name(csb, name); par_name(csb, name);
*arg++ = (jrd_nod*) ALL_cstring(name); *arg++ = (jrd_nod*) ALL_cstring(name);
break; break;
@ -2454,7 +2454,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used)) if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used))
error(csb, isc_ctxnotdef, 0); error(csb, isc_ctxnotdef, 0);
node->nod_arg[e_erase_stream] = node->nod_arg[e_erase_stream] =
(jrd_nod*) (SLONG) csb->csb_rpt[n].csb_stream; (jrd_nod*) (IPTR) csb->csb_rpt[n].csb_stream;
break; break;
case blr_modify: case blr_modify:
@ -2540,12 +2540,12 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
break; break;
case blr_aggregate: case blr_aggregate:
node->nod_arg[e_agg_stream] = (jrd_nod*) (SLONG) par_context(csb, 0); node->nod_arg[e_agg_stream] = (jrd_nod*) (IPTR) par_context(csb, 0);
fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS); fb_assert((int) (IPTR)node->nod_arg[e_agg_stream] <= MAX_STREAMS);
node->nod_arg[e_agg_rse] = parse(tdbb, csb, TYPE_RSE); node->nod_arg[e_agg_rse] = parse(tdbb, csb, TYPE_RSE);
node->nod_arg[e_agg_group] = parse(tdbb, csb, OTHER); node->nod_arg[e_agg_group] = parse(tdbb, csb, OTHER);
node->nod_arg[e_agg_map] = node->nod_arg[e_agg_map] =
par_map(tdbb, csb, (USHORT)(ULONG) node->nod_arg[e_agg_stream]); par_map(tdbb, csb, (USHORT)(IPTR) node->nod_arg[e_agg_stream]);
break; break;
case blr_group_by: case blr_group_by:
@ -2568,7 +2568,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
error(csb, isc_gennotdef, error(csb, isc_gennotdef,
isc_arg_string, ERR_cstring(name), 0); isc_arg_string, ERR_cstring(name), 0);
} }
node->nod_arg[e_gen_relation] = (jrd_nod*) tmp; node->nod_arg[e_gen_relation] = (jrd_nod*) (IPTR) tmp;
node->nod_arg[e_gen_value] = parse(tdbb, csb, VALUE); node->nod_arg[e_gen_value] = parse(tdbb, csb, VALUE);
/* CVC: There're thousand ways to go wrong, but I don't see any value /* CVC: There're thousand ways to go wrong, but I don't see any value
@ -2579,7 +2579,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
{ {
jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length);
dep_node->nod_type = nod_dependency; dep_node->nod_type = nod_dependency;
dep_node->nod_arg [e_dep_object] = (jrd_nod*) tmp; dep_node->nod_arg [e_dep_object] = (jrd_nod*) (IPTR) tmp;
dep_node->nod_arg [e_dep_object_type] = (jrd_nod*) obj_generator; dep_node->nod_arg [e_dep_object_type] = (jrd_nod*) obj_generator;
LLS_PUSH (dep_node, &csb->csb_dependencies); LLS_PUSH (dep_node, &csb->csb_dependencies);
} }
@ -2592,7 +2592,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
n = BLR_BYTE; n = BLR_BYTE;
if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used)) if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used))
error(csb, isc_ctxnotdef, 0); error(csb, isc_ctxnotdef, 0);
node->nod_arg[0] = (jrd_nod*) (SLONG) csb->csb_rpt[n].csb_stream; node->nod_arg[0] = (jrd_nod*) (IPTR) csb->csb_rpt[n].csb_stream;
break; break;
case blr_fetch: case blr_fetch:
@ -2627,7 +2627,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
case blr_dcl_variable: case blr_dcl_variable:
{ {
n = BLR_WORD; n = BLR_WORD;
node->nod_arg[e_dcl_id] = (jrd_nod*) (SLONG) n; node->nod_arg[e_dcl_id] = (jrd_nod*) (IPTR) n;
PAR_desc(csb, (DSC *) (node->nod_arg + e_dcl_desc)); PAR_desc(csb, (DSC *) (node->nod_arg + e_dcl_desc));
vec* vector = csb->csb_variables = vec* vector = csb->csb_variables =
vec::newVector(*tdbb->tdbb_default, csb->csb_variables, n + 1); vec::newVector(*tdbb->tdbb_default, csb->csb_variables, n + 1);
@ -2638,7 +2638,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
case blr_variable: case blr_variable:
{ {
n = BLR_WORD; n = BLR_WORD;
node->nod_arg[e_var_id] = (jrd_nod*) (SLONG) n; node->nod_arg[e_var_id] = (jrd_nod*) (IPTR) n;
vec* vector = csb->csb_variables; vec* vector = csb->csb_variables;
if (!vector || n >= vector->count() || if (!vector || n >= vector->count() ||
!(node->nod_arg[e_var_variable] = (jrd_nod*) (*vector)[n])) !(node->nod_arg[e_var_variable] = (jrd_nod*) (*vector)[n]))
@ -2661,7 +2661,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
} }
node->nod_arg[e_arg_message] = message; node->nod_arg[e_arg_message] = message;
n = BLR_WORD; n = BLR_WORD;
node->nod_arg[e_arg_number] = (jrd_nod*) (SLONG) n; node->nod_arg[e_arg_number] = (jrd_nod*) (IPTR) n;
const fmt* format = (FMT) message->nod_arg[e_msg_format]; const fmt* format = (FMT) message->nod_arg[e_msg_format];
if (n >= format->fmt_count) if (n >= format->fmt_count)
error(csb, isc_badparnum, 0); error(csb, isc_badparnum, 0);
@ -2673,7 +2673,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
temp->nod_type = nod_argument; temp->nod_type = nod_argument;
temp->nod_arg[e_arg_message] = message; temp->nod_arg[e_arg_message] = message;
n = BLR_WORD; n = BLR_WORD;
temp->nod_arg[e_arg_number] = (jrd_nod*) (SLONG) n; temp->nod_arg[e_arg_number] = (jrd_nod*) (IPTR) n;
if (n >= format->fmt_count) if (n >= format->fmt_count)
error(csb, isc_badparnum, 0); error(csb, isc_badparnum, 0);
} }
@ -2685,7 +2685,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
temp->nod_type = nod_argument; temp->nod_type = nod_argument;
temp->nod_arg[e_arg_message] = message; temp->nod_arg[e_arg_message] = message;
n = BLR_WORD; n = BLR_WORD;
temp->nod_arg[e_arg_number] = (jrd_nod*) (SLONG) n; temp->nod_arg[e_arg_number] = (jrd_nod*) (IPTR) n;
if (n >= format->fmt_count) if (n >= format->fmt_count)
error(csb, isc_badparnum, 0); error(csb, isc_badparnum, 0);
} }
@ -2750,12 +2750,12 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti
break; break;
case blr_label: case blr_label:
node->nod_arg[e_lbl_label] = (jrd_nod*) (SLONG) BLR_BYTE; node->nod_arg[e_lbl_label] = (jrd_nod*) (IPTR) BLR_BYTE;
node->nod_arg[e_lbl_statement] = parse(tdbb, csb, sub_type); node->nod_arg[e_lbl_statement] = parse(tdbb, csb, sub_type);
break; break;
case blr_leave: case blr_leave:
node->nod_arg[0] = (jrd_nod*) (SLONG) BLR_BYTE; node->nod_arg[0] = (jrd_nod*) (IPTR) BLR_BYTE;
break; break;

View File

@ -20,7 +20,7 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* *
* $Id: rse.cpp,v 1.50 2004-01-13 09:52:14 robocop Exp $ * $Id: rse.cpp,v 1.51 2004-01-21 07:18:25 skidder Exp $
* *
* 2001.07.28: John Bellardo: Implemented rse_skip and made rse_first work with * 2001.07.28: John Bellardo: Implemented rse_skip and made rse_first work with
* seekable streams. * seekable streams.
@ -728,8 +728,8 @@ void RSE_open(TDBB tdbb, RSB rsb)
/* Initialize the record number of each stream in the union */ /* Initialize the record number of each stream in the union */
RSB* ptr = &rsb->rsb_arg[rsb->rsb_count]; RSB* ptr = &rsb->rsb_arg[rsb->rsb_count];
for (RSB* const end = ptr + (USHORT)(ULONG) * ptr; ++ptr <= end;) { for (RSB* const end = ptr + (USHORT)(IPTR) * ptr; ++ptr <= end;) {
request->req_rpb[(USHORT)(ULONG) * ptr].rpb_number = -1; request->req_rpb[(USHORT)(IPTR) * ptr].rpb_number = -1;
} }
rsb = rsb->rsb_arg[0]; rsb = rsb->rsb_arg[0];
@ -2123,7 +2123,7 @@ static BOOLEAN get_procedure(TDBB tdbb,
EXE_receive(tdbb, proc_request, 1, oml, om); EXE_receive(tdbb, proc_request, 1, oml, om);
dsc desc = msg_format->fmt_desc[msg_format->fmt_count - 1]; dsc desc = msg_format->fmt_desc[msg_format->fmt_count - 1];
desc.dsc_address = (UCHAR *) (om + (int) desc.dsc_address); desc.dsc_address = (UCHAR *) (om + (IPTR) desc.dsc_address);
USHORT eos; USHORT eos;
dsc eos_desc; dsc eos_desc;
eos_desc.dsc_dtype = dtype_short; eos_desc.dsc_dtype = dtype_short;
@ -2887,7 +2887,7 @@ static void join_to_nulls(TDBB tdbb, RSB rsb, USHORT streams)
request = tdbb->tdbb_request; request = tdbb->tdbb_request;
stack = (LLS) rsb->rsb_arg[streams]; stack = (LLS) rsb->rsb_arg[streams];
for (; stack; stack = stack->lls_next) { for (; stack; stack = stack->lls_next) {
rpb = &request->req_rpb[(USHORT)(ULONG) stack->lls_object]; rpb = &request->req_rpb[(USHORT)(IPTR) stack->lls_object];
/* Make sure a record block has been allocated. If there isn't /* Make sure a record block has been allocated. If there isn't
one, first find the format, then allocate the record block */ one, first find the format, then allocate the record block */
@ -2932,7 +2932,7 @@ static void map_sort_data(jrd_req* request, SMB map, UCHAR * data)
for (item = map->smb_rpt; item < end_item; item++) { for (item = map->smb_rpt; item < end_item; item++) {
flag = *(data + item->smb_flag_offset); flag = *(data + item->smb_flag_offset);
from = item->smb_desc; from = item->smb_desc;
from.dsc_address = data + (ULONG) from.dsc_address; from.dsc_address = data + (IPTR) from.dsc_address;
if ((node = item->smb_node) && node->nod_type != nod_field) if ((node = item->smb_node) && node->nod_type != nod_field)
continue; continue;
@ -2945,7 +2945,7 @@ static void map_sort_data(jrd_req* request, SMB map, UCHAR * data)
list that contains the data to send back list that contains the data to send back
*/ */
if (IS_INTL_DATA(&item->smb_desc) && if (IS_INTL_DATA(&item->smb_desc) &&
(USHORT)(ULONG) item->smb_desc.dsc_address < (USHORT)(IPTR) item->smb_desc.dsc_address <
map->smb_key_length * sizeof(ULONG)) continue; map->smb_key_length * sizeof(ULONG)) continue;
rpb = &request->req_rpb[item->smb_stream]; rpb = &request->req_rpb[item->smb_stream];
@ -3167,7 +3167,7 @@ static void open_sort(TDBB tdbb, RSB rsb, IRSB_SORT impure, UINT64 max_records)
end_item = map->smb_rpt + map->smb_count; end_item = map->smb_rpt + map->smb_count;
for (item = map->smb_rpt; item < end_item; item++) { for (item = map->smb_rpt; item < end_item; item++) {
to = item->smb_desc; to = item->smb_desc;
to.dsc_address = data + (ULONG) to.dsc_address; to.dsc_address = data + (IPTR) to.dsc_address;
flag = FALSE; flag = FALSE;
if (item->smb_node) { if (item->smb_node) {
from = EVL_expr(tdbb, item->smb_node); from = EVL_expr(tdbb, item->smb_node);
@ -3194,7 +3194,7 @@ static void open_sort(TDBB tdbb, RSB rsb, IRSB_SORT impure, UINT64 max_records)
// then want to sort by language dependent order. // then want to sort by language dependent order.
if (IS_INTL_DATA(&item->smb_desc) && if (IS_INTL_DATA(&item->smb_desc) &&
(USHORT)(ULONG) item->smb_desc.dsc_address < (USHORT)(IPTR) item->smb_desc.dsc_address <
map->smb_key_length * sizeof(ULONG)) { map->smb_key_length * sizeof(ULONG)) {
INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc), INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc),
from, &to, FALSE); from, &to, FALSE);
@ -3257,13 +3257,13 @@ static void proc_assignment(
desc2.dsc_flags = 0; desc2.dsc_flags = 0;
desc2.dsc_address = (UCHAR *) & indicator; desc2.dsc_address = (UCHAR *) & indicator;
desc1 = *flag_desc; desc1 = *flag_desc;
desc1.dsc_address = msg + (int) flag_desc->dsc_address; desc1.dsc_address = msg + (IPTR) flag_desc->dsc_address;
MOV_move(&desc1, &desc2); MOV_move(&desc1, &desc2);
if (indicator) { if (indicator) {
SET_NULL(record, to_id); SET_NULL(record, to_id);
SSHORT l = to_desc->dsc_length; // it seems safer to use USHORT SSHORT l = to_desc->dsc_length; // it seems safer to use USHORT
fb_assert(l); // l == 0 would produce undesirable results here fb_assert(l); // l == 0 would produce undesirable results here
UCHAR* p = record->rec_data + (int) to_desc->dsc_address; UCHAR* p = record->rec_data + (IPTR) to_desc->dsc_address;
switch (to_desc->dsc_dtype) { switch (to_desc->dsc_dtype) {
case dtype_text: case dtype_text:
/* YYY - not necessarily the right thing to do */ /* YYY - not necessarily the right thing to do */
@ -3294,9 +3294,9 @@ static void proc_assignment(
else { else {
CLEAR_NULL(record, to_id); CLEAR_NULL(record, to_id);
desc1 = *from_desc; desc1 = *from_desc;
desc1.dsc_address = msg + (int) desc1.dsc_address; desc1.dsc_address = msg + (IPTR) desc1.dsc_address;
desc2 = *to_desc; desc2 = *to_desc;
desc2.dsc_address = record->rec_data + (int) desc2.dsc_address; desc2.dsc_address = record->rec_data + (IPTR) desc2.dsc_address;
if (!DSC_EQUIV((&desc1), (&desc2))) if (!DSC_EQUIV((&desc1), (&desc2)))
MOV_move(&desc1, &desc2); MOV_move(&desc1, &desc2);
@ -3780,7 +3780,8 @@ static void write_merge_block(TDBB tdbb, MFB mfb, ULONG block)
if (!sfb_->sfb_file_name) { if (!sfb_->sfb_file_name) {
TEXT file_name[128]; TEXT file_name[128];
sfb_->sfb_file = (int) gds__temp_file(FALSE, SCRATCH, file_name); // Cast is ok because stdio_flag is false
sfb_->sfb_file = (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name);
if (sfb_->sfb_file == -1) if (sfb_->sfb_file == -1)
SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error, SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error,
errno); errno);

View File

@ -1110,7 +1110,7 @@ static SLONG compute_access(TDBB tdbb,
REQUEST(irq_l_security) = request; REQUEST(irq_l_security) = request;
privileges |= SCL_exists; privileges |= SCL_exists;
blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID) & X.RDB$ACL); blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, &X.RDB$ACL);
TEXT* acl = buffer; TEXT* acl = buffer;
while (true) while (true)
{ {

View File

@ -704,7 +704,7 @@ static BOOLEAN execute(SDL_ARG arg)
} }
element_desc = array_desc->ads_rpt[value].ads_desc; element_desc = array_desc->ads_rpt[value].ads_desc;
element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array + element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array +
(SLONG) element_desc.dsc_address + (IPTR) element_desc.dsc_address +
(array_desc->ads_element_length * subscript); (array_desc->ads_element_length * subscript);
/* Is this element within the array bounds? */ /* Is this element within the array bounds? */

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: sort.cpp,v 1.52 2003-12-24 13:04:59 dimitr Exp $ * $Id: sort.cpp,v 1.53 2004-01-21 07:18:25 skidder Exp $
* *
* 2001-09-24 SJL - Temporary fix for large sort file bug * 2001-09-24 SJL - Temporary fix for large sort file bug
* *
@ -1771,7 +1771,7 @@ static ULONG find_file_space(SCB scb, ULONG size, SFB * ret_sfb)
// Create a scratch file // Create a scratch file
sfb->sfb_file = sfb->sfb_file =
(int) gds__temp_file(FALSE, SCRATCH, file_name, (int) (IPTR) gds__temp_file(FALSE, SCRATCH, file_name,
sfb->sfb_dls->dls_directory, TRUE); sfb->sfb_dls->dls_directory, TRUE);
// allocate the file name even if the file is not open, // allocate the file name even if the file is not open,

View File

@ -67,6 +67,7 @@ class jrd_tra : public pool_alloc_rpt<SCHAR, type_tra>
class traRpbList *tra_rpblist; /* active RPB's of given transaction */ class traRpbList *tra_rpblist; /* active RPB's of given transaction */
UCHAR tra_use_count; /* use count for safe AST delivery */ UCHAR tra_use_count; /* use count for safe AST delivery */
UCHAR tra_callback_count; /* callback count for 'execute statement' */ UCHAR tra_callback_count; /* callback count for 'execute statement' */
ULONG tra_next_blob_id; // ID of the next blob or array created in this transaction
UCHAR tra_transactions[1]; UCHAR tra_transactions[1];
}; };

View File

@ -1215,6 +1215,10 @@ void API_ROUTINE isc_set_single_user(const UCHAR** dpb,
} }
static void print_version(void* dummy, const char* version) {
ib_printf("\t%s\n", version);
}
int API_ROUTINE isc_version(FRBRD** handle, int API_ROUTINE isc_version(FRBRD** handle,
FPTR_VERSION_CALLBACK routine, void* user_arg) FPTR_VERSION_CALLBACK routine, void* user_arg)
@ -1229,10 +1233,8 @@ int API_ROUTINE isc_version(FRBRD** handle,
* Obtain and print information about a database. * Obtain and print information about a database.
* *
**************************************/ **************************************/
if (!routine) { if (!routine)
routine = (FPTR_VERSION_CALLBACK) ib_printf; routine = print_version;
user_arg = (void*)"\t%s\n";
}
UCHAR buffer[256]; UCHAR buffer[256];
UCHAR* buf = buffer; UCHAR* buf = buffer;

View File

@ -168,6 +168,7 @@ class arr : public pool_alloc_rpt<ads::ads_repeat, type_arr>
SLONG arr_effective_length; /* Length of array instance */ SLONG arr_effective_length; /* Length of array instance */
USHORT arr_desc_length; /* Length of array descriptor */ USHORT arr_desc_length; /* Length of array descriptor */
struct ads arr_desc; /* Array descriptor */ struct ads arr_desc; /* Array descriptor */
ULONG arr_temp_id; // Temporary ID for open array inside the transaction
}; };
typedef arr* ARR; typedef arr* ARR;

View File

@ -2683,7 +2683,7 @@ void VIO_store(TDBB tdbb, RPB * rpb, jrd_tra* transaction)
rpb->rpb_flags = 0; rpb->rpb_flags = 0;
rpb->rpb_transaction = transaction->tra_number; rpb->rpb_transaction = transaction->tra_number;
rpb->rpb_window.win_flags = 0; rpb->rpb_window.win_flags = 0;
LLS_PUSH((BLK) - rpb->rpb_transaction, &rpb->rpb_record->rec_precedence); LLS_PUSH((BLK) (IPTR) -rpb->rpb_transaction, &rpb->rpb_record->rec_precedence);
DPM_store(tdbb, rpb, &rpb->rpb_record->rec_precedence, DPM_primary); DPM_store(tdbb, rpb, &rpb->rpb_record->rec_precedence, DPM_primary);
#ifdef VIO_DEBUG #ifdef VIO_DEBUG
@ -4268,7 +4268,7 @@ static int prepare_update( TDBB tdbb,
DPM_store(tdbb, temp, stack, DPM_secondary); DPM_store(tdbb, temp, stack, DPM_secondary);
continue; continue;
} }
LLS_PUSH((BLK) temp->rpb_page, stack); LLS_PUSH((BLK) (IPTR)temp->rpb_page, stack);
return PREPARE_OK; return PREPARE_OK;
case tra_active: case tra_active:
@ -4649,7 +4649,7 @@ retry:
temp2.rpb_number = org_rpb->rpb_number; temp2.rpb_number = org_rpb->rpb_number;
DPM_store(tdbb, &temp2, stack, DPM_secondary); DPM_store(tdbb, &temp2, stack, DPM_secondary);
LLS_PUSH((BLK) temp2.rpb_page, stack); LLS_PUSH((BLK)(IPTR)temp2.rpb_page, stack);
} }
if (!DPM_get(tdbb, org_rpb, LCK_write)) { if (!DPM_get(tdbb, org_rpb, LCK_write)) {

View File

@ -42,7 +42,7 @@
* *
*/ */
/* /*
$Id: why.cpp,v 1.49 2004-01-03 10:59:41 robocop Exp $ $Id: why.cpp,v 1.50 2004-01-21 07:18:26 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -171,7 +171,7 @@ typedef struct clean
DatabaseCleanupRoutine* DatabaseRoutine; DatabaseCleanupRoutine* DatabaseRoutine;
TransactionCleanupRoutine *TransactionRoutine; TransactionCleanupRoutine *TransactionRoutine;
}; };
SLONG clean_arg; void* clean_arg;
} *CLEAN; } *CLEAN;
/* Transaction element block */ /* Transaction element block */
@ -1457,7 +1457,7 @@ ISC_STATUS API_ROUTINE GDS_CREATE_DATABASE(ISC_STATUS* user_status,
ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS * user_status, ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS * user_status,
WHY_ATT * handle, WHY_ATT * handle,
DatabaseCleanupRoutine * routine, DatabaseCleanupRoutine * routine,
SCHAR* arg) void* arg)
{ {
/************************************** /**************************************
* *
@ -1488,7 +1488,7 @@ ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS * user_status,
clean->clean_next = database->cleanup; clean->clean_next = database->cleanup;
database->cleanup = clean; database->cleanup = clean;
clean->DatabaseRoutine = routine; clean->DatabaseRoutine = routine;
clean->clean_arg = (SLONG) arg; clean->clean_arg = arg;
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
status[1] = 0; status[1] = 0;
@ -4827,7 +4827,7 @@ ISC_STATUS API_ROUTINE GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS * user_status, ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS * user_status,
WHY_TRA * tra_handle, WHY_TRA * tra_handle,
TransactionCleanupRoutine *routine, TransactionCleanupRoutine *routine,
SLONG arg) void* arg)
{ {
/************************************** /**************************************
* *

View File

@ -251,7 +251,7 @@ ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS*, FRBRD**, USHORT,
#endif #endif
typedef void DatabaseCleanupRoutine(FRBRD**, SLONG); typedef void DatabaseCleanupRoutine(FRBRD**, void*);
#ifdef CANCEL_OPERATION #ifdef CANCEL_OPERATION
#define CANCEL_disable 1 #define CANCEL_disable 1
@ -261,14 +261,14 @@ ISC_STATUS API_ROUTINE gds__cancel_operation(ISC_STATUS*, FRBRD**, USHORT);
#endif #endif
ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS*, FRBRD**, ISC_STATUS API_ROUTINE isc_database_cleanup(ISC_STATUS*, FRBRD**,
DatabaseCleanupRoutine*, SCHAR*); DatabaseCleanupRoutine*, void*);
int API_ROUTINE gds__disable_subsystem(TEXT*); int API_ROUTINE gds__disable_subsystem(TEXT*);
int API_ROUTINE gds__enable_subsystem(TEXT*); int API_ROUTINE gds__enable_subsystem(TEXT*);
ISC_STATUS gds__handle_cleanup(ISC_STATUS*, FRBRD**); ISC_STATUS gds__handle_cleanup(ISC_STATUS*, FRBRD**);
typedef void TransactionCleanupRoutine(FRBRD*, SLONG); typedef void TransactionCleanupRoutine(FRBRD*, void*);
ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS*, FRBRD**, ISC_STATUS API_ROUTINE gds__transaction_cleanup(ISC_STATUS*, FRBRD**,
TransactionCleanupRoutine*, SLONG); TransactionCleanupRoutine*, void*);
#ifdef SERVER_SHUTDOWN #ifdef SERVER_SHUTDOWN
BOOLEAN WHY_set_shutdown(BOOLEAN); BOOLEAN WHY_set_shutdown(BOOLEAN);

View File

@ -39,7 +39,7 @@
*/ */
/* /*
$Id: lock.cpp,v 1.83 2004-01-03 10:59:43 robocop Exp $ $Id: lock.cpp,v 1.84 2004-01-21 07:18:29 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -736,7 +736,7 @@ void LOCK_fini( ISC_STATUS * status_vector, PTR * owner_offset)
release_mutex(); release_mutex();
#ifdef USE_BLOCKING_SIGNALS #ifdef USE_BLOCKING_SIGNALS
ISC_signal_cancel(LOCK_block_signal, blocking_action, (void *)offset); ISC_signal_cancel(LOCK_block_signal, blocking_action, (void *)(IPTR)offset);
#endif #endif
*owner_offset = (PTR)0; *owner_offset = (PTR)0;
@ -798,7 +798,7 @@ int LOCK_init(
#ifdef USE_BLOCKING_SIGNALS #ifdef USE_BLOCKING_SIGNALS
if (LOCK_owner_offset) if (LOCK_owner_offset)
ISC_signal(LOCK_block_signal, blocking_action, ISC_signal(LOCK_block_signal, blocking_action,
(void *) LOCK_owner_offset); (void *)(IPTR) LOCK_owner_offset);
#endif #endif
/* Initialize process level stuffs for different platforms. /* Initialize process level stuffs for different platforms.

View File

@ -2031,7 +2031,7 @@ ISC_STATUS GDS_DSQL_FREE(ISC_STATUS * user_status, RSR * stmt_handle, USHORT opt
return error(user_status); return error(user_status);
} }
statement->rsr_handle = (FRBRD *)(ULONG) packet->p_resp.p_resp_object; statement->rsr_handle = (FRBRD *)(IPTR) packet->p_resp.p_resp_object;
if (packet->p_resp.p_resp_object == 0xFFFF) { if (packet->p_resp.p_resp_object == 0xFFFF) {
release_sql_request(statement); release_sql_request(statement);
*stmt_handle = NULL; *stmt_handle = NULL;
@ -3134,7 +3134,10 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status,
event->p_event_items.cstr_length = length; event->p_event_items.cstr_length = length;
event->p_event_items.cstr_address = const_cast<UCHAR*>(items); event->p_event_items.cstr_address = const_cast<UCHAR*>(items);
event->p_event_ast = ast; event->p_event_ast = ast;
event->p_event_arg = (SLONG) arg; // Nickolay Samofatov: We pass this value to the server (as 32-bit value)
// then it returns it to us and we do not use it. Maybe pass zero here
// to avoid client-side security risks?
event->p_event_arg = (SLONG) (IPTR) arg;
event->p_event_rid = rem_event->rvnt_id; event->p_event_rid = rem_event->rvnt_id;
if (!send_packet(port, packet, user_status) || if (!send_packet(port, packet, user_status) ||
@ -6029,8 +6032,8 @@ static ISC_STATUS mov_dsql_message(const UCHAR* from_msg,
dsc from = *from_desc; dsc from = *from_desc;
dsc to = *to_desc; dsc to = *to_desc;
// Safe const cast, we are going to move from it to anywhere. // Safe const cast, we are going to move from it to anywhere.
from.dsc_address = const_cast<UCHAR*>(from_msg) + (SLONG) from.dsc_address; from.dsc_address = const_cast<UCHAR*>(from_msg) + (IPTR) from.dsc_address;
to.dsc_address = to_msg + (SLONG) to.dsc_address; to.dsc_address = to_msg + (IPTR) to.dsc_address;
CVT_move(&from, &to, move_error); CVT_move(&from, &to, move_error);
} }

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: parser.cpp,v 1.13 2003-11-08 16:30:20 brodsom Exp $ $Id: parser.cpp,v 1.14 2004-01-21 07:18:30 skidder Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -225,7 +225,7 @@ REM_MSG PARSE_messages(const UCHAR* blr, USHORT blr_length)
net_length += (desc->dsc_length + 3) & ~3; net_length += (desc->dsc_length + 3) & ~3;
if (align > 1) if (align > 1)
offset = FB_ALIGN(offset, align); offset = FB_ALIGN(offset, align);
desc->dsc_address = (UCHAR *)(ULONG) offset; desc->dsc_address = (UCHAR*) (IPTR) offset;
offset += desc->dsc_length; offset += desc->dsc_length;
} }
format->fmt_length = offset; format->fmt_length = offset;

View File

@ -531,10 +531,13 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p)
MAP(xdr_short, MAP(xdr_short,
reinterpret_cast<SSHORT&>(event->p_event_database)); reinterpret_cast<SSHORT&>(event->p_event_database));
MAP(xdr_cstring, event->p_event_items); MAP(xdr_cstring, event->p_event_items);
#pragma FB_COMPILER_MESSAGE("p_event_ast is a pointer to function forced to SLONG!")
// Nickolay Samofatov: this values are parsed, but are ignored by the client.
// Values are useful only for debugging, anyway since upper words of pointers
// are trimmed for 64-bit clients
MAP(xdr_long, reinterpret_cast<SLONG&>(event->p_event_ast)); MAP(xdr_long, reinterpret_cast<SLONG&>(event->p_event_ast));
#pragma FB_COMPILER_MESSAGE("p_event_arg is a void* stored as SLONG!")
MAP(xdr_long, event->p_event_arg); MAP(xdr_long, event->p_event_arg);
MAP(xdr_long, event->p_event_rid); MAP(xdr_long, event->p_event_rid);
DEBUG_PRINTSIZE(p->p_operation); DEBUG_PRINTSIZE(p->p_operation);
return P_TRUE; return P_TRUE;
@ -984,7 +987,7 @@ static bool_t xdr_datum( XDR* xdrs, DSC* desc, BLOB_PTR* buffer)
**************************************/ **************************************/
SSHORT n; SSHORT n;
BLOB_PTR* p = buffer + (ULONG) desc->dsc_address; BLOB_PTR* p = buffer + (IPTR) desc->dsc_address;
switch (desc->dsc_dtype) { switch (desc->dsc_dtype) {
case dtype_text: case dtype_text:
@ -1367,7 +1370,7 @@ static bool_t xdr_semi_opaque( XDR* xdrs, REM_MSG message, FMT format)
for (desc = format->fmt_desc, end = desc + format->fmt_count; for (desc = format->fmt_desc, end = desc + format->fmt_count;
desc < end; desc++) desc < end; desc++)
if (desc->dsc_dtype == dtype_d_float) { if (desc->dsc_dtype == dtype_d_float) {
convert = (double *) (msg_address + (int) desc->dsc_address); convert = (double *) (msg_address + (IPTR)desc->dsc_address);
*convert = MTH$CVT_D_G(convert); *convert = MTH$CVT_D_G(convert);
} }
@ -1382,7 +1385,7 @@ static bool_t xdr_semi_opaque( XDR* xdrs, REM_MSG message, FMT format)
if (desc->dsc_dtype == dtype_d_float) { if (desc->dsc_dtype == dtype_d_float) {
convert = convert =
(double *) (message->msg_address + (double *) (message->msg_address +
(int) desc->dsc_address); (IPTR) desc->dsc_address);
*convert = MTH$CVT_G_D(convert); *convert = MTH$CVT_G_D(convert);
} }
return TRUE; return TRUE;

View File

@ -2452,7 +2452,7 @@ ISC_STATUS port::get_slice(P_SLC * stuff, PACKET* send)
stuff->p_slc_parameters.cstr_length, stuff->p_slc_parameters.cstr_length,
(const ISC_LONG*) stuff->p_slc_parameters.cstr_address, (const ISC_LONG*) stuff->p_slc_parameters.cstr_address,
stuff->p_slc_length, slice, stuff->p_slc_length, slice,
reinterpret_cast<long*>(&response->p_slr_length)); reinterpret_cast<SLONG*>(&response->p_slr_length));
THREAD_ENTER; THREAD_ENTER;
if (status_vector[1]) if (status_vector[1])
@ -4260,9 +4260,12 @@ static void server_ast(void* event_void, USHORT length, const UCHAR* items)
p_event->p_event_items.cstr_length = length; p_event->p_event_items.cstr_length = length;
// Probalby should define this item with CSTRING_CONST instead. // Probalby should define this item with CSTRING_CONST instead.
p_event->p_event_items.cstr_address = const_cast<UCHAR*>(items); p_event->p_event_items.cstr_address = const_cast<UCHAR*>(items);
// Nickolay Samofatov: We keep this values and even pass them to the client
// (as 32-bit values) when event is fired, but client ignores them.
p_event->p_event_ast = event->rvnt_ast; p_event->p_event_ast = event->rvnt_ast;
// CVC: Using SLONG to keep pointer! p_event->p_event_arg = (SLONG)(IPTR) event->rvnt_arg;
p_event->p_event_arg = (SLONG) event->rvnt_arg;
p_event->p_event_rid = event->rvnt_rid; p_event->p_event_rid = event->rvnt_rid;
port->send(&packet); port->send(&packet);
@ -4396,7 +4399,7 @@ ISC_STATUS port::service_start(P_INFO * stuff, PACKET* send)
THREAD_EXIT; THREAD_EXIT;
isc_service_start(status_vector, isc_service_start(status_vector,
&rdb->rdb_handle, &rdb->rdb_handle,
reinterpret_cast<long*>(reserved), reinterpret_cast<SLONG*>(reserved),
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<char*>(stuff->p_info_items.cstr_address)); reinterpret_cast<char*>(stuff->p_info_items.cstr_address));
THREAD_ENTER; THREAD_ENTER;