mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Comments.
This commit is contained in:
parent
19356f022c
commit
f0249e6cb1
@ -52,7 +52,7 @@ struct sdl_arg
|
||||
const IPTR* sdl_arg_end;
|
||||
};
|
||||
|
||||
/* Structure to computes ranges */
|
||||
// Structure to compute ranges
|
||||
|
||||
// Let's stop this insanity! The header rng.h defined rng for the purposes
|
||||
// of refresh range and emulation of file-based data formats like Pdx.
|
||||
@ -291,10 +291,11 @@ const UCHAR* SDL_prepare_slice(const UCHAR* sdl, USHORT sdl_length)
|
||||
if (new_sdl == old_sdl)
|
||||
{
|
||||
UCHAR* temp_sdl = (UCHAR*)gds__alloc((SLONG) sdl_length);
|
||||
/* FREE: apparently never freed */
|
||||
// FREE: apparently never freed
|
||||
if (!temp_sdl)
|
||||
{ /* NOMEM: ignore operation */
|
||||
fb_assert_continue(FALSE); /* no real error handling */
|
||||
{
|
||||
// NOMEM: ignore operation
|
||||
fb_assert_continue(FALSE); // no real error handling
|
||||
return old_sdl;
|
||||
}
|
||||
memcpy(temp_sdl, old_sdl, sdl_length);
|
||||
@ -389,7 +390,7 @@ int SDL_walk(ISC_STATUS* status_vector,
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Check that element is in range of valid SDL */
|
||||
// Check that element is in range of valid SDL
|
||||
fb_assert_continue(*(p - 1) >= isc_sdl_version1 && *(p - 1) <= isc_sdl_element);
|
||||
|
||||
arg.sdl_arg_next = arg.sdl_arg_compiled;
|
||||
@ -444,11 +445,11 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
|
||||
else
|
||||
{
|
||||
ptr1 = p;
|
||||
COMPILE(p, 0); /* skip over lower bound */
|
||||
COMPILE(p, 0); // skip over lower bound
|
||||
}
|
||||
COMPILE(p, arg); /* upper bound */
|
||||
COMPILE(p, arg); // upper bound
|
||||
if (op == isc_sdl_do3) {
|
||||
COMPILE(p, arg); /* increment */
|
||||
COMPILE(p, arg); // increment
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -456,18 +457,18 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
|
||||
STUFF(1, arg);
|
||||
}
|
||||
if (ptr1) {
|
||||
COMPILE(ptr1, arg); /* initial value */
|
||||
COMPILE(ptr1, arg); // initial value
|
||||
}
|
||||
else
|
||||
{
|
||||
STUFF(op_literal, arg); /* default initial value */
|
||||
STUFF(op_literal, arg); // default initial value
|
||||
STUFF(1, arg);
|
||||
}
|
||||
STUFF(op_loop, arg);
|
||||
if (!(label = stuff(op_iterate, arg)))
|
||||
return NULL;
|
||||
STUFF(variable, arg);
|
||||
STUFF(0, arg); /* future branch out address */
|
||||
STUFF(0, arg); // future branch out address
|
||||
if (!(p = compile(p, arg)))
|
||||
return NULL;
|
||||
STUFF(op_goto, arg);
|
||||
@ -546,7 +547,7 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
|
||||
if (arg && count != 1)
|
||||
{
|
||||
error(arg->sdl_arg_status_vector, Arg::Gds(isc_datnotsup));
|
||||
/* Msg107: "data operation not supported" (arrays of structures) */
|
||||
// Msg107: "data operation not supported" (arrays of structures)
|
||||
return NULL;
|
||||
}
|
||||
expr = expressions;
|
||||
@ -680,7 +681,7 @@ static bool execute(sdl_arg* arg)
|
||||
case op_scalar:
|
||||
{
|
||||
value = *next++;
|
||||
next++; /* Skip count, unsupported. */
|
||||
next++; // Skip count, unsupported.
|
||||
SLONG subscript = 0;
|
||||
for (const Ods::InternalArrayDesc::iad_repeat* range = array_desc->iad_rpt;
|
||||
range < range_end; ++range)
|
||||
@ -697,7 +698,7 @@ static bool execute(sdl_arg* arg)
|
||||
element_desc.dsc_address = arg->sdl_arg_array + (IPTR) element_desc.dsc_address +
|
||||
(array_desc->iad_element_length * subscript);
|
||||
|
||||
/* Is this element within the array bounds? */
|
||||
// Is this element within the array bounds?
|
||||
fb_assert_continue(element_desc.dsc_address >= arg->sdl_arg_array);
|
||||
fb_assert_continue(element_desc.dsc_address + element_desc.dsc_length <=
|
||||
arg->sdl_arg_array + array_desc->iad_total_length);
|
||||
@ -708,13 +709,13 @@ static bool execute(sdl_arg* arg)
|
||||
count = *next++;
|
||||
if (arg->sdl_arg_argument->slice_direction == array_slice::slc_writing_array)
|
||||
{
|
||||
/* Storing INTO array */
|
||||
// Storing INTO array
|
||||
|
||||
(*arg->sdl_arg_callback) (arg->sdl_arg_argument, count, &element_desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fetching FROM array */
|
||||
// Fetching FROM array
|
||||
|
||||
if (element_desc.dsc_address < arg->sdl_arg_argument->slice_high_water)
|
||||
{
|
||||
@ -1009,7 +1010,7 @@ static IPTR* stuff(IPTR value, sdl_arg* arg)
|
||||
|
||||
if (arg->sdl_arg_next >= arg->sdl_arg_end)
|
||||
error(arg->sdl_arg_status_vector, Arg::Gds(isc_virmemexh));
|
||||
/* unable to allocate memory from operating system */
|
||||
// unable to allocate memory from operating system
|
||||
|
||||
*(arg->sdl_arg_next)++ = value;
|
||||
|
||||
|
@ -87,7 +87,7 @@ bool SHUT_blocking_ast(thread_db* tdbb)
|
||||
const SSHORT flag = data.data_items.flag;
|
||||
const SSHORT delay = data.data_items.delay;
|
||||
|
||||
/* Database shutdown has been cancelled. */
|
||||
// Database shutdown has been cancelled.
|
||||
|
||||
// Delay of -1 means we're going online
|
||||
if (delay == -1)
|
||||
@ -145,8 +145,7 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
Jrd::Attachment* attachment = tdbb->getAttachment();
|
||||
|
||||
/* Only platform's user locksmith can shutdown or bring online
|
||||
a database. */
|
||||
// Only platform's user locksmith can shutdown or bring online a database.
|
||||
|
||||
if (!attachment->locksmith())
|
||||
{
|
||||
@ -212,18 +211,17 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay)
|
||||
attachment->att_flags |= ATT_shutdown_manager;
|
||||
--dbb->dbb_use_count;
|
||||
|
||||
/* Database is being shutdown. First notification gives shutdown
|
||||
type and delay in seconds. */
|
||||
// Database is being shutdown. First notification gives shutdown type and delay in seconds.
|
||||
|
||||
bool exclusive = notify_shutdown(tdbb, flag, delay);
|
||||
|
||||
/* Notify local attachments */
|
||||
// Notify local attachments
|
||||
|
||||
SHUT_blocking_ast(tdbb);
|
||||
|
||||
/* Try to get exclusive database lock periodically up to specified delay. If we
|
||||
haven't gotten it report shutdown error for weaker forms. For forced shutdown
|
||||
keep notifying until successful. */
|
||||
// Try to get exclusive database lock periodically up to specified delay. If we
|
||||
// haven't gotten it report shutdown error for weaker forms. For forced shutdown
|
||||
// keep notifying until successful.
|
||||
|
||||
SSHORT timeout = delay - SHUT_WAIT_TIME;
|
||||
|
||||
@ -241,15 +239,14 @@ void SHUT_database(thread_db* tdbb, SSHORT flag, SSHORT delay)
|
||||
|
||||
if (!exclusive && (timeout > 0 || flag & (isc_dpb_shut_attachment | isc_dpb_shut_transaction)))
|
||||
{
|
||||
notify_shutdown(tdbb, 0, 0); /* Tell everyone we're giving up */
|
||||
notify_shutdown(tdbb, 0, 0); // Tell everyone we're giving up
|
||||
SHUT_blocking_ast(tdbb);
|
||||
attachment->att_flags &= ~ATT_shutdown_manager;
|
||||
++dbb->dbb_use_count;
|
||||
ERR_post(Arg::Gds(isc_shutfail));
|
||||
}
|
||||
|
||||
/* Once there are no more transactions active, force all remaining
|
||||
attachments to shutdown. */
|
||||
// Once there are no more transactions active, force all remaining attachments to shutdown.
|
||||
|
||||
if (flag & isc_dpb_shut_transaction)
|
||||
{
|
||||
@ -343,8 +340,7 @@ void SHUT_online(thread_db* tdbb, SSHORT flag)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
Jrd::Attachment* attachment = tdbb->getAttachment();
|
||||
|
||||
/* Only platform's user locksmith can shutdown or bring online
|
||||
a database. */
|
||||
// Only platform's user locksmith can shutdown or bring online a database.
|
||||
|
||||
if (!attachment->att_user->locksmith())
|
||||
{
|
||||
@ -404,7 +400,7 @@ void SHUT_online(thread_db* tdbb, SSHORT flag)
|
||||
check_backup_state(tdbb);
|
||||
}
|
||||
|
||||
/* Clear shutdown flag on database header page */
|
||||
// Clear shutdown flag on database header page
|
||||
|
||||
WIN window(HEADER_PAGE_NUMBER);
|
||||
Ods::header_page* header = (Ods::header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
|
||||
@ -429,13 +425,12 @@ void SHUT_online(thread_db* tdbb, SSHORT flag)
|
||||
}
|
||||
CCH_RELEASE(tdbb, &window);
|
||||
|
||||
/* Notify existing database clients that a currently
|
||||
scheduled shutdown is cancelled. */
|
||||
// Notify existing database clients that a currently scheduled shutdown is cancelled.
|
||||
|
||||
if (notify_shutdown(tdbb, shut_mode, -1))
|
||||
CCH_release_exclusive(tdbb);
|
||||
|
||||
/* Notify local attachments */
|
||||
// Notify local attachments
|
||||
|
||||
SHUT_blocking_ast(tdbb);
|
||||
}
|
||||
@ -494,7 +489,7 @@ static bool notify_shutdown(thread_db* tdbb, SSHORT flag, SSHORT delay)
|
||||
|
||||
LCK_write_data(tdbb, dbb->dbb_lock, data.data_long);
|
||||
|
||||
/* Send blocking ASTs to database users */
|
||||
// Send blocking ASTs to database users
|
||||
|
||||
const bool exclusive = CCH_exclusive(tdbb, LCK_PW, delay > 0 ? -SHUT_WAIT_TIME : -1);
|
||||
|
||||
@ -528,7 +523,7 @@ static bool shutdown_locks(thread_db* tdbb, SSHORT flag)
|
||||
**************************************/
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
/* Mark database and all active attachments as shutdown. */
|
||||
// Mark database and all active attachments as shutdown.
|
||||
|
||||
dbb->dbb_ast_flags &= ~(DBB_shutdown | DBB_shutdown_single | DBB_shutdown_full);
|
||||
|
||||
@ -574,8 +569,8 @@ static bool shutdown_locks(thread_db* tdbb, SSHORT flag)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Since no attachment is actively running, release all
|
||||
attachment-specfic locks while they're not looking. */
|
||||
// Since no attachment is actively running, release all
|
||||
// attachment-specfic locks while they're not looking.
|
||||
|
||||
const Jrd::Attachment* shut_attachment = NULL;
|
||||
|
||||
@ -593,16 +588,16 @@ static bool shutdown_locks(thread_db* tdbb, SSHORT flag)
|
||||
TRA_shutdown_attachment(tdbb, attachment);
|
||||
}
|
||||
|
||||
/* Release database locks that are shared by all attachments.
|
||||
These include relation and index existence locks, as well
|
||||
as, relation interest and record locking locks for PC semantic
|
||||
record locking. */
|
||||
// Release database locks that are shared by all attachments.
|
||||
// These include relation and index existence locks, as well
|
||||
// as, relation interest and record locking locks for PC semantic
|
||||
// record locking.
|
||||
|
||||
CMP_shutdown_database(tdbb);
|
||||
|
||||
/* If shutdown manager is here, leave enough database lock context
|
||||
to run as a normal attachment. Otherwise, get rid of the rest
|
||||
of the database locks.*/
|
||||
// If shutdown manager is here, leave enough database lock context
|
||||
// to run as a normal attachment. Otherwise, get rid of the rest
|
||||
// of the database locks.
|
||||
|
||||
if (!shut_attachment)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ USHORT SQZ_apply_differences(Record* record, const SCHAR* differences, const SCH
|
||||
|
||||
if (end - differences > MAX_DIFFERENCES)
|
||||
{
|
||||
BUGCHECK(176); /* msg 176 bad difference record */
|
||||
BUGCHECK(176); // msg 176 bad difference record
|
||||
}
|
||||
|
||||
SCHAR* p = (SCHAR*) record->rec_data;
|
||||
@ -61,7 +61,7 @@ USHORT SQZ_apply_differences(Record* record, const SCHAR* differences, const SCH
|
||||
{
|
||||
if (p + l > p_end)
|
||||
{
|
||||
BUGCHECK(177); /* msg 177 applied differences will not fit in record */
|
||||
BUGCHECK(177); // msg 177 applied differences will not fit in record
|
||||
}
|
||||
memcpy(p, differences, l);
|
||||
p += l;
|
||||
@ -77,7 +77,7 @@ USHORT SQZ_apply_differences(Record* record, const SCHAR* differences, const SCH
|
||||
|
||||
if (length > record->rec_length || differences < end)
|
||||
{
|
||||
BUGCHECK(177); /* msg 177 applied differences will not fit in record */
|
||||
BUGCHECK(177); // msg 177 applied differences will not fit in record
|
||||
}
|
||||
|
||||
return length;
|
||||
@ -223,7 +223,7 @@ UCHAR* SQZ_decompress(const UCHAR* input,
|
||||
|
||||
if ((output - len) > output_end)
|
||||
{
|
||||
BUGCHECK(179); /* msg 179 decompression overran buffer */
|
||||
BUGCHECK(179); // msg 179 decompression overran buffer
|
||||
}
|
||||
memset(output, c, (-1 * len));
|
||||
output -= len;
|
||||
@ -232,7 +232,7 @@ UCHAR* SQZ_decompress(const UCHAR* input,
|
||||
{
|
||||
if ((output + len) > output_end)
|
||||
{
|
||||
BUGCHECK(179); /* msg 179 decompression overran buffer */
|
||||
BUGCHECK(179); // msg 179 decompression overran buffer
|
||||
}
|
||||
memcpy(output, input, len);
|
||||
output += len;
|
||||
@ -242,7 +242,7 @@ UCHAR* SQZ_decompress(const UCHAR* input,
|
||||
|
||||
if (output > output_end)
|
||||
{
|
||||
BUGCHECK(179); /* msg 179 decompression overran buffer */
|
||||
BUGCHECK(179); // msg 179 decompression overran buffer
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -302,24 +302,24 @@ USHORT SQZ_differences(const SCHAR* rec1,
|
||||
**************************************/
|
||||
SCHAR *p;
|
||||
// SLONG l; Moved to the proper scope. Comment immediately below still applies.
|
||||
/* This "l" could be more than 32K since the Old and New records
|
||||
could be the same for more than 32K characters.
|
||||
MAX record size is currently 64K. Hence it is defined as a SLONG */
|
||||
// This "l" could be more than 32K since the Old and New records
|
||||
// could be the same for more than 32K characters.
|
||||
// MAX record size is currently 64K. Hence it is defined as a SLONG
|
||||
|
||||
#define STUFF(val) if (out < end) *out++ = val; else return 32000;
|
||||
/* WHY IS THIS RETURNING 32000 ???
|
||||
* It returns a large Positive value to indicate to the caller that we ran out
|
||||
* of buffer space in the 'out' argument. Thus we could not create a
|
||||
* successful differences record. Now it is upto the caller to check the
|
||||
* return value of this function and figure out whether the differences record
|
||||
* was created or not. Check prepare_update() (JRD/vio.c) for further
|
||||
* information. Of course, the size for a 'differences' record is not expected
|
||||
* to go near 32000 in the future. If the case arises where we want to store
|
||||
* differences record of 32000 bytes and more, please change the return value
|
||||
* above to accomodate a failure value.
|
||||
*
|
||||
* This was investigated as a part of solving bug 10206, bsriram - 25-Feb-1999.
|
||||
*/
|
||||
/* WHY IS THIS RETURNING 32000 ???
|
||||
* It returns a large Positive value to indicate to the caller that we ran out
|
||||
* of buffer space in the 'out' argument. Thus we could not create a
|
||||
* successful differences record. Now it is upto the caller to check the
|
||||
* return value of this function and figure out whether the differences record
|
||||
* was created or not. Check prepare_update() (JRD/vio.c) for further
|
||||
* information. Of course, the size for a 'differences' record is not expected
|
||||
* to go near 32000 in the future. If the case arises where we want to store
|
||||
* differences record of 32000 bytes and more, please change the return value
|
||||
* above to accomodate a failure value.
|
||||
*
|
||||
* This was investigated as a part of solving bug 10206, bsriram - 25-Feb-1999.
|
||||
*/
|
||||
|
||||
const SCHAR* const start = out;
|
||||
const SCHAR* const end = out + length;
|
||||
@ -332,8 +332,8 @@ USHORT SQZ_differences(const SCHAR* rec1,
|
||||
{
|
||||
p = out++;
|
||||
|
||||
/* cast this to LONG to take care of OS/2 pointer arithmetic
|
||||
when rec1 is at the end of a segment, to avoid wrapping around */
|
||||
// cast this to LONG to take care of OS/2 pointer arithmetic
|
||||
// when rec1 is at the end of a segment, to avoid wrapping around
|
||||
|
||||
const SCHAR* yellow = (SCHAR *) MIN((U_IPTR) end1, ((U_IPTR) rec1 + 127)) - 1;
|
||||
while (rec1 <= yellow && (rec1[0] != rec2[0] || (rec1[1] != rec2[1] && rec1 < yellow)))
|
||||
@ -364,8 +364,8 @@ USHORT SQZ_differences(const SCHAR* rec1,
|
||||
{
|
||||
p = out++;
|
||||
|
||||
/* cast this to LONG to take care of OS/2 pointer arithmetic
|
||||
when rec1 is at the end of a segment, to avoid wrapping around */
|
||||
// cast this to LONG to take care of OS/2 pointer arithmetic
|
||||
// when rec1 is at the end of a segment, to avoid wrapping around
|
||||
|
||||
const SCHAR* yellow = (SCHAR *) MIN((U_IPTR) end2, ((U_IPTR) rec2 + 127));
|
||||
while (rec2 < yellow)
|
||||
@ -441,7 +441,7 @@ USHORT SQZ_length(const SCHAR* data, int length, DataComprControl* dcc)
|
||||
{
|
||||
const SCHAR* start = data;
|
||||
|
||||
/* Find length of non-compressable run */
|
||||
// Find length of non-compressable run
|
||||
|
||||
if ((max = count - 1) > 1)
|
||||
{
|
||||
@ -459,7 +459,7 @@ USHORT SQZ_length(const SCHAR* data, int length, DataComprControl* dcc)
|
||||
}
|
||||
data = start + count;
|
||||
|
||||
/* Non-compressable runs are limited to 127 bytes */
|
||||
// Non-compressable runs are limited to 127 bytes
|
||||
|
||||
while (count)
|
||||
{
|
||||
@ -469,7 +469,7 @@ USHORT SQZ_length(const SCHAR* data, int length, DataComprControl* dcc)
|
||||
*control++ = max;
|
||||
}
|
||||
|
||||
/* Find compressible run. Compressable runs are limited to 128 bytes */
|
||||
// Find compressible run. Compressable runs are limited to 128 bytes
|
||||
|
||||
if ((max = MIN(128, end - data)) >= 3)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user