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

Comments.

This commit is contained in:
robocop 2009-04-17 14:10:11 +00:00
parent 12d548e52f
commit 6780b8c31e
23 changed files with 597 additions and 753 deletions

View File

@ -417,10 +417,6 @@
RelativePath="..\..\..\src\jrd\os\win32\isc_ipc.cpp"
>
</File>
<File
RelativePath="..\..\..\src\jrd\isc_sync.cpp"
>
</File>
</Filter>
<Filter
Name="Header files"

View File

@ -312,8 +312,7 @@ int alice(Firebird::UtilSvc* uSvc)
// an unsigned number. Therefore this check is useless.
// if (tdgbl->ALICE_data.ua_db_SQL_dialect < 0)
// {
// ALICE_error(114); /* msg 114: positive or zero numeric value
// required */
// ALICE_error(114); // msg 114: positive or zero numeric value required
// }
}

View File

@ -60,10 +60,9 @@ static void parse_fullpath(tdr*);
static USHORT snarf_blob(ISC_QUAD*, USHORT, TEXT*);
/*
table used to determine capabilities, checking for specific
fields in system relations
*/
// table used to determine capabilities, checking for specific
// fields in system relations
struct rfr_tab_t
{
@ -270,7 +269,7 @@ static USHORT get_capabilities(ISC_STATUS* user_status)
USHORT capabilities = CAP_none;
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
// Look for desired fields in system relations
// Look for desired fields in system relations
FB_API_HANDLE req = 0;
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; rel_field_table++)
@ -326,7 +325,7 @@ static tdr* get_description(ISC_QUAD* blob_id)
alice_str* host_site = NULL;
alice_str* database_path = NULL;
// skip version number
// skip version number
++p;
tdr* ptr = NULL; // silence uninitialized warning
@ -391,7 +390,7 @@ static void parse_fullpath(tdr* trans)
{
AliceGlobals* tdgbl = AliceGlobals::getSpecific();
// start at the end of the full pathname
// start at the end of the full pathname
const TEXT* p = (TEXT*) trans->tdr_fullpath->str_data;
const TEXT* const start = p;
@ -399,14 +398,15 @@ static void parse_fullpath(tdr* trans)
p++;
const TEXT* const end = p;
// Check for a named pipes name - \\node\path\db or //node/path/db
// Check for a named pipes name - \\node\path\db or //node/path/db
while (p > start && !(*p == '/' && p[-1] == '/') && !(*p == '\\' && p[-1] == '\\'))
{
--p;
}
if (p > start) {
/* Increment p past slash, & search forward for end of node name */
if (p > start)
{
// Increment p past slash, & search forward for end of node name
p = p + 1;
const TEXT* q = p;
@ -420,12 +420,13 @@ static void parse_fullpath(tdr* trans)
trans->tdr_remote_site->str_data[q - p] = '\0';
}
}
else {
else
{
p = end;
/* If not named pipes, check the other protocols
* work backwards until we find a remote protocol specifier
*/
// If not named pipes, check the other protocols
// work backwards until we find a remote protocol specifier
while (p >= start && (*p != '^' && *p != ':' && *p != '@'))
p--;
@ -479,7 +480,7 @@ static USHORT snarf_blob(ISC_QUAD* blob_id, USHORT buffer_length, TEXT* buffer)
return 0;
}
// get the blob into the buffer, if it fits
// get the blob into the buffer, if it fits
TEXT* ptr = buffer;
const TEXT* const end = buffer + buffer_length;
@ -495,7 +496,7 @@ static USHORT snarf_blob(ISC_QUAD* blob_id, USHORT buffer_length, TEXT* buffer)
ptr += returned_length;
}
// snarf failed, get length of blob for retry
// snarf failed, get length of blob for retry
if (!buffer_length)
{

View File

@ -77,8 +77,8 @@ int EXE_action(const TEXT* database, const ULONG switches)
tdgbl->ALICE_data.ua_val_errors[i] = 0;
}
// generate the database parameter block for the attach,
// based on the various switches
// generate the database parameter block for the attach,
// based on the various switches
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE);
buildDpb(dpb, switches);
@ -149,8 +149,8 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
tdgbl->ALICE_data.ua_val_errors[i] = 0;
}
// generate the database parameter block for the attach,
// based on the various switches
// generate the database parameter block for the attach,
// based on the various switches
Firebird::ClumpletWriter dpb(Firebird::ClumpletReader::Tagged, MAX_DPB_SIZE);
buildDpb(dpb, switches);
@ -400,7 +400,7 @@ static void extract_db_info(const UCHAR* db_info_buffer, size_t buf_size)
break;
case isc_info_error:
/* has to be a < V4 database. */
// has to be a < V4 database.
tdgbl->ALICE_data.ua_val_errors[VAL_INVALID_DB_VERSION] = 1;
return;

View File

@ -85,8 +85,8 @@ USHORT TDR_analyze(const tdr* trans)
if (trans == NULL)
return TRA_none;
// if the tdr for the first transaction is missing,
// we can assume it was committed
// if the tdr for the first transaction is missing,
// we can assume it was committed
USHORT state = trans->tdr_state;
if (state == TRA_none)
@ -374,7 +374,7 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
{
ISC_STATUS_ARRAY status_vector;
// get the state of all the associated transactions
// get the state of all the associated transactions
tdr* trans = MET_get_transaction(status_vector, handle, id);
if (!trans)
@ -383,8 +383,8 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
reattach_databases(trans);
TDR_get_states(trans);
// analyze what to do with them; if the advice contradicts the user's
// desire, make them confirm it; otherwise go with the flow.
// analyze what to do with them; if the advice contradicts the user's
// desire, make them confirm it; otherwise go with the flow.
const USHORT advice = TDR_analyze(trans);
@ -483,7 +483,7 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle, SLONG id, const TEXT* name, UL
error = true;
}
// shutdown all the databases for cleanliness' sake
// shutdown all the databases for cleanliness' sake
TDR_shutdown_databases(trans);
@ -589,7 +589,7 @@ static void print_description(const tdr* trans)
if (!tdgbl->uSvc->isService())
{
//msg 101: Remote Site: %s
// msg 101: Remote Site: %s
ALICE_print(101, SafeArg() << pszRemoteSite);
}
tdgbl->uSvc->putLine(isc_spb_tra_remote_site, pszRemoteSite);
@ -608,7 +608,7 @@ static void print_description(const tdr* trans)
}
}
// let the user know what the suggested action is
// let the user know what the suggested action is
switch (TDR_analyze(trans))
{
@ -697,8 +697,8 @@ static void reattach_database(tdr* trans)
ISC_get_host(buffer, sizeof(buffer));
// if this is being run from the same host,
// try to reconnect using the same pathname
// if this is being run from the same host,
// try to reconnect using the same pathname
if (!strcmp(buffer, reinterpret_cast<const char*>(trans->tdr_host_site->str_data)))
{
@ -728,8 +728,8 @@ static void reattach_database(tdr* trans)
}
}
// attaching using the old method didn't work;
// try attaching to the remote node directly
// attaching using the old method didn't work;
// try attaching to the remote node directly
if (trans->tdr_remote_site) {
char* p = buffer;
@ -747,8 +747,8 @@ static void reattach_database(tdr* trans)
}
}
// we have failed to reattach; notify the user
// and let them try to succeed where we have failed
// we have failed to reattach; notify the user
// and let them try to succeed where we have failed
ALICE_print(86, SafeArg() << trans->tdr_id);
// msg 86: Could not reattach to database for transaction %ld.

View File

@ -63,10 +63,10 @@
using MsgFormat::SafeArg;
// For service APIs the follow DB handle is a value stored
// in thread data. This is also done for other statics generated by
// GPRE. This is to avoid multiple threading problems with module
// level statics.
// For service APIs the follow DB handle is a value stored
// in thread data. This is also done for other statics generated by
// GPRE. This is to avoid multiple threading problems with module
// level statics.
DATABASE DB = STATIC FILENAME "yachts.lnk" RUNTIME * dbb_file;
@ -187,10 +187,8 @@ UCHAR debug_on = 0; // able to turn this on in debug mode
#endif
/*
table used to determine capabilities, checking for specific
fields in system relations
*/
// table used to determine capabilities, checking for specific
// fields in system relations
struct rfr_tab_t
{
@ -205,9 +203,8 @@ struct rfr_tab_t
const rfr_tab_t rfr_table[] =
{
{"RDB$INDICES", "RDB$INDEX_INACTIVE", BCK_idx_inactive},
/* Backup of V2 triggers no longer supported 1996-Aug-05 David Schnepper
{"RDB$RELATIONS", "RDB$STORE_TRIGGER", BCK_triggers},
*/
// Backup of V2 triggers no longer supported 1996-Aug-05 David Schnepper
// {"RDB$RELATIONS", "RDB$STORE_TRIGGER", BCK_triggers},
{"RDB$RELATIONS", "RDB$EXTERNAL_FILE", BCK_external},
{"RDB$SECURITY_CLASSES", "RDB$SECURITY_CLASS", BCK_security},
{"RDB$FILES", "RDB$FILE_NAME", BCK_files},
@ -673,11 +670,11 @@ burp_fld* get_fields( burp_rel* relation)
USHORT count = 1;
burp_fld* fields = NULL;
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if ((tdgbl->BCK_capabilities & BCK_attributes_v3) && (tdgbl->BCK_capabilities & BCK_ods8) &&
(tdgbl->BCK_capabilities & BCK_rfr_sys_flag) && (tdgbl->BCK_capabilities & BCK_security))
@ -874,8 +871,8 @@ burp_fld* get_fields( burp_rel* relation)
field->fld_dimensions = RF.RDB$DIMENSIONS;
if (field->fld_dimensions < 0) {
BURP_error_redirect (NULL, 52, SafeArg() << field->fld_name);
}
// msg 52 array dimension for field %s is invalid
}
get_ranges (field);
}
END_FOR;
@ -956,10 +953,10 @@ SINT64 get_gen_id( const TEXT* name, SSHORT name_len)
FB_API_HANDLE gen_id_reqh = 0;
UCHAR* blr = blr_buffer;
/* If this is ODS 10 (IB version 6.0) or greater, build BLR to retrieve
the 64-bit value of the generator. If not, build BLR to retrieve the
32-bit value, which we will cast to the expected INT64 format.
*/
// If this is ODS 10 (IB version 6.0) or greater, build BLR to retrieve
// the 64-bit value of the generator. If not, build BLR to retrieve the
// 32-bit value, which we will cast to the expected INT64 format.
if (tdgbl->BCK_capabilities & BCK_ods10)
{
// build the blr with the right relation name and 64-bit results.
@ -1088,7 +1085,7 @@ void get_ranges( burp_fld* field)
SLONG* rp = field->fld_ranges;
USHORT count = 0;
// Get the array dimensions in the rdb$field_dimensions
// Get the array dimensions in the rdb$field_dimensions
FOR (REQUEST_HANDLE tdgbl->handles_get_ranges_req_handle1)
X IN RDB$FIELD_DIMENSIONS
@ -1109,7 +1106,7 @@ void get_ranges( burp_fld* field)
if (count != field->fld_dimensions)
BURP_error_redirect(NULL, 52, SafeArg() << field->fld_name);
// msg 52 array dimension for field %s is invalid
// msg 52 array dimension for field %s is invalid
}
@ -1130,7 +1127,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
// If the array is null, don't store it. It will be restored as null.
// If the array is null, don't store it. It will be restored as null.
if (!blob_id->gds_quad_low && !blob_id->gds_quad_high)
return;
@ -1146,7 +1143,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
if (tdgbl->gbl_sw_transportable)
xdr_buffer.lstr_length = field_length + 3;
// build the sdl
// build the sdl
add_byte(blr, isc_sdl_version1);
@ -1210,7 +1207,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
const USHORT blr_length = blr - blr_buffer;
// compute the range size for each dimension = high_range - low_range
// compute the range size for each dimension = high_range - low_range
ULONG slice_length = field_length;
for (range = field->fld_ranges; range < end_ranges; range += 2)
@ -1221,7 +1218,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
}
UCHAR* slice = BURP_alloc(slice_length);
// allocate space for the XDR representation
// allocate space for the XDR representation
if (tdgbl->gbl_sw_transportable)
{
@ -1253,8 +1250,8 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
if (return_length != slice_length)
{
int i1, i3;
/* Ugh. The full array wasn't returned. We must recompute the top
element to backup. */
// Ugh. The full array wasn't returned. We must recompute the top
// element to backup.
SLONG returned_elements = (return_length / field_length) - 1;
@ -1483,7 +1480,7 @@ void put_blob( burp_fld* field, ISC_QUAD& blob_id, ULONG count)
if (!blob.close())
BURP_error_redirect(status_vector, 23);
// msg 23 isc_close_blob failed
// msg 23 isc_close_blob failed
if (buffer != static_buffer)
BURP_free(buffer);
@ -1645,7 +1642,7 @@ void put_data(burp_rel* relation)
add_byte(blr, blr_version4);
add_byte(blr, blr_begin);
add_byte(blr, blr_message);
add_byte(blr, 0); // Message number
add_byte(blr, 0); // Message number
add_word(blr, field_count); // Number of fields, counting eof
RCRD_OFFSET offset = 0;
@ -1951,11 +1948,11 @@ void put_index( burp_rel* relation)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if ((tdgbl->BCK_capabilities & BCK_idx_inactive) &&
(tdgbl->BCK_capabilities & BCK_attributes_v3) &&
@ -2235,8 +2232,8 @@ void put_relation( burp_rel* relation)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* Write local field information. This is made slightly more complicated
by the requirement that computational fields be aligned. */
// Write local field information. This is made slightly more complicated
// by the requirement that computational fields be aligned.
burp_fld* aligned = NULL;
burp_fld* unaligned = NULL;
@ -2245,7 +2242,7 @@ void put_relation( burp_rel* relation)
burp_fld* fields = get_fields(relation);
// sort the list of fields into three lists, depending on alignment
// sort the list of fields into three lists, depending on alignment
burp_fld* field;
for (field = fields; field = fields;)
{
@ -2275,9 +2272,9 @@ void put_relation( burp_rel* relation)
}
}
/* Next, merge the aligned and unaligned sub-lists. In the process,
re-create (approximately) the original order of the fields. This is
not strictly required, but it certainly is polite. */
// Next, merge the aligned and unaligned sub-lists. In the process,
// re-create (approximately) the original order of the fields. This is
// not strictly required, but it certainly is polite.
while (field = unaligned)
{
@ -2307,7 +2304,7 @@ void put_relation( burp_rel* relation)
relation->rel_fields = field;
}
// Now write the fields in what will become physical backup order
// Now write the fields in what will become physical backup order
for (field = relation->rel_fields; field; field = field->fld_next)
{
@ -2366,7 +2363,7 @@ void put_relation( burp_rel* relation)
put(tdgbl, att_end);
}
// Write out view relations (if a view, of course)
// Write out view relations (if a view, of course)
if (relation->rel_flags & REL_view)
{
@ -2579,7 +2576,7 @@ void set_capabilities()
FB_API_HANDLE req = 0;
// Look for desireable fields in system relations
// Look for desireable fields in system relations
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; rel_field_table++)
{
@ -2850,11 +2847,11 @@ void write_database( const TEXT* dbb_file)
put(tdgbl, (UCHAR) rec_database);
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if ((tdgbl->BCK_capabilities & BCK_security) &&
(tdgbl->BCK_capabilities & BCK_db_description) &&
@ -3057,7 +3054,7 @@ void write_functions()
const SSHORT l = PUT_TEXT (att_function_name, X.RDB$FUNCTION_NAME);
MISC_terminate (X.RDB$FUNCTION_NAME, temp, l, sizeof(temp));
BURP_verbose (147, temp);
/* msg 147 writing function %.*s */
// msg 147 writing function %.*s
put_source_blob (att_function_description2, att_function_description, X.RDB$DESCRIPTION);
PUT_TEXT (att_function_module_name, X.RDB$MODULE_NAME);
PUT_TEXT (att_function_entrypoint, X.RDB$ENTRYPOINT);
@ -3093,11 +3090,11 @@ void write_function_args( GDS_NAME funcptr)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if (tdgbl->BCK_capabilities & BCK_ods10)
{
@ -3154,9 +3151,9 @@ void write_function_args( GDS_NAME funcptr)
if (!X2.RDB$CHARACTER_SET_ID.NULL)
put_numeric (att_functionarg_character_set, X2.RDB$CHARACTER_SET_ID);
/* Note that BCK_ods10 canNOT be set if we're in this
"else" branch. Hence there is no need to test that
bit and store the RDB$FIELD_PRECISION. */
// Note that BCK_ods10 canNOT be set if we're in this
// "else" branch. Hence there is no need to test that
// bit and store the RDB$FIELD_PRECISION.
END_FOR;
ON_ERROR
@ -3259,11 +3256,11 @@ void write_global_fields()
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if ((tdgbl->BCK_capabilities & BCK_attributes_v3) &&
(tdgbl->BCK_capabilities & BCK_ods8) &&
@ -3278,7 +3275,7 @@ void write_global_fields()
const SSHORT l = PUT_TEXT (att_field_name, X.RDB$FIELD_NAME);
MISC_terminate (X.RDB$FIELD_NAME, temp, l, sizeof(temp));
BURP_verbose (149, temp);
/* msg 149 writing global field %.*s */
// msg 149 writing global field %.*s
if (X.RDB$QUERY_NAME [0] != ' ')
PUT_TEXT (att_field_query_name, X.RDB$QUERY_NAME);
if (X.RDB$EDIT_STRING [0] != ' ')
@ -3346,7 +3343,7 @@ void write_global_fields()
const SSHORT l = PUT_TEXT (att_field_name, X.RDB$FIELD_NAME);
MISC_terminate (X.RDB$FIELD_NAME, temp, l, sizeof(temp));
BURP_verbose (149, temp);
/* msg 149 writing global field %.*s */
// msg 149 writing global field %.*s
if (X.RDB$QUERY_NAME [0] != ' ')
PUT_TEXT (att_field_query_name, X.RDB$QUERY_NAME);
if (X.RDB$EDIT_STRING [0] != ' ')
@ -3464,7 +3461,7 @@ void write_procedures()
const SSHORT l = PUT_TEXT (att_procedure_name, X.RDB$PROCEDURE_NAME);
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
BURP_verbose (193, temp);
/* msg 193 writing stored procedure %.*s */
// msg 193 writing stored procedure %.*s
put_numeric (att_procedure_inputs, X.RDB$PROCEDURE_INPUTS);
put_numeric (att_procedure_outputs, X.RDB$PROCEDURE_OUTPUTS);
put_source_blob(att_procedure_description2, att_procedure_description, X.RDB$DESCRIPTION);
@ -3497,7 +3494,7 @@ void write_procedures()
const SSHORT l = PUT_TEXT (att_procedure_name, X.RDB$PROCEDURE_NAME);
MISC_terminate (X.RDB$PROCEDURE_NAME, temp, l, sizeof(temp));
BURP_verbose (193, temp);
/* msg 193 writing stored procedure %.*s */
// msg 193 writing stored procedure %.*s
put_numeric (att_procedure_inputs, X.RDB$PROCEDURE_INPUTS);
put_numeric (att_procedure_outputs, X.RDB$PROCEDURE_OUTPUTS);
put_source_blob (att_procedure_description2, att_procedure_description, X.RDB$DESCRIPTION);
@ -3689,11 +3686,11 @@ void write_relations()
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if ((tdgbl->BCK_capabilities & BCK_ods8) &&
(tdgbl->BCK_capabilities & BCK_security) &&
@ -3709,11 +3706,10 @@ void write_relations()
const SSHORT l = PUT_TEXT (att_relation_name, X.RDB$RELATION_NAME);
MISC_terminate (X.RDB$RELATION_NAME, temp, l, sizeof(temp));
BURP_verbose (153, temp);
/* msg 153 writing relation %.*s */
// msg 153 writing relation %.*s
/* RDB$VIEW_BLR must be the first blob field in the backup file.
* RESTORE.EPP makes this assumption in get_relation().
*/
// RDB$VIEW_BLR must be the first blob field in the backup file.
// RESTORE.EPP makes this assumption in get_relation().
if (put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR))
flags |= REL_view;
@ -3767,11 +3763,10 @@ void write_relations()
const SSHORT l = PUT_TEXT(att_relation_name, X.RDB$RELATION_NAME);
MISC_terminate (X.RDB$RELATION_NAME, temp, l, sizeof(temp));
BURP_verbose (153, temp);
/* msg 153 writing relation %.*s */
// msg 153 writing relation %.*s
/* RDB$VIEW_BLR must be the first blob field in the backup file.
* RESTORE.E makes this assumption in get_relation().
*/
// RDB$VIEW_BLR must be the first blob field in the backup file.
// RESTORE.EPP makes this assumption in get_relation().
if (put_blr_blob (att_relation_view_blr, X.RDB$VIEW_BLR))
flags |= REL_view;
@ -4016,11 +4011,11 @@ void write_triggers()
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
/* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't
have one of the capabilities we must use the second set of
requests--this requires more code but it is well worth it
for the performance benefits, especially remotely--deej */
// if we have all capabilities, use the first request to get the
// most performance out of the latest engine; if we don't
// have one of the capabilities we must use the second set of
// requests--this requires more code but it is well worth it
// for the performance benefits, especially remotely--deej
if (tdgbl->BCK_capabilities & BCK_ods11_1)
{
@ -4175,7 +4170,7 @@ void write_trigger_messages()
const SSHORT l = PUT_TEXT (att_trigmsg_name, X.RDB$TRIGGER_NAME);
MISC_terminate (X.RDB$TRIGGER_NAME, temp, l, sizeof(temp));
BURP_verbose (157, temp);
/* msg 157 writing trigger message for *s */
// msg 157 writing trigger message for *s
put_numeric (att_trigmsg_number, X.RDB$MESSAGE_NUMBER);
PUT_MESSAGE (att_trigmsg_text, att_end, X.RDB$MESSAGE);
put(tdgbl, att_end);

View File

@ -188,7 +188,7 @@ static int api_gbak(Firebird::UtilSvc* uSvc, in_sw_tab_t* const in_sw_tab)
case IN_SW_BURP_SE: // service name
if (itr >= argc - 1)
{
// user name parameter missing
// user name parameter missing
BURP_error(inSw->in_sw == IN_SW_BURP_USER ? 188 :
// password parameter missing
inSw->in_sw == IN_SW_BURP_PASS ? 189 :
@ -252,12 +252,11 @@ static int api_gbak(Firebird::UtilSvc* uSvc, in_sw_tab_t* const in_sw_tab)
try
{
Firebird::ClumpletWriter spb(Firebird::ClumpletWriter::SpbAttach, 4096, isc_spb_current_version);
/*
* isc_spb_user_name
* isc_spb_password
* isc_spb_trusted_auth
* isc_spb_options
*/
// isc_spb_user_name
// isc_spb_password
// isc_spb_trusted_auth
// isc_spb_options
if (usr.hasData())
{
@ -533,8 +532,8 @@ int gbak(Firebird::UtilSvc* uSvc)
{
if (!file || file->fil_length || !get_size(argv[itr], file))
{
/* Miserable thing must be a filename
(dummy in a length for the backup file */
// Miserable thing must be a filename
// (dummy in a length for the backup file
file = FB_NEW(*getDefaultMemoryPool()) burp_fil(*getDefaultMemoryPool());
file->fil_name = str.ToPathName();
@ -1496,16 +1495,15 @@ static void close_out_transaction(gbak_action action, isc_tr_handle* handle)
if (*handle != 0)
{
ISC_STATUS_ARRAY status_vector;
if (action == RESTORE) {
/* Even if the restore failed, commit the transaction so that
* a partial database is at least recovered.
*/
if (action == RESTORE)
{
// Even if the restore failed, commit the transaction so that
// a partial database is at least recovered.
isc_commit_transaction(status_vector, handle);
if (status_vector[1]) {
/* If we can't commit - have to roll it back, as
* we need to close all outstanding transactions before
* we can detach from the database.
*/
// If we can't commit - have to roll it back, as
// we need to close all outstanding transactions before
// we can detach from the database.
isc_rollback_transaction(status_vector, handle);
if (status_vector[1])
BURP_print_status(status_vector);
@ -1513,10 +1511,9 @@ static void close_out_transaction(gbak_action action, isc_tr_handle* handle)
}
else
{
/* A backup shouldn't touch any data - we ensure that
* by never writing data during a backup, but let's double
* ensure it by doing a rollback
*/
// A backup shouldn't touch any data - we ensure that
// by never writing data during a backup, but let's double
// ensure it by doing a rollback
if (isc_rollback_transaction(status_vector, handle))
BURP_print_status(status_vector);
}
@ -1575,7 +1572,7 @@ static gbak_action open_files(const TEXT* file1,
ISC_STATUS_ARRAY temp_status;
ISC_STATUS* status_vector = temp_status;
// try to attach the database using the first file_name
// try to attach the database using the first file_name
if (sw_replace != IN_SW_BURP_C && sw_replace != IN_SW_BURP_R)
{
@ -1663,9 +1660,9 @@ static gbak_action open_files(const TEXT* file1,
flag = QUIT;
break;
}
/* We ignore SIGPIPE so that we can report an IO error when we
* try to write to the broken pipe.
*/
// We ignore SIGPIPE so that we can report an IO error when we
// try to write to the broken pipe.
#ifndef WIN_NT
signal(SIGPIPE, SIG_IGN);
#endif
@ -1732,42 +1729,40 @@ static gbak_action open_files(const TEXT* file1,
}
/*
* If we got to here, then we're really not backing up a database,
* so open a backup file.
*/
// If we got to here, then we're really not backing up a database,
// so open a backup file.
/* There are four possible cases such as:
*
* 1. restore single backup file to single db file
* 2. restore single backup file to multiple db files
* 3. restore multiple backup files (join operation) to single db file
* 4. restore multiple backup files (join operation) to multiple db files
*
* Just looking at the command line, we can't say for sure whether it is a
* specification of the last file to be join or it is a specification of the
* primary db file (case 4), for example:
*
* gbak -c gbk1 gbk2 gbk3 db1 200 db2 500 db3 -v
* ^^^
* db1 could be either the last file to be join or primary db file
*
* Since 'gbk' and 'gsplit' formats are different (gsplit file has its own
* header record) hence we can use it as follows:
*
* - open first file
* - read & check a header record
*
* If a header is identified as a 'gsplit' one then we know exactly how
* many files need to be join and in which order. We keep opening a file by
* file till we reach the last one to be join. During this step we check
* that the files are accessible and are in proper order. It gives us
* possibility to let silly customer know about an error as soon as possible.
* Besides we have to find out which file is going to be a db file.
*
* If header is not identified as a 'gsplit' record then we assume that
* we got a single backup file.
*/
/* There are four possible cases such as:
*
* 1. restore single backup file to single db file
* 2. restore single backup file to multiple db files
* 3. restore multiple backup files (join operation) to single db file
* 4. restore multiple backup files (join operation) to multiple db files
*
* Just looking at the command line, we can't say for sure whether it is a
* specification of the last file to be join or it is a specification of the
* primary db file (case 4), for example:
*
* gbak -c gbk1 gbk2 gbk3 db1 200 db2 500 db3 -v
* ^^^
* db1 could be either the last file to be join or primary db file
*
* Since 'gbk' and 'gsplit' formats are different (gsplit file has its own
* header record) hence we can use it as follows:
*
* - open first file
* - read & check a header record
*
* If a header is identified as a 'gsplit' one then we know exactly how
* many files need to be join and in which order. We keep opening a file by
* file till we reach the last one to be join. During this step we check
* that the files are accessible and are in proper order. It gives us
* possibility to let silly customer know about an error as soon as possible.
* Besides we have to find out which file is going to be a db file.
*
* If header is not identified as a 'gsplit' record then we assume that
* we got a single backup file.
*/
fil = tdgbl->gbl_sw_files;
tdgbl->gbl_sw_backup_files = tdgbl->gbl_sw_files;
@ -1871,7 +1866,8 @@ static gbak_action open_files(const TEXT* file1,
return QUIT;
}
}
else {
else
{
// Move pointer to the begining of the file. At this point we
// assume -- this is a single backup file because we were
// not able to read a split header record.
@ -1889,13 +1885,13 @@ static gbak_action open_files(const TEXT* file1,
}
// If we got here, we've opened a backup file, and we're
// thinking about creating or replacing a database.
// If we got here, we've opened a backup file, and we're
// thinking about creating or replacing a database.
*file2 = tdgbl->gbl_sw_files->fil_name.c_str();
if (tdgbl->gbl_sw_files->fil_size_code != size_n)
BURP_error(262, true, *file2);
// msg 262 size specification either missing or incorrect for file %s
// msg 262 size specification either missing or incorrect for file %s
if ((sw_replace == IN_SW_BURP_C || sw_replace == IN_SW_BURP_R) &&
!isc_attach_database(status_vector,
@ -1930,24 +1926,23 @@ static gbak_action open_files(const TEXT* file1,
}
}
if (sw_replace == IN_SW_BURP_R && status_vector[1] == isc_adm_task_denied) {
/* if we got an error from attach database and we have replace switch set
* then look for error from attach returned due to not owner, if we are
* not owner then return the error status back up
*/
// if we got an error from attach database and we have replace switch set
// then look for error from attach returned due to not owner, if we are
// not owner then return the error status back up
BURP_error(274, true);
/* msg # 274 : Cannot restore over current database, must be sysdba
* or owner of the existing database.
*/
// msg # 274 : Cannot restore over current database, must be sysdba
// or owner of the existing database.
}
/* if we got here, then all is well, remove any error condition from the
* status vector when running as a service thread. If we don't then the
* service will think that there is an error if isc_attach_database failed
* like it should have (if creating a database).
*/
// if we got here, then all is well, remove any error condition from the
// status vector when running as a service thread. If we don't then the
// service will think that there is an error if isc_attach_database failed
// like it should have (if creating a database).
if (tdgbl->uSvc->isService())
memset(tdgbl->status, 0, sizeof(ISC_STATUS_ARRAY));
// check the file size specification
// check the file size specification
for (fil = tdgbl->gbl_sw_files; fil; fil = fil->fil_next)
{
if (fil->fil_size_code != size_n)

View File

@ -197,7 +197,7 @@ ULONG CAN_encode_decode(burp_rel* relation,
}
}
// Next, get null flags
// Next, get null flags
for (field = relation->rel_fields; field; field = field->fld_next)
{
@ -644,7 +644,7 @@ static bool_t xdr_slice(XDR* xdrs,
if (!xdr_long(xdrs, reinterpret_cast<SLONG*>(&slice->lstr_length)))
return FALSE;
// Handle operation specific stuff, particularly memory allocation/deallocation
// Handle operation specific stuff, particularly memory allocation/deallocation
switch (xdrs->x_op)
{
@ -681,7 +681,7 @@ static bool_t xdr_slice(XDR* xdrs,
return FALSE;
}
// Get descriptor of array element
// Get descriptor of array element
ISC_STATUS_ARRAY status_vector;
sdl_info info;

View File

@ -48,14 +48,14 @@ UCHAR *MISC_alloc_burp(ULONG size)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
// Add some header space to store a list of blocks allocated for this gbak
// Add some header space to store a list of blocks allocated for this gbak
size += ROUNDUP(sizeof(UCHAR *), FB_ALIGNMENT);
UCHAR* block = (UCHAR*)gds__alloc(size);
if (!block)
/* NOMEM: message & abort FREE: all items freed at gbak exit */
{
// NOMEM: message & abort FREE: all items freed at gbak exit
BURP_error(238, true);
// msg 238: System memory exhaused
return NULL;
@ -63,10 +63,10 @@ UCHAR *MISC_alloc_burp(ULONG size)
memset(block, 0, size);
/* FREE: We keep a linked list of all gbak memory allocations, which
* are then freed when gbak exits. This is important for
* NETWARE in particular.
*/
// FREE: We keep a linked list of all gbak memory allocations, which
// are then freed when gbak exits. This is important for
// NETWARE in particular.
*((UCHAR**) block) = tdgbl->head_of_mem_list;
tdgbl->head_of_mem_list = block;

View File

@ -369,8 +369,8 @@ int MVOL_read(int* cnt, UCHAR** ptr)
//
UCHAR* MVOL_read_block(BurpGlobals* tdgbl, UCHAR* ptr, ULONG count)
{
// To handle tape drives & Multi-volume boundaries, use the normal
// read function, instead of doing a more optimal bulk read.
// To handle tape drives & Multi-volume boundaries, use the normal
// read function, instead of doing a more optimal bulk read.
while (count)
@ -409,8 +409,8 @@ UCHAR* MVOL_read_block(BurpGlobals* tdgbl, UCHAR* ptr, ULONG count)
//
void MVOL_skip_block( BurpGlobals* tdgbl, ULONG count)
{
// To handle tape drives & Multi-volume boundaries, use the normal
// read function, instead of doing a more optimal seek.
// To handle tape drives & Multi-volume boundaries, use the normal
// read function, instead of doing a more optimal seek.
while (count)
@ -678,9 +678,9 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
}
#endif
// After the first block of first volume is written (using a default block size)
// change the block size to one that reflects the user's blocking factor. By
// making the first block a standard size we will avoid restore problems.
// After the first block of first volume is written (using a default block size)
// change the block size to one that reflects the user's blocking factor. By
// making the first block a standard size we will avoid restore problems.
tdgbl->mvol_io_buffer_size = tdgbl->mvol_actual_buffer_size;
@ -700,8 +700,8 @@ UCHAR MVOL_write(const UCHAR c, int* io_cnt, UCHAR** io_ptr)
//
const UCHAR* MVOL_write_block(BurpGlobals* tdgbl, const UCHAR* ptr, ULONG count)
{
// To handle tape drives & Multi-volume boundaries, use the normal
// write function, instead of doing a more optimal bulk write.
// To handle tape drives & Multi-volume boundaries, use the normal
// write function, instead of doing a more optimal bulk write.
while (count)
{
@ -815,8 +815,8 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer)
{
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
// We must close the old handle before the user inserts
// another tape, or something.
// We must close the old handle before the user inserts
// another tape, or something.
#ifdef WIN_NT
if (handle != INVALID_HANDLE_VALUE)
@ -840,15 +840,15 @@ static DESC next_volume( DESC handle, ULONG mode, bool full_buffer)
BURP_error_redirect(0, 50); // msg 50 unexpected end of file on backup file
}
// If we got here, we've got a live one... Up the volume number unless
// the old file was empty
// If we got here, we've got a live one... Up the volume number unless
// the old file was empty
if (!tdgbl->mvol_empty_file)
++tdgbl->mvol_volume_count;
tdgbl->mvol_empty_file = true;
// Loop until we have opened a file successfully
// Loop until we have opened a file successfully
SCHAR new_file[MAX_FILE_NAME_SIZE];
DESC new_desc = INVALID_HANDLE_VALUE;
@ -935,8 +935,8 @@ static void prompt_for_name(SCHAR* name, int length)
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
// Unless we are operating as a service, stdin can't necessarily be trusted.
// Get a location to read from.
// Unless we are operating as a service, stdin can't necessarily be trusted.
// Get a location to read from.
fb_assert(!tdgbl->uSvc->isService());
if (isatty(fileno(stdout)) || !(term_out = fopen(TERM_OUTPUT, "w")))
@ -949,7 +949,7 @@ static void prompt_for_name(SCHAR* name, int length)
term_in = stdin;
}
// Loop until we have a file name to try
// Loop until we have a file name to try
for (;;)
{
@ -1073,7 +1073,7 @@ static bool read_header(DESC handle, ULONG* buffer_size, USHORT* format, bool in
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
// Headers are a version number, and a volume number
// Headers are a version number, and a volume number
#ifndef WIN_NT
tdgbl->mvol_io_cnt = read(handle, tdgbl->mvol_io_buffer, tdgbl->mvol_actual_buffer_size);

View File

@ -84,14 +84,14 @@ const int DB_VERSION_DDL11_2 = 112; // ods11.2 db, FB2.5
const int DB_VERSION_OLDEST_SUPPORTED = DB_VERSION_DDL8; // IB4.0 is ods8
const int DEFERRED_ACTIVE = 3; /* RDB$INDEX_INACTIVE setting for Foreign Keys
* This setting is used temporarily while
* restoring a database. This was required
* in order to differentiate a partial
* "inactive" state of SOME indices from
* "inactive" state of ALL indices (gbak -i)
* -bsriram, 11-May-1999 BUG: 10016
*/
const int DEFERRED_ACTIVE = 3; // RDB$INDEX_INACTIVE setting for Foreign Keys
// This setting is used temporarily while
// restoring a database. This was required
// in order to differentiate a partial
// "inactive" state of SOME indices from
// "inactive" state of ALL indices (gbak -i)
// -bsriram, 11-May-1999 BUG: 10016
const int RESTORE_VERBOSE_INTERVAL = 10000;
const int cvtbl_len = 28;
@ -280,9 +280,9 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
COMMIT;
ON_ERROR
/* Fix for bug_no 8055:
don't throw away the database just because an index
could not be made */
// Fix for bug_no 8055:
// don't throw away the database just because an index
// could not be made
long error_code;
while (error_code = tdgbl->status_vector[1])
{
@ -385,15 +385,15 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
if (gds_status[1])
EXEC SQL SET TRANSACTION;
/* Only activate Foreign keys that have been marked for deferred
* activation.
* -bsriram, 11-May-1999 BUG: 10016
*/
/* In case error happens creating FK, triggers don't let set
* INACTIVE = TRUE for FK index. Therefore use separate
* transaction be able to rollback when needed.
* AP, 2005
*/
// Only activate Foreign keys that have been marked for deferred
// activation.
// -bsriram, 11-May-1999 BUG: 10016
// In case error happens creating FK, triggers don't let set
// INACTIVE = TRUE for FK index. Therefore use separate
// transaction be able to rollback when needed.
// AP, 2005
FOR (REQUEST_HANDLE req_handle1)
CNST IN RDB$RELATION_CONSTRAINTS
CROSS IDS IN RDB$INDICES WITH
@ -479,9 +479,7 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
//
update_view_dbkey_lengths(tdgbl);
/*
** Change ownership of any procedures necessary
*/
// Change ownership of any procedures necessary
for (burp_prc* procedure = tdgbl->procedures; procedure; procedure = procedure->prc_next)
{
@ -539,8 +537,8 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
MISC_release_request_silent(req_handle2);
/* Now that changing ownership of tables is over, it is safe to
update the database security class in RDB$DATABASE */
// Now that changing ownership of tables is over, it is safe to
// update the database security class in RDB$DATABASE
if (tdgbl->database_security_class[0]) // Do it only if it's not NULL
{
@ -726,7 +724,7 @@ void add_files(BurpGlobals* tdgbl, const char* file_name)
if (count)
{
BURP_verbose (70);
// msg 70 committing secondary files
// msg 70 committing secondary files
COMMIT
// existing ON_ERROR continues past error, beck
ON_ERROR
@ -782,7 +780,7 @@ void bad_attribute(scan_attr_t scan_next_attr, att_type bad_attr, USHORT type)
skip_count = tdgbl->gbl_sw_skip_count;
get_skip(tdgbl, skip_count);
BURP_print (203, SafeArg() << skip_count << int(bad_attr));
//msg 203: skipped %d bytes after reading a bad attribute %d
// msg 203: skipped %d bytes after reading a bad attribute %d
}
else
{
@ -966,9 +964,9 @@ void create_database(BurpGlobals* tdgbl, const TEXT* file_name)
db_read_only = tdgbl->gbl_sw_mode_val;
else
{
/* No access mode specified by user. Use attribute settings. Since the
* database is set to readOnly only after making it Online in
* RESTORE_restore(), pass on this information through Global structures */
// No access mode specified by user. Use attribute settings. Since the
// database is set to readOnly only after making it Online in
// RESTORE_restore(), pass on this information through Global structures
tdgbl->gbl_sw_mode = true;
tdgbl->gbl_sw_mode_val = db_read_only;
}
@ -1012,13 +1010,10 @@ void create_database(BurpGlobals* tdgbl, const TEXT* file_name)
// Turn off sync writes during restore
dpb.insertByte(isc_dpb_force_write, 0);
/*
**
** which SQL dialect that this database speaks
** When we restore backup files that came from prior
** to V6, we force the SQL database dialect to 1
**
*/
// which SQL dialect that this database speaks
// When we restore backup files that came from prior
// to V6, we force the SQL database dialect to 1
dpb.insertByte(isc_dpb_sql_dialect, SQL_dialect_flag ? SQL_dialect : SQL_DIALECT_V5);
// start database up shut down,
@ -1274,11 +1269,10 @@ bool get_acl(BurpGlobals* tdgbl,
case isc_info_blob_num_segments:
num_segments = (USHORT) n;
/*
** we assume that the ACL list was written out as
** in one big segment
**
*/
// we assume that the ACL list was written out as
// in one big segment
if (num_segments > 1) {
// CVC: I can't see the effect of assert(true)
fb_assert (num_segments > 1);
@ -1313,10 +1307,8 @@ bool get_acl(BurpGlobals* tdgbl,
if (length < max_segment)
length = max_segment;
/*
** Allocate a buffer large enough for the largest segment and start
** grinding.
*/
// Allocate a buffer large enough for the largest segment and start grinding.
BlobBuffer static_buffer;
UCHAR* buffer = static_buffer.getBuffer(length);
@ -1652,9 +1644,8 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer)
last_element_dim[count] : (last_element_dim[count] - 1);
if (upper < range[0])
{
/**
see Special Case above
**/
// see Special Case above
dont_write = true;
break;
}
@ -1766,7 +1757,8 @@ void get_array(BurpGlobals* tdgbl, burp_rel* relation, UCHAR* record_buffer)
}
}
else
{ /** This is the regular case we've got the entire array **/
{
// This is the regular case we've got the entire array
UCHAR* blr = blr_buffer;
// build the sdl
@ -2774,9 +2766,9 @@ rec_type get_data(BurpGlobals* tdgbl, burp_rel* relation)
// existing ON_ERROR continues past error, beck
ON_ERROR
/* Fix for bug_no 8055:
don't throw away the database just because an index
could not be made */
// Fix for bug_no 8055:
// don't throw away the database just because an index
// could not be made
ISC_STATUS error_code;
while (error_code = tdgbl->status_vector[1])
{
@ -2807,7 +2799,7 @@ rec_type get_data(BurpGlobals* tdgbl, burp_rel* relation)
// msg 245 Set the TMP environment variable to a directory on a filesystem that does have enough space, and activate index with
}
BURP_print(243, index_name);
/* msg 243 ALTER INDEX \"%s\" ACTIVE; */
// msg 243 ALTER INDEX \"%s\" ACTIVE
END_MODIFY;
END_FOR;
// don't bring the database on-line
@ -5552,9 +5544,9 @@ bool get_relation(BurpGlobals* tdgbl)
}
// If we fall thru, there are data records to be gotten
/* we can get here only when restoring ancient gbak'ed files where rec_data
was once embedded into rec_relation ... otherwise, meta commit happens
when we see the first rec_relation_data */
// we can get here only when restoring ancient gbak'ed files where rec_data
// was once embedded into rec_relation ... otherwise, meta commit happens
// when we see the first rec_relation_data
BURP_verbose (68);
// msg 68 committing meta data
@ -5770,11 +5762,7 @@ bool get_sql_roles(BurpGlobals* tdgbl)
X.RDB$ROLE_NAME.NULL = FALSE;
l = GET_TEXT(X.RDB$ROLE_NAME);
MISC_terminate (X.RDB$ROLE_NAME, temp, l, sizeof(temp));
/************************************************
**
** msg 251, restoring SQL role: %s
**
*************************************************/
// msg 251, restoring SQL role: %s
BURP_verbose (251, temp);
break;
@ -5824,11 +5812,7 @@ bool get_sql_roles(BurpGlobals* tdgbl)
X.RDB$ROLE_NAME.NULL = FALSE;
l = GET_TEXT(X.RDB$ROLE_NAME);
MISC_terminate (X.RDB$ROLE_NAME, temp, l, sizeof(temp));
/************************************************
**
** msg 251, restoring SQL role: %s
**
*************************************************/
// msg 251, restoring SQL role: %s
BURP_verbose (251, temp);
break;
@ -5951,10 +5935,10 @@ bool get_mapping(BurpGlobals* tdgbl)
{
tdgbl->firstMap = false;
BURP_verbose(301);
//msg 301, restoring names mapping
// msg 301, restoring names mapping
}
BURP_verbose(298, ADMIN_ROLE);
//msg 298, restoring map @1
// msg 298, restoring map @1
Firebird::string sql;
sql.printf("%s ('%s', %d) %s",
"UPDATE OR INSERT INTO RDB$ROLES(RDB$ROLE_NAME, RDB$SYSTEM_FLAG) VALUES",
@ -6025,13 +6009,13 @@ bool get_security_class(BurpGlobals* tdgbl)
case att_class_security_class:
l = GET_TEXT(X.RDB$SECURITY_CLASS);
/* Bug fix for bug_no 7299: There was a V3 bug that inserted
garbage security class entry when doing GBAK. In order to
restore the V3 gbak file with this bad security entry to
V4 database. We should check if the security class is a
valid ASCII name. If not, skip this entry by setting
'is_valid_sec_class' to false.
*/
// Bug fix for bug_no 7299: There was a V3 bug that inserted
// garbage security class entry when doing GBAK. In order to
// restore the V3 gbak file with this bad security entry to
// V4 database. We should check if the security class is a
// valid ASCII name. If not, skip this entry by setting
// 'is_valid_sec_class' to false.
is_valid_sec_class = is_ascii_name(X.RDB$SECURITY_CLASS, l);
if (!is_valid_sec_class)
{
@ -6927,14 +6911,12 @@ bool get_user_privilege(BurpGlobals* tdgbl)
strcpy (X.RDB$FIELD_NAME, field_name);
}
/*
* USER_TYPE & OBJECT_TYPE are fields that did not exist before
* V4.0. So, we have to reconstruct them and initialize them to
* reasonable values. If they existed before then user_type and
* object_type contain the proper values. If they didn't exist
* then user_type and object_type contain the reasonable default
* values.
*/
// USER_TYPE & OBJECT_TYPE are fields that did not exist before
// V4.0. So, we have to reconstruct them and initialize them to
// reasonable values. If they existed before then user_type and
// object_type contain the proper values. If they didn't exist
// then user_type and object_type contain the reasonable default
// values.
X.RDB$USER_TYPE.NULL = FALSE;
X.RDB$USER_TYPE = user_type;
@ -6943,14 +6925,14 @@ bool get_user_privilege(BurpGlobals* tdgbl)
X.RDB$OBJECT_TYPE = object_type;
/*
* If OBJECT_TYPE didn't exist before and we have a field level
* user privileges, then use obj_field instead.
*
* NOTE: Scanning the V4.0 code base, obj_field has never been
* used at all. The following code should be uncommented
* in case we ever introduce obj_field to the picture.
*/
// If OBJECT_TYPE didn't exist before and we have a field level
// user privileges, then use obj_field instead.
// NOTE: Scanning the V4.0 code base, obj_field has never been
// used at all. The following code should be uncommented
// in case we ever introduce obj_field to the picture.
/***********************************************************
if ( !(flags & USER_PRIV_OBJECT_TYPE) )
{
@ -7408,10 +7390,9 @@ bool restore(BurpGlobals* tdgbl,
if (gds_status[1])
EXEC SQL SET TRANSACTION;
/* For V4.0, start a read commited transaction. This will be used
* to create blobs for global fields and update the record in the
* RDB$FIELDS table.
*/
// For V4.0, start a read commited transaction. This will be used
// to create blobs for global fields and update the record in the
// RDB$FIELDS table.
EXEC SQL SET TRANSACTION NAME tdgbl->global_trans ISOLATION LEVEL READ COMMITTED;
@ -7433,10 +7414,10 @@ bool restore(BurpGlobals* tdgbl,
switch (attribute)
{
case att_database_security_class:
/* Instead of updating the security class in RDB$DATABASE,
just store the value in tdgbl. It will be updated at
the very end to prevent security class validation
failures during change table ownership operation */
// Instead of updating the security class in RDB$DATABASE,
// just store the value in tdgbl. It will be updated at
// the very end to prevent security class validation
// failures during change table ownership operation
GET_TEXT(tdgbl->database_security_class);
break;
@ -7735,15 +7716,15 @@ bool restore(BurpGlobals* tdgbl,
MISC_release_request_silent(req_handle4);
}
/* This piece of code is to fix bug 10098: restore of database with
only domains and no relations aborts with the message ERROR: deadlock
This is because insertion of domains into RDB$FIELDS is happening in
the default transaction, whereas updation of RDB$FIELDS to add
constraints to the domains is done in tdgbl->global_trans. In case of
no relations, no COMMIT of default transaction occurs till this point
because of which rows in RDB$FIELDS for domains are still locked by
default transaction. The below code COMMITs the default transaction
in that particular situation */
// This piece of code is to fix bug 10098: restore of database with
// only domains and no relations aborts with the message ERROR: deadlock
// This is because insertion of domains into RDB$FIELDS is happening in
// the default transaction, whereas updation of RDB$FIELDS to add
// constraints to the domains is done in tdgbl->global_trans. In case of
// no relations, no COMMIT of default transaction occurs till this point
// because of which rows in RDB$FIELDS for domains are still locked by
// default transaction. The below code COMMITs the default transaction
// in that particular situation
if (flag_norel)
{

View File

@ -77,10 +77,8 @@ static in_sw_tab_t spit_in_sw_table[] =
{IN_SW_SPIT_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL}
};
/*************************************
** backup files header record
**************************************
*/
// backup files header record
struct header_rec
{
@ -97,10 +95,8 @@ struct header_rec
const size_t header_rec_len = sizeof(header_rec);
static const char *header_rec_name = "InterBase/gsplit, ";
/*************************************
** backup files structure
**************************************
*/
// backup files structure
struct b_fil
{
@ -113,12 +109,7 @@ struct b_fil
const size_t b_fil_len = sizeof(b_fil);
/*****************************************************
**
** local function declarations
**
******************************************************
*/
// local function declarations
static int conv_ntoc(SLONG, TEXT*);
static int free_file_list(b_fil*);
@ -139,12 +130,12 @@ static int write_header(const b_fil*, header_rec, FILE_DESC, TEXT*);
/*****************************************************
**
** M A I N P R O G R A M
**
******************************************************
*/
/*****************************************************
**
** M A I N P R O G R A M
**
******************************************************
*/
int main( int argc, char *argv[])
{
@ -156,10 +147,7 @@ int main( int argc, char *argv[])
return FB_FAILURE;
}
/************************
** Fields initialization
*************************
*/
// Fields initialization
b_fil* file_ptr = NULL;
b_fil* file_list = NULL;
@ -167,20 +155,15 @@ int main( int argc, char *argv[])
SINT64 file_size = -1;
gsplit_option sw_replace = IN_SW_SPIT_0;
/*******************************
** Initialize in_sw_table table.
*******************************
*/
// Initialize in_sw_table table.
for (in_sw_tab_t* in_sw_tab = spit_in_sw_table; in_sw_tab->in_sw_name; in_sw_tab++)
{
in_sw_tab->in_sw_state = false;
}
/**********************************
** validating command line options
***********************************
*/
// validating command line options
SLONG ret_cd, file_num = 0;
bool file_nm_sw = false;
@ -318,12 +301,7 @@ int main( int argc, char *argv[])
break;
}
/********************************************************
**
** free all the storage allocated for backup files
**
*********************************************************
*/
// free all the storage allocated for backup files
free_file_list(file_list);
return FB_SUCCESS;
@ -533,13 +511,13 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
TEXT header_str[header_rec_len], num_arr[5];
header_rec hdr_rec;
// CVC: there's a can of worms here. First, this function assumes it can free
// the io_buffer's allocated memory without keeping a second copy of that pointer.
// However, io_buffer can't be declared UCHAR* const because its address is
// passed to final_read_and_write() and read_and_write() and both functions
// thus suggest, by taking a UCHAR** that they can change the pointer's address;
// but in practice they never affect it, so fixing those functions to take simply
// UCHAR* would allow the correct declaration for io_buffer to succeed.
// CVC: there's a can of worms here. First, this function assumes it can free
// the io_buffer's allocated memory without keeping a second copy of that pointer.
// However, io_buffer can't be declared UCHAR* const because its address is
// passed to final_read_and_write() and read_and_write() and both functions
// thus suggest, by taking a UCHAR** that they can change the pointer's address;
// but in practice they never affect it, so fixing those functions to take simply
// UCHAR* would allow the correct declaration for io_buffer to succeed.
//UCHAR* const io_buffer = (UCHAR *) malloc(IO_BUFFER_SIZE);
UCHAR* io_buffer = (UCHAR *) malloc(IO_BUFFER_SIZE);
@ -675,9 +653,8 @@ static int gen_multy_bakup_files(b_fil* file_list, FILE_DESC input_file_desc, SL
case FILE_IS_FULL:
{
byte_read = 0; /* reset byte read count,
** prepare for next read
*/
byte_read = 0; // reset byte read count, prepare for next read
const UCHAR* remaining_io = io_buffer + byte_write;
SLONG remaining_io_len = IO_BUFFER_SIZE - byte_write;
while (!flush_done && (fl_ptr != NULL))
@ -782,14 +759,11 @@ static int read_and_write(FILE_DESC input_file_desc,
SLONG read_cnt, last_read_size;
/********************************************************
** when number of byte read + number of byte goint to
** be read is greater then file size, then calculate
** the size for the last read and do the last read for
** the current backup file. Otherwise read as mush data
** as will fit in the current backup file.
**********************************************************
*/
// when number of byte read + number of byte goint to
// be read is greater then file size, then calculate
// the size for the last read and do the last read for
// the current backup file. Otherwise read as mush data
// as will fit in the current backup file.
if (*byte_read + io_size > file_size) {
last_read_size = (SLONG) (file_size - *byte_read);
@ -1194,7 +1168,7 @@ static int flush_io_buff(const UCHAR* remaining_io,
if (file_size > remaining_io_len) {
write_cnt = write(output_fl_desc, remaining_io, remaining_io_len);
}
else { /* file_size <= remaining_io_len */
else { // file_size <= remaining_io_len
write_cnt = write(output_fl_desc, remaining_io, (unsigned int) file_size);
}

View File

@ -26,7 +26,7 @@
*
*/
/* PLEASE, DO NOT CONSTIFY THIS MODULE !!! */
// PLEASE, DO NOT CONSTIFY THIS MODULE !!!
#include "firebird.h"
#include "../common/classes/alloc.h"
@ -75,7 +75,7 @@ inline void PATTERN_FILL(void*, size_t, unsigned int) { }
// 7. shared pool locking
// 8. red zones checking (not really needed because verify_pool is able to detect most corruption cases)
/****************************** Local declarations *****************************/
// ****************************** Local declarations *****************************
namespace {
@ -162,7 +162,7 @@ size_t get_page_size()
#endif
#if defined(HAVE_MMAP) && !defined(MAP_ANONYMOUS)
int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
int dev_zero_fd = -1; // Cached file descriptor for /dev/zero.
#endif
#if defined(WIN_NT) || defined(HAVE_MMAP)
@ -207,7 +207,7 @@ size_t delayedExtentsPos = 0;
namespace Firebird {
/****************************** Firebird::MemoryPool ***************************/
// ****************************** Firebird::MemoryPool ***************************
static void print_block(FILE* file, MemoryBlock* blk, bool used_only,
const char* filter_path, const size_t filter_len);
@ -550,7 +550,7 @@ void MemoryPool::external_free(void* blk, size_t& size, bool pool_destroying)
# else
if (munmap(blk, size))
system_call_failed::raise("munmap");
# endif /*Solaris*/
# endif // Solaris
# else
::free(blk);
# endif

View File

@ -238,12 +238,12 @@ public:
counter_type operator ++()
{
return atomic_inc_uint_nv (&counter);
return atomic_inc_uint_nv(&counter);
}
counter_type operator --()
{
return atomic_dec_uint_nv (&counter);
return atomic_dec_uint_nv(&counter);
}
counter_type value() const { return counter; }

View File

@ -234,7 +234,8 @@ namespace Firebird
return baseAssign(l);
}
/* inline void swap(AbstractString& str)
/*
inline void swap(AbstractString& str)
{
Storage *tmp = StringData;
StringData = str.StringData;

View File

@ -172,11 +172,9 @@ class TlsValue
public:
static void TlsV_on_thread_exit (void * pval)
{
/* Usually should delete pval like this
T* ptempT = (T*) pval;
delete ptempT;
*/
// Usually should delete pval like this
// T* ptempT = (T*) pval;
// delete ptempT;
}
TlsValue()

View File

@ -51,13 +51,13 @@ namespace Firebird
iterator(ObjectsArray *l, size_t p) : lst(l), pos(p) { }
public:
iterator() : lst(0), pos(0) { }
/*
/*
iterator& operator=(ObjectsArray& a)
{
lst = &a;
pos = 0;
}
*/
*/
iterator& operator++()
{
++pos;
@ -117,13 +117,13 @@ namespace Firebird
const_iterator() : lst(0), pos(0) { }
explicit const_iterator(const iterator& it) : lst(it.lst), pos(it.pos) {}
explicit const_iterator(iterator& it) : lst(it.lst), pos(it.pos) {}
/*
/*
const_iterator& operator=(const ObjectsArray& a)
{
lst = &a;
pos = 0;
}
*/
*/
const_iterator& operator++()
{
++pos;

View File

@ -336,9 +336,9 @@ public:
} // namespace Firebird
#endif /*solaris threading (not posix)*/
#endif // solaris threading (not posix)
#endif /*!WIN_NT*/
#endif // !WIN_NT
namespace Firebird {

View File

@ -33,8 +33,7 @@
#include "../jrd/gdsassert.h"
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h> /* XPG: prototypes for malloc/free have to be in
stdlib.h (EKU) */
#include <stdlib.h> // XPG: prototypes for malloc/free have to be in stdlib.h (EKU)
#endif
#include "vector.h"
@ -636,7 +635,7 @@ private:
friend class Accessor;
};
/************************ BePlusTree implementation ******************/
// ************************ BePlusTree implementation ******************
template <typename Value, typename Key, typename Allocator, typename KeyOfValue, typename Cmp, int LeafCount, int NodeCount>
bool BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::add(const Value& item, Accessor* accessor)

View File

@ -139,7 +139,7 @@ static Firebird::InitInstance<ConfigImpl> sysConfig;
ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p)
{
/* Prepare some stuff */
// Prepare some stuff
ConfigFile file(p, true);
root_dir = getRootDirectory();
@ -149,7 +149,7 @@ ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p)
//string val_sep = ",";
file.setConfigFilePath(getConfigFilePath());
/* Iterate through the known configuration entries */
// Iterate through the known configuration entries
for (int i = 0; i < size; i++)
{
@ -158,13 +158,13 @@ ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p)
if (!value.length())
{
/* Assign the default value */
// Assign the default value
values[i] = entries[i].default_value;
continue;
}
/* Assign the actual value */
// Assign the actual value
switch (entry.data_type)
{
@ -192,7 +192,7 @@ ConfigImpl::~ConfigImpl()
{
const int size = FB_NELEM(entries);
/* Free allocated memory */
// Free allocated memory
for (int i = 0; i < size; i++)
{

View File

@ -122,219 +122,136 @@ class Config
public:
/*
Interface to support command line root specification.
*
This ugly solution was required to make it possible to specify root
in command line to load firebird.conf from that root, though in other
cases firebird.conf may be also used to specify root.
*/
// Interface to support command line root specification.
// This ugly solution was required to make it possible to specify root
// in command line to load firebird.conf from that root, though in other
// cases firebird.conf may be also used to specify root.
static void setRootDirectoryFromCommandLine(const Firebird::PathName& newRoot);
static const Firebird::PathName* getCommandLineRootDirectory();
/*
Installation directory
*/
// Installation directory
static const char* getInstallDirectory();
/*
Root directory of current installation
*/
// Root directory of current installation
static const char* getRootDirectory();
/*
Allocation chunk for the temporary spaces
*/
// Allocation chunk for the temporary spaces
static int getTempBlockSize();
/*
Caching limit for the temporary data
*/
// Caching limit for the temporary data
static int getTempCacheLimit();
/*
Whether remote (NFS) files can be opened
*/
// Whether remote (NFS) files can be opened
static bool getRemoteFileOpenAbility();
/*
Startup option for the guardian
*/
// Startup option for the guardian
static int getGuardianOption();
/*
CPU affinity mask
*/
// CPU affinity mask
static int getCpuAffinityMask();
/*
XDR buffer size
*/
// XDR buffer size
static int getTcpRemoteBufferSize();
/*
Disable Nagle algorithm
*/
// Disable Nagle algorithm
static bool getTcpNoNagle();
/*
Default database cache size
*/
// Default database cache size
static int getDefaultDbCachePages();
/*
Connection timeout
*/
// Connection timeout
static int getConnectionTimeout();
/*
Dummy packet interval
*/
// Dummy packet interval
static int getDummyPacketInterval();
/*
Lock manager memory size
*/
// Lock manager memory size
static int getLockMemSize();
/*
Lock manager grant order
*/
// Lock manager grant order
static bool getLockGrantOrder();
/*
Lock manager hash slots
*/
// Lock manager hash slots
static int getLockHashSlots();
/*
Lock manager acquire spins
*/
// Lock manager acquire spins
static int getLockAcquireSpins();
/*
Event manager memory size
*/
// Event manager memory size
static int getEventMemSize();
/*
Deadlock timeout
*/
// Deadlock timeout
static int getDeadlockTimeout();
/*
Priority switch delay
*/
// Priority switch delay
static int getPrioritySwitchDelay();
/*
Use priority scheduler
*/
// Use priority scheduler
static bool getUsePriorityScheduler();
/*
Priority boost
*/
// Priority boost
static int getPriorityBoost();
/*
Service name for remote protocols
*/
// Service name for remote protocols
static const char *getRemoteServiceName();
/*
Service port for INET
*/
// Service port for INET
static unsigned short getRemoteServicePort();
/*
Pipe name for WNET
*/
// Pipe name for WNET
static const char *getRemotePipeName();
/*
Name for IPC-related objects
*/
// Name for IPC-related objects
static const char *getIpcName();
/*
Unflushed writes number
*/
// Unflushed writes number
static int getMaxUnflushedWrites();
/*
Unflushed write time
*/
// Unflushed write time
static int getMaxUnflushedWriteTime();
/*
Process priority level
*/
// Process priority level
static int getProcessPriorityLevel();
/*
Complete boolean evaluation
*/
// Complete boolean evaluation
static bool getCompleteBooleanEvaluation();
/*
Port for event processing
*/
// Port for event processing
static int getRemoteAuxPort();
/*
Server binding NIC address
*/
// Server binding NIC address
static const char *getRemoteBindAddress();
/*
Directory list for external tables
*/
// Directory list for external tables
static const char *getExternalFileAccess();
/*
Directory list for databases
*/
// Directory list for databases
static const char *getDatabaseAccess();
/*
Directory list for UDF libraries
*/
// Directory list for UDF libraries
static const char *getUdfAccess();
/*
Temporary directories list
*/
// Temporary directories list
static const char *getTempDirectories();
/*
Abort on BUGCHECK and structured exceptions
*/
// Abort on BUGCHECK and structured exceptions
static bool getBugcheckAbort();
/*
Let use of des hash to verify passwords
*/
// Let use of des hash to verify passwords
static bool getLegacyHash();
/*
GC policy
*/
// GC policy
static const char *getGCPolicy();
/*
Redirection
*/
// Redirection
static bool getRedirection();
/*
Use old column naming rules (does not conform to SQL standard)
*/
// Use old column naming rules (does not conform to SQL standard)
static bool getOldColumnNaming();
/*
Use native, trusted or mixed authentication
*/
// Use native, trusted or mixed authentication
static const char *getAuthMethod();
static int getDatabaseGrowthIncrement();

View File

@ -73,24 +73,24 @@ using namespace Firebird;
So, instead of some including <limits.h> and others using these
definitions, just always use these definitions (huh?) */
#define LONG_MIN_real -2147483648. /* min decimal value of an "SLONG" */
#define LONG_MAX_real 2147483647. /* max decimal value of an "SLONG" */
#define LONG_MIN_int -2147483648 /* min integer value of an "SLONG" */
#define LONG_MAX_int 2147483647 /* max integer value of an "SLONG" */
#define LONG_MIN_real -2147483648. // min decimal value of an "SLONG"
#define LONG_MAX_real 2147483647. // max decimal value of an "SLONG"
#define LONG_MIN_int -2147483648 // min integer value of an "SLONG"
#define LONG_MAX_int 2147483647 // max integer value of an "SLONG"
/* It turns out to be tricky to write the INT64 versions of those constant in
a way that will do the right thing on all platforms. Here we go. */
// It turns out to be tricky to write the INT64 versions of those constant in
// a way that will do the right thing on all platforms. Here we go.
#define LONG_MAX_int64 ((SINT64) 2147483647) /* max int64 value of an SLONG */
#define LONG_MIN_int64 (-LONG_MAX_int64 - 1) /* min int64 value of an SLONG */
#define LONG_MAX_int64 ((SINT64) 2147483647) // max int64 value of an SLONG
#define LONG_MIN_int64 (-LONG_MAX_int64 - 1) // min int64 value of an SLONG
#define QUAD_MIN_real -9223372036854775808. /* min decimal value of quad */
#define QUAD_MAX_real 9223372036854775807. /* max decimal value of quad */
#define QUAD_MIN_real -9223372036854775808. // min decimal value of quad
#define QUAD_MAX_real 9223372036854775807. // max decimal value of quad
#define QUAD_MIN_int quad_min_int /* min integer value of quad */
#define QUAD_MAX_int quad_max_int /* max integer value of quad */
#define QUAD_MIN_int quad_min_int // min integer value of quad
#define QUAD_MAX_int quad_max_int // max integer value of quad
#define FLOAT_MAX 3.4e38 /* max float (32 bit) value */
#define FLOAT_MAX 3.4e38 // max float (32 bit) value
#define LETTER7(c) ((c) >= 'A' && (c) <= 'Z')
#define DIGIT(c) ((c) >= '0' && (c) <= '9')
@ -105,9 +105,9 @@ using namespace Firebird;
#define SHORT_LIMIT ((1 << 14) / 5)
#define LONG_LIMIT ((1L << 30) / 5)
/* NOTE: The syntax for the below line may need modification to ensure
* the result of 1 << 62 is a quad
*/
// NOTE: The syntax for the below line may need modification to ensure
// the result of 1 << 62 is a quad
#define QUAD_LIMIT ((((SINT64) 1) << 62) / 5)
#define INT64_LIMIT ((((SINT64) 1) << 62) / 5)
@ -188,61 +188,61 @@ static void float_to_text(const dsc* from, dsc* to, Callbacks* cb)
int precision;
if (dtype_double == from->dsc_dtype) {
precision = 16; /* minimum significant digits in a double */
precision = 16; // minimum significant digits in a double
d = *(double*) from->dsc_address;
}
else {
fb_assert(dtype_real == from->dsc_dtype);
precision = 8; /* minimum significant digits in a float */
precision = 8; // minimum significant digits in a float
d = (double) *(float*) from->dsc_address;
}
/* If this is a double with non-zero scale, then it is an old-style
NUMERIC(15, -scale): print it in fixed format with -scale digits
to the right of the ".". */
// If this is a double with non-zero scale, then it is an old-style
// NUMERIC(15, -scale): print it in fixed format with -scale digits
// to the right of the ".".
/* CVC: Here sprintf was given an extra space in the two formatting
masks used below, "%- #*.*f" and "%- #*.*g" but certainly with positive
quantities and CAST it yields an annoying leading space.
However, by getting rid of the space you get in dialect 1:
cast(17/13 as char(5)) => 1.308
cast(-17/13 as char(5)) => -1.31
Since this is inconsistent with dialect 3, see workaround at the tail
of this function. */
// CVC: Here sprintf was given an extra space in the two formatting
// masks used below, "%- #*.*f" and "%- #*.*g" but certainly with positive
// quantities and CAST it yields an annoying leading space.
// However, by getting rid of the space you get in dialect 1:
// cast(17/13 as char(5)) => 1.308
// cast(-17/13 as char(5)) => -1.31
// Since this is inconsistent with dialect 3, see workaround at the tail
// of this function.
int chars_printed; /* number of characters printed */
int chars_printed; // number of characters printed
if ((dtype_double == from->dsc_dtype) && (from->dsc_scale < 0))
chars_printed = sprintf(temp, "%- #*.*f", width, -from->dsc_scale, d);
else
chars_printed = LONG_MAX_int; /* sure to be greater than to_len */
chars_printed = LONG_MAX_int; // sure to be greater than to_len
/* If it's not an old-style numeric, or the f-format was too long for the
destination, try g-format with the maximum precision which makes sense
for the input type: if it fits, we're done. */
// If it's not an old-style numeric, or the f-format was too long for the
// destination, try g-format with the maximum precision which makes sense
// for the input type: if it fits, we're done.
if (chars_printed > width)
{
char num_format[] = "%- #*.*g";
chars_printed = sprintf(temp, num_format, width, precision, d);
/* If the full-precision result is too wide for the destination,
reduce the precision and try again. */
// If the full-precision result is too wide for the destination,
// reduce the precision and try again.
if (chars_printed > width)
{
precision -= (chars_printed - width);
/* If we cannot print at least two digits, one on each side of the
".", report an overflow exception. */
// If we cannot print at least two digits, one on each side of the
// ".", report an overflow exception.
if (precision < 2)
cb->err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
chars_printed = sprintf(temp, num_format, width, precision, d);
/* It's possible that reducing the precision caused sprintf to switch
from f-format to e-format, and that the output is still too long
for the destination. If so, reduce the precision once more.
This is certain to give a short-enough result. */
// It's possible that reducing the precision caused sprintf to switch
// from f-format to e-format, and that the output is still too long
// for the destination. If so, reduce the precision once more.
// This is certain to give a short-enough result.
if (chars_printed > width) {
precision -= (chars_printed - width);
@ -264,10 +264,10 @@ static void float_to_text(const dsc* from, dsc* to, Callbacks* cb)
dsc intermediate;
intermediate.dsc_dtype = dtype_text;
intermediate.dsc_ttype() = ttype_ascii;
/* CVC: If you think this is dangerous, replace the "else" with a call to
MEMMOVE(temp, temp + 1, chars_printed) or something cleverer.
Paranoid assumption:
UCHAR is unsigned char as seen on jrd\common.h => same size. */
// CVC: If you think this is dangerous, replace the "else" with a call to
// MEMMOVE(temp, temp + 1, chars_printed) or something cleverer.
// Paranoid assumption:
// UCHAR is unsigned char as seen on jrd\common.h => same size.
if (d < 0)
{
intermediate.dsc_address = reinterpret_cast<UCHAR*>(temp);
@ -299,8 +299,8 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
*
**************************************/
#ifndef NATIVE_QUAD
/* For now, this routine does not handle quadwords unless this is
supported by the platform as a native datatype. */
// For now, this routine does not handle quadwords unless this is
// supported by the platform as a native datatype.
if (from->dsc_dtype == dtype_quad)
cb->err(Arg::Gds(isc_badblk)); /* internal error */
@ -308,8 +308,8 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
SSHORT pad_count = 0, decimal = 0, neg = 0;
/* Save (or compute) scale of source. Then convert source to ordinary
longword or int64. */
// Save (or compute) scale of source. Then convert source to ordinary
// longword or int64.
SCHAR scale = from->dsc_scale;
@ -328,7 +328,7 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
CVT_move_common(from, &intermediate, cb);
/* Check for negation, then convert the number to a string of digits */
// Check for negation, then convert the number to a string of digits
FB_UINT64 u;
if (n >= 0)
@ -348,21 +348,21 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
SSHORT l = p - temp;
/* if scale < 0, we need at least abs(scale)+1 digits, so add
any leading zeroes required. */
// if scale < 0, we need at least abs(scale)+1 digits, so add
// any leading zeroes required.
while (l + scale <= 0) {
*p++ = '0';
l++;
}
/* postassertion: l+scale > 0 */
// postassertion: l+scale > 0
fb_assert(l + scale > 0);
// CVC: also, we'll check for buffer overflow directly.
fb_assert(temp + sizeof(temp) >= p);
/* Compute the total length of the field formatted. Make sure it
fits. Keep in mind that routine handles both string and varying
string fields. */
// Compute the total length of the field formatted. Make sure it
// fits. Keep in mind that routine handles both string and varying
// string fields.
const USHORT length = l + neg + decimal + pad_count;
@ -846,9 +846,9 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
double d, eps;
SINT64 val64;
TEXT buffer[50]; /* long enough to represent largest long in ASCII */
TEXT buffer[50]; // long enough to represent largest long in ASCII
/* adjust exact numeric values to same scaling */
// adjust exact numeric values to same scaling
if (DTYPE_IS_EXACT(desc->dsc_dtype))
scale -= desc->dsc_scale;
@ -868,7 +868,7 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
case dtype_int64:
val64 = *((SINT64 *) p);
/* adjust for scale first, *before* range-checking the value. */
// adjust for scale first, *before* range-checking the value.
if (scale > 0) {
SLONG fraction = 0;
do {
@ -878,12 +878,10 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
} while (--scale);
if (fraction > 4)
val64++;
/*
* The following 2 lines are correct for platforms where
* ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
* a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
* we'll have to change this depending on the platform.
*/
// The following 2 lines are correct for platforms where
// ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
// a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
// we'll have to change this depending on the platform.
else if (fraction < -4)
val64--;
}
@ -929,10 +927,9 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
else
d -= 0.5 + eps;
/* make sure the cast will succeed - different machines
do different things if the value is larger than a long
can hold */
/* If rounding would yield a legitimate value, permit it */
// make sure the cast will succeed - different machines
// do different things if the value is larger than a long can hold
// If rounding would yield a legitimate value, permit it
if (d < (double) LONG_MIN_real) {
if (d > (double) LONG_MIN_real - 1.)
@ -965,11 +962,11 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
break;
default:
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
break;
}
/* Last, but not least, adjust for scale */
// Last, but not least, adjust for scale
if (scale > 0)
{
@ -981,12 +978,10 @@ SLONG CVT_get_long(const dsc* desc, SSHORT scale, ErrorFunction err)
} while (--scale);
if (fraction > 4)
value++;
/*
* The following 2 lines are correct for platforms where
* ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
* a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
* we'll have to change this depending on the platform.
*/
// The following 2 lines are correct for platforms where
// ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
// a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
// we'll have to change this depending on the platform.
else if (fraction < -4)
value--;
}
@ -1048,8 +1043,8 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
return *((float*) desc->dsc_address);
case DEFAULT_DOUBLE:
/* memcpy is done in case dsc_address is on a platform dependant
invalid alignment address for doubles */
// memcpy is done in case dsc_address is on a platform dependant
// invalid alignment address for doubles
memcpy(&value, desc->dsc_address, sizeof(double));
return value;
@ -1057,7 +1052,7 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
case dtype_cstring:
case dtype_text:
{
TEXT buffer[50]; /* must hold ascii of largest double */
TEXT buffer[50]; // must hold ascii of largest double
const char* p;
const USHORT length =
@ -1112,15 +1107,14 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
CVT_conversion_error(desc, err);
}
/* If we didn't see a digit then must be a funny string like " ". */
// If we didn't see a digit then must be a funny string like " ".
if (!digit_seen)
CVT_conversion_error(desc, err);
if (sign == -1)
value = -value;
/* If there's still something left, there must be an explicit
exponent */
// If there's still something left, there must be an explicit exponent
if (p < end)
{
@ -1129,13 +1123,14 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
SSHORT exp = 0;
for (p++; p < end; p++)
{
if (DIGIT(*p)) {
if (DIGIT(*p))
{
digit_seen = true;
exp = exp * 10 + *p - '0';
/* The following is a 'safe' test to prevent overflow of
exp here and of scale below. A more precise test occurs
later in this routine. */
// The following is a 'safe' test to prevent overflow of
// exp here and of scale below. A more precise test occurs
// later in this routine.
if (exp >= SHORT_LIMIT)
err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
@ -1166,22 +1161,21 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
scale -= exp;
}
/* if the scale is greater than the power of 10 representable
in a double number, then something has gone wrong... let
the user know... */
// if the scale is greater than the power of 10 representable
// in a double number, then something has gone wrong... let
// the user know...
if (ABSOLUT(scale) > DBL_MAX_10_EXP)
err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
/*
Repeated division is a good way to mung the least significant bits
of your value, so we have replaced this iterative multiplication/division
by a single multiplication or division, depending on sign(scale).
if (scale > 0)
do value /= 10.; while (--scale);
else if (scale)
do value *= 10.; while (++scale);
*/
// Repeated division is a good way to mung the least significant bits
// of your value, so we have replaced this iterative multiplication/division
// by a single multiplication or division, depending on sign(scale).
//if (scale > 0)
// do value /= 10.; while (--scale);
//else if (scale)
// do value *= 10.; while (++scale);
if (scale > 0)
value /= CVT_power_of_ten(scale);
else if (scale < 0)
@ -1198,19 +1192,19 @@ double CVT_get_double(const dsc* desc, ErrorFunction err)
break;
default:
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
break;
}
/* Last, but not least, adjust for scale */
// Last, but not least, adjust for scale
const int dscale = desc->dsc_scale;
if (dscale == 0)
return value;
/* if the scale is greater than the power of 10 representable
in a double number, then something has gone wrong... let
the user know... */
// if the scale is greater than the power of 10 representable
// in a double number, then something has gone wrong... let
// the user know...
if (ABSOLUT(dscale) > DBL_MAX_10_EXP)
err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
@ -1241,10 +1235,10 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
UCHAR* p = to->dsc_address;
const UCHAR* q = from->dsc_address;
/* If the datatypes and lengths are identical, just move the
stuff byte by byte. Although this may seem slower than
optimal, it would cost more to find the fast move than the
fast move would gain. */
// If the datatypes and lengths are identical, just move the
// stuff byte by byte. Although this may seem slower than
// optimal, it would cost more to find the fast move than the
// fast move would gain.
if (DSC_EQUIV(from, to, false)) {
if (length) {
@ -1253,8 +1247,8 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
}
/* Do data type by data type conversions. Not all are supported,
and some will drop out for additional handling. */
// Do data type by data type conversions. Not all are supported,
// and some will drop out for additional handling.
switch (to->dsc_dtype)
{
@ -1283,7 +1277,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
default:
fb_assert(false); /* Fall into ... */
fb_assert(false); // Fall into ...
case dtype_short:
case dtype_long:
case dtype_int64:
@ -1313,7 +1307,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
default:
fb_assert(false); /* Fall into ... */
fb_assert(false); // Fall into ...
case dtype_sql_time:
case dtype_short:
case dtype_long:
@ -1344,7 +1338,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
default:
fb_assert(false); /* Fall into ... */
fb_assert(false); // Fall into ...
case dtype_sql_date:
case dtype_short:
case dtype_long:
@ -1417,8 +1411,8 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
toLength = length;
l -= length;
/* TMN: Here we should really have the following fb_assert */
/* fb_assert((to->dsc_length - length) <= MAX_SSHORT); */
// TMN: Here we should really have the following fb_assert
// fb_assert((to->dsc_length - length) <= MAX_SSHORT);
fill = to->dsc_length - length;
CVT_COPY_BUFF(q, p, length);
@ -1432,9 +1426,9 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
break;
case dtype_cstring:
/* Note: Following is only correct for narrow and
multibyte character sets which use a zero
byte to represent end-of-string */
// Note: Following is only correct for narrow and
// multibyte character sets which use a zero
// byte to represent end-of-string
length = MIN(length, to->dsc_length - 1);
cb->validateData(toCharset, length, q, cb->err);
@ -1451,8 +1445,8 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
toLength = length;
l -= length;
/* TMN: Here we should really have the following fb_assert */
/* fb_assert(length <= MAX_USHORT); */
// TMN: Here we should really have the following fb_assert
// fb_assert(length <= MAX_USHORT);
((vary*) p)->vary_length = (USHORT) length;
start = p = reinterpret_cast<UCHAR*>(((vary*) p)->vary_string);
CVT_COPY_BUFF(q, p, length);
@ -1495,7 +1489,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
default:
fb_assert(false); /* Fall into ... */
fb_assert(false); // Fall into ...
case dtype_blob:
CVT_conversion_error(from, cb->err);
return;
@ -1513,19 +1507,18 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
if (to->dsc_dtype != from->dsc_dtype)
cb->err(Arg::Gds(isc_wish_list) << Arg::Gds(isc_blobnotsup) << "move");
/* Note: DSC_EQUIV failed above as the blob sub_types were different,
* or their character sets were different. In V4 we aren't trying
* to provide blob type integrity, so we just assign the blob id
*/
// Note: DSC_EQUIV failed above as the blob sub_types were different,
// or their character sets were different. In V4 we aren't trying
// to provide blob type integrity, so we just assign the blob id
/* Move blob_id byte-by-byte as that's the way it was done before */
// Move blob_id byte-by-byte as that's the way it was done before
CVT_COPY_BUFF(q, p, length);
return;
case dtype_short:
l = CVT_get_long(from, (SSHORT) to->dsc_scale, cb->err);
/* TMN: Here we should really have the following fb_assert */
/* fb_assert(l <= MAX_SSHORT); */
// TMN: Here we should really have the following fb_assert
// fb_assert(l <= MAX_SSHORT);
*(SSHORT *) p = (SSHORT) l;
if (*(SSHORT *) p != l)
cb->err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
@ -1572,7 +1565,7 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
cb->err(Arg::Gds(isc_wish_list) << Arg::Gds(isc_blobnotsup) << "move");
}
cb->err(Arg::Gds(isc_badblk)); /* internal error */
cb->err(Arg::Gds(isc_badblk)); // internal error
}
@ -1798,7 +1791,7 @@ USHORT CVT_make_string(const dsc* desc,
}
}
/* Not string data, then -- convert value to varying string. */
// Not string data, then -- convert value to varying string.
dsc temp_desc;
MOVE_CLEAR(&temp_desc, sizeof(temp_desc));
@ -1826,11 +1819,10 @@ double CVT_power_of_ten(const int scale)
*
*************************************/
/* Note that we could speed things up slightly by making the auxiliary
* arrays global to this source module and replacing this function with
* a macro, but the old code did up to 308 multiplies to our 1, and
* that seems enough of a speed-up for now.
*/
// Note that we could speed things up slightly by making the auxiliary
// arrays global to this source module and replacing this function with
// a macro, but the old code did up to 308 multiplies to our 1, and
// that seems enough of a speed-up for now.
static const double upper_part[] =
{
@ -1848,19 +1840,19 @@ double CVT_power_of_ten(const int scale)
1.e30, 1.e31
};
/* The sole caller of this function checks for scale <= 308 before calling,
* but we just fb_assert the weakest precondition which lets the code work.
* If the size of the exponent field, and thus the scaling, of doubles
* gets bigger, increase the size of the upper_part array.
*/
// The sole caller of this function checks for scale <= 308 before calling,
// but we just fb_assert the weakest precondition which lets the code work.
// If the size of the exponent field, and thus the scaling, of doubles
// gets bigger, increase the size of the upper_part array.
fb_assert((scale >= 0) && (scale < 320));
/* Note that "scale >> 5" is another way of writing "scale / 32",
* while "scale & 0x1f" is another way of writing "scale % 32".
* We split the scale into the lower 5 bits and everything else,
* then use the "everything else" to index into the upper_part array,
* whose contents increase in steps of 1e32.
*/
// Note that "scale >> 5" is another way of writing "scale / 32",
// while "scale & 0x1f" is another way of writing "scale % 32".
// We split the scale into the lower 5 bits and everything else,
// then use the "everything else" to index into the upper_part array,
// whose contents increase in steps of 1e32.
return upper_part[scale >> 5] * lower_part[scale & 0x1f];
}
@ -1883,11 +1875,11 @@ SSHORT CVT_decompose(const char* string,
*
**************************************/
#ifndef NATIVE_QUAD
/* For now, this routine does not handle quadwords unless this is
supported by the platform as a native datatype. */
// For now, this routine does not handle quadwords unless this is
// supported by the platform as a native datatype.
if (dtype == dtype_quad)
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
#endif
dsc errd;
@ -1904,7 +1896,7 @@ SSHORT CVT_decompose(const char* string,
const SINT64 lower_limit = (dtype == dtype_long) ? MIN_SLONG : MIN_SINT64;
const SINT64 upper_limit = (dtype == dtype_long) ? MAX_SLONG : MAX_SINT64;
const SINT64 limit_by_10 = upper_limit / 10; /* used to check for overflow */
const SINT64 limit_by_10 = upper_limit / 10; // used to check for overflow
const char* p = string;
const char* end = p + length;
@ -1962,13 +1954,13 @@ SSHORT CVT_decompose(const char* string,
{
digit_seen = true;
/* Before computing the next value, make sure there will be
no overflow. Trying to detect overflow after the fact is
tricky: the value doesn't always become negative after an
overflow! */
// Before computing the next value, make sure there will be
// no overflow. Trying to detect overflow after the fact is
// tricky: the value doesn't always become negative after an
// overflow!
if (value >= limit_by_10) {
/* possibility of an overflow */
// possibility of an overflow
if (value > limit_by_10)
{
err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
@ -2016,7 +2008,7 @@ SSHORT CVT_decompose(const char* string,
if ((sign == -1) && value != lower_limit)
value = -value;
/* If there's still something left, there must be an explicit exponent */
// If there's still something left, there must be an explicit exponent
if (p < end)
{
sign = 0;
@ -2029,10 +2021,10 @@ SSHORT CVT_decompose(const char* string,
digit_seen = true;
exp = exp * 10 + *p - '0';
/* The following is a 'safe' test to prevent overflow of
exp here and of scale below. A more precise test will
occur in the calling routine when the scale/exp is
applied to the value. */
// The following is a 'safe' test to prevent overflow of
// exp here and of scale below. A more precise test will
// occur in the calling routine when the scale/exp is
// applied to the value.
if (exp >= SHORT_LIMIT)
err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_numeric_out_of_range));
@ -2108,8 +2100,8 @@ USHORT CVT_get_string_ptr(const dsc* desc,
desc->dsc_dtype == dtype_text ||
desc->dsc_dtype == dtype_cstring || desc->dsc_dtype == dtype_varying);
/* If the value is already a string (fixed or varying), just return
the address and length. */
// If the value is already a string (fixed or varying), just return
// the address and length.
if (desc->dsc_dtype <= dtype_any_text)
{
@ -2128,7 +2120,7 @@ USHORT CVT_get_string_ptr(const dsc* desc,
}
}
/* No luck -- convert value to varying string. */
// No luck -- convert value to varying string.
dsc temp_desc;
MOVE_CLEAR(&temp_desc, sizeof(temp_desc));
@ -2159,9 +2151,9 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
**************************************/
SQUAD value;
double d;
TEXT buffer[50]; /* long enough to represent largest quad in ASCII */
TEXT buffer[50]; // long enough to represent largest quad in ASCII
/* adjust exact numeric values to same scaling */
// adjust exact numeric values to same scaling
if (DTYPE_IS_EXACT(desc->dsc_dtype))
scale -= desc->dsc_scale;
@ -2223,12 +2215,12 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
else
d -= 0.5;
/* make sure the cast will succeed - different machines
do different things if the value is larger than a quad
can hold */
// make sure the cast will succeed - different machines
// do different things if the value is larger than a quad
// can hold
if (d < (double) QUAD_MIN_real || (double) QUAD_MAX_real < d) {
/* If rounding would yield a legitimate value, permit it */
// If rounding would yield a legitimate value, permit it
if (d > (double) QUAD_MIN_real - 1.)
return QUAD_MIN_int;
@ -2259,17 +2251,17 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
break;
default:
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
break;
}
/* Last, but not least, adjust for scale */
// Last, but not least, adjust for scale
if (scale == 0)
return value;
#ifndef NATIVE_QUAD
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
#else
if (scale > 0)
{
@ -2281,12 +2273,10 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
} while (--scale);
if (fraction > 4)
value++;
/*
* The following 2 lines are correct for platforms where
* ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
* a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
* we'll have to change this depending on the platform.
*/
// The following 2 lines are correct for platforms where
// ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
// a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
// we'll have to change this depending on the platform.
else if (fraction < -4)
value--;
}
@ -2319,9 +2309,9 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err)
**************************************/
SINT64 value;
double d, eps;
TEXT buffer[50]; /* long enough to represent largest SINT64 in ASCII */
TEXT buffer[50]; // long enough to represent largest SINT64 in ASCII
/* adjust exact numeric values to same scaling */
// adjust exact numeric values to same scaling
if (DTYPE_IS_EXACT(desc->dsc_dtype))
scale -= desc->dsc_scale;
@ -2404,11 +2394,11 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err)
break;
default:
err(Arg::Gds(isc_badblk)); /* internal error */
err(Arg::Gds(isc_badblk)); // internal error
break;
}
/* Last, but not least, adjust for scale */
// Last, but not least, adjust for scale
if (scale > 0)
{
@ -2420,12 +2410,10 @@ SINT64 CVT_get_int64(const dsc* desc, SSHORT scale, ErrorFunction err)
} while (--scale);
if (fraction > 4)
value++;
/*
* The following 2 lines are correct for platforms where
* ((-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
* a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
* we'll have to change this depending on the platform.
*/
// The following 2 lines are correct for platforms where
// (-85 / 10 == -8) && (-85 % 10 == -5)). If we port to
// a platform where ((-85 / 10 == -9) && (-85 % 10 == 5)),
// we'll have to change this depending on the platform.
else if (fraction < -4)
value--;
}

View File

@ -83,7 +83,7 @@ Firebird::GlobalPtr<InterlockedStringsBuffer> engine_failures;
namespace Firebird {
/********************************* StringsBuffer *******************************/
// ******************************** StringsBuffer *******************************
void StringsBuffer::makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans)
{
@ -124,7 +124,7 @@ void StringsBuffer::makeEnginePermanentVector(ISC_STATUS* v)
engine_failures->makePermanentVector(v, v);
}
/********************************* status_exception *******************************/
// ********************************* status_exception *******************************
status_exception::status_exception() throw() :
m_strings_permanent(true)
@ -199,7 +199,7 @@ status_exception::~status_exception() throw()
release_vector();
}
/********************************* fatal_exception *******************************/
// ********************************* fatal_exception ******************************
void fatal_exception::raiseFmt(const char* format, ...)
{
@ -254,7 +254,7 @@ ISC_STATUS status_exception::stuff_exception(ISC_STATUS* const status_vector, St
return status_vector[1];
}
/********************************* BadAlloc ****************************/
// ********************************* BadAlloc ****************************
void BadAlloc::raise()
{
@ -272,7 +272,7 @@ ISC_STATUS BadAlloc::stuff_exception(ISC_STATUS* const status_vector, StringsBuf
return status_vector[1];
}
/********************************* LongJump ****************************/
// ********************************* LongJump ***************************
void LongJump::raise()
{
@ -306,7 +306,7 @@ ISC_STATUS LongJump::stuff_exception(ISC_STATUS* const status_vector, StringsBuf
}
/********************************* system_error ****************************/
// ********************************* system_error ***************************
system_error::system_error(const char* syscall, int error_code) :
status_exception(0, false), errorCode(error_code)
@ -336,7 +336,7 @@ int system_error::getSystemError()
#endif
}
/********************************* system_call_failed ****************************/
// ********************************* system_call_failed ***************************
system_call_failed::system_call_failed(const char* syscall, int error_code) :
system_error(syscall, error_code)
@ -358,7 +358,7 @@ void system_call_failed::raise(const char* syscall)
throw system_call_failed(syscall, getSystemError());
}
/********************************* fatal_exception ********************************/
// ********************************* fatal_exception *******************************
fatal_exception::fatal_exception(const char* message) :
status_exception(0, false)
@ -388,7 +388,7 @@ void fatal_exception::raise(const char* message)
throw fatal_exception(message);
}
/************************** exception handling routines ***************************/
// ************************** exception handling routines **************************
// Serialize exception into status_vector, put transient strings from exception into given StringsBuffer
ISC_STATUS stuff_exception(ISC_STATUS *status_vector, const Firebird::Exception& ex, StringsBuffer* sb) throw()