diff --git a/builds/posix/Makefile.in.boot.gpre b/builds/posix/Makefile.in.boot.gpre index 1ff865a7dd..74c996681e 100644 --- a/builds/posix/Makefile.in.boot.gpre +++ b/builds/posix/Makefile.in.boot.gpre @@ -27,7 +27,7 @@ # 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=.. 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 \ - 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 GPRE_Files = $(GPRECOMMON_Files) pretty.cpp gpre_meta_boot.cpp diff --git a/builds/posix/Makefile.in.client.gpre b/builds/posix/Makefile.in.client.gpre index 2fa244f6ed..9b7f74de03 100644 --- a/builds/posix/Makefile.in.client.gpre +++ b/builds/posix/Makefile.in.client.gpre @@ -27,7 +27,7 @@ # 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=.. ObjModuleName=client.gpre @@ -43,7 +43,7 @@ include $(ROOT)/gen/make.shared.variables GPRE_Files = gpre_meta.epp \ 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 \ @GPRE_LANGUAGE_MODULES@ diff --git a/builds/posix/Makefile.in.embed.gpre b/builds/posix/Makefile.in.embed.gpre index a1d192113b..3ba6697bc6 100644 --- a/builds/posix/Makefile.in.embed.gpre +++ b/builds/posix/Makefile.in.embed.gpre @@ -27,7 +27,7 @@ # 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=.. ObjModuleName=embed.gpre @@ -42,7 +42,7 @@ include $(ROOT)/gen/make.shared.variables GPRE_Files = gpre_meta.epp \ 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 \ @GPRE_LANGUAGE_MODULES@ diff --git a/builds/posix/Makefile.in.static.gpre b/builds/posix/Makefile.in.static.gpre index 1339670968..57ea8839fb 100644 --- a/builds/posix/Makefile.in.static.gpre +++ b/builds/posix/Makefile.in.static.gpre @@ -27,7 +27,7 @@ # 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=.. 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 \ - 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 GPRESTATIC_Files = $(GPRECOMMON_Files) gpre_meta.epp diff --git a/builds/win32/msvc6/gpre.dsp b/builds/win32/msvc6/gpre.dsp index a4c468f7eb..21fdfff5e9 100644 --- a/builds/win32/msvc6/gpre.dsp +++ b/builds/win32/msvc6/gpre.dsp @@ -150,10 +150,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\gpre\int.cpp -# End Source File -# Begin Source File - SOURCE=..\..\..\src\gpre\int_cxx.cpp # End Source File # Begin Source File diff --git a/builds/win32/msvc6/gpre_boot.dsp b/builds/win32/msvc6/gpre_boot.dsp index 58fd995789..4224ce29cb 100644 --- a/builds/win32/msvc6/gpre_boot.dsp +++ b/builds/win32/msvc6/gpre_boot.dsp @@ -134,10 +134,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\gpre\int.cpp -# End Source File -# Begin Source File - SOURCE=..\..\..\src\gpre\int_cxx.cpp # End Source File # Begin Source File diff --git a/builds/win32/msvc6/gpre_static.dsp b/builds/win32/msvc6/gpre_static.dsp index 3349aaade3..b52818c295 100644 --- a/builds/win32/msvc6/gpre_static.dsp +++ b/builds/win32/msvc6/gpre_static.dsp @@ -150,10 +150,6 @@ SOURCE=..\..\..\src\gpre\hsh.cpp # End Source File # Begin Source File -SOURCE=..\..\..\src\gpre\int.cpp -# End Source File -# Begin Source File - SOURCE=..\..\..\src\gpre\int_cxx.cpp # End Source File # Begin Source File diff --git a/builds/win32/msvc7/gpre.vcproj b/builds/win32/msvc7/gpre.vcproj index 6f71e193e0..3cab7e70e5 100644 --- a/builds/win32/msvc7/gpre.vcproj +++ b/builds/win32/msvc7/gpre.vcproj @@ -176,9 +176,6 @@ - - diff --git a/builds/win32/msvc7/gpre_boot.vcproj b/builds/win32/msvc7/gpre_boot.vcproj index 379a4f7fca..6b0abfd862 100644 --- a/builds/win32/msvc7/gpre_boot.vcproj +++ b/builds/win32/msvc7/gpre_boot.vcproj @@ -176,9 +176,6 @@ - - diff --git a/builds/win32/msvc7/gpre_static.vcproj b/builds/win32/msvc7/gpre_static.vcproj index 82e2191975..d57a2387f8 100644 --- a/builds/win32/msvc7/gpre_static.vcproj +++ b/builds/win32/msvc7/gpre_static.vcproj @@ -173,9 +173,6 @@ - - diff --git a/examples/api/apifull.c b/examples/api/apifull.c index a2d28083b2..cbde2716d5 100644 --- a/examples/api/apifull.c +++ b/examples/api/apifull.c @@ -21,7 +21,7 @@ * 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 @@ -81,7 +81,7 @@ int main (ARG(int, argc), ARG(char **, argv)) ARGLIST(int argc) ARGLIST(char **argv) { - long query[MAXLEN]; + int query[MAXLEN]; XSQLDA * sqlda; char db_name[128]; @@ -161,16 +161,16 @@ process_statement (ARG(XSQLDA **, sqldap), ARGLIST(XSQLDA **sqldap) ARGLIST(char *query) { - long buffer[MAXLEN]; + int buffer[MAXLEN]; XSQLDA *sqlda; XSQLVAR *var; short num_cols, i; short length, alignment, type, offset; - long fetch_stat; + int fetch_stat; static char stmt_info[] = { isc_info_sql_stmt_type }; char info_buffer[20]; short l; - long statement_type; + int statement_type; sqlda = *sqldap; @@ -398,7 +398,7 @@ ARGLIST(XSQLVAR *var) field_width = 6; break; case SQL_LONG: - value = (ISC_INT64) *(long *) var->sqldata; + value = (ISC_INT64) *(int *) var->sqldata; field_width = 11; break; case SQL_INT64: diff --git a/examples/dyn/dynfull.e b/examples/dyn/dynfull.e index 932e482ada..0777bc95f5 100644 --- a/examples/dyn/dynfull.e +++ b/examples/dyn/dynfull.e @@ -21,7 +21,7 @@ * 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" @@ -119,7 +119,7 @@ void process_statement(ARG(XSQLDA * *, sqldap), ARGLIST(XSQLDA **sqldap) ARGLIST(char *query) { - long buffer[MAXLEN]; + int buffer[MAXLEN]; XSQLVAR *var; XSQLDA *sqlda; short num_cols, i; @@ -338,7 +338,7 @@ ARGLIST(XSQLVAR *var) field_width = 6; break; case SQL_LONG: - value = (ISC_INT64) *(long *) var->sqldata; + value = (ISC_INT64) *(int *) var->sqldata; field_width = 11; break; case SQL_INT64: diff --git a/examples/functions.c b/examples/functions.c index b7996d85c6..7fe9949b36 100644 --- a/examples/functions.c +++ b/examples/functions.c @@ -35,18 +35,18 @@ extern char *fn_strcat(); extern char *fn_substr(); extern char *fn_trim(); extern char *fn_trunc(); -extern long fn_doy(); +extern int fn_doy(); extern short *fn_moy(); extern char *fn_dow(); extern char *fn_sysdate(); -extern long fn_add2(); +extern int fn_add2(); extern double fn_mul(); extern double fn_fact(); extern double fn_abs(); extern double fn_max(); extern double fn_sqrt(); -extern long fn_blob_linecount(); -extern long fn_blob_bytecount(); +extern int fn_blob_linecount(); +extern int fn_blob_bytecount(); extern char *fn_blob_substr(); static FN isc_functions [] = { diff --git a/examples/stat/stat10.e b/examples/stat/stat10.e index 315d928e08..1492a62855 100644 --- a/examples/stat/stat10.e +++ b/examples/stat/stat10.e @@ -186,7 +186,7 @@ return (0); */ int count_types (void) { - long cnt; + int cnt; EXEC SQL SELECT COUNT(DISTINCT currency) INTO :cnt FROM country; @@ -205,7 +205,7 @@ return (0); */ int count_records (void) { - long cnt; + int cnt; /* Use the database handle along with the table name. */ EXEC SQL diff --git a/examples/stat/stat11.e b/examples/stat/stat11.e index f8ff71b8d2..f6f6ea057c 100644 --- a/examples/stat/stat11.e +++ b/examples/stat/stat11.e @@ -42,8 +42,8 @@ char Db_name[128]; EXEC SQL SET DATABASE empdb = COMPILETIME "employee.fdb" RUNTIME :Db_name; -long cust_no; -long tot; +int cust_no; +int tot; char ord_stat[8]; EXEC SQL diff --git a/examples/stat/stat4.e b/examples/stat/stat4.e index b56ed96bf5..0853790747 100644 --- a/examples/stat/stat4.e +++ b/examples/stat/stat4.e @@ -43,7 +43,7 @@ EXEC SQL int main (void) { char dept[4]; - long lvl = 1; + int lvl = 1; /* Describe the new table's structure. */ EXEC SQL @@ -102,7 +102,7 @@ return 1; void build_tree (void) { char dept[4]; - long lvl = 1; + int lvl = 1; EXEC SQL WHENEVER SQLERROR GO TO Error2; diff --git a/examples/udf/udflib.c b/examples/udf/udflib.c index 962318f238..ebf6bc3b28 100644 --- a/examples/udf/udflib.c +++ b/examples/udf/udflib.c @@ -44,9 +44,9 @@ typedef struct blob { short (*blob_get_segment) (); void *blob_handle; - long blob_number_segments; - long blob_max_segment; - long blob_total_length; + int blob_number_segments; + int blob_max_segment; + int blob_total_length; void (*blob_put_segment) (); } *BLOB; @@ -60,13 +60,13 @@ char buffer[256]; char buffer2[512]; /* for string concatenation */ char datebuf[12]; /* for date string */ -long r_long; +int r_long; double r_double; float r_float; short r_short; struct tm *tbuf; -long time_sec; +int time_sec; 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. ============================================================== */ -long EXPORT fn_doy() +int EXPORT fn_doy() { char buf[4]; /* for day */ - long i; + int i; time (&time_sec); tbuf = localtime(&time_sec); @@ -290,7 +290,7 @@ char* EXPORT fn_sysdate() 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); } @@ -360,7 +360,7 @@ double* EXPORT fn_sqrt(double* n) 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; 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. ==============================================================*/ -long EXPORT fn_blob_bytecount(BLOB b) +int EXPORT fn_blob_bytecount(BLOB b) { /* Null values */ if (!b->blob_handle) @@ -408,12 +408,12 @@ long EXPORT fn_blob_bytecount(BLOB b) 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; - long i = 0; - long curr_bytecount = 0; - long begin, end; + int i = 0; + int curr_bytecount = 0; + int begin, end; short length, actual_length; 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) return ""; - if (b->blob_total_length < (long)*m) + if (b->blob_total_length < (int)*m) return ""; 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 */ else end = *n; diff --git a/src/burp/backup.epp b/src/burp/backup.epp index 3956f930a7..af804c6241 100644 --- a/src/burp/backup.epp +++ b/src/burp/backup.epp @@ -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" @@ -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); if (cumul_count <= MAX_SLONG) { 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 } else { @@ -1383,7 +1383,7 @@ void put_blob( burp_fld* field, ISC_QUAD * blob_id, ULONG count) break; 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 } } @@ -1489,7 +1489,7 @@ bool put_blr_blob( SCHAR attribute, ISC_QUAD * blob_id) break; 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 return false; } @@ -1668,7 +1668,7 @@ void put_data(burp_rel* relation) break; 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 break; } @@ -1813,7 +1813,7 @@ void put_data(burp_rel* relation) records++; // Verbose records 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_numeric(att_data_length, record_length); @@ -1864,7 +1864,7 @@ void put_data(burp_rel* relation) if (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 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); - 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. put(tdgbl, (UCHAR) (att_end)); @@ -3129,7 +3129,7 @@ void write_generators(void) put(tdgbl, att_end); MISC_terminate (X.RDB$GENERATOR_NAME, temp, l, sizeof(temp)); #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 END_FOR; ON_ERROR diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index 8f8058634a..3a5b0daa99 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -1099,8 +1099,8 @@ int common_main(int argc, // msg 3 Page size specified (%ld) greater than limit (MAX_PAGE_SIZE bytes) } if (temp != tdgbl->gbl_sw_page_size) { - BURP_print(103, (void*)(ULONG) tdgbl->gbl_sw_page_size, - (void*)(SLONG) temp, 0, 0, 0); + BURP_print(103, (void*)(IPTR) tdgbl->gbl_sw_page_size, + (void*)(IPTR) temp, 0, 0, 0); // msg 103 page size specified (%ld bytes) rounded up to %ld bytes tdgbl->gbl_sw_page_size = temp; } diff --git a/src/burp/canonical.cpp b/src/burp/canonical.cpp index 40ede458a7..10d6d2759b 100644 --- a/src/burp/canonical.cpp +++ b/src/burp/canonical.cpp @@ -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" @@ -486,7 +486,7 @@ static bool_t xdr_datum(XDR* xdrs, DSC* desc, UCHAR* buffer) **************************************/ SSHORT n; - UCHAR* p = buffer + (int) desc->dsc_address; + UCHAR* p = buffer + (IPTR) desc->dsc_address; switch (desc->dsc_dtype) { @@ -654,7 +654,7 @@ static bool_t xdr_slice(XDR* xdrs, * Move a slice of an array under * **************************************/ - if (!xdr_long(xdrs, reinterpret_cast(&slice->lstr_length))) + if (!xdr_long(xdrs, reinterpret_cast(&slice->lstr_length))) return FALSE; // Handle operation specific stuff, particularly memory allocation/deallocation diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 43f82ca6ca..096106a258 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -617,7 +617,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr) tdgbl->action->act_file->fil_fd = INVALID_HANDLE_VALUE; BURP_print(272, 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, 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 += @@ -755,7 +755,7 @@ static void bad_attribute(USHORT attribute, USHORT type) TGBL tdgbl = GET_THREAD_DATA; 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 SSHORT l = get(tdgbl); if (l) @@ -910,7 +910,7 @@ static DESC next_volume( DESC handle, int mode, bool full_buffer) } 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); // Starting with volume #vol_count, new_file 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 { - 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); // Starting with volume #vol_count, new_file 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) { - 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); ib_fprintf(term_out, msg); 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) { BURP_msg_get(232, msg, - (void*) (SLONG) (tdgbl->mvol_volume_count), - (void*) (SLONG) temp, 0, 0, 0); + (void*) (IPTR) (tdgbl->mvol_volume_count), + (void*) (IPTR) temp, 0, 0, 0); // Expected volume number %d, found volume %d\n ib_printf(msg); return false; diff --git a/src/burp/restore.epp b/src/burp/restore.epp index d335724258..e4f366110b 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -24,7 +24,7 @@ * 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" @@ -685,7 +685,7 @@ void add_files (const UCHAR* file_name) general_on_error (); END_ERROR; 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 } 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"); } - 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 } @@ -2399,7 +2399,7 @@ rec_type get_data (burp_rel* relation) break; 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); // msg 26 datatype %ld not understood break; @@ -2515,8 +2515,8 @@ rec_type get_data (burp_rel* relation) old_length = recompute_length (relation); if (l != old_length) { - BURP_error(40, true, isc_arg_number, (void*)length, - isc_arg_number, (void*) (ULONG) l, + BURP_error(40, true, isc_arg_number, (void*)(IPTR)length, + isc_arg_number, (void*) (IPTR) l, 0, NULL, 0, NULL, 0, NULL); // msg 40 wrong length record, expected %ld encountered %ld } @@ -2566,7 +2566,7 @@ rec_type get_data (burp_rel* relation) records++; 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) 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]) 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 return record; @@ -4806,7 +4806,7 @@ bool get_relation() break; 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); // msg 43 don't recognize record type %ld break; @@ -6157,7 +6157,7 @@ rec_type ignore_data (burp_rel* relation) 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 return record; @@ -6325,7 +6325,7 @@ bool restore (const TEXT* file_name, 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); // 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(); 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); // msg 51 database format %ld is too old to restore to } @@ -6568,7 +6568,7 @@ bool restore (const TEXT* file_name, break; 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); // msg 43 don't recognize record type %ld break; @@ -6751,7 +6751,7 @@ void store_blr_gen_id (const TEXT* gen_name, // TEXT GDS_NAME[GDS_NAME_LEN] if (!value) { #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 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") - 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 isc_release_request (status_vector, &gen_id_reqh); diff --git a/src/common/config/config_impl.h b/src/common/config/config_impl.h index 6e7dc5d3f7..37a8fdf80e 100644 --- a/src/common/config/config_impl.h +++ b/src/common/config/config_impl.h @@ -50,7 +50,7 @@ class ConfigImpl : public ConfigRoot }; typedef char* ConfigKey; - typedef void* ConfigValue; + typedef IPTR ConfigValue; struct ConfigEntry { diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index 7137acff5f..ece1cb63dc 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -20,7 +20,7 @@ * All Rights Reserved. * 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, * 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) { 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]; 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); } @@ -1232,7 +1232,7 @@ request->append_number(isc_dyn_rel_sql_protection, 1); switch (element->nod_type) { case nod_file_length: - start = (SLONG) (element->nod_arg[0]) + 1; + start = (IPTR) (element->nod_arg[0]) + 1; break; default: @@ -1309,25 +1309,25 @@ request->append_number(isc_dyn_rel_sql_protection, 1); case nod_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); break; case nod_check_point_len: 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); break; case nod_num_log_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); break; case nod_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); break; @@ -1613,11 +1613,11 @@ static void define_dimensions( dsql_req* request, const dsql_fld* field) request->append_number(isc_dyn_def_dimension, position); const dsql_nod* element = *ptr++; 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); element = *ptr; 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_uchar(isc_dyn_end); if (lrange >= hrange) @@ -2009,9 +2009,9 @@ static void define_filter( dsql_req* request) request->append_cstring(isc_dyn_def_filter, ((dsql_str*) (ptr[e_filter_name]))->str_data); 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, - (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, ((dsql_str*) (ptr[e_filter_entry_pt]))->str_data); 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); } - 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_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, - (SSHORT)(SLONG) ((ptr[e_shadow_conditional])->nod_arg[0])); + (SSHORT)(IPTR) ((ptr[e_shadow_conditional])->nod_arg[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_uchar(isc_dyn_end); @@ -2846,7 +2846,7 @@ static void define_shadow(dsql_req* request) ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607, isc_arg_gds, isc_dsql_command_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 0); } @@ -2952,15 +2952,15 @@ static void define_trigger( dsql_req* request, dsql_nod* node) dsql_nod* constant = node->nod_arg[e_trg_active]; if (constant) 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]) 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]) { - request->append_number(isc_dyn_trg_type, (SSHORT)(SLONG) constant->nod_arg[0]); - trig_type = (USHORT)(ULONG) constant->nod_arg[0]; + request->append_number(isc_dyn_trg_type, (SSHORT)(IPTR) constant->nod_arg[0]); + trig_type = (USHORT)(IPTR) constant->nod_arg[0]; } else { 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) { 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) { 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 " - 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 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 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_func_mechanism, (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_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); @@ -3217,7 +3217,7 @@ static void define_udf( dsql_req* request) request->append_number(isc_dyn_def_function_arg, (SSHORT) position); if (param_node[e_udf_param_type]) { - SSHORT arg_mechanism = (SSHORT)(SLONG) (param_node[e_udf_param_type]->nod_arg[0]); + SSHORT arg_mechanism = (SSHORT)(IPTR) (param_node[e_udf_param_type]->nod_arg[0]); request->append_number(isc_dyn_func_mechanism, arg_mechanism); } 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) { 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]; USHORT trig_type; 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); } else @@ -4288,7 +4288,7 @@ static void generate_dyn( dsql_req* request, dsql_nod* node) case nod_del_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); break; @@ -4733,25 +4733,25 @@ request->append_number(isc_dyn_rel_sql_protection, 1); case nod_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); break; case nod_check_point_len: 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); break; case nod_num_log_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); break; case nod_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); break; 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]; /* 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, relation_name->str_data); diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 6998975302..880cd6831d 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -99,8 +99,8 @@ nested FOR loops are added. #endif static void cleanup(void*); -static void cleanup_database(FRBRD**, SLONG); -static void cleanup_transaction(FRBRD*, SLONG); +static void cleanup_database(FRBRD**, void*); +static void cleanup_transaction(FRBRD*, void*); static void close_cursor(dsql_req*); static USHORT convert(SLONG, UCHAR*); static ISC_STATUS error(); @@ -603,7 +603,7 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP( ISC_STATUS_ARRAY local_status; gds__transaction_cleanup(local_status, trans_handle, - cleanup_transaction, 0); + cleanup_transaction, NULL); THREAD_ENTER; } @@ -1055,7 +1055,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status, desc.dsc_scale = 0; desc.dsc_length = sizeof(USHORT); desc.dsc_flags = 0; - desc.dsc_address = (UCHAR *) & direction; + desc.dsc_address = (UCHAR*) & direction; offset_parameter = message->msg_parameters; 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_length = sizeof(SLONG); desc.dsc_flags = 0; - desc.dsc_address = (UCHAR *) & offset; + desc.dsc_address = (UCHAR*) & offset; 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; par* null = parameter->par_null; USHORT* ret_length = - (USHORT *) (dsql_msg_buf + (SLONG) null->par_user_desc.dsc_address); - UCHAR* buffer = dsql_msg_buf + (SLONG) parameter->par_user_desc.dsc_address; + (USHORT *) (dsql_msg_buf + (IPTR) null->par_user_desc.dsc_address); + UCHAR* buffer = dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address; THREAD_EXIT; s = isc_get_segment(tdsql->tsql_status, &request->req_handle, 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; const SCHAR* buffer = reinterpret_cast( - dsql_msg_buf + (SLONG) parameter->par_user_desc.dsc_address); + dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address); THREAD_EXIT; const ISC_STATUS s = 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* p = buffer; - p += sprintf(p, "%.7X ", (unsigned int) node); + p += sprintf(p, "%p ", node); if (column) { USHORT l = column * 3; @@ -2736,7 +2736,7 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_parameter: if (node->nod_column) { trace_line("%sparameter: %d\n", buffer, - (USHORT)(ULONG)node->nod_arg[e_par_parameter]); + (USHORT)(IPTR)node->nod_arg[e_par_parameter]); } else { const par* param = (par*) node->nod_arg[e_par_parameter]; @@ -2834,7 +2834,7 @@ static void cleanup( void *arg) @param flag **/ -static void cleanup_database(FRBRD ** db_handle, SLONG flag) +static void cleanup_database(FRBRD ** db_handle, void* flag) { DBB *dbb_ptr, dbb; @@ -2895,7 +2895,7 @@ static void cleanup_database(FRBRD ** db_handle, SLONG flag) @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; 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) { 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* 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 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) break; if (!desc.dsc_dtype) @@ -4309,8 +4309,7 @@ static void map_in_out( dsql_req* request, par* null = parameter->par_null; if (null != NULL) { - const USHORT null_offset = - (USHORT)(ULONG) (null->par_user_desc.dsc_address); + const USHORT null_offset = (IPTR) null->par_user_desc.dsc_address; length = null_offset + sizeof(SSHORT); if (length > msg_length) 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) MOVD_move(¶meter->par_desc, &desc); else if (!flag || *flag >= 0) @@ -4555,7 +4554,7 @@ static USHORT parse_blr( USHORT align = type_alignments[desc.dsc_dtype]; if (align) offset = FB_ALIGN(offset, align); - desc.dsc_address = (UCHAR *) (ULONG) offset; + desc.dsc_address = (UCHAR*)(IPTR) offset; offset += desc.dsc_length; 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_scale = 0; 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; } } } diff --git a/src/dsql/gen.cpp b/src/dsql/gen.cpp index e854ea3d2e..8f1ee69d1f 100644 --- a/src/dsql/gen.cpp +++ b/src/dsql/gen.cpp @@ -627,8 +627,7 @@ void GEN_port( dsql_req* request, dsql_msg* message) const USHORT align = type_alignments[parameter->par_desc.dsc_dtype]; if (align) message->msg_length = FB_ALIGN(message->msg_length, align); - parameter->par_desc.dsc_address = - (UCHAR *) (SLONG) message->msg_length; + parameter->par_desc.dsc_address = (UCHAR*)(IPTR)message->msg_length; // CVC: No check for overflow here? Should be < 64K message->msg_length += parameter->par_desc.dsc_length; if (request->req_blr_string) @@ -647,8 +646,8 @@ void GEN_port( dsql_req* request, dsql_msg* message) for (parameter = message->msg_parameters; parameter; parameter = parameter->par_next) { - parameter->par_desc.dsc_address = - message->msg_buffer + (SLONG) parameter->par_desc.dsc_address; + parameter->par_desc.dsc_address = message->msg_buffer + + (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) { case nod_sqlcode: stuff(request, blr_sql_code); - stuff_word(request, (USHORT)(ULONG) node->nod_arg[0]); + stuff_word(request, (USHORT)(IPTR) node->nod_arg[0]); return; 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_flags = 0; 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 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]; if (nulls_placement) { - switch ((SLONG)nulls_placement->nod_arg[0]) { + switch ((IPTR)nulls_placement->nod_arg[0]) { case NOD_NULLS_FIRST: stuff(request, blr_nullsfirst); break; diff --git a/src/dsql/make.cpp b/src/dsql/make.cpp index 322b4216b7..843a355ae4 100644 --- a/src/dsql/make.cpp +++ b/src/dsql/make.cpp @@ -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_scale = 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; 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_sub_type = 0; node->nod_desc.dsc_length = sizeof(double); - node->nod_desc.dsc_address = reinterpret_cast(constant->str_data); + node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_ttype = ttype_ascii; node->nod_arg[0] = (dsql_nod*) constant; 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_scale = 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 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_scale = 0; 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 @@ -192,7 +192,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag) tmp.dsc_flags = 0; tmp.dsc_ttype = ttype_ascii; tmp.dsc_length = static_cast(constant->str_length); - tmp.dsc_address = reinterpret_cast(constant->str_data); + tmp.dsc_address = (UCHAR*) constant->str_data; // 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_length = static_cast(constant->str_length); - node->nod_desc.dsc_address = reinterpret_cast(constant->str_data); + node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_ttype = ttype_dynamic; // carry a pointer to the constant to resolve character set in pass1 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_scale = 0; node->nod_desc.dsc_length = static_cast(constant->str_length); - node->nod_desc.dsc_address = reinterpret_cast(constant->str_data); + node->nod_desc.dsc_address = (UCHAR*) constant->str_data; node->nod_desc.dsc_ttype = character_set; // carry a pointer to the constant to resolve character set in pass1 node->nod_arg[0] = (dsql_nod*) constant; diff --git a/src/dsql/metd.epp b/src/dsql/metd.epp index 43faf68d48..0ac571aaa2 100644 --- a/src/dsql/metd.epp +++ b/src/dsql/metd.epp @@ -1027,7 +1027,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) if (d->dsc_dtype == dtype_varying) { d->dsc_length += sizeof (USHORT); } - d->dsc_address = 0; + d->dsc_address = NULL; if (!X.RDB$CHARACTER_SET_ID.NULL) { if (d->dsc_dtype != dtype_blob) { diff --git a/src/dsql/parse.y b/src/dsql/parse.y index e24279cef6..51b8f428dc 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -555,7 +555,7 @@ statement : alter | set | update | KW_DEBUG signed_short_integer - { prepare_console_debug ((int) $2, &yydebug); + { prepare_console_debug ((IPTR) $2, &yydebug); $$ = make_node (nod_null, (int) 0, NULL); } ; @@ -757,7 +757,7 @@ udf_data_type : simple_type | CSTRING '(' pos_short_integer ')' charset_clause { 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 : @@ -1125,7 +1125,7 @@ db_cache : CACHE sql_string cache_length yyabandon (-260, isc_cache_redef); */ /* Cache redefined */ /* 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.cache_defined = TRUE; $$ = (dsql_nod*) make_node (nod_cache_file_desc, (int) 1, @@ -1163,7 +1163,7 @@ logfile_attrs : ; 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 { lex.g_file->fil_partitions = (SSHORT) $3; @@ -1183,9 +1183,9 @@ file_desc : file_clause ; 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 - { lex.g_file->fil_length = (SLONG) $3;} + { lex.g_file->fil_length = (IPTR) $3;} ; file_clause_noise : @@ -1977,35 +1977,35 @@ trigger_type_prefix : BEFORE ; 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 - { $$ = 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 @@ -2312,7 +2312,7 @@ array_spec : array_range ; array_range : signed_long_integer - { if ((SLONG) $1 < 1) + { if ((IPTR) $1 < 1) $$ = make_node (nod_list, (int) 2, 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 ')' { 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; } | BLOB '(' unsigned_short_integer ',' signed_short_integer ')' { lex.g_field->fld_dtype = dtype_blob; - lex.g_field->fld_seg_length = (USHORT)(ULONG) $3; - lex.g_field->fld_sub_type = (USHORT)(ULONG) $5; + lex.g_field->fld_seg_length = (USHORT)(IPTR) $3; + lex.g_field->fld_sub_type = (USHORT)(IPTR) $5; } | BLOB '(' ',' signed_short_integer ')' { lex.g_field->fld_dtype = dtype_blob; lex.g_field->fld_seg_length = 80; - lex.g_field->fld_sub_type = (USHORT)(ULONG) $4; + lex.g_field->fld_sub_type = (USHORT)(IPTR) $4; } ; 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 { - lex.g_field->fld_sub_type = (USHORT)(ULONG) $2; + lex.g_field->fld_sub_type = (USHORT)(IPTR) $2; } | 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 ')' { 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; } | national_character_keyword @@ -2485,7 +2485,7 @@ national_character_type : national_character_keyword '(' pos_short_integer ')' | national_character_keyword VARYING '(' pos_short_integer ')' { 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; } ; @@ -2493,7 +2493,7 @@ national_character_type : national_character_keyword '(' pos_short_integer ')' character_type : character_keyword '(' pos_short_integer ')' { 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 { @@ -2503,7 +2503,7 @@ character_type : character_keyword '(' pos_short_integer ')' | varying_keyword '(' pos_short_integer ')' { 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 ')' { - if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) ) + if ( ((IPTR) $2 < 1) || ((IPTR) $2 > 18) ) yyabandon (-842, isc_precision_err); /* Precision most be between 1 and 18. */ - if ((SLONG) $2 > 9) + if ((IPTR) $2 > 9) { if ( ( (client_dialect <= SQL_DIALECT_V5) && (db_dialect > SQL_DIALECT_V5) ) || @@ -2588,7 +2588,7 @@ prec_scale : } } else - if ((SLONG) $2 < 5) + if ((IPTR) $2 < 5) { lex.g_field->fld_dtype = dtype_short; lex.g_field->fld_length = sizeof (SSHORT); @@ -2598,17 +2598,17 @@ prec_scale : lex.g_field->fld_dtype = dtype_long; 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 ')' { - if ( ((SLONG) $2 < 1) || ((SLONG) $2 > 18) ) + if ( ((IPTR) $2 < 1) || ((IPTR) $2 > 18) ) yyabandon (-842, isc_precision_err); /* 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); /* Scale must be between 0 and precision */ - if ((SLONG) $2 > 9) + if ((IPTR) $2 > 9) { if ( ( (client_dialect <= SQL_DIALECT_V5) && (db_dialect > SQL_DIALECT_V5) ) || @@ -2646,7 +2646,7 @@ prec_scale : } else { - if ((SLONG) $2 < 5) + if ((IPTR) $2 < 5) { lex.g_field->fld_dtype = dtype_short; lex.g_field->fld_length = sizeof (SSHORT); @@ -2657,8 +2657,8 @@ prec_scale : lex.g_field->fld_length = sizeof (SLONG); } } - lex.g_field->fld_precision = (USHORT)(ULONG) $2; - lex.g_field->fld_scale = - (SSHORT)(SLONG) $4; + lex.g_field->fld_precision = (USHORT)(IPTR) $2; + lex.g_field->fld_scale = - (SSHORT)(IPTR) $4; } ; @@ -2672,7 +2672,7 @@ decimal_keyword : DECIMAL 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_length = sizeof (double); @@ -2875,7 +2875,7 @@ restr_option : table_list table_lock ; 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; } ; @@ -3851,32 +3851,32 @@ sql_string : STRING /* string in current charset */ signed_short_integer : nonneg_short_integer | '-' neg_short_integer - { $$ = (dsql_nod*) - (SLONG) $2; } + { $$ = (dsql_nod*) - (IPTR) $2; } ; nonneg_short_integer : NUMBER - { if ((SLONG) $1 > SHRT_POS_MAX) + { if ((IPTR) $1 > SHRT_POS_MAX) yyabandon (-842, isc_expec_short); /* Short integer expected */ $$ = $1;} ; neg_short_integer : NUMBER - { if ((SLONG) $1 > SHRT_NEG_MAX) + { if ((IPTR) $1 > SHRT_NEG_MAX) yyabandon (-842, isc_expec_short); /* Short integer expected */ $$ = $1;} ; pos_short_integer : nonneg_short_integer - { if ((SLONG) $1 == 0) + { if ((IPTR) $1 == 0) yyabandon (-842, isc_expec_positive); /* Positive number expected */ $$ = $1;} ; unsigned_short_integer : NUMBER - { if ((SLONG) $1 > SHRT_UNSIGNED_MAX) + { if ((IPTR) $1 > SHRT_UNSIGNED_MAX) yyabandon (-842, isc_expec_ushort); /* Unsigned short integer expected */ $$ = $1;} @@ -3884,7 +3884,7 @@ unsigned_short_integer : NUMBER signed_long_integer : long_integer | '-' long_integer - { $$ = (dsql_nod*) - (SLONG) $2; } + { $$ = (dsql_nod*) - (IPTR) $2; } ; long_integer : NUMBER @@ -4409,7 +4409,7 @@ static dsql_nod* make_parameter (void) node->nod_line = (USHORT) lex.lines_bk; node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 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; } @@ -4964,7 +4964,7 @@ int LexerState::yylex ( if (!have_decimal && (number <= MAX_SLONG)) { - yylval = (dsql_nod*) (ULONG) number; + yylval = (dsql_nod*) (IPTR) number; return NUMBER; } else diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 66d9c070a1..1a5b09e68c 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -693,7 +693,7 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag) true, true, // Pass 0 here to restore older parameter // ordering behavior unconditionally. - (USHORT)(ULONG) input->nod_arg[0]); + (USHORT)(IPTR) input->nod_arg[0]); return node; 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); 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_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; 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); 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_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; 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)) { - const ULONG position = (ULONG) (sub->nod_arg[0]); + const ULONG position = (IPTR) (sub->nod_arg[0]); if ((position < 1) || !select_list || (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); 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_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; 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); 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_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; return derived_field; } @@ -4851,7 +4851,7 @@ static dsql_nod* pass1_make_derived_field(dsql_req* request, TSQL tdsql, dsql_no // with orginal map. 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_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; 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) { - const ULONG position = (ULONG) (node1->nod_arg[0]); + const ULONG position = (IPTR) (node1->nod_arg[0]); if ((position < 1) || !s_list || (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. 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) { ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104, isc_arg_gds, isc_dsql_command_err, diff --git a/src/dsql/user_dsql.cpp b/src/dsql/user_dsql.cpp index e7ca5aed68..a2cafccd69 100644 --- a/src/dsql/user_dsql.cpp +++ b/src/dsql/user_dsql.cpp @@ -88,7 +88,7 @@ struct dsql_name static void cleanup(void*); -static void cleanup_database(FRBRD**, SLONG); +static void cleanup_database(FRBRD**, void*); static ISC_STATUS error(); static void error_post(ISC_STATUS, ...); 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 // -static void cleanup_database(FRBRD** db_handle, SLONG dummy) +static void cleanup_database(FRBRD** db_handle, void* dummy) { if (!db_handle || !databases) { return; diff --git a/src/dudley/expr.cpp b/src/dudley/expr.cpp index 1f302152fd..0826d46f22 100644 --- a/src/dudley/expr.cpp +++ b/src/dudley/expr.cpp @@ -363,7 +363,7 @@ static CON make_numeric_constant( TEXT * string, USHORT length) constant->con_desc.dsc_dtype = dtype_long; constant->con_desc.dsc_length = sizeof(SLONG); number = (SLONG *) constant->con_data; - constant->con_desc.dsc_address = (UCHAR *) number; + constant->con_desc.dsc_address = (UCHAR*) (IPTR) number; scale = 0; do { @@ -673,7 +673,7 @@ static CON parse_literal(void) constant->con_desc.dsc_dtype = dtype_text; constant->con_desc.dsc_ttype = ttype_ascii; 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) do *p++ = *q++; diff --git a/src/gpre/c_cxx.cpp b/src/gpre/c_cxx.cpp index 77ea2ab434..1fdeb0d254 100644 --- a/src/gpre/c_cxx.cpp +++ b/src/gpre/c_cxx.cpp @@ -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" @@ -140,8 +140,8 @@ static TEXT* global_status_name; const int INDENT = 3; static const char* const NULL_STRING = "(char *)0"; -static const char* const NULL_STATUS = "(long*) 0L"; -static const char* const NULL_SQLDA = "(XSQLDA*) 0L"; +static const char* const NULL_STATUS = "NULL"; +static const char* const NULL_SQLDA = "NULL"; #ifdef VMS static const char* const GDS_INCLUDE = "\"interbase:[syslib]ibase.h\""; @@ -151,7 +151,7 @@ static const char* const GDS_INCLUDE = ""; static const char* const GDS_INCLUDE = ""; #endif -static const char* const DCL_LONG = "long"; +static const char* const DCL_LONG = "int"; static const char* const DCL_QUAD = "ISC_QUAD"; 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]; 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, 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_vector1 = status_vector(action); - args.pat_value1 = (int) init->nod_arg[2]; + args.pat_value1 = (IPTR) init->nod_arg[2]; args.pat_value2 = (int) event_list->nod_count; // generate call to dynamically generate event blocks @@ -2081,7 +2081,7 @@ static void gen_event_wait( const act* action, int column) GPRE_NOD event_init = (GPRE_NOD) event_action->act_object; SYM stack_name = (SYM) event_init->nod_arg[0]; if (!strcmp(event_name->sym_string, stack_name->sym_string)) { - ident = (int) event_init->nod_arg[2]; + ident = (IPTR) event_init->nod_arg[2]; database = (DBB) event_init->nod_arg[3]; } } @@ -3461,7 +3461,7 @@ static void gen_trans( 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); } diff --git a/src/gpre/cmd.cpp b/src/gpre/cmd.cpp index 704a44cc7d..01c6dcbef4 100644 --- a/src/gpre/cmd.cpp +++ b/src/gpre/cmd.cpp @@ -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" @@ -215,7 +215,7 @@ int CMD_compile_ddl(GPRE_REQ request) case ACT_drop_shadow: put_numeric(request, isc_dyn_delete_shadow, - (SSHORT) (SLONG) action->act_object); + (SSHORT) (IPTR) action->act_object); STUFF_END; break; diff --git a/src/gpre/cme.cpp b/src/gpre/cme.cpp index e5a2b44618..88d5267e5a 100644 --- a/src/gpre/cme.cpp +++ b/src/gpre/cme.cpp @@ -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" @@ -253,7 +253,7 @@ void CME_expr(GPRE_NOD node, GPRE_REQ request) // ** Begin date/time/timestamp support * case nod_extract: STUFF(blr_extract); - switch ((KWWORDS) (int) node->nod_arg[0]) + switch ((KWWORDS) (IPTR) node->nod_arg[0]) { case KW_YEAR: STUFF(blr_extract_year); @@ -480,7 +480,7 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f) // ** Begin date/time/timestamp support * case nod_extract: { - KWWORDS kw_word = (KWWORDS) (int) node->nod_arg[0]; + KWWORDS kw_word = (KWWORDS) (IPTR) node->nod_arg[0]; CME_get_dtype(node->nod_arg[1], f); switch (f->fld_dtype) { @@ -1514,7 +1514,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request) from.dsc_flags = 0; from.dsc_dtype = dtype_text; from.dsc_length = length; - from.dsc_address = (UCHAR *) buffer; + from.dsc_address = (UCHAR*) buffer; dsc to; to.dsc_sub_type = 0; to.dsc_flags = 0; @@ -1524,7 +1524,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request) STUFF(blr_sql_date); to.dsc_dtype = dtype_sql_date; to.dsc_length = sizeof(ISC_DATE); - to.dsc_address = (UCHAR *) & dt; + to.dsc_address = (UCHAR*) & dt; MOVG_move(&from, &to); STUFF_WORD(dt); STUFF_WORD(dt >> 16); @@ -1536,7 +1536,7 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request) STUFF(blr_timestamp); to.dsc_dtype = dtype_timestamp; to.dsc_length = sizeof(ISC_TIMESTAMP); - to.dsc_address = (UCHAR *) & ts; + to.dsc_address = (UCHAR*) & ts; MOVG_move(&from, &to); STUFF_WORD(ts.timestamp_date); 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); to.dsc_dtype = dtype_sql_time; to.dsc_length = sizeof(ISC_DATE); - to.dsc_address = (UCHAR *) & itim; + to.dsc_address = (UCHAR*) & itim; MOVG_move(&from, &to); STUFF_WORD(itim); STUFF_WORD(itim >> 16); diff --git a/src/gpre/exp.cpp b/src/gpre/exp.cpp index 4aa987f9ed..92faa0cbae 100644 --- a/src/gpre/exp.cpp +++ b/src/gpre/exp.cpp @@ -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" @@ -778,7 +778,7 @@ GPRE_RSE EXP_rse(GPRE_REQ request, SYM initial_symbol) upcase->nod_arg[0] = item; } count++; - MSC_push((GPRE_NOD) (ULONG) ((direction) ? 1 : 0), &directions); + MSC_push((GPRE_NOD) (IPTR) ((direction) ? 1 : 0), &directions); if (insensitive) MSC_push(upcase, &items); else diff --git a/src/gpre/gpre.cpp b/src/gpre/gpre.cpp index de6d43f1a8..24de1732c7 100644 --- a/src/gpre/gpre.cpp +++ b/src/gpre/gpre.cpp @@ -20,7 +20,7 @@ // // All Rights Reserved. // 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 // Added new switch -verbose to gpre that will dump // parsed lines to stderr @@ -619,7 +619,7 @@ int main(int argc, char* argv[]) case IN_SW_GPRE_G: sw_language = lang_internal; - gen_routine = INT_action; + gen_routine = INT_CXX_action; sw_cstring = false; transaction_name = "dbb->dbb_sys_trans"; sw_know_interp = TRUE; diff --git a/src/gpre/int.cpp b/src/gpre/int.cpp deleted file mode 100644 index 34dbcee8b3..0000000000 --- a/src/gpre/int.cpp +++ /dev/null @@ -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 -#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); -} - diff --git a/src/gpre/int_cxx.cpp b/src/gpre/int_cxx.cpp index 92f9d68943..67f7caf2ac 100644 --- a/src/gpre/int_cxx.cpp +++ b/src/gpre/int_cxx.cpp @@ -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" @@ -693,10 +693,14 @@ static void make_port( POR port, int column) break; case dtype_quad: - case dtype_blob: ib_fprintf(out_file, " ISC_QUAD jrd_%d;\t// %s ", reference->ref_ident, name); break; + + case dtype_blob: + ib_fprintf(out_file, " bid jrd_%d;\t// %s ", + reference->ref_ident, name); + break; case dtype_cstring: case dtype_text: diff --git a/src/gpre/par.cpp b/src/gpre/par.cpp index e36c153392..493bec5747 100644 --- a/src/gpre/par.cpp +++ b/src/gpre/par.cpp @@ -20,7 +20,7 @@ // // All Rights Reserved. // 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 // Fixed bugs in gpre to handle PYXIS forms // and allow edit.e and fred.e to go through @@ -3077,7 +3077,7 @@ static ACT par_type() PAR_get_token(); action = MSC_action(0, ACT_type_number); - action->act_object = (REF) (ULONG) type; + action->act_object = (REF) (IPTR) type; return action; } diff --git a/src/gpre/sqe.cpp b/src/gpre/sqe.cpp index 2eabd1892f..0760d19599 100644 --- a/src/gpre/sqe.cpp +++ b/src/gpre/sqe.cpp @@ -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 @@ -2197,7 +2197,7 @@ static void par_order(GPRE_REQ request, else if (MSC_match(KW_DESCENDING)) direction = TRUE; count++; - MSC_push((GPRE_NOD) direction, &directions); + MSC_push((GPRE_NOD)(IPTR)direction, &directions); MSC_push(sort, &items); if (!MSC_match(KW_COMMA)) break; diff --git a/src/gpre/sql.cpp b/src/gpre/sql.cpp index 5a1fc38029..7e83037feb 100644 --- a/src/gpre/sql.cpp +++ b/src/gpre/sql.cpp @@ -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" @@ -2851,7 +2851,7 @@ static ACT act_drop(void) SLONG num = EXP_USHORT_ordinal(true); if (!range_positive_short_integer(num)) PAR_error("Shadow number out of range"); - action->act_object = (REF) num; + action->act_object = (REF)(IPTR)num; } return action; diff --git a/src/isql/extract.epp b/src/isql/extract.epp index ecc2ad4c90..798c58487d 100644 --- a/src/isql/extract.epp +++ b/src/isql/extract.epp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * In get_procedure_args change comment style from // to c style * @@ -1197,7 +1197,7 @@ static void list_all_procs() END_FOR 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); STDERROUT(msg, 1); /* Statement failed, SQLCODE = %d\n\n */ ISQL_errmsg(gds_status); diff --git a/src/isql/isql.epp b/src/isql/isql.epp index a8ce64bffe..f2d3acd8a0 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -881,7 +881,7 @@ void ISQL_errmsg(const ISC_STATUS* status) return; } 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; STDERROUT(errbuf, 1); gds_interprete_cpp(errbuf, &vec); @@ -6028,8 +6028,8 @@ static processing_state print_item_blob(IB_FILE* fp, return CONT; if ((var->sqlsubtype != Doblob) && (Doblob != ALL_BLOBS)) { - ISQL_msg_get(BLOB_SUBTYPE, msg, (TEXT*) (SLONG) Doblob, - (TEXT*) (SLONG) var->sqlsubtype, NULL, NULL, NULL); + ISQL_msg_get(BLOB_SUBTYPE, msg, (TEXT*) (IPTR) Doblob, + (TEXT*) (IPTR) var->sqlsubtype, NULL, NULL, NULL); /* Blob display set to subtype %d. This blob: subtype = %d\n */ ISQL_printf(fp, msg); if (buffer) diff --git a/src/isql/show.epp b/src/isql/show.epp index 0f80d32b2d..e944f71ee2 100644 --- a/src/isql/show.epp +++ b/src/isql/show.epp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * Change in show.e to use CHARACTER_LENGTH instead of FIELD_LENGTH in * SHOW PROCEDURE @@ -349,7 +349,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_db_size_in_pages: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -361,7 +361,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_sweep_interval: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -397,7 +397,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_num_wal_buffers: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -409,7 +409,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_wal_buffer_size: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -420,7 +420,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_wal_ckpt_length: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -432,7 +432,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_wal_cur_ckpt_interval: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -444,7 +444,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_wal_grpc_wait_usecs: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -456,7 +456,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_base_level: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } @@ -467,7 +467,7 @@ bool SHOW_dbb_parameters(FRBRD* db_handle, case isc_info_limbo: value_out = isc_vax_integer(d, length); 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); sprintf(info, msg); } diff --git a/src/jrd/alt.cpp b/src/jrd/alt.cpp index 5be8e0effb..9cdc1b6a8b 100644 --- a/src/jrd/alt.cpp +++ b/src/jrd/alt.cpp @@ -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, FRBRD **db_handle, - DatabaseCleanupRoutine *routine, SLONG arg) + DatabaseCleanupRoutine *routine, void* arg) { 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, diff --git a/src/jrd/blb.cpp b/src/jrd/blb.cpp index ca052b1c15..3c7c450fe1 100644 --- a/src/jrd/blb.cpp +++ b/src/jrd/blb.cpp @@ -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" @@ -241,7 +241,7 @@ BLB BLB_create2(TDBB tdbb, if (BLF_create_blob(tdbb, transaction, &blob->blb_filter, - reinterpret_cast(blob_id), + (SLONG*)blob_id, bpb_length, bpb, // CVC: This cast is very suspicious to me. @@ -268,7 +268,7 @@ BLB BLB_create2(TDBB tdbb, /* 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; 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; bid* source = (bid*) from_desc->dsc_address; bid* destination = (bid*) to_desc->dsc_address; - const USHORT id = (USHORT) (ULONG) field->nod_arg[e_fld_id]; - RPB* rpb = &request->req_rpb[(int) field->nod_arg[e_fld_stream]]; + const USHORT id = (USHORT) (IPTR) field->nod_arg[e_fld_id]; + RPB* rpb = &request->req_rpb[(IPTR)field->nod_arg[e_fld_stream]]; jrd_rel* relation = rpb->rpb_relation; 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 zeros, then the blob is null. */ - if ((request->req_flags & req_null) || (!source->bid_relation_id && - !source->bid_stuff.bid_blob)) + if ((request->req_flags & req_null) || source->isEmpty()) { SET_NULL(record, id); destination->bid_relation_id = 0; @@ -912,7 +911,7 @@ void BLB_move(TDBB tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field) } else { 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; break; @@ -1117,7 +1116,7 @@ BLB BLB_open2(TDBB tdbb, for (new_blob = transaction->tra_blobs; new_blob; 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; } } @@ -1143,7 +1142,7 @@ BLB BLB_open2(TDBB tdbb, (UCHAR *) ((BLP) new_blob->blb_data)->blp_data; } return blob; - } + } /* Ordinarily, we would call MET_relation to get the relation id. 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; } } - else if (blob_id->bid_stuff.bid_blob) + else if (blob_id->bid_stuff.bid_temp_id) { array = find_array(transaction, blob_id); if (!array) { @@ -1476,7 +1475,7 @@ void BLB_put_slice( TDBB tdbb, 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; } @@ -1621,6 +1620,7 @@ static ARR alloc_array(jrd_tra* transaction, ADS proto_desc) ,__FILE__, __LINE__ #endif ); + array->arr_temp_id = transaction->tra_next_blob_id++; return array; } @@ -1659,6 +1659,7 @@ static BLB allocate_blob(TDBB tdbb, jrd_tra* transaction) sizeof(blh); blob->blb_max_pages = blob->blb_clump_size >> SHIFTLONG; blob->blb_pointers = (dbb->dbb_page_size - BLP_SIZE) >> SHIFTLONG; + blob->blb_temp_id = transaction->tra_next_blob_id++; return blob; } @@ -1784,8 +1785,11 @@ static void check_BID_validity(const blb* blob, TDBB tdbb) **************************************/ if (!blob || - MemoryPool::blk_type(blob) != type_blb || - blob->blb_attachment != tdbb->tdbb_attachment || + // Nickolay Samofatov. This checks are now unnecessary since we + // 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)) { 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 (!blob_id->bid_stuff.bid_number && !blob_id->bid_relation_id) + if (blob_id->isEmpty()) return; 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; 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; } } @@ -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) { - 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; } } diff --git a/src/jrd/blb.h b/src/jrd/blb.h index 6cf92a07f7..3d7f1bd2e8 100644 --- a/src/jrd/blb.h +++ b/src/jrd/blb.h @@ -34,13 +34,14 @@ word contains the relation id of the blob and the second the record number of the first segment-clump. The two types of blobs can be reliably distinguished by a zero or non-zero relation id. */ - + typedef struct bid { ULONG bid_relation_id; /* Relation id (or null) */ union { - class blb *bid_blob; /* Pointer to blob block */ - ULONG bid_number; /* Record number */ + ULONG bid_temp_id; /* Temporary ID of blob or array. Used for newly created objects (bid_relation_id==0) */ + ULONG bid_number; /* Record number */ } bid_stuff; + bool isEmpty() const { return bid_relation_id == 0 && bid_stuff.bid_number == 0; } } *BID; /* Your basic blob block. */ @@ -74,6 +75,7 @@ class blb : public pool_alloc_rpt ULONG blb_length; /* Total length of data sans segments */ ULONG blb_lead_page; /* First page number */ ULONG blb_seek; /* Seek location */ + ULONG blb_temp_id; // ID of newly created blob in transaction /* blb_data must be longword aligned */ UCHAR blb_data[1]; /* A page's worth of blob */ }; diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 259cd3c97b..1a624fb0e9 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -4576,8 +4576,8 @@ static SSHORT lock_buffer( error, and log it to firebird.log. */ gds__msg_format(0, JRD_BUGCHK, 215, sizeof(errmsg), errmsg, - (TEXT *) bdb->bdb_page, - (TEXT *) (SLONG) page_type, 0, 0, 0); + (TEXT *) (IPTR) bdb->bdb_page, + (TEXT *) (IPTR) page_type, 0, 0, 0); IBERR_append_status(status, isc_random, isc_arg_string, ERR_cstring(errmsg), 0); 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. */ gds__msg_format(0, JRD_BUGCHK, 216, sizeof(errmsg), errmsg, - (TEXT*) bdb->bdb_page, - (TEXT*) (SLONG) page_type, 0, 0, 0); + (TEXT*) (IPTR) bdb->bdb_page, + (TEXT*) (IPTR) page_type, 0, 0, 0); IBERR_append_status(status, isc_random, isc_arg_string, ERR_cstring(errmsg), 0); ERR_log(JRD_BUGCHK, 216, errmsg); /* msg 216 page %ld, page type %ld lock denied */ diff --git a/src/jrd/cmp.cpp b/src/jrd/cmp.cpp index 12d96085ee..7dd480d09f 100644 --- a/src/jrd/cmp.cpp +++ b/src/jrd/cmp.cpp @@ -756,9 +756,9 @@ void CMP_get_desc(TDBB tdbb, Csb* csb, jrd_nod* node, DSC * desc) 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 = - 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) { desc->dsc_dtype = dtype_unknown; 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_rel* relation = - csb->csb_rpt[(USHORT)(ULONG) sub-> + csb->csb_rpt[(USHORT)(IPTR) sub-> 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 arr* 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; case nod_extract: - if ((ULONG) node->nod_arg[e_extract_part] == blr_extract_second) { + if ((IPTR) node->nod_arg[e_extract_part] == blr_extract_second) { // QUADDATE - SECOND returns a float, or scaled! desc->dsc_dtype = dtype_long; desc->dsc_length = sizeof(ULONG); @@ -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 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; } @@ -2534,14 +2534,14 @@ static jrd_nod* copy(TDBB tdbb, --field_id; } 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) { jrd_rel* relation = csb->csb_rpt[stream].csb_relation; jrd_fld* field = MET_get_field(relation, field_id); 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) stream = remap[stream]; @@ -2652,7 +2652,7 @@ static jrd_nod* copy(TDBB tdbb, node->nod_type = input->nod_type; 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. // 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; new_stream = csb->csb_n_stream++; 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; 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, 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++; 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; node->nod_arg[e_prc_procedure] = input->nod_arg[e_prc_procedure]; csb_repeat* element = CMP_csb_element(csb, new_stream); // SKIDDER: Maybe we need to check if we really found a procedure? element->csb_procedure = MET_lookup_procedure_id(tdbb, - (SSHORT)(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[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->nod_type = input->nod_type; 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); new_stream = csb->csb_n_stream++; 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); remap[stream] = (UCHAR) 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->nod_type = input->nod_type; 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); new_stream = csb->csb_n_stream++; 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; 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); node->nod_count = 0; node->nod_type = type; - node->nod_arg[0] = (jrd_nod*) (SLONG) stream; + node->nod_arg[0] = (jrd_nod*) (IPTR) stream; 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;) { jrd_nod* node = *ptr++; 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; const csb_repeat* tail = &csb->csb_rpt[stream]; const jrd_rel* relation = tail->csb_relation; @@ -3176,7 +3176,7 @@ static jrd_nod* pass1(TDBB tdbb, jrd_fld* field; 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 // 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) || !(field = MET_get_field(relation, - (USHORT)(ULONG) node->nod_arg[e_fld_id]))) + (USHORT)(IPTR) node->nod_arg[e_fld_id]))) { break; } @@ -3312,9 +3312,9 @@ static jrd_nod* pass1(TDBB tdbb, { sub = node->nod_arg[e_asgn_from]; 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, - (USHORT)(ULONG) sub->nod_arg[e_fld_id]); + (USHORT)(IPTR) sub->nod_arg[e_fld_id]); if (field) 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]; if (sub->nod_type != nod_field) break; - stream = (USHORT)(ULONG) sub->nod_arg[e_fld_stream]; + stream = (USHORT)(IPTR) sub->nod_arg[e_fld_stream]; tail = &csb->csb_rpt[stream]; 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) { break; } @@ -3337,13 +3337,13 @@ static jrd_nod* pass1(TDBB tdbb, break; 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_flags |= csb_modify; pass1_modify(tdbb, csb, node); // fb_assert(node->nod_arg [e_mod_new_stream] <= MAX_USHORT); if ( (node->nod_arg[e_mod_validate] = make_validation(tdbb, csb, - (USHORT)(ULONG) node-> + (USHORT)(IPTR) node-> nod_arg[e_mod_new_stream])) ) { node->nod_count = @@ -3352,7 +3352,7 @@ static jrd_nod* pass1(TDBB tdbb, break; 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_flags |= csb_erase; pass1_erase(tdbb, csb, node); @@ -3367,12 +3367,12 @@ static jrd_nod* pass1(TDBB tdbb, case nod_store: 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_flags |= csb_store; sub = pass1_store(tdbb, csb, node); 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]) && (node->nod_arg[e_sto_validate] = make_validation(tdbb, csb, stream))) @@ -3402,7 +3402,7 @@ static jrd_nod* pass1(TDBB tdbb, case nod_aggregate: 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; ignore_dbkey(tdbb, csb, (RSE) node->nod_arg[e_agg_rse], view); node->nod_arg[e_agg_rse] = @@ -3427,7 +3427,7 @@ static jrd_nod* pass1(TDBB tdbb, case nod_dbkey: { 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) return node; @@ -3443,7 +3443,7 @@ static jrd_nod* pass1(TDBB tdbb, node->nod_count = 0; node->nod_type = type; node->nod_flags |= nod_agg_dbkey; - node->nod_arg[0] = (jrd_nod*) (SLONG) stream; + node->nod_arg[0] = (jrd_nod*) (IPTR) stream; return node; } @@ -3466,7 +3466,7 @@ static jrd_nod* pass1(TDBB tdbb, break; 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; 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 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; csb_repeat* tail = &csb->csb_rpt[stream]; 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) { 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; } @@ -3595,8 +3595,8 @@ static void pass1_erase(TDBB tdbb, Csb* csb, jrd_nod* node) parent = relation; parent_stream = stream; - new_stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; - node->nod_arg[e_erase_stream] = (jrd_nod*) (SLONG) map[new_stream]; + new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_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); if (field->fld_source) { new_id = - (USHORT)(ULONG) (field->fld_source)->nod_arg[e_fld_id]; + (USHORT)(IPTR) (field->fld_source)->nod_arg[e_fld_id]; } else { 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 for (;;) { - USHORT stream = (USHORT)(ULONG) node->nod_arg[e_mod_org_stream]; - USHORT new_stream = (USHORT)(ULONG) node->nod_arg[e_mod_new_stream]; + USHORT stream = (USHORT)(IPTR) node->nod_arg[e_mod_org_stream]; + USHORT new_stream = (USHORT)(IPTR) node->nod_arg[e_mod_new_stream]; csb_repeat* tail = &csb->csb_rpt[new_stream]; tail->csb_flags |= csb_modify; 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 = MAX(node->nod_count, (USHORT) e_mod_map_view + 1); 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]; const USHORT view_stream = new_stream; @@ -3746,17 +3746,17 @@ static void pass1_modify(TDBB tdbb, Csb* csb, jrd_nod* node) map = 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); 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); - 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] = source->nod_arg[e_rel_stream]; view_node->nod_arg[e_mod_map_view] = NULL; node->nod_arg[e_mod_sub_mod] = view_node; - new_stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; + new_stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream]; view_node->nod_arg[e_mod_statement] = pass1_expand_view(tdbb, csb, view_stream, new_stream, true); node->nod_count = @@ -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. UCHAR* map = csb->csb_rpt[stream].csb_map; - stream = (USHORT)(ULONG) source->nod_arg[e_rel_stream]; - node->nod_arg[e_mod_org_stream] = (jrd_nod*) (SLONG) map[stream]; + stream = (USHORT)(IPTR) source->nod_arg[e_rel_stream]; + node->nod_arg[e_mod_org_stream] = (jrd_nod*) (IPTR) map[stream]; // next, do update stream map = 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); 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) { pass1(tdbb, csb, source, parent_view, view_stream, false); 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); CMP_post_resource(tdbb, &csb->csb_resources, (BLK) procedure, rsc_procedure, procedure->prc_id); @@ -4056,7 +4056,7 @@ static void pass1_source(TDBB tdbb, view->rel_id); 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); element->csb_view = parent_view; fb_assert(view_stream <= MAX_STREAMS); @@ -4069,7 +4069,7 @@ static void pass1_source(TDBB tdbb, vcx_ptr = &(*vcx_ptr)->vcx_next) { 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; break; @@ -4215,7 +4215,7 @@ static jrd_nod* pass1_store(TDBB tdbb, Csb* csb, jrd_nod* node) for (;;) { 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]; tail->csb_flags |= csb_store; 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] = copy(tdbb, csb, source, map, 0, NULL, false); 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] = pass1_expand_view(tdbb, csb, stream, new_stream, true); 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 // active. So that the optimizer can use indices for // 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; - 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; } @@ -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) { // 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; - 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; } @@ -4742,7 +4742,7 @@ static jrd_nod* pass2(TDBB tdbb, Csb* csb, jrd_nod* const node, jrd_nod* parent) 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; const fmt* format = CMP_format(tdbb, csb, stream); 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; 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; break; 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 - 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); if (node->nod_flags & nod_value) { 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(tdbb, csb, node->nod_arg[e_agg_map], 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); process_map(tdbb, csb, node->nod_arg[e_agg_map], &csb->csb_rpt[stream].csb_format); @@ -4969,7 +4969,7 @@ static void pass2_rse(TDBB tdbb, Csb* csb, RSE rse) { jrd_nod* node = *ptr; 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; 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); } 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; pass2(tdbb, csb, node, (jrd_nod*) rse); } 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); csb->csb_rpt[stream].csb_flags |= csb_active; 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 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; // process alternating rse and map blocks @@ -5082,7 +5082,7 @@ static void plan_check(Csb* csb, RSE rse) ptr < end; ptr++) { 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)) { ERR_post(isc_no_stream_plan, isc_arg_string, 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 - 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]; // 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_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 @@ -5405,15 +5405,15 @@ static RSB post_rse(TDBB tdbb, Csb* csb, RSE rse) { jrd_nod* node = *ptr; 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; } 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; } 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); 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* 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) { 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) { 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; } } @@ -5751,7 +5751,7 @@ static bool stream_in_rse(USHORT stream, RSE rse) // for aggregates, check current rse, if not found then check // the sub-rse 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]))) { 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) && - (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 } diff --git a/src/jrd/common.h b/src/jrd/common.h index 10529a632b..5b49bdac88 100644 --- a/src/jrd/common.h +++ b/src/jrd/common.h @@ -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 @@ -98,10 +98,14 @@ $Id: common.h,v 1.97 2004-01-12 06:58:26 skidder Exp $ #ifdef LINUX #define QUADFORMAT "ll" #define QUADCONST(n) (n##LL) + +// SLONG is a 32-bit integer on 64-bit platforms +#if SIZEOF_LONG == 4 #define SLONGFORMAT "ld" #define ULONGFORMAT "lu" #define XLONGFORMAT "lX" #define xLONGFORMAT "lx" +#endif //format for __LINE__ @@ -275,7 +279,6 @@ static inline int sinixz_sigaction(int sig, const struct sinixz_sigaction *act, #define QUADFORMAT "q" #define MAP_ANONYMOUS #define MAP_ANNON -#define LSEEK_OFFSET_CAST (off_t) #define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t)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" #endif -#ifdef SOLX86 -#define LSEEK_OFFSET_CAST (off_t) -#endif - #define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length) /********* Reason for introducing MEMMOVE macro. @@ -865,8 +864,8 @@ typedef struct #define JRD_BUGCHK 15 /* facility code for bugcheck messages */ #ifndef OFFSET -#define OFFSET(struct,fld) ((int) &((struct) NULL)->fld) -#define OFFSETA(struct,fld) ((int) ((struct) NULL)->fld) +#define OFFSET(struct,fld) ((IPTR) &((struct) NULL)->fld) +#define OFFSETA(struct,fld) ((IPTR) ((struct) NULL)->fld) #endif #ifndef ODS_ALIGNMENT diff --git a/src/jrd/cvt2.cpp b/src/jrd/cvt2.cpp index fe86e3330b..ef16a56249 100644 --- a/src/jrd/cvt2.cpp +++ b/src/jrd/cvt2.cpp @@ -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. */ BID bid1 = (BID) arg1->dsc_address, bid2 = (BID) arg2->dsc_address; 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_number == bid2->bid_stuff.bid_number)) + ((!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))) return 0; } diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index cd869fe0d1..db6359a17e 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -138,12 +138,6 @@ typedef enum rids #define COMPUTED_FLAG 128 #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"; /*================================================================== @@ -196,7 +190,7 @@ static void load_trigs(TDBB, jrd_rel*, TRIG_VEC *); static FMT make_format(TDBB, jrd_rel*, USHORT *, TFB); static USHORT name_length(const TEXT*); 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 setup_array(TDBB, blb*, const TEXT*, USHORT, TFB); static blb* setup_triggers(TDBB, jrd_rel*, bool, TRIG_VEC*, blb*); @@ -1849,7 +1843,7 @@ static bool create_relation(TDBB tdbb, BLK request; jrd_rel* relation; USHORT rel_id, external_flag; - ISC_QUAD blob_id; + bid blob_id; BLK handle; LCK lock; @@ -1945,7 +1939,7 @@ static bool create_relation(TDBB tdbb, local_min_relation_id : rel_id; MODIFY Y USING Y.RDB$RELATION_ID = --rel_id; - if (NULL_BLOB(blob_id)) + if (blob_id.isEmpty()) Y.RDB$DBKEY_LENGTH = 8; else { @@ -1989,7 +1983,7 @@ static bool create_relation(TDBB tdbb, /* if this is not a view, create the relation */ - if (NULL_BLOB(blob_id)) + if (blob_id.isEmpty()) { if (!external_flag) DPM_create_relation(tdbb, relation); @@ -3159,7 +3153,7 @@ static void get_procedure_dependencies(DFW work) DBB dbb = tdbb->tdbb_database; 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); @@ -3182,13 +3176,13 @@ static void get_procedure_dependencies(DFW work) /* 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; /* Nickolay Samofatov: allocate statement memory pool... */ tdbb->tdbb_default = JrdMemoryPool::createPool(); 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); if (request) CMP_release(tdbb, request); @@ -3224,7 +3218,7 @@ static void get_trigger_dependencies( DFW work) jrd_rel* relation = NULL; 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) X IN RDB$TRIGGERS WITH 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 */ - if (relation && !NULL_BLOB(blob_id)) + if (relation && !blob_id.isEmpty()) { JrdMemoryPool* old_pool = tdbb->tdbb_default; /* Nickolay Samofatov: allocate statement memory pool... */ tdbb->tdbb_default = JrdMemoryPool::createPool(); 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); if (request) CMP_release(tdbb, request); @@ -3375,7 +3369,7 @@ static FMT make_format(TDBB tdbb, jrd_rel* relation, USHORT * version, TFB stack offset += 65536L; break; } - desc2->dsc_address = (UCHAR *) (SLONG) offset; + desc2->dsc_address = (UCHAR *) (IPTR) offset; 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; FMT.RDB$FORMAT = format->fmt_version; 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, blob, // (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_; jrd_rel* relation; BLB blob; - ISC_QUAD blob_id; + bid blob_id; BLK temp; USHORT version, n, external_flag; BOOLEAN computed_field; @@ -3510,7 +3504,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, jrd_tra* transaction return false; } blob_id = REL.RDB$VIEW_BLR; - null_view = NULL_BLOB(blob_id); + null_view = blob_id.isEmpty(); external_flag = REL.RDB$EXTERNAL_FILE[0]; 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 blob = BLB_create(tdbb, dbb->dbb_sys_trans, - (BID)&REL.RDB$RUNTIME); + &REL.RDB$RUNTIME); request_fmtx = (BLK) CMP_find_request(tdbb, irq_format2, IRQ_REQUESTS); 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 = 1; - if (!NULL_BLOB(FLD.RDB$COMPUTED_BLR)) + if (!FLD.RDB$COMPUTED_BLR.isEmpty()) { RFR.RDB$UPDATE_FLAG = 0; 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, (UCHAR*) 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) { put_summary_blob(blob, RSR_computed_blr, - (SLONG*)&FLD.RDB$COMPUTED_BLR); + &FLD.RDB$COMPUTED_BLR); } 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)); } put_summary_blob(blob, RSR_missing_value, - (SLONG*)&FLD.RDB$MISSING_VALUE); + &FLD.RDB$MISSING_VALUE); put_summary_blob(blob, RSR_default_value, - (SLONG*)((NULL_BLOB(RFR.RDB$DEFAULT_VALUE)) ? + (RFR.RDB$DEFAULT_VALUE.isEmpty() ? &FLD.RDB$DEFAULT_VALUE : &RFR.RDB$DEFAULT_VALUE)); 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) { 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 - if (null_view && !NULL_BLOB(FLD.RDB$COMPUTED_BLR)) + if (null_view && !FLD.RDB$COMPUTED_BLR.isEmpty()) tfb_->tfb_flags |= TFB_computed; 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_id[0] && !blob_id[1]) { + if (blob_id->isEmpty()) return; - } // 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); USHORT length = (USHORT)blr->blb_length; UCHAR* buffer = (length > sizeof(temp)) ? diff --git a/src/jrd/dpm.epp b/src/jrd/dpm.epp index 7a8b5afc12..35d79aec3b 100644 --- a/src/jrd/dpm.epp +++ b/src/jrd/dpm.epp @@ -1943,7 +1943,7 @@ SLONG DPM_store_blob(TDBB tdbb, BLB blob, REC record) if (blob->blb_level > 0) { vcl::iterator 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) { 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. */ 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); @@ -2706,7 +2706,7 @@ static UCHAR* find_space(TDBB tdbb, (SLONG) page->dpg_sequence * dbb->dbb_max_records + slot; 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; @@ -2917,7 +2917,7 @@ static RHD locate_space( } if (record) { - LLS_PUSH((BLK) window->win_page, &record->rec_precedence); + LLS_PUSH((BLK)(IPTR)window->win_page, &record->rec_precedence); } #ifdef VIO_DEBUG diff --git a/src/jrd/dsc.h b/src/jrd/dsc.h index e2c0918541..5a12ac7718 100644 --- a/src/jrd/dsc.h +++ b/src/jrd/dsc.h @@ -51,7 +51,7 @@ typedef struct dsc USHORT dsc_length; SSHORT dsc_sub_type; USHORT dsc_flags; - UCHAR* dsc_address; + UCHAR* dsc_address; // Used either as offset in a message or as a pointer } DSC; /* values for dsc_flags */ diff --git a/src/jrd/dyn.epp b/src/jrd/dyn.epp index b05a6b4314..8f20fe45ca 100644 --- a/src/jrd/dyn.epp +++ b/src/jrd/dyn.epp @@ -665,7 +665,7 @@ USHORT DYN_get_string(const TEXT** ptr, TEXT* field, USHORT size, bool err_flag) 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 { - 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_close(tdbb, blob); } @@ -703,7 +703,7 @@ USHORT DYN_put_blr_blob(GBL gbl, const UCHAR** ptr, ISC_QUAD* blob_id) 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; 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) { diff --git a/src/jrd/dyn.h b/src/jrd/dyn.h index 8ed4dba03c..be6c46720f 100644 --- a/src/jrd/dyn.h +++ b/src/jrd/dyn.h @@ -76,12 +76,12 @@ USHORT DYN_get_string(const TEXT**, TEXT*, USHORT, bool); // This function doesn't need to be exported currently. 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. //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. //USHORT DYN_put_text_blob2(GBL, const UCHAR**, ISC_QUAD *); diff --git a/src/jrd/dyn_def.epp b/src/jrd/dyn_def.epp index 60edaf1dc1..3b10d6eb24 100644 --- a/src/jrd/dyn_def.epp +++ b/src/jrd/dyn_def.epp @@ -3796,7 +3796,7 @@ void DYN_define_shadow( GBL gbl, const UCHAR** ptr) } 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); /* msg 165: "Shadow %ld already exists" */ } diff --git a/src/jrd/dyn_mod.epp b/src/jrd/dyn_mod.epp index 581d4ed50e..7508dda7af 100644 --- a/src/jrd/dyn_mod.epp +++ b/src/jrd/dyn_mod.epp @@ -2955,7 +2955,7 @@ static void modify_err_punt(TDBB tdbb, DYN_error_punt(false, 208, 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); diff --git a/src/jrd/evl.cpp b/src/jrd/evl.cpp index 4b69953230..abe4c655c3 100644 --- a/src/jrd/evl.cpp +++ b/src/jrd/evl.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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]; desc = &format->fmt_desc[arg_number]; 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_length = desc->dsc_length; 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. 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); if (!impure->vlu_desc.dsc_address) 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); SBM_reset(&impure->inv_bitmap); 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; numbers += id * sizeof(SLONG); 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 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 + - 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_length = desc->dsc_length; 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. * 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, - (USHORT)(ULONG) node->nod_arg[e_fld_id], + (USHORT)(IPTR) node->nod_arg[e_fld_id], &impure->vlu_desc)) { request->req_flags |= req_null; @@ -984,7 +984,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node) case nod_extract: { 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]); impure->vlu_desc.dsc_dtype = dtype_short; @@ -1162,7 +1162,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node) switch (node->nod_type) { case nod_gen_id: /* return a 32-bit generator value */ impure->vlu_misc.vlu_long = (SLONG) DPM_gen_id(tdbb, - (SLONG) + (SLONG)(IPTR) node->nod_arg [e_gen_id], 0, MOV_get_int64 @@ -1177,11 +1177,7 @@ dsc* EVL_expr(TDBB tdbb, jrd_nod* node) case nod_gen_id2: impure->vlu_misc.vlu_int64 = DPM_gen_id(tdbb, - (SLONG) - node->nod_arg[e_gen_id], - 0, - MOV_get_int64(values[0], - 0)); + (IPTR) node->nod_arg[e_gen_id], 0, MOV_get_int64(values[0], 0)); impure->vlu_desc.dsc_dtype = dtype_int64; impure->vlu_desc.dsc_length = sizeof(SINT64); impure->vlu_desc.dsc_scale = 0; @@ -1368,7 +1364,7 @@ bool EVL_field(jrd_rel* relation, REC record, USHORT id, dsc* desc) 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)) { 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* 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 = request->req_rpb[(int) (IPTR) field->nod_arg[e_fld_stream]].rpb_record; vlux* impure = (vlux*) ((SCHAR *) request + from->nod_impure); diff --git a/src/jrd/exe.cpp b/src/jrd/exe.cpp index 608fdf12d9..e89487c0e1 100644 --- a/src/jrd/exe.cpp +++ b/src/jrd/exe.cpp @@ -404,7 +404,7 @@ void EXE_assignment(TDBB tdbb, jrd_nod* node) 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; if (null) { SET_NULL(record, id); @@ -650,7 +650,7 @@ void EXE_receive(TDBB tdbb, const jrd_nod* message = request->req_message; 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); if (length != format->fmt_length) { @@ -795,7 +795,7 @@ void EXE_send(TDBB tdbb, ptr++) { 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; break; } @@ -806,7 +806,7 @@ void EXE_send(TDBB tdbb, 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); if (length != format->fmt_length) { @@ -1050,7 +1050,7 @@ static void cleanup_rpb(TDBB tdbb, RPB *rpb) const dsc* desc = &format->fmt_desc[n]; if (!desc->dsc_address) continue; - UCHAR* p = record->rec_data + (SLONG) desc->dsc_address; + UCHAR* p = record->rec_data + (IPTR) desc->dsc_address; if (TEST_NULL(record, n)) { 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: 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]; // 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; 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; 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: request->req_flags |= req_leave; 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; break; @@ -2743,7 +2743,7 @@ static jrd_nod* looper(TDBB tdbb, jrd_req* request, jrd_nod* in_node) case nod_set_generator: if (request->req_operation == jrd_req::req_evaluate) { 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)); 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: if (request->req_operation == jrd_req::req_evaluate) { 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)); 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; 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]; 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]; #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_tra* transaction = request->req_transaction; 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]; jrd_rel* relation = rpb->rpb_relation; @@ -4189,8 +4189,8 @@ static void validate(TDBB tdbb, jrd_nod* list) const TEXT* name = 0; if (node->nod_type == nod_field) { - const USHORT stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; - const USHORT id = (USHORT)(ULONG) node->nod_arg[e_fld_id]; + const USHORT stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream]; + const USHORT id = (USHORT)(IPTR) node->nod_arg[e_fld_id]; const jrd_rel* relation = request->req_rpb[stream].rpb_relation; const jrd_fld* field; diff --git a/src/jrd/ext.cpp b/src/jrd/ext.cpp index 1b826be215..61881a3f23 100644 --- a/src/jrd/ext.cpp +++ b/src/jrd/ext.cpp @@ -244,7 +244,7 @@ int EXT_get(RSB rsb) rec* record = rpb->rpb_record; 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; SSHORT l = record->rec_length - offset; @@ -283,7 +283,7 @@ int EXT_get(RSB rsb) const lit* literal = (LIT) field->fld_missing_value; if (literal) { 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)) continue; } @@ -475,7 +475,7 @@ void EXT_store(RPB * rpb, int *transaction) desc_ptr->dsc_length && 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; if (literal) { 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; USHORT l = record->rec_length - offset; diff --git a/src/jrd/filters.cpp b/src/jrd/filters.cpp index 6d11388de1..2de7bf78e4 100644 --- a/src/jrd/filters.cpp +++ b/src/jrd/filters.cpp @@ -486,7 +486,7 @@ ISC_STATUS filter_text(USHORT action, ctl* control) case ACTION_close: if (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; @@ -570,7 +570,7 @@ ISC_STATUS filter_text(USHORT action, ctl* control) && (control->ctl_data[0] > control->ctl_data[3])) { gds__free((SLONG *) control->ctl_data[1]); - control->ctl_data[1] = (IPTR) NULL; + control->ctl_data[1] = 0; control->ctl_data[3] = 0; } @@ -820,7 +820,7 @@ ISC_STATUS filter_transliterate_text(USHORT action, ctl* control) } if (aux) { gds__free(aux); - control->ctl_data[0] = (IPTR) NULL; + control->ctl_data[0] = 0; aux = NULL; } return FB_SUCCESS; diff --git a/src/jrd/fun.epp b/src/jrd/fun.epp index b6352fb923..8115591deb 100644 --- a/src/jrd/fun.epp +++ b/src/jrd/fun.epp @@ -30,7 +30,7 @@ * 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" @@ -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/sch_proto.h" #include "../jrd/isc_s_proto.h" +#include "../jrd/blb.h" #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]) @@ -425,18 +426,14 @@ void FUN_evaluate(FUN function, jrd_nod* node, VLU value) { blob = BLB_create(tdbb, tdbb->tdbb_request->req_transaction, - (BID) & value->vlu_misc); + (BID)&value->vlu_misc); return_blob_struct = blob_desc; } else { - SLONG* blob_id; + bid blob_id; if (request->req_flags & req_null) - { - SLONG null_quad[2]; - null_quad[0] = null_quad[1] = 0; - blob_id = null_quad; - } + memset(&blob_id, 0, sizeof(bid)); else { 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_string, "conversion", 0); } - blob_id = (SLONG *) input->dsc_address; + blob_id = *(BID) input->dsc_address; } blob = BLB_open(tdbb, tdbb->tdbb_request->req_transaction, - (BID)blob_id); + &blob_id); } LLS_PUSH(blob, &blob_stack); blob_desc->blob_get_segment = blob_get_segment; diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 9682eeba57..9c02d66909 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -2394,7 +2394,7 @@ void* API_ROUTINE gds__temp_file( strcat(file_name, TEMP_PATTERN); #ifdef HAVE_MKSTEMP - result = (void *)mkstemp(file_name); + result = (void *)(IPTR)mkstemp(file_name); #else if (mktemp(file_name) == (char *)0) return (void *)-1; @@ -2407,7 +2407,7 @@ void* API_ROUTINE gds__temp_file( return result; if (stdio_flag) - if (!(result = ib_fdopen((int) result, "w+"))) + if (!(result = ib_fdopen((int)(IPTR)result, "w+"))) return (void *)-1; if (expanded_string) diff --git a/src/jrd/grant.epp b/src/jrd/grant.epp index 60ae5bff60..7046e1364c 100644 --- a/src/jrd/grant.epp +++ b/src/jrd/grant.epp @@ -510,8 +510,7 @@ static void get_object_info( strcpy(default_class, REL.RDB$DEFAULT_CLASS); fb_utils::fb_exact_name_limit(REL.RDB$OWNER_NAME, sizeof(REL.RDB$OWNER_NAME)); strcpy(owner, REL.RDB$OWNER_NAME); - *view = (REL.RDB$VIEW_BLR.gds_quad_high || - REL.RDB$VIEW_BLR.gds_quad_low) ? true : false; + *view = !REL.RDB$VIEW_BLR.isEmpty(); END_FOR; if (!REQUEST(irq_grant1)) @@ -1065,8 +1064,8 @@ static void save_security_class(TDBB tdbb, SET_TDBB(tdbb); DBB dbb = tdbb->tdbb_database; - ISC_QUAD blob_id; - blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id); + bid blob_id; + blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, &blob_id); BLB_put_segment(tdbb, blob, buffer, length); BLB_close(tdbb, blob); diff --git a/src/jrd/ibase.h b/src/jrd/ibase.h index 8fa25fdabc..95c7e9d7ac 100644 --- a/src/jrd/ibase.h +++ b/src/jrd/ibase.h @@ -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 @@ -53,13 +53,16 @@ $Id: ibase.h,v 1.64 2004-01-12 06:58:26 skidder Exp $ #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 unsigned int ISC_ULONG; -#else -typedef signed long ISC_LONG; -typedef unsigned long ISC_ULONG; -#endif +//#else +//typedef signed long ISC_LONG; +//typedef unsigned long ISC_ULONG; +//#endif typedef signed short ISC_SHORT; typedef unsigned short ISC_USHORT; @@ -93,8 +96,8 @@ typedef ISC_LONG isc_resv_handle; /*******************************************************************/ #ifndef ISC_TIMESTAMP_DEFINED -typedef long ISC_DATE; -typedef unsigned long ISC_TIME; +typedef int ISC_DATE; +typedef unsigned int ISC_TIME; typedef struct { ISC_DATE timestamp_date; diff --git a/src/jrd/idx.cpp b/src/jrd/idx.cpp index 826d0c69d4..cf1f9976d5 100644 --- a/src/jrd/idx.cpp +++ b/src/jrd/idx.cpp @@ -1001,15 +1001,15 @@ static IDX_E check_foreign_key( index_number++) { if (idx->idx_id != - (UCHAR)(ULONG) (*idx->idx_foreign_primaries)[index_number]) + (UCHAR)(IPTR) (*idx->idx_foreign_primaries)[index_number]) { continue; } partner_relation = MET_relation(tdbb, - (int) (*idx->idx_foreign_relations)[index_number]); + (IPTR) (*idx->idx_foreign_relations)[index_number]); index_id = - (USHORT)(ULONG) (*idx->idx_foreign_indexes)[index_number]; + (USHORT)(IPTR) (*idx->idx_foreign_indexes)[index_number]; if ( (result = check_partner_index(tdbb, relation, record, transaction, idx, partner_relation, index_id)) ) diff --git a/src/jrd/inf.cpp b/src/jrd/inf.cpp index 94f7a70403..082f14cb0a 100644 --- a/src/jrd/inf.cpp +++ b/src/jrd/inf.cpp @@ -927,7 +927,7 @@ int INF_request_info(const jrd_req* request, node = request->req_message; if (item == isc_info_message_number) length = - INF_convert((SLONG) node->nod_arg[e_msg_number], + INF_convert((IPTR) node->nod_arg[e_msg_number], buffer_ptr); else { format = (FMT) node->nod_arg[e_msg_format]; diff --git a/src/jrd/ini.epp b/src/jrd/ini.epp index 3ddc007d39..3ef9efb3a6 100644 --- a/src/jrd/ini.epp +++ b/src/jrd/ini.epp @@ -693,7 +693,7 @@ void INI_init2(void) if (n-- > 0) { 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; } } @@ -1150,13 +1150,13 @@ static void add_security_to_sys_rel(TDBB tdbb, strcpy(sec_class_name, "SQL$"); strcat(sec_class_name, rel_name); - ISC_QUAD blob_id_1; - blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id_1); + 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_close(tdbb, blob); - ISC_QUAD blob_id_2; - blob = BLB_create(tdbb, dbb->dbb_sys_trans, (BID)&blob_id_2); + bid blob_id_2; + blob = BLB_create(tdbb, dbb->dbb_sys_trans, &blob_id_2); BLB_put_segment(tdbb, blob, acl, acl_length); 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; 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_SCALE = 0; 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; 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, blob, 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$TRIGGER_TYPE = trigger->trg_type; 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, blob, trigger->trg_blr, diff --git a/src/jrd/intl.cpp b/src/jrd/intl.cpp index 00d5b1456c..e00d584cdd 100644 --- a/src/jrd/intl.cpp +++ b/src/jrd/intl.cpp @@ -367,7 +367,7 @@ public: SSHORT err_code; USHORT 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]; else out_str = tempBuffer; @@ -392,7 +392,7 @@ public: UpcaseConverter(TDBB tdbb, TextType obj, const UCHAR* &str, SSHORT &len) : PrevConverter(tdbb, obj, str, len) { - if (len > sizeof(tempBuffer)) + if (len > (int) sizeof(tempBuffer)) out_str = FB_NEW(*tdbb->tdbb_default) UCHAR[len]; else out_str = tempBuffer; diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 8cc7c9198f..09d310f317 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -1659,7 +1659,7 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status, #ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM 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 } catch (const std::exception&) @@ -3776,7 +3776,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status, jrd_nod* in_message = NULL; jrd_nod* out_message = NULL; 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) ) { diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 0c572258cc..e3e79ab61a 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -37,7 +37,7 @@ * 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 #ifdef DARWIN @@ -124,21 +124,19 @@ typedef enum rids { #undef END_RELATION #define BLR_BYTE *(csb->csb_running)++ -#define NULL_BLOB(id) (!id.gds_quad_high && !id.gds_quad_low) - #define BLANK '\040' DATABASE DB = FILENAME "ODS.RDB"; static int blocking_ast_procedure(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 void lookup_view_contexts(TDBB, jrd_rel*); static void name_copy(TEXT*, const TEXT*); static USHORT name_length(const TEXT *); -static jrd_nod* parse_param_blr(TDBB, jrd_prc*, SLONG[2], Csb*); -static jrd_nod* parse_procedure_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*, BID, Csb*); static BOOLEAN par_messages(TDBB, const UCHAR*, USHORT, jrd_prc*, Csb*); static BOOLEAN resolve_charset_and_collation(TDBB, SSHORT*, const UCHAR*, const UCHAR*); @@ -831,7 +829,7 @@ FMT MET_format(TDBB tdbb, jrd_rel* relation, USHORT number) { 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); format = fmt::newFmt(*dbb->dbb_permanent, count); format->fmt_count = count; @@ -845,7 +843,7 @@ FMT MET_format(TDBB tdbb, jrd_rel* relation, USHORT number) if (desc->dsc_address) { format->fmt_length = - (ULONG) desc->dsc_address + desc->dsc_length; + (IPTR) desc->dsc_address + desc->dsc_length; break; } } @@ -940,7 +938,7 @@ jrd_nod* MET_get_dependencies(TDBB tdbb, jrd_rel* relation, TEXT* blob, Csb* view_csb, - SLONG blob_id[2], + BID blob_id, jrd_req** request, Csb** csb_ptr, const TEXT* object_name, @@ -1176,7 +1174,7 @@ void MET_load_trigger( { get_trigger(tdbb, relation, - (SLONG*)&TRG.RDB$TRIGGER_BLR, + &TRG.RDB$TRIGGER_BLR, triggers + trigger_action, TRG.RDB$TRIGGER_NAME, (bool) TRG.RDB$SYSTEM_FLAG, @@ -1796,21 +1794,21 @@ bool MET_lookup_partner( index_number + 1); (*references->frgn_reference_ids)[index_number] = - (BLK) (IDX.RDB$INDEX_ID - 1); + (BLK)(IPTR)(IDX.RDB$INDEX_ID - 1); references->frgn_relations = vec::newVector(*dbb->dbb_permanent, references->frgn_relations, index_number + 1); (*references->frgn_relations)[index_number] = - (BLK) (ULONG) partner_relation->rel_id; + (BLK) (IPTR) partner_relation->rel_id; references->frgn_indexes = vec::newVector(*dbb->dbb_permanent, references->frgn_indexes, index_number + 1); (*references->frgn_indexes)[index_number] = - (BLK) (IND.RDB$INDEX_ID - 1); + (BLK) (IPTR) (IND.RDB$INDEX_ID - 1); index_number++; } @@ -1875,21 +1873,21 @@ bool MET_lookup_partner( index_number + 1); (*dependencies->prim_reference_ids)[index_number] = - (BLK) (IDX.RDB$INDEX_ID - 1); + (BLK) (IPTR) (IDX.RDB$INDEX_ID - 1); dependencies->prim_relations = vec::newVector(*dbb->dbb_permanent, dependencies->prim_relations, index_number+1); (*dependencies->prim_relations)[index_number] = - (BLK) (ULONG) partner_relation->rel_id; + (BLK) (IPTR) partner_relation->rel_id; dependencies->prim_indexes = vec::newVector(*dbb->dbb_permanent, dependencies->prim_indexes, index_number+1); (*dependencies->prim_indexes)[index_number] = - (BLK) (IND.RDB$INDEX_ID - 1); + (BLK) (IPTR) (IND.RDB$INDEX_ID - 1); index_number++; } @@ -1943,13 +1941,13 @@ bool MET_lookup_partner( index_number < (int) references->frgn_reference_ids->count(); index_number++) { - if (idx->idx_id == (UCHAR)(ULONG) (*references->frgn_reference_ids) + if (idx->idx_id == (UCHAR)(IPTR) (*references->frgn_reference_ids) [index_number]) { idx->idx_primary_relation = - (USHORT)(ULONG) (*references->frgn_relations)[index_number]; + (USHORT)(IPTR) (*references->frgn_relations)[index_number]; idx->idx_primary_index = - (UCHAR)(ULONG) (*references->frgn_indexes)[index_number]; + (UCHAR)(IPTR) (*references->frgn_indexes)[index_number]; return true; } } @@ -1965,7 +1963,7 @@ bool MET_lookup_partner( index_number < (int) dependencies->prim_reference_ids->count(); index_number++) { - if (idx->idx_id == (UCHAR)(ULONG) (*dependencies->prim_reference_ids) + if (idx->idx_id == (UCHAR)(IPTR) (*dependencies->prim_reference_ids) [index_number]) { 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_rel* relation, - SLONG blob_id[2], + BID blob_id, Csb** csb_ptr, jrd_req** request_ptr, BOOLEAN trigger, @@ -2347,7 +2345,7 @@ jrd_nod* MET_parse_blob(TDBB tdbb, SET_TDBB(tdbb); 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; str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str(); 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; blb* blob = BLB_create(tdbb, dbb->dbb_sys_trans, - (BID)&X.RDB$TRANSACTION_DESCRIPTION); + &X.RDB$TRANSACTION_DESCRIPTION); BLB_put_segment(tdbb, blob, msg, length); BLB_close(tdbb, blob); 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); 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_; 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; length = MET_align(&*desc, length); - desc->dsc_address = (UCHAR *) length; + desc->dsc_address = (UCHAR *) (IPTR) 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; tdbb->tdbb_default = JrdMemoryPool::createPool(); 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; 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; } - 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 */ @@ -3311,7 +3309,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation) { relation->rel_view_rse = (RSE) MET_get_dependencies(tdbb, relation, NULL, NULL, - (SLONG*)&REL.RDB$VIEW_BLR, NULL, + &REL.RDB$VIEW_BLR, NULL, &csb_, REL.RDB$RELATION_NAME, obj_view); } @@ -3319,7 +3317,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation) { relation->rel_view_rse = (RSE) MET_parse_blob(tdbb, relation, - (SLONG*)&REL.RDB$VIEW_BLR, &csb_, + &REL.RDB$VIEW_BLR, &csb_, NULL, FALSE, FALSE); } @@ -3339,7 +3337,7 @@ void MET_scan_relation( TDBB tdbb, jrd_rel* relation) /* Pick up field specific stuff */ 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)) { buffer = temp; @@ -3751,7 +3749,7 @@ static int blocking_ast_relation(void* ast_object) static void get_trigger( TDBB tdbb, jrd_rel* relation, - SLONG blob_id[2], + BID blob_id, TRIG_VEC* ptr, const TEXT* name, bool sys_trigger, USHORT flags) { @@ -3767,12 +3765,11 @@ static void get_trigger( **************************************/ SET_TDBB(tdbb); - if (!blob_id[0] && !blob_id[1]) { + if (blob_id->isEmpty()) return; - } 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; STR blr = FB_NEW_RPT(*dbb->dbb_permanent,length) str(); 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, - jrd_prc* procedure, SLONG blob_id[2], Csb* csb) + jrd_prc* procedure, BID blob_id, Csb* csb) { SET_TDBB(tdbb); 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; 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( 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); 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; // CVC: Warning: the str class is limited by 64K str* temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str(); @@ -4035,7 +4032,7 @@ static BOOLEAN par_messages(TDBB tdbb, if (align) { offset = FB_ALIGN(offset, align); } - desc->dsc_address = (UCHAR *) (ULONG) offset; + desc->dsc_address = (UCHAR *) (IPTR) offset; offset += desc->dsc_length; } format->fmt_length = offset; @@ -4317,7 +4314,7 @@ static void store_dependencies(TDBB tdbb, jrd_nod* node = (jrd_nod*) LLS_POP(&csb->csb_dependencies); if (!node->nod_arg[e_dep_object]) 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_prc* procedure = NULL; const TEXT* dpdo_name; @@ -4332,7 +4329,7 @@ static void store_dependencies(TDBB tdbb, break; 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); dpdo_name = name; 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. */ 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); dpdo_name = name; break; @@ -4360,7 +4357,7 @@ static void store_dependencies(TDBB tdbb, { 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) { const jrd_fld* field = MET_get_field(relation, fld_id); diff --git a/src/jrd/met_proto.h b/src/jrd/met_proto.h index 75656d8260..3210f9282d 100644 --- a/src/jrd/met_proto.h +++ b/src/jrd/met_proto.h @@ -37,7 +37,7 @@ void MET_error(const TEXT*, ...); struct fmt* MET_format(TDBB, struct jrd_rel *, USHORT); BOOLEAN MET_get_char_subtype(TDBB, SSHORT*, const UCHAR*, USHORT); 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); struct jrd_fld* MET_get_field(struct jrd_rel *, USHORT); 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_rel* MET_lookup_relation(TDBB, const char*); 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); void MET_parse_sys_trigger(TDBB, struct jrd_rel *); int MET_post_existence(TDBB, struct jrd_rel *); diff --git a/src/jrd/nav.cpp b/src/jrd/nav.cpp index d5e6be643c..69fec92ef9 100644 --- a/src/jrd/nav.cpp +++ b/src/jrd/nav.cpp @@ -459,7 +459,7 @@ BOOLEAN NAV_get_record(TDBB tdbb, #endif 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 // direction. It is of no help when we change direction, @@ -502,7 +502,7 @@ BOOLEAN NAV_get_record(TDBB tdbb, #else MOVE_FAST( (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); #endif } @@ -510,7 +510,7 @@ BOOLEAN NAV_get_record(TDBB tdbb, lower.key_length = impure->irsb_nav_lower_length; MOVE_FAST( (impure->irsb_nav_data + - (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data, + (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_data, lower.key_length); } @@ -1352,7 +1352,7 @@ static bool find_saved_node(RSB rsb, IRSB_NAV impure, **************************************/ 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); // the outer loop goes through all the sibling pages @@ -1570,7 +1570,7 @@ static BOOLEAN get_record( TDBB tdbb = GET_THREAD_DATA; 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; USHORT old_att_flags; @@ -1606,7 +1606,7 @@ static BOOLEAN get_record( { BTR_key(tdbb, rpb->rpb_relation, rpb->rpb_record, reinterpret_cast((SCHAR*) impure + - (SLONG) rsb->rsb_arg[RSB_NAV_idx_offset]), + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]), &value, 0); if (compare_keys(idx, key->key_data, key->key_length, &value, FALSE)) { result = FALSE; @@ -1702,7 +1702,7 @@ static UCHAR* nav_open( // Find the starting leaf page retrieval_node = (jrd_nod*) rsb->rsb_arg[RSB_NAV_index]; 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, &upper, (direction == RSE_get_backward)); impure->irsb_nav_page = window->win_page; @@ -1744,7 +1744,7 @@ static UCHAR* nav_open( if (retrieval->irb_upper_count) { impure->irsb_nav_upper_length = upper.key_length; MOVE_FAST(upper.key_data, (impure->irsb_nav_data + - (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), + (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), upper.key_length); } if (retrieval->irb_lower_count) { @@ -1755,7 +1755,7 @@ static UCHAR* nav_open( if (retrieval->irb_lower_count) { impure->irsb_nav_lower_length = lower.key_length; MOVE_FAST(lower.key_data, (impure->irsb_nav_data + - (SLONG) rsb->rsb_arg[RSB_NAV_key_length]), + (IPTR) rsb->rsb_arg[RSB_NAV_key_length]), lower.key_length); } if (retrieval->irb_upper_count) { diff --git a/src/jrd/opt.cpp b/src/jrd/opt.cpp index 4d36f5d0cb..42ae8cc3eb 100644 --- a/src/jrd/opt.cpp +++ b/src/jrd/opt.cpp @@ -377,7 +377,7 @@ RSB OPT_compile(TDBB tdbb, 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(beds[0] < MAX_STREAMS && beds[0] < MAX_UCHAR); beds[++beds[0]] = (UCHAR) stream; @@ -397,7 +397,7 @@ RSB OPT_compile(TDBB tdbb, (USHORT) (key_streams[0] - i)); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); 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) { 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); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); 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) { rsb = gen_procedure(tdbb, opt_, node); fb_assert(local_streams[0] < MAX_STREAMS && local_streams[0] < MAX_UCHAR); 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) { 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 */ - if ((USHORT)(ULONG) dbkey->nod_arg[0] != stream) + if ((USHORT)(IPTR) dbkey->nod_arg[0] != stream) return NULL; /* 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_type = nod_bit_dbkey; 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)); return dbkey; @@ -1107,7 +1107,7 @@ void OPT_set_index(TDBB tdbb, /* go out to the vector which stores all rsbs for the 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) { request->req_fors[i] = new_rsb; break; @@ -1601,7 +1601,7 @@ static bool computable(Csb* csb, switch (node->nod_type) { 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; } // 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; case nod_dbkey: - if ((n = (USHORT)(ULONG) node->nod_arg[0]) == stream) { + if ((n = (USHORT)(IPTR) node->nod_arg[0]) == stream) { return false; } // 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++) { 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; } } @@ -1702,7 +1702,7 @@ static bool computable(Csb* csb, { 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; } } @@ -1743,12 +1743,12 @@ static void compute_dependencies(jrd_nod* node, ULONG * dependencies) switch (node->nod_type) { 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); return; case nod_dbkey: - n = (USHORT)(ULONG) node->nod_arg[0]; + n = (USHORT)(IPTR) node->nod_arg[0]; SET_DEP_BIT(dependencies, n); 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++) { 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); } } @@ -1832,7 +1832,7 @@ static void compute_dbkey_streams(Csb* csb, jrd_nod* node, UCHAR * streams) if (node->nod_type == nod_relation) { 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) { 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; if (node->nod_type != nod_rse) { 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 { 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; DEV_BLKCHK(dbkey, type_nod); if (dbkey->nod_type == nod_dbkey) { - if ((USHORT)(ULONG) dbkey->nod_arg[0] == stream) + if ((USHORT)(IPTR) dbkey->nod_arg[0] == stream) return dbkey; else { *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_indexed: // 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; case rsb_cross: @@ -3261,7 +3261,7 @@ static void form_rivers(TDBB tdbb, // the stream into the river. temp[0]++; 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 @@ -3433,7 +3433,7 @@ static RSB gen_aggregate(TDBB tdbb, OPT opt, jrd_nod* node) 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_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_next = OPT_compile(tdbb, csb, rse, NULL); rsb->rsb_arg[0] = (RSB) node; @@ -3878,7 +3878,7 @@ static RSB gen_nav_rsb(TDBB tdbb, rsb->rsb_stream = (UCHAR) stream; rsb->rsb_alias = alias; 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 // indicate that the index needs to be navigated in a mirror-image @@ -3964,7 +3964,7 @@ static RSB gen_outer(TDBB tdbb, else { stream_ptr[i]->stream_rsb = NULL; 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; 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_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_format = procedure->prc_format; rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb_procedure)); @@ -4653,13 +4653,13 @@ static RSB gen_sort(TDBB tdbb, id = -1; while (SBM_next(csb->csb_rpt[*ptr].csb_fields, &id, RSE_get_forward)) { items++; - LLS_PUSH((BLK) id, &id_stack); - LLS_PUSH((BLK)(ULONG) * ptr, &stream_stack); + LLS_PUSH((BLK)(IPTR)id, &id_stack); + LLS_PUSH((BLK)(IPTR) * ptr, &stream_stack); for (node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) { node = *node_ptr; if (node->nod_type == nod_field - && (USHORT)(ULONG) node->nod_arg[e_fld_stream] == *ptr - && (USHORT)(ULONG) node->nod_arg[e_fld_id] == id) { + && (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr + && (USHORT)(IPTR) node->nod_arg[e_fld_id] == id) { desc = &descriptor; CMP_get_desc(tdbb, csb, node, desc); /* International type text has a computed key */ @@ -4766,11 +4766,11 @@ static RSB gen_sort(TDBB tdbb, ++sort_key; map_item->smb_node = node; 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; if (node->nod_type == nod_field) { - map_item->smb_stream = (USHORT)(ULONG) node->nod_arg[e_fld_stream]; - map_item->smb_field_id = (USHORT)(ULONG) node->nod_arg[e_fld_id]; + map_item->smb_stream = (USHORT)(IPTR) node->nod_arg[e_fld_stream]; + 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 it. */ while (stream_stack) { - id = (USHORT)(ULONG) LLS_POP(&id_stack); - stream = (USHORT)(ULONG) LLS_POP(&stream_stack); + id = (USHORT)(IPTR) LLS_POP(&id_stack); + stream = (USHORT)(IPTR) LLS_POP(&stream_stack); format = CMP_format(tdbb, csb, stream); desc = &format->fmt_desc[id]; 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_flag_offset = flag_offset++; 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_item++; } @@ -4809,7 +4809,7 @@ static RSB gen_sort(TDBB tdbb, desc = &map_item->smb_desc; desc->dsc_dtype = dtype_long; desc->dsc_length = sizeof(SLONG); - desc->dsc_address = (UCHAR *) map_length; + desc->dsc_address = (UCHAR *)(IPTR)map_length; map_length += desc->dsc_length; } @@ -4821,7 +4821,7 @@ static RSB gen_sort(TDBB tdbb, desc = &map_item->smb_desc; desc->dsc_dtype = dtype_long; desc->dsc_length = sizeof(SLONG); - desc->dsc_address = (UCHAR *) map_length; + desc->dsc_address = (UCHAR *) (IPTR)map_length; map_length += desc->dsc_length; } @@ -4834,7 +4834,7 @@ static RSB gen_sort(TDBB tdbb, desc = &map_item->smb_desc; desc->dsc_dtype = dtype_long; desc->dsc_length = sizeof(SLONG); - desc->dsc_address = (UCHAR *) map_length; + desc->dsc_address = (UCHAR *)(IPTR)map_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->rsb_type = rsb_union; 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_impure = CMP_impure(csb, sizeof(struct irsb)); 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 */ - *rsb_ptr++ = (RSB)(ULONG) nstreams; + *rsb_ptr++ = (RSB)(IPTR) nstreams; while (nstreams--) { - *rsb_ptr++ = (RSB)(ULONG) * streams++; + *rsb_ptr++ = (RSB)(IPTR) * streams++; } return rsb; } @@ -5649,8 +5649,8 @@ static jrd_nod* make_missing(TDBB tdbb, jrd_nod* field = boolean->nod_arg[0]; if (field->nod_type != nod_field) return NULL; - if ((USHORT)(ULONG) field->nod_arg[e_fld_stream] != stream || - (USHORT)(ULONG) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field) + if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream || + (USHORT)(IPTR) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field) { return NULL; } @@ -5731,8 +5731,8 @@ static jrd_nod* make_starts(TDBB tdbb, } } - if ((USHORT)(ULONG) field->nod_arg[e_fld_stream] != stream || - (USHORT)(ULONG) field->nod_arg[e_fld_id] != idx->idx_rpt[0].idx_field + if ((USHORT)(IPTR) field->nod_arg[e_fld_stream] != stream || + (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_byte_array || 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* const end = arg + plan_count; 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 */ 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 && 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 (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)) { match = value; value = boolean->nod_arg[0]; 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)) { return 0; @@ -5956,7 +5956,7 @@ static SSHORT match_index(TDBB tdbb, #ifdef EXPRESSION_INDICES (idx->idx_expression || #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 ) #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 that was used to generate this rsb */ 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); 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; 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; return true; } @@ -6626,7 +6626,7 @@ static void set_rse_inactive(Csb* csb, RSE rse) { jrd_nod* node = *ptr; 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; } else diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index d9d42953b7..c60a47fe96 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -910,7 +910,7 @@ static FIL seek_file(FIL file, BDB bdb, UINT64 * offset, ISC_STATUS * status_vec break; 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); 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 *= dbb->dbb_page_size; -#if _FILE_OFFSET_BITS != 64 - if (lseek_offset > MAX_SLONG) { - return (FIL)(ULONG) unix_error ("lseek", file, isc_io_32bit_exceeded_err, status_vector); + if (lseek_offset != LSEEK_OFFSET_CAST lseek_offset) { + return (FIL)(IPTR) unix_error ("lseek", file, isc_io_32bit_exceeded_err, status_vector); } -#endif #ifdef PREAD_PWRITE *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) { 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); } #endif diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index 5557373409..fc2253e1d3 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -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(); node->nod_type = nod_field; - node->nod_arg[e_fld_id] = (jrd_nod*) (SLONG) id; - node->nod_arg[e_fld_stream] = (jrd_nod*) (SLONG) stream; + node->nod_arg[e_fld_id] = (jrd_nod*) (IPTR) id; + node->nod_arg[e_fld_stream] = (jrd_nod*) (IPTR) stream; 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->nod_type = nod_dependency; 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; LLS_PUSH(dep_node, &csb->csb_dependencies); break; @@ -874,7 +874,7 @@ static XCP par_conditions(TDBB tdbb, Csb* csb) dep_node = PAR_make_node(tdbb, e_dep_length); dep_node->nod_type = nod_dependency; 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; LLS_PUSH(dep_node, &csb->csb_dependencies); break; @@ -981,7 +981,7 @@ static void par_dependency(TDBB tdbb, jrd_nod* field_node = PAR_make_node(tdbb, 1); node->nod_arg[e_dep_field] = field_node; 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); @@ -1442,7 +1442,7 @@ static jrd_nod* par_message(TDBB tdbb, Csb* csb) jrd_nod* node = PAR_make_node(tdbb, e_msg_length); tail->csb_message = node; 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) 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); if (alignment) offset = FB_ALIGN(offset, alignment); - desc->dsc_address = (UCHAR *) (SLONG) offset; + desc->dsc_address = (UCHAR *) (IPTR) offset; 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); node->nod_count = 1; - node->nod_arg[e_mod_org_stream] = (jrd_nod*) (SLONG) org_stream; - node->nod_arg[e_mod_new_stream] = (jrd_nod*) (SLONG) new_stream; + node->nod_arg[e_mod_org_stream] = (jrd_nod*) (IPTR) org_stream; + node->nod_arg[e_mod_new_stream] = (jrd_nod*) (IPTR) new_stream; node->nod_arg[e_mod_statement] = parse(tdbb, csb, STATEMENT); return node; @@ -1611,8 +1611,8 @@ static jrd_nod* par_plan(TDBB tdbb, Csb* csb) error(csb, isc_ctxnotdef, 0); 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_context] = (jrd_nod*) (SLONG) n; + relation_node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) stream; + relation_node->nod_arg[e_rel_context] = (jrd_nod*) (IPTR) n; /* 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; save the index name also, for convenience */ - access_type->nod_arg[0] = (jrd_nod*) relation_id; - access_type->nod_arg[1] = (jrd_nod*) index_id; + access_type->nod_arg[0] = (jrd_nod*) (IPTR) relation_id; + access_type->nod_arg[1] = (jrd_nod*) (IPTR) index_id; access_type->nod_arg[2] = (jrd_nod*) ALL_cstring(name); 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; save the index name also, for convenience */ - *arg++ = (jrd_nod*) relation_id; - *arg++ = (jrd_nod*) index_id; + *arg++ = (jrd_nod*) (IPTR) relation_id; + *arg++ = (jrd_nod*) (IPTR) index_id; *arg++ = (jrd_nod*) ALL_cstring(name); } 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); node->nod_type = nod_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); - 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; 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_ptr = message; 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 = input_flag ? procedure->prc_input_fmt : procedure->prc_output_fmt; /* 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_count = 1; 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] = PAR_make_node(tdbb, e_arg_length); prm_f->nod_type = nod_argument; prm_f->nod_count = 0; 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) && @@ -1996,8 +1996,8 @@ static jrd_nod* par_relation( SSHORT context; const SSHORT stream = par_context(csb, &context); fb_assert(stream <= MAX_STREAMS); - node->nod_arg[e_rel_stream] = (jrd_nod*) (SLONG) stream; - node->nod_arg[e_rel_context] = (jrd_nod*) (SLONG) context; + node->nod_arg[e_rel_stream] = (jrd_nod*) (IPTR) stream; + node->nod_arg[e_rel_context] = (jrd_nod*) (IPTR) context; csb->csb_rpt[stream].csb_relation = relation; 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); node->nod_count = 2; 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; /* 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; case blr_user_savepoint: - *arg++ = (jrd_nod*) (ULONG) BLR_BYTE; + *arg++ = (jrd_nod*) (IPTR) BLR_BYTE; par_name(csb, name); *arg++ = (jrd_nod*) ALL_cstring(name); 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)) error(csb, isc_ctxnotdef, 0); 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; case blr_modify: @@ -2540,12 +2540,12 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti break; 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); 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_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; 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, 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); /* 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); 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; 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; if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used)) 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; case blr_fetch: @@ -2627,7 +2627,7 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti case blr_dcl_variable: { 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)); vec* vector = csb->csb_variables = 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: { 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; if (!vector || n >= vector->count() || !(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; 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]; if (n >= format->fmt_count) 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_arg[e_arg_message] = message; 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) 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_arg[e_arg_message] = message; 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) error(csb, isc_badparnum, 0); } @@ -2750,12 +2750,12 @@ static jrd_nod* parse(TDBB tdbb, Csb* csb, USHORT expected, USHORT expected_opti break; 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); break; case blr_leave: - node->nod_arg[0] = (jrd_nod*) (SLONG) BLR_BYTE; + node->nod_arg[0] = (jrd_nod*) (IPTR) BLR_BYTE; break; diff --git a/src/jrd/rse.cpp b/src/jrd/rse.cpp index fd860d0d1d..fdaa3ad7d0 100644 --- a/src/jrd/rse.cpp +++ b/src/jrd/rse.cpp @@ -20,7 +20,7 @@ * All Rights Reserved. * 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 * seekable streams. @@ -728,8 +728,8 @@ void RSE_open(TDBB tdbb, RSB rsb) /* Initialize the record number of each stream in the union */ RSB* ptr = &rsb->rsb_arg[rsb->rsb_count]; - for (RSB* const end = ptr + (USHORT)(ULONG) * ptr; ++ptr <= end;) { - request->req_rpb[(USHORT)(ULONG) * ptr].rpb_number = -1; + for (RSB* const end = ptr + (USHORT)(IPTR) * ptr; ++ptr <= end;) { + request->req_rpb[(USHORT)(IPTR) * ptr].rpb_number = -1; } rsb = rsb->rsb_arg[0]; @@ -2123,7 +2123,7 @@ static BOOLEAN get_procedure(TDBB tdbb, EXE_receive(tdbb, proc_request, 1, oml, om); 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; dsc eos_desc; 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; stack = (LLS) rsb->rsb_arg[streams]; 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 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++) { flag = *(data + item->smb_flag_offset); 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) 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 */ 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; 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; for (item = map->smb_rpt; item < end_item; item++) { to = item->smb_desc; - to.dsc_address = data + (ULONG) to.dsc_address; + to.dsc_address = data + (IPTR) to.dsc_address; flag = FALSE; if (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. 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)) { INTL_string_to_key(tdbb, INTL_INDEX_TYPE(&item->smb_desc), from, &to, FALSE); @@ -3257,13 +3257,13 @@ static void proc_assignment( desc2.dsc_flags = 0; desc2.dsc_address = (UCHAR *) & indicator; desc1 = *flag_desc; - desc1.dsc_address = msg + (int) flag_desc->dsc_address; + desc1.dsc_address = msg + (IPTR) flag_desc->dsc_address; MOV_move(&desc1, &desc2); if (indicator) { SET_NULL(record, to_id); SSHORT l = to_desc->dsc_length; // it seems safer to use USHORT 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) { case dtype_text: /* YYY - not necessarily the right thing to do */ @@ -3294,9 +3294,9 @@ static void proc_assignment( else { CLEAR_NULL(record, to_id); desc1 = *from_desc; - desc1.dsc_address = msg + (int) desc1.dsc_address; + desc1.dsc_address = msg + (IPTR) desc1.dsc_address; 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))) MOV_move(&desc1, &desc2); @@ -3780,7 +3780,8 @@ static void write_merge_block(TDBB tdbb, MFB mfb, ULONG block) if (!sfb_->sfb_file_name) { 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) SORT_error(tdbb->tdbb_status_vector, sfb_, "open", isc_io_error, errno); diff --git a/src/jrd/scl.epp b/src/jrd/scl.epp index dd0aec128a..968af55389 100644 --- a/src/jrd/scl.epp +++ b/src/jrd/scl.epp @@ -1110,7 +1110,7 @@ static SLONG compute_access(TDBB tdbb, REQUEST(irq_l_security) = request; 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; while (true) { diff --git a/src/jrd/sdl.cpp b/src/jrd/sdl.cpp index 61cb873ecb..f8845912c7 100644 --- a/src/jrd/sdl.cpp +++ b/src/jrd/sdl.cpp @@ -704,7 +704,7 @@ static BOOLEAN execute(SDL_ARG arg) } element_desc = array_desc->ads_rpt[value].ads_desc; element_desc.dsc_address = (BLOB_PTR *) arg->sdl_arg_array + - (SLONG) element_desc.dsc_address + + (IPTR) element_desc.dsc_address + (array_desc->ads_element_length * subscript); /* Is this element within the array bounds? */ diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index ab0b17040a..f9a79ae859 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * @@ -1771,7 +1771,7 @@ static ULONG find_file_space(SCB scb, ULONG size, SFB * ret_sfb) // Create a scratch 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); // allocate the file name even if the file is not open, diff --git a/src/jrd/tra.h b/src/jrd/tra.h index af38a0861b..84e3e6e3c7 100644 --- a/src/jrd/tra.h +++ b/src/jrd/tra.h @@ -67,6 +67,7 @@ class jrd_tra : public pool_alloc_rpt class traRpbList *tra_rpblist; /* active RPB's of given transaction */ UCHAR tra_use_count; /* use count for safe AST delivery */ 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]; }; diff --git a/src/jrd/utl.cpp b/src/jrd/utl.cpp index 6f8422c476..64fa7cc556 100644 --- a/src/jrd/utl.cpp +++ b/src/jrd/utl.cpp @@ -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, 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. * **************************************/ - if (!routine) { - routine = (FPTR_VERSION_CALLBACK) ib_printf; - user_arg = (void*)"\t%s\n"; - } + if (!routine) + routine = print_version; UCHAR buffer[256]; UCHAR* buf = buffer; diff --git a/src/jrd/val.h b/src/jrd/val.h index d795d5cada..a9a8a172ea 100644 --- a/src/jrd/val.h +++ b/src/jrd/val.h @@ -168,6 +168,7 @@ class arr : public pool_alloc_rpt SLONG arr_effective_length; /* Length of array instance */ USHORT arr_desc_length; /* Length of array descriptor */ struct ads arr_desc; /* Array descriptor */ + ULONG arr_temp_id; // Temporary ID for open array inside the transaction }; typedef arr* ARR; diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index e575c054ac..20aa05f2da 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -2683,7 +2683,7 @@ void VIO_store(TDBB tdbb, RPB * rpb, jrd_tra* transaction) rpb->rpb_flags = 0; rpb->rpb_transaction = transaction->tra_number; 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); #ifdef VIO_DEBUG @@ -4268,7 +4268,7 @@ static int prepare_update( TDBB tdbb, DPM_store(tdbb, temp, stack, DPM_secondary); continue; } - LLS_PUSH((BLK) temp->rpb_page, stack); + LLS_PUSH((BLK) (IPTR)temp->rpb_page, stack); return PREPARE_OK; case tra_active: @@ -4649,7 +4649,7 @@ retry: temp2.rpb_number = org_rpb->rpb_number; 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)) { diff --git a/src/jrd/why.cpp b/src/jrd/why.cpp index ee71b65b32..87757cd53e 100644 --- a/src/jrd/why.cpp +++ b/src/jrd/why.cpp @@ -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" @@ -171,7 +171,7 @@ typedef struct clean DatabaseCleanupRoutine* DatabaseRoutine; TransactionCleanupRoutine *TransactionRoutine; }; - SLONG clean_arg; + void* clean_arg; } *CLEAN; /* 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, WHY_ATT * handle, 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; database->cleanup = clean; clean->DatabaseRoutine = routine; - clean->clean_arg = (SLONG) arg; + clean->clean_arg = arg; status[0] = isc_arg_gds; 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, WHY_TRA * tra_handle, TransactionCleanupRoutine *routine, - SLONG arg) + void* arg) { /************************************** * diff --git a/src/jrd/why_proto.h b/src/jrd/why_proto.h index 97be8adb2e..75a68d99d0 100644 --- a/src/jrd/why_proto.h +++ b/src/jrd/why_proto.h @@ -251,7 +251,7 @@ ISC_STATUS API_ROUTINE isc_wait_for_event(ISC_STATUS*, FRBRD**, USHORT, #endif -typedef void DatabaseCleanupRoutine(FRBRD**, SLONG); +typedef void DatabaseCleanupRoutine(FRBRD**, void*); #ifdef CANCEL_OPERATION #define CANCEL_disable 1 @@ -261,14 +261,14 @@ ISC_STATUS API_ROUTINE gds__cancel_operation(ISC_STATUS*, FRBRD**, USHORT); #endif 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__enable_subsystem(TEXT*); 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**, - TransactionCleanupRoutine*, SLONG); + TransactionCleanupRoutine*, void*); #ifdef SERVER_SHUTDOWN BOOLEAN WHY_set_shutdown(BOOLEAN); diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 28bb900515..c7c1a3ca7f 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -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" @@ -736,7 +736,7 @@ void LOCK_fini( ISC_STATUS * status_vector, PTR * owner_offset) release_mutex(); #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 *owner_offset = (PTR)0; @@ -798,7 +798,7 @@ int LOCK_init( #ifdef USE_BLOCKING_SIGNALS if (LOCK_owner_offset) ISC_signal(LOCK_block_signal, blocking_action, - (void *) LOCK_owner_offset); + (void *)(IPTR) LOCK_owner_offset); #endif /* Initialize process level stuffs for different platforms. diff --git a/src/remote/interface.cpp b/src/remote/interface.cpp index f3464e29c8..7d5a267936 100644 --- a/src/remote/interface.cpp +++ b/src/remote/interface.cpp @@ -2031,7 +2031,7 @@ ISC_STATUS GDS_DSQL_FREE(ISC_STATUS * user_status, RSR * stmt_handle, USHORT opt 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) { release_sql_request(statement); *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_address = const_cast(items); 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; 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 to = *to_desc; // Safe const cast, we are going to move from it to anywhere. - from.dsc_address = const_cast(from_msg) + (SLONG) from.dsc_address; - to.dsc_address = to_msg + (SLONG) to.dsc_address; + from.dsc_address = const_cast(from_msg) + (IPTR) from.dsc_address; + to.dsc_address = to_msg + (IPTR) to.dsc_address; CVT_move(&from, &to, move_error); } diff --git a/src/remote/parser.cpp b/src/remote/parser.cpp index ceba9aefdb..d626a0214d 100644 --- a/src/remote/parser.cpp +++ b/src/remote/parser.cpp @@ -21,7 +21,7 @@ * 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" @@ -225,7 +225,7 @@ REM_MSG PARSE_messages(const UCHAR* blr, USHORT blr_length) net_length += (desc->dsc_length + 3) & ~3; if (align > 1) offset = FB_ALIGN(offset, align); - desc->dsc_address = (UCHAR *)(ULONG) offset; + desc->dsc_address = (UCHAR*) (IPTR) offset; offset += desc->dsc_length; } format->fmt_length = offset; diff --git a/src/remote/protocol.cpp b/src/remote/protocol.cpp index e6a37418de..b1cb06b7a7 100644 --- a/src/remote/protocol.cpp +++ b/src/remote/protocol.cpp @@ -531,10 +531,13 @@ bool_t xdr_protocol(XDR* xdrs, PACKET* p) MAP(xdr_short, reinterpret_cast(event->p_event_database)); 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(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_rid); DEBUG_PRINTSIZE(p->p_operation); return P_TRUE; @@ -984,7 +987,7 @@ static bool_t xdr_datum( XDR* xdrs, DSC* desc, BLOB_PTR* buffer) **************************************/ SSHORT n; - BLOB_PTR* p = buffer + (ULONG) desc->dsc_address; + BLOB_PTR* p = buffer + (IPTR) desc->dsc_address; switch (desc->dsc_dtype) { 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; desc < end; desc++) 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); } @@ -1382,7 +1385,7 @@ static bool_t xdr_semi_opaque( XDR* xdrs, REM_MSG message, FMT format) if (desc->dsc_dtype == dtype_d_float) { convert = (double *) (message->msg_address + - (int) desc->dsc_address); + (IPTR) desc->dsc_address); *convert = MTH$CVT_G_D(convert); } return TRUE; diff --git a/src/remote/server.cpp b/src/remote/server.cpp index 1941f2fc39..e7338639ac 100644 --- a/src/remote/server.cpp +++ b/src/remote/server.cpp @@ -2452,7 +2452,7 @@ ISC_STATUS port::get_slice(P_SLC * stuff, PACKET* send) stuff->p_slc_parameters.cstr_length, (const ISC_LONG*) stuff->p_slc_parameters.cstr_address, stuff->p_slc_length, slice, - reinterpret_cast(&response->p_slr_length)); + reinterpret_cast(&response->p_slr_length)); THREAD_ENTER; 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; // Probalby should define this item with CSTRING_CONST instead. p_event->p_event_items.cstr_address = const_cast(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; - // CVC: Using SLONG to keep pointer! - p_event->p_event_arg = (SLONG) event->rvnt_arg; + p_event->p_event_arg = (SLONG)(IPTR) event->rvnt_arg; + p_event->p_event_rid = event->rvnt_rid; port->send(&packet); @@ -4396,7 +4399,7 @@ ISC_STATUS port::service_start(P_INFO * stuff, PACKET* send) THREAD_EXIT; isc_service_start(status_vector, &rdb->rdb_handle, - reinterpret_cast(reserved), + reinterpret_cast(reserved), stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address)); THREAD_ENTER;