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

-Undo gds__vax_integer to isc_vax_integer and gds__event_* to isc_event_* changes

This commit is contained in:
brodsom 2003-11-16 01:44:51 +00:00
parent a4b537468d
commit 6e8e00c191
26 changed files with 213 additions and 204 deletions

View File

@ -27,7 +27,7 @@
*
*____________________________________________________________
*
* $Id: alice_meta.epp,v 1.25 2003-11-11 12:05:30 brodsom Exp $
* $Id: alice_meta.epp,v 1.26 2003-11-16 01:43:07 brodsom Exp $
*/
#include "firebird.h"
@ -343,7 +343,7 @@ static TDR get_description(SLONG blob_id[2])
case TDR_TRANSACTION_ID:
id_length = *p++;
id = isc_vax_integer(reinterpret_cast<SCHAR*>(p), id_length);
id = gds__vax_integer((UCHAR*) p, id_length);
p += id_length;
if (!trans)
trans = ptr = FB_NEW(*tdgbl->ALICE_default_pool) tdr;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: exe.cpp,v 1.25 2003-11-11 12:05:30 brodsom Exp $
// $Id: exe.cpp,v 1.26 2003-11-16 01:43:07 brodsom Exp $
//
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports
@ -342,52 +342,52 @@ static void extract_db_info(const UCHAR* db_info_buffer)
UCHAR item;
while ((item = *p++) != isc_info_end) {
const SLONG length = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2);
const SLONG length = gds__vax_integer(p, 2);
p += 2;
// TMN: Here we should really have the following assert
// fb_assert(length <= MAX_SSHORT);
// for all cases that use 'length' as input to 'isc_vax_integer'
// for all cases that use 'length' as input to 'gds__vax_integer'
switch (item) {
case isc_info_page_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_record_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_RECORD_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_bpage_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_BLOB_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_dpage_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_DATA_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_ipage_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_INDEX_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_ppage_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_POINTER_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;
case isc_info_tpage_errors:
tdgbl->ALICE_data.ua_val_errors[VAL_TIP_PAGE_ERRORS] =
isc_vax_integer(reinterpret_cast<const SCHAR*>(p), (SSHORT) length);
gds__vax_integer(p, (SSHORT) length);
p += length;
break;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: tdr.cpp,v 1.29 2003-11-11 12:05:29 brodsom Exp $
// $Id: tdr.cpp,v 1.30 2003-11-16 01:43:07 brodsom Exp $
//
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
//
@ -309,11 +309,11 @@ void TDR_list_limbo(FRBRD* handle, const TEXT* name, const ULONG switches)
while (flag) {
const USHORT item = *ptr++;
const USHORT length = (USHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(ptr), 2);
const USHORT length = (USHORT) gds__vax_integer(ptr, 2);
ptr += 2;
switch (item) {
case isc_info_limbo:
id = isc_vax_integer(reinterpret_cast<const SCHAR*>(ptr), length);
id = gds__vax_integer(ptr, length);
if (switches &
(sw_commit | sw_rollback | sw_two_phase | sw_prompt))
{
@ -879,7 +879,7 @@ static bool reconnect(FRBRD* handle,
{
ISC_STATUS_ARRAY status_vector;
const SLONG id = isc_vax_integer((SCHAR*) &number, 4);
const SLONG id = gds__vax_integer((UCHAR *) &number, 4);
FRBRD* transaction = NULL;
if (isc_reconnect_transaction(status_vector, &handle, &transaction,
sizeof(id),

View File

@ -794,7 +794,7 @@ static SLONG get_numeric(void)
SSHORT length = get_text((UCHAR*) value, sizeof(value));
return isc_vax_integer(reinterpret_cast<const SCHAR*>(value), length);
return gds__vax_integer((UCHAR*) value, length);
}
@ -1082,7 +1082,7 @@ static void put_numeric( SCHAR attribute, int value)
{
TGBL tdgbl = GET_THREAD_DATA;
ULONG vax_value = isc_vax_integer(reinterpret_cast<const SCHAR*>(&value), sizeof(value));
ULONG vax_value = gds__vax_integer((UCHAR *) & value, sizeof(value));
UCHAR* p = (UCHAR *) &vax_value;
put(tdgbl, attribute);
@ -1269,8 +1269,7 @@ static bool write_header(DESC handle,
}
else
{
ULONG vax_value = isc_vax_integer(reinterpret_cast<const SCHAR*>(
&(tdgbl->mvol_volume_count)),
ULONG vax_value = gds__vax_integer((UCHAR*) &(tdgbl->mvol_volume_count),
sizeof(tdgbl->mvol_volume_count));
const UCHAR *p = (UCHAR *) &vax_value;
UCHAR *q = tdgbl->mvol_io_volume;

View File

@ -24,7 +24,7 @@
* 2003.08.17 Claudio Valderrama: Fix SF Bug #750659.
*/
/*
$Id: restore.epp,v 1.55 2003-11-11 12:05:48 brodsom Exp $
$Id: restore.epp,v 1.56 2003-11-16 01:43:24 brodsom Exp $
*/
#include "firebird.h"
@ -1208,9 +1208,9 @@ bool get_acl (const TEXT *owner_nm,
while ((item = *p++) != isc_info_end)
{
USHORT l = (USHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2);
USHORT l = (USHORT) gds__vax_integer (p, 2);
p += 2;
SLONG n = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), l);
SLONG n = gds__vax_integer (p, l);
p += l;
switch (item)
{

View File

@ -1678,8 +1678,10 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
}
else if (item == isc_info_sql_sqlda_start) {
length = *items++;
first_index = static_cast<USHORT>(isc_vax_integer(reinterpret_cast
<const SCHAR*>(items), length));
first_index =
static_cast<USHORT>
(gds__vax_integer
(items, length));
items += length;
}
else if (item == isc_info_sql_batch_fetch) {
@ -3708,28 +3710,33 @@ static USHORT get_request_info(
UCHAR p;
while ((p = *data++) != isc_info_end) {
const USHORT data_length =
static_cast <USHORT>(isc_vax_integer(data, 2));
static_cast < USHORT >
(gds__vax_integer(reinterpret_cast<UCHAR*>(data), 2));
data += 2;
switch (p) {
case isc_info_req_update_count:
request->req_updates =
isc_vax_integer(data, data_length);
gds__vax_integer(reinterpret_cast<UCHAR*>(data),
data_length);
break;
case isc_info_req_delete_count:
request->req_deletes =
isc_vax_integer(data, data_length);
gds__vax_integer(reinterpret_cast<UCHAR*>(data),
data_length);
break;
case isc_info_req_select_count:
request->req_selects =
isc_vax_integer(data, data_length);
gds__vax_integer(reinterpret_cast<UCHAR*>(data),
data_length);
break;
case isc_info_req_insert_count:
request->req_inserts =
isc_vax_integer(data, data_length);
gds__vax_integer(reinterpret_cast<UCHAR*>(data),
data_length);
break;
default:
@ -4159,7 +4166,9 @@ static DBB init(FRBRD** db_handle)
UCHAR p;
while ((p = *data++) != isc_info_end)
{
SSHORT l = static_cast<SSHORT>(isc_vax_integer(data, 2));
SSHORT l =
static_cast<SSHORT>(
gds__vax_integer(reinterpret_cast<UCHAR*>(data), 2));
data += 2;
switch (p)
@ -4169,7 +4178,7 @@ static DBB init(FRBRD** db_handle)
break;
case isc_info_ods_version:
if (isc_vax_integer(data, l) > 7)
if (gds__vax_integer(reinterpret_cast<UCHAR*>(data), l) > 7)
database->dbb_flags &= ~DBB_v3;
break;
@ -4203,7 +4212,7 @@ static DBB init(FRBRD** db_handle)
case frb_info_att_charset:
database->dbb_att_charset =
static_cast<short>(
isc_vax_integer(data, 2));
gds__vax_integer(reinterpret_cast<UCHAR*>(data), 2));
break;
default:

View File

@ -30,7 +30,7 @@
*/
/*
$Id: utld.cpp,v 1.22 2003-11-11 12:06:53 brodsom Exp $
$Id: utld.cpp,v 1.23 2003-11-16 01:43:40 brodsom Exp $
*/
#include "firebird.h"
@ -793,9 +793,9 @@ static ISC_STATUS error_dsql_804( ISC_STATUS * status, ISC_STATUS err)
**/
static SLONG get_numeric_info( SCHAR ** ptr)
{
SSHORT l = static_cast<SSHORT>(isc_vax_integer(*ptr, 2));
SSHORT l = static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<UCHAR*>(*ptr), 2));
*ptr += 2;
int item = isc_vax_integer(*ptr, l);
int item = gds__vax_integer(reinterpret_cast<UCHAR*>(*ptr), l);
*ptr += l;
return item;
@ -819,7 +819,7 @@ static SLONG get_numeric_info( SCHAR ** ptr)
static SLONG get_string_info( SCHAR ** ptr, SCHAR * buffer, int buffer_len)
{
SCHAR *p = *ptr;
SSHORT l = static_cast<SSHORT>(isc_vax_integer(p, 2));
SSHORT l = static_cast<SSHORT>(gds__vax_integer(reinterpret_cast<UCHAR*>(p), 2));
*ptr += l + 2;
p += 2;

View File

@ -1060,8 +1060,8 @@ static void add_files( DBB dbb, FIL files)
DDL_err(38, NULL, NULL, NULL, NULL, NULL);
/* msg 38: isc_database_info failed */
length = isc_vax_integer(reinterpret_cast<const SCHAR*>(s + 1), 2);
start = isc_vax_integer(reinterpret_cast<const SCHAR*>(s + 3), length);
length = gds__vax_integer((UCHAR*) s + 1, 2);
start = gds__vax_integer((UCHAR*) s + 3, length);
length = (dbb->dbb_length) ? dbb->dbb_length + 1 : 0;
start = MAX(start, length);
@ -4305,11 +4305,11 @@ static void wal_info(UCHAR * db_info_buffer,
p = db_info_buffer;
while ((item = *p++) != isc_info_end) {
length = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2);
length = gds__vax_integer(p, 2);
p += 2;
switch (item) {
case isc_info_logfile:
*log = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*log = gds__vax_integer(p, length);
p += length;
break;
@ -4322,7 +4322,7 @@ static void wal_info(UCHAR * db_info_buffer,
break;
case isc_info_cur_log_part_offset:
*part_offset = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*part_offset = gds__vax_integer(p, length);
p += length;
break;

View File

@ -275,7 +275,7 @@ static void decompile_blr_literal(const SCHAR * string)
switch (*p++) {
case (blr_text):
size = isc_vax_integer(p, 2);
size = gds__vax_integer((UCHAR*) p, 2);
p += 2;
*b++ = '"';
while (size--)
@ -286,13 +286,13 @@ static void decompile_blr_literal(const SCHAR * string)
case (blr_long):
scale = *p++;
value = isc_vax_integer(p, 4);
value = gds__vax_integer((UCHAR*) p, 4);
binary_to_ascii(value, scale, buffer);
break;
case (blr_short):
scale = *p++;
value = isc_vax_integer(p, 2);
value = gds__vax_integer((UCHAR*) p, 2);
binary_to_ascii(value, scale, buffer);
break;
@ -512,9 +512,9 @@ static void extract_database(const TEXT * DB_file_name)
TEXT* d = buffer;
if (*d++ == isc_info_page_size) {
SSHORT length = isc_vax_integer(d, 2);
SSHORT length = gds__vax_integer((UCHAR*) d, 2);
d += 2;
page_size = isc_vax_integer(d, length);
page_size = gds__vax_integer((UCHAR*) d, length);
if (page_size)
ib_fprintf(output_file, "\n\tpage_size %"SLONGFORMAT, page_size);
}
@ -2103,23 +2103,23 @@ static void wal_info(const UCHAR* db_info_buffer,
const UCHAR* p = db_info_buffer;
while ((item = *p++) != isc_info_end) {
USHORT length = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2);
USHORT length = gds__vax_integer(p, 2);
p += 2;
switch (item) {
case isc_info_num_wal_buffers:
*num_buf = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*num_buf = gds__vax_integer(p, length);
break;
case isc_info_wal_buffer_size:
*buf_size = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*buf_size = gds__vax_integer(p, length);
break;
case isc_info_wal_ckpt_length:
*chkpt_len = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*chkpt_len = gds__vax_integer(p, length);
break;
case isc_info_wal_grpc_wait_usecs:
*grp_commit = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
*grp_commit = gds__vax_integer(p, length);
break;
default:

View File

@ -6437,8 +6437,8 @@ static int process_statement(TEXT* string,
}
else {
if (info_buffer [0] == isc_info_sql_stmt_type) {
l = isc_vax_integer(info_buffer + 1, 2);
statement_type = isc_vax_integer(info_buffer + 3, l);
l = gds__vax_integer((UCHAR*) info_buffer + 1, 2);
statement_type = gds__vax_integer( (UCHAR*) info_buffer + 3, l);
}
}
@ -6531,7 +6531,7 @@ static int process_statement(TEXT* string,
ISQL_errmsg(isc_status);
}
else if (plan_buffer[0] == isc_info_sql_get_plan) {
l = isc_vax_integer(plan_buffer + 1, 2);
l = gds__vax_integer((UCHAR*) plan_buffer + 1, 2);
sprintf(Print_buffer, "%.*s%s", l, plan_buffer + 3, NEWLINE);
ISQL_printf(Diag, Print_buffer);
}
@ -6613,9 +6613,9 @@ static int process_statement(TEXT* string,
for (p = count_buffer + 3; *p != isc_info_end;) {
count_is = *p++;
l = isc_vax_integer(p, 2);
l = gds__vax_integer((UCHAR*) p, 2);
p += 2;
count = isc_vax_integer(p, l);
count = gds__vax_integer((UCHAR*) p, l);
p += l;
if (count_is == count_type)
break;

View File

@ -260,7 +260,9 @@ static void process_start_dump(CNCT, LTJW *);
static void process_wal_file(CNCT, LTJW *);
static void put_line(CNCT, SSHORT, const TEXT*, const TEXT*, const TEXT*);
static void put_message(SSHORT, DJB);
#ifdef WIN_NT
static void read_asynchronous(CNCT);
#endif
static void report_status(CNCT);
static void restart_all_backups(int);
static void restart_backup(DJB, int);

View File

@ -54,30 +54,29 @@ bool is_valid_server(ISC_STATUS* status, const TEXT* server);
FRBRD *open_security_db(ISC_STATUS*, const TEXT*, const TEXT*, int, const TEXT*);
void get_security_error(ISC_STATUS*, int);
SLONG API_ROUTINE gds__event_block(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, ...)
SLONG API_ROUTINE_VARARG isc_event_block(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, ...)
{
/**************************************
*
* g d s _ $ e v e n t _ b l o c k
* i s c _ e v e n t _ b l o c k
*
**************************************
*
* Functional description
* Create an initialized event parameter block from a
* variable number of input arguments.
* Return the size of the block.
* Create an initialized event parameter block from a
* variable number of input arguments.
* Return the size of the block.
*
* Return 0 as the size if the event parameter block cannot be
* created for any reason.
* Return 0 if any error occurs.
*
**************************************/
SCHAR *p, *q;
SCHAR *end;
SLONG length;
va_list ptr;
USHORT i;
va_list ptr;
VA_START(ptr, count);
@ -92,21 +91,19 @@ SLONG API_ROUTINE gds__event_block(SCHAR ** event_buffer,
length += strlen(q) + 5;
}
p = *event_buffer =
(SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
p = *event_buffer = (SCHAR *) gds__alloc((SLONG) length);
/* FREE: apparently never freed */
if (!*event_buffer) /* NOMEM: */
return 0;
*result_buffer = (SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*result_buffer) { /* NOMEM: */
if ((*result_buffer = (SCHAR *) gds__alloc((SLONG) length)) == NULL) { /* NOMEM: */
/* FREE: apparently never freed */
gds__free(*event_buffer);
*event_buffer = NULL;
return 0;
}
#ifdef DEBUG_GDS_ALLOC
/* I can't find anywhere these items are freed */
/* I can find no place where these are freed */
/* 1994-October-25 David Schnepper */
gds_alloc_flag_unfreed((void *) *event_buffer);
gds_alloc_flag_unfreed((void *) *result_buffer);
@ -122,7 +119,7 @@ SLONG API_ROUTINE gds__event_block(SCHAR ** event_buffer,
while (i--) {
q = va_arg(ptr, SCHAR *);
/* Strip trailing blanks from string */
/* Strip the blanks from the ends */
for (end = q + strlen(q); --end >= q && *end == ' ';);
*p++ = end - q + 1;
@ -134,18 +131,17 @@ SLONG API_ROUTINE gds__event_block(SCHAR ** event_buffer,
*p++ = 0;
}
return p - *event_buffer;
return (int) (p - *event_buffer);
}
USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
SCHAR ** result_buffer,
SSHORT count,
SCHAR ** name_buffer)
USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, TEXT ** name_buffer)
{
/**************************************
*
* g d s _ $ e v e n t _ b l o c k _ a
* i s c _ e v e n t _ b l o c k _ a
*
**************************************
*
@ -156,8 +152,10 @@ USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
* Return the size of the block.
*
**************************************/
#define MAX_NAME_LENGTH 31
SCHAR *p, *q;
SCHAR *end, **nb;
SCHAR *end;
TEXT **nb;
SLONG length;
USHORT i;
@ -173,26 +171,25 @@ USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
/* Strip trailing blanks from string */
for (end = q + 31; --end >= q && *end == ' ';);
for (end = q + MAX_NAME_LENGTH; --end >= q && *end == ' ';);
length += end - q + 1 + 5;
}
i = count;
p = *event_buffer =
(SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*event_buffer) /* NOMEM: */
p = *event_buffer = (SCHAR *) gds__alloc((SLONG) length);
/* FREE: apparently never freed */
if (!(*event_buffer)) /* NOMEM: */
return 0;
*result_buffer = (SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*result_buffer) { /* NOMEM: */
if ((*result_buffer = (SCHAR *) gds__alloc((SLONG) length)) == NULL) { /* NOMEM: */
/* FREE: apparently never freed */
gds__free(*event_buffer);
*event_buffer = NULL;
return 0;
}
#ifdef DEBUG_GDS_ALLOC
/* I can't find anywhere these items are freed */
/* I can find no place where these are freed */
/* 1994-October-25 David Schnepper */
gds_alloc_flag_unfreed((void *) *event_buffer);
gds_alloc_flag_unfreed((void *) *result_buffer);
@ -207,7 +204,7 @@ USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
/* Strip trailing blanks from string */
for (end = q + 31; --end >= q && *end == ' ';);
for (end = q + MAX_NAME_LENGTH; --end >= q && *end == ' ';);
*p++ = end - q + 1;
while (q <= end)
*p++ = *q++;
@ -221,16 +218,15 @@ USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
}
void API_ROUTINE gds__event_block_s(
SCHAR ** event_buffer,
SCHAR ** result_buffer,
SSHORT count,
SCHAR ** name_buffer,
SSHORT * return_count)
void API_ROUTINE isc_event_block_s(
SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count,
TEXT ** name_buffer, USHORT * return_count)
{
/**************************************
*
* g d s _ $ e v e n t _ b l o c k _ s
* i s c _ e v e n t _ b l o c k _ s
*
**************************************
*
@ -241,7 +237,7 @@ void API_ROUTINE gds__event_block_s(
**************************************/
*return_count =
gds__event_block_a(event_buffer, result_buffer, count, name_buffer);
isc_event_block_a(event_buffer, result_buffer, count, name_buffer);
}
@ -707,9 +703,9 @@ void API_ROUTINE gds__encode_date(const void* time_structure, GDS_QUAD* date)
isc_encode_date(time_structure, date);
}
SLONG API_ROUTINE gds__vax_integer(const UCHAR* input, SSHORT length)
SLONG API_ROUTINE isc_vax_integer(const SCHAR* input, SSHORT length)
{
return isc_vax_integer(reinterpret_cast<const SCHAR*>(input), length);
return gds__vax_integer(reinterpret_cast<const UCHAR*>(input), length);
}
#ifndef REQUESTER

View File

@ -105,17 +105,13 @@ void API_ROUTINE gds__decode_date(const GDS_QUAD*, void*);
void API_ROUTINE gds__encode_date(const void*, GDS_QUAD*);
int API_ROUTINE gds__version(FRBRD**, void(*) (), void*);
void API_ROUTINE gds__set_debug(int);
SLONG API_ROUTINE gds__vax_integer(const UCHAR*, SSHORT);
//
// gds_ functions which don't use isc_ functions (the isc_ ones are in utl.cpp)
// isc_ functions which are not mapped to gds_ functions (the gds_ ones are in utl.cpp)
// Should be analyzed
//
SLONG API_ROUTINE gds__event_block(SCHAR **, SCHAR **, USHORT, ...);
USHORT API_ROUTINE gds__event_block_a(SCHAR **, SCHAR **, SSHORT, SCHAR **);
void API_ROUTINE gds__event_block_s(SCHAR **, SCHAR **, SSHORT,
SCHAR **, SSHORT *);
SLONG API_ROUTINE_VARARG isc_event_block(SCHAR**, SCHAR**, USHORT, ...);
USHORT API_ROUTINE isc_event_block_a(SCHAR**, SCHAR**, USHORT, TEXT**);
void API_ROUTINE isc_event_block_s(SCHAR**, SCHAR**, USHORT, TEXT**, USHORT*);
//
// isc functions using gds_ functions (gds_ functions defined in gds.cpp)
//
@ -128,9 +124,9 @@ SLONG API_ROUTINE isc_sqlcode(const ISC_STATUS*);
void API_ROUTINE isc_sqlcode_s(const ISC_STATUS*, ULONG*);
void API_ROUTINE isc_vtof(const SCHAR*, SCHAR*, USHORT);
void API_ROUTINE isc_vtov(const SCHAR*, SCHAR*, SSHORT);
SLONG API_ROUTINE isc_vax_integer(const SCHAR*, SSHORT);
SLONG API_ROUTINE isc_interprete(SCHAR*, ISC_STATUS**);
SLONG API_ROUTINE isc_interprete_cpp(SCHAR* const, const ISC_STATUS**);
//
// isc_ functions with no gds_ equivalence
//

View File

@ -615,7 +615,7 @@ SLONG DYN_get_number(const UCHAR** ptr)
length |= (*p++) << 8;
*ptr = p + length;
return isc_vax_integer(reinterpret_cast<const SCHAR*>(p), length);
return gds__vax_integer(p, length);
}

View File

@ -141,8 +141,8 @@ void DYN_modify_database( GBL gbl, const UCHAR** ptr)
request = (BLK) CMP_find_request(tdbb, drq_m_database, DYN_REQUESTS);
const SSHORT length = isc_vax_integer(reinterpret_cast<const SCHAR*>(s + 1), 2);
SLONG start = isc_vax_integer(reinterpret_cast<const SCHAR*>(s + 3), length);
const SSHORT length = gds__vax_integer(s + 1, 2);
SLONG start = gds__vax_integer(s + 3, length);
bool log_params_defined = false;
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)

View File

@ -506,7 +506,7 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
ptr = &interest->rint_next;
ptr_offset = REL_PTR(ptr);
interest->rint_request = request_offset;
interest->rint_count = isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 4);
interest->rint_count = gds__vax_integer(p, 4);
p += 4;
if (interest->rint_count <= event->evnt_count)
flag = TRUE;

View File

@ -1063,7 +1063,7 @@ ISC_STATUS filter_trans(USHORT action, CTL control)
case TDR_TRANSACTION_ID:
id =
isc_vax_integer(p, length);
gds__vax_integer(reinterpret_cast < UCHAR * >(p), length);
sprintf(out, " Transaction id: %ld", id);
break;

View File

@ -712,9 +712,9 @@ SINT64 API_ROUTINE isc_portable_integer(const UCHAR* ptr, SSHORT length)
*
* **Note**
*
* This function is similar to isc_vax_integer() in functionality.
* This function is similar to gds__vax_integer() in functionality.
* The difference is in the return type. Changed from SLONG to SINT64
* Since isc_vax_integer() is a public API routine, it could not be
* Since gds__vax_integer() is a public API routine, it could not be
* changed. This function has been made public so gbak can use it.
*
**************************************/
@ -2002,32 +2002,25 @@ USHORT API_ROUTINE gds__parse_bpb2(USHORT bpb_length,
length = *p++;
switch (op) {
case gds_bpb_source_type:
*source = (USHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(p),
length);
*source = (USHORT) gds__vax_integer(p, length);
break;
case gds_bpb_target_type:
*target = (USHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(p),
length);
*target = (USHORT) gds__vax_integer(p, length);
break;
case gds_bpb_type:
type = (USHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(p),
length);
type = (USHORT) gds__vax_integer(p, length);
break;
case gds_bpb_source_interp:
if (source_interp)
*source_interp = (USHORT) isc_vax_integer(reinterpret_cast
<const SCHAR*>(p),
length);
*source_interp = (USHORT) gds__vax_integer(p, length);
break;
case gds_bpb_target_interp:
if (target_interp)
*target_interp = (USHORT) isc_vax_integer(reinterpret_cast
<const SCHAR*>(p),
length);
*target_interp = (USHORT) gds__vax_integer(p, length);
break;
default:
@ -2604,11 +2597,11 @@ BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT* module,
#endif
SLONG API_ROUTINE isc_vax_integer(const SCHAR* ptr, SSHORT length)
SLONG API_ROUTINE gds__vax_integer(const UCHAR* ptr, SSHORT length)
{
/**************************************
*
* i s c _ v a x _ i n t e g e r
* g d s _ $ v a x _ i n t e g e r
*
**************************************
*
@ -2623,7 +2616,7 @@ SLONG API_ROUTINE isc_vax_integer(const SCHAR* ptr, SSHORT length)
value = shift = 0;
while (--length >= 0) {
value += ((SLONG) (UCHAR) *ptr++) << shift;
value += ((SLONG) * ptr++) << shift;
shift += 8;
}

View File

@ -128,7 +128,7 @@ void* API_ROUTINE gds__temp_file(BOOLEAN, const TEXT*, TEXT*, TEXT* = NULL,
void API_ROUTINE gds__unregister_cleanup(FPTR_VOID_PTR, void*);
BOOLEAN API_ROUTINE gds__validate_lib_path(const TEXT*, const TEXT*, TEXT*,
SLONG);
SLONG API_ROUTINE isc_vax_integer(const SCHAR*, SSHORT);
SLONG API_ROUTINE gds__vax_integer(const UCHAR*, SSHORT);
void API_ROUTINE gds__vtof(const SCHAR*, SCHAR*, USHORT);
void API_ROUTINE gds__vtov(const SCHAR*, char*, SSHORT);
void API_ROUTINE isc_print_sqlerror(SSHORT, const ISC_STATUS*);

View File

@ -5387,7 +5387,7 @@ static SLONG get_parameter(const UCHAR** ptr)
*
**************************************/
const SSHORT l = *(*ptr)++;
const SLONG parameter = isc_vax_integer(reinterpret_cast<const SCHAR*>(*ptr), l);
const SLONG parameter = gds__vax_integer(*ptr, l);
*ptr += l;
return parameter;

View File

@ -512,7 +512,7 @@ static void log_long(SLONG number)
USHORT i;
SCHAR *p;
vax_number = isc_vax_integer(&number, sizeof(number));
vax_number = gds__vax_integer(&number, sizeof(number));
p = (SCHAR *) & vax_number;
for (i = 0; i < sizeof(number); i++)
PUT(*p++);
@ -556,7 +556,7 @@ static void log_short(SSHORT number)
USHORT i;
SCHAR *p;
vax_number = (USHORT) isc_vax_integer(&number, sizeof(number));
vax_number = (USHORT) gds__vax_integer(&number, sizeof(number));
p = (SCHAR *) & vax_number;
for (i = 0; i < sizeof(number); i++)
PUT(*p++);

View File

@ -1351,22 +1351,22 @@ static JRD_NOD par_literal(TDBB tdbb, CSB csb)
switch (desc.dsc_dtype) {
case dtype_short:
l = 2;
*(SSHORT *) p = (SSHORT) isc_vax_integer(reinterpret_cast<const SCHAR*>(q), l);
*(SSHORT *) p = (SSHORT) gds__vax_integer(q, l);
break;
case dtype_long:
case dtype_sql_date:
case dtype_sql_time:
l = 4;
*(SLONG *) p = (SLONG) isc_vax_integer(reinterpret_cast<const SCHAR*>(q), l);
*(SLONG *) p = (SLONG) gds__vax_integer(q, l);
break;
case dtype_timestamp:
l = 8;
*(SLONG *) p = (SLONG) isc_vax_integer(reinterpret_cast<const SCHAR*>(q), 4);
*(SLONG *) p = (SLONG) gds__vax_integer(q, 4);
p += 4;
q += 4;
*(SLONG *) p = (SLONG) isc_vax_integer(reinterpret_cast<const SCHAR*>(q), 4);
*(SLONG *) p = (SLONG) gds__vax_integer(q, 4);
break;
case dtype_int64:

View File

@ -897,7 +897,8 @@ int SVC_output(svc* output_data, const UCHAR* output_buf)
default:
if (items + 2 <= end_items) {
l =
(USHORT) isc_vax_integer(items, 2);
(USHORT) gds__vax_integer(reinterpret_cast<
const UCHAR*>(items), 2);
items += 2;
if (items + l <= end_items) {
switch (item) {
@ -909,11 +910,13 @@ int SVC_output(svc* output_data, const UCHAR* output_buf)
break;
case isc_info_svc_timeout:
timeout =
(USHORT) isc_vax_integer(items, l);
(USHORT) gds__vax_integer(reinterpret_cast<
const UCHAR*>(items), l);
break;
case isc_info_svc_version:
version =
(USHORT) isc_vax_integer(items, l);
(USHORT) gds__vax_integer(reinterpret_cast<
const UCHAR*>(items), l);
break;
}
}
@ -1179,7 +1182,8 @@ int SVC_output(svc* output_data, const UCHAR* output_buf)
service_get(service, &item, 1, GET_BINARY, 0, &length);
service_get(service, buffer, 2, GET_BINARY, 0, &length);
l =
(USHORT) isc_vax_integer(buffer, 2);
(USHORT) gds__vax_integer(reinterpret_cast<
UCHAR*>(buffer), 2);
length = MIN(end - (info + 5), l);
service_get(service, info + 3, length, GET_BINARY, 0, &length);
info = INF_put_item(item, length, info + 3, info, end);
@ -1230,7 +1234,8 @@ int SVC_output(svc* output_data, const UCHAR* output_buf)
service_get(service, &item, 1, GET_BINARY, 0, &length);
service_get(service, buffer, 2, GET_BINARY, 0, &length);
l =
(USHORT) isc_vax_integer(buffer, 2);
(USHORT) gds__vax_integer(reinterpret_cast <
UCHAR * >(buffer), 2);
service_get(service, buffer, l, GET_BINARY, 0, &length);
if (!(info = INF_put_item(item, length, buffer, info, end))) {
THREAD_ENTER;
@ -1342,7 +1347,7 @@ void SVC_query(SVC service,
default:
if (items + 2 <= end_items)
{
l = (USHORT) isc_vax_integer(items, 2);
l = (USHORT) gds__vax_integer(reinterpret_cast<const UCHAR*>(items), 2);
items += 2;
if (items + l <= end_items)
{
@ -1355,11 +1360,11 @@ void SVC_query(SVC service,
break;
case isc_info_svc_timeout:
timeout =
(USHORT) isc_vax_integer(items, l);
(USHORT) gds__vax_integer(reinterpret_cast<const UCHAR*>(items), l);
break;
case isc_info_svc_version:
version =
(USHORT) isc_vax_integer(items, l);
(USHORT) gds__vax_integer(reinterpret_cast<const UCHAR*>(items), l);
break;
}
}
@ -1589,7 +1594,7 @@ void SVC_query(SVC service,
service_put(service, &item, 1);
service_get(service, &item, 1, GET_BINARY, 0, &length);
service_get(service, buffer, 2, GET_BINARY, 0, &length);
l = (USHORT) isc_vax_integer(buffer, 2);
l = (USHORT) gds__vax_integer(reinterpret_cast<UCHAR*>(buffer), 2);
length = MIN(end - (info + 4), l);
service_get(service, info + 3, length, GET_BINARY, 0, &length);
info = INF_put_item(item, length, info + 3, info, end);
@ -1646,7 +1651,7 @@ void SVC_query(SVC service,
service_put(service, &item, 1);
service_get(service, &item, 1, GET_BINARY, 0, &length);
service_get(service, buffer, 2, GET_BINARY, 0, &length);
l = (USHORT) isc_vax_integer(buffer, 2);
l = (USHORT) gds__vax_integer(reinterpret_cast<UCHAR*>(buffer), 2);
service_get(service, buffer, l, GET_BINARY, 0, &length);
if (!(info = INF_put_item(item, length, buffer, info, end)))
{
@ -3651,7 +3656,9 @@ static BOOLEAN get_action_svc_bitmask(
TEXT *s_ptr;
ISC_USHORT count;
opt = isc_vax_integer(*spb, sizeof(ISC_ULONG));
opt =
gds__vax_integer(reinterpret_cast < UCHAR * >(*spb),
sizeof(ISC_ULONG));
for (mask = 1, count = (sizeof(ISC_ULONG) * 8) - 1; count; --count) {
if (opt & mask) {
if (!(s_ptr = find_switch((opt & mask), table)))
@ -3694,7 +3701,8 @@ static void get_action_svc_string(
**************************************/
ISC_USHORT l, l2;
l = isc_vax_integer(*spb, sizeof(ISC_USHORT));
l = gds__vax_integer(reinterpret_cast < UCHAR * >(*spb),
sizeof(ISC_USHORT));
const char* local_server = "localhost:";
#if defined(WIN_NT) && !defined(SUPERSERVER)
@ -3749,7 +3757,9 @@ static void get_action_svc_data(
ISC_ULONG ll;
TEXT buf[64];
ll = isc_vax_integer(*spb, sizeof(ISC_ULONG));
ll =
gds__vax_integer(reinterpret_cast < UCHAR * >(*spb),
sizeof(ISC_ULONG));
sprintf(buf, "%lu ", ll);
if (*cmd) {
sprintf(*cmd, "%lu ", ll);

View File

@ -1008,7 +1008,7 @@ jrd_tra* TRA_reconnect(TDBB tdbb, const UCHAR* id, USHORT length)
tdbb->tdbb_default = JrdMemoryPool::createPool();
jrd_tra* trans = FB_NEW_RPT(*tdbb->tdbb_default, 0) jrd_tra();
trans->tra_pool = tdbb->tdbb_default;
trans->tra_number = isc_vax_integer(reinterpret_cast<const SCHAR*>(id), length);
trans->tra_number = gds__vax_integer(id, length);
trans->tra_flags |= TRA_prepared | TRA_reconnected | TRA_write;
const UCHAR state = limbo_transaction(tdbb, trans->tra_number);

View File

@ -316,9 +316,9 @@ int API_ROUTINE gds__blob_size(
while ((item = *p++) != isc_info_end) {
l =
static_cast<SSHORT>
(isc_vax_integer(p, 2));
(gds__vax_integer(reinterpret_cast<UCHAR*>(p), 2));
p += 2;
n = isc_vax_integer(p, l);
n = gds__vax_integer(reinterpret_cast<UCHAR*>(p), l);
p += l;
switch (item) {
case isc_info_blob_max_segment:
@ -702,29 +702,30 @@ int API_ROUTINE gds__edit(TEXT * file_name, USHORT type)
}
#endif
SLONG API_ROUTINE_VARARG isc_event_block(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, ...)
SLONG API_ROUTINE gds__event_block(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, ...)
{
/**************************************
*
* i s c _ e v e n t _ b l o c k
* g d s _ $ e v e n t _ b l o c k
*
**************************************
*
* Functional description
* Create an initialized event parameter block from a
* variable number of input arguments.
* Return the size of the block.
* Create an initialized event parameter block from a
* variable number of input arguments.
* Return the size of the block.
*
* Return 0 if any error occurs.
* Return 0 as the size if the event parameter block cannot be
* created for any reason.
*
**************************************/
SCHAR *p, *q;
SCHAR *end;
SLONG length;
USHORT i;
va_list ptr;
USHORT i;
VA_START(ptr, count);
@ -739,19 +740,21 @@ SLONG API_ROUTINE_VARARG isc_event_block(SCHAR ** event_buffer,
length += strlen(q) + 5;
}
p = *event_buffer = (SCHAR *) gds__alloc((SLONG) length);
/* FREE: apparently never freed */
p = *event_buffer =
(SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*event_buffer) /* NOMEM: */
return 0;
if ((*result_buffer = (SCHAR *) gds__alloc((SLONG) length)) == NULL) { /* NOMEM: */
/* FREE: apparently never freed */
*result_buffer = (SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*result_buffer) { /* NOMEM: */
gds__free(*event_buffer);
*event_buffer = NULL;
return 0;
}
#ifdef DEBUG_GDS_ALLOC
/* I can find no place where these are freed */
/* I can't find anywhere these items are freed */
/* 1994-October-25 David Schnepper */
gds_alloc_flag_unfreed((void *) *event_buffer);
gds_alloc_flag_unfreed((void *) *result_buffer);
@ -767,7 +770,7 @@ SLONG API_ROUTINE_VARARG isc_event_block(SCHAR ** event_buffer,
while (i--) {
q = va_arg(ptr, SCHAR *);
/* Strip the blanks from the ends */
/* Strip trailing blanks from string */
for (end = q + strlen(q); --end >= q && *end == ' ';);
*p++ = end - q + 1;
@ -779,17 +782,18 @@ SLONG API_ROUTINE_VARARG isc_event_block(SCHAR ** event_buffer,
*p++ = 0;
}
return (int) (p - *event_buffer);
return p - *event_buffer;
}
USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count, TEXT ** name_buffer)
USHORT API_ROUTINE gds__event_block_a(SCHAR ** event_buffer,
SCHAR ** result_buffer,
SSHORT count,
SCHAR ** name_buffer)
{
/**************************************
*
* i s c _ e v e n t _ b l o c k _ a
* g d s _ $ e v e n t _ b l o c k _ a
*
**************************************
*
@ -800,10 +804,8 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
* Return the size of the block.
*
**************************************/
#define MAX_NAME_LENGTH 31
SCHAR *p, *q;
SCHAR *end;
TEXT **nb;
SCHAR *end, **nb;
SLONG length;
USHORT i;
@ -819,25 +821,26 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
/* Strip trailing blanks from string */
for (end = q + MAX_NAME_LENGTH; --end >= q && *end == ' ';);
for (end = q + 31; --end >= q && *end == ' ';);
length += end - q + 1 + 5;
}
i = count;
p = *event_buffer = (SCHAR *) gds__alloc((SLONG) length);
/* FREE: apparently never freed */
if (!(*event_buffer)) /* NOMEM: */
p = *event_buffer =
(SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*event_buffer) /* NOMEM: */
return 0;
if ((*result_buffer = (SCHAR *) gds__alloc((SLONG) length)) == NULL) { /* NOMEM: */
/* FREE: apparently never freed */
*result_buffer = (SCHAR *) gds__alloc((SLONG) (sizeof(SCHAR) * length));
/* FREE: unknown */
if (!*result_buffer) { /* NOMEM: */
gds__free(*event_buffer);
*event_buffer = NULL;
return 0;
}
#ifdef DEBUG_GDS_ALLOC
/* I can find no place where these are freed */
/* I can't find anywhere these items are freed */
/* 1994-October-25 David Schnepper */
gds_alloc_flag_unfreed((void *) *event_buffer);
gds_alloc_flag_unfreed((void *) *result_buffer);
@ -852,7 +855,7 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
/* Strip trailing blanks from string */
for (end = q + MAX_NAME_LENGTH; --end >= q && *end == ' ';);
for (end = q + 31; --end >= q && *end == ' ';);
*p++ = end - q + 1;
while (q <= end)
*p++ = *q++;
@ -866,15 +869,16 @@ USHORT API_ROUTINE isc_event_block_a(SCHAR ** event_buffer,
}
void API_ROUTINE isc_event_block_s(
SCHAR ** event_buffer,
SCHAR ** result_buffer,
USHORT count,
TEXT ** name_buffer, USHORT * return_count)
void API_ROUTINE gds__event_block_s(
SCHAR ** event_buffer,
SCHAR ** result_buffer,
SSHORT count,
SCHAR ** name_buffer,
SSHORT * return_count)
{
/**************************************
*
* i s c _ e v e n t _ b l o c k _ s
* g d s _ $ e v e n t _ b l o c k _ s
*
**************************************
*
@ -885,7 +889,7 @@ TEXT ** name_buffer, USHORT * return_count)
**************************************/
*return_count =
isc_event_block_a(event_buffer, result_buffer, count, name_buffer);
gds__event_block_a(event_buffer, result_buffer, count, name_buffer);
}
@ -932,10 +936,10 @@ void API_ROUTINE isc_event_counts(
/* get the change in count */
initial_count =
isc_vax_integer(p, sizeof(SLONG));
gds__vax_integer(reinterpret_cast<UCHAR*>(p), sizeof(SLONG));
p += sizeof(SLONG);
new_count =
isc_vax_integer(q, sizeof(SLONG));
gds__vax_integer(reinterpret_cast<UCHAR*>(q), sizeof(SLONG));
q += sizeof(SLONG);
*vec++ = new_count - initial_count;
}
@ -1267,7 +1271,7 @@ int API_ROUTINE isc_version(FRBRD** handle,
while (!redo && *p != isc_info_end && p < buf + buf_len) {
item = *p++;
len = static_cast<USHORT>(isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2));
len = static_cast<USHORT>(gds__vax_integer(p, 2));
p += 2;
switch (item) {
case isc_info_firebird_version:
@ -2213,9 +2217,9 @@ static int get_ods_version(
p = buffer;
while ((item = *p++) != isc_info_end) {
l = static_cast<USHORT>(isc_vax_integer(reinterpret_cast<const SCHAR*>(p), 2));
l = static_cast<USHORT>(gds__vax_integer(p, 2));
p += 2;
n = static_cast<USHORT>(isc_vax_integer(reinterpret_cast<const SCHAR*>(p), l));
n = static_cast<USHORT>(gds__vax_integer(p, l));
p += l;
switch (item) {
case isc_info_ods_version:

View File

@ -42,7 +42,7 @@
*
*/
/*
$Id: why.cpp,v 1.39 2003-11-11 12:14:06 brodsom Exp $
$Id: why.cpp,v 1.40 2003-11-16 01:44:51 brodsom Exp $
*/
#include "firebird.h"
@ -4960,7 +4960,7 @@ ISC_STATUS API_ROUTINE GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
ptr = buffer;
end = buffer + buffer_len;
while (ptr < end && *ptr == isc_info_tra_id)
ptr += 3 + isc_vax_integer(reinterpret_cast<const SCHAR*>(ptr + 1), 2);
ptr += 3 + gds__vax_integer(ptr + 1, 2);
if (ptr >= end || *ptr != isc_info_end) {
RETURN_SUCCESS;
@ -5513,7 +5513,7 @@ static ISC_STATUS get_transaction_info(ISC_STATUS * status,
q = buffer + 3;
*p++ = TDR_TRANSACTION_ID;
length = (USHORT)isc_vax_integer(reinterpret_cast<SCHAR*>(buffer + 1), 2);
length = (USHORT)gds__vax_integer(reinterpret_cast<UCHAR*>(buffer + 1), 2);
*p++ = length;
if (length) {
do {