8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 02:03:04 +01:00
This commit is contained in:
robocop 2006-04-06 08:18:53 +00:00
parent 16b49ddada
commit c5f2284b15
37 changed files with 350 additions and 292 deletions

View File

@ -133,7 +133,7 @@ UCHAR ClumpletReader::getBufferTag() const
const UCHAR* buffer_end = getBufferEnd();
const UCHAR* buffer_start = getBuffer();
switch(kind)
switch (kind)
{
case Tpb:
case Tagged:
@ -199,7 +199,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
return SingleTpb;
case isc_action_svc_backup:
case isc_action_svc_restore:
switch(tag)
switch (tag)
{
case isc_spb_bkp_file:
case isc_spb_dbname:
@ -219,7 +219,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
invalid_structure("unknown parameter for backup/restore");
break;
case isc_action_svc_repair:
switch(tag)
switch (tag)
{
case isc_spb_dbname:
case isc_spb_tra_host_site:
@ -251,7 +251,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
case isc_action_svc_delete_user:
case isc_action_svc_modify_user:
case isc_action_svc_display_user:
switch(tag)
switch (tag)
{
case isc_spb_dbname:
case isc_spb_sql_role_name:
@ -269,7 +269,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
invalid_structure("unknown parameter for security database operation");
break;
case isc_action_svc_properties:
switch(tag)
switch (tag)
{
case isc_spb_dbname:
return StringSpb;
@ -291,7 +291,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
// case isc_action_svc_add_license:
// case isc_action_svc_remove_license:
case isc_action_svc_db_stats:
switch(tag)
switch (tag)
{
case isc_spb_dbname:
return StringSpb;

View File

@ -45,7 +45,7 @@ ClumpletWriter::ClumpletWriter(Kind k, size_t limit, UCHAR tag) :
void ClumpletWriter::initNewBuffer(UCHAR tag)
{
switch(kind)
switch (kind)
{
case SpbAttach:
if (tag != isc_spb_version1)
@ -290,7 +290,8 @@ void ClumpletWriter::deleteClumplet()
if (buffer_end - clumplet < 2) {
// It appears we're erasing EOF marker
dynamic_buffer.shrink(cur_offset);
} else {
}
else {
dynamic_buffer.removeCount(cur_offset, getClumpletSize(true, true, true));
}
}

View File

@ -458,7 +458,7 @@ void* MemoryPool::external_alloc(size_t &size)
result = mmap(0, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON , -1, 0);
if (result == MAP_FAILED) {
//sheet happens!
// failure happens!
return NULL;
}
else {
@ -746,30 +746,31 @@ bool MemoryPool::verify_pool(bool fast_checks_only) {
size_t blk_mapped_memory = 0;
// Verify that free blocks tree is consistent and indeed contains free memory blocks
if (freeBlocks.getFirst()) do {
BlockInfo *current = &freeBlocks.current();
if (freeBlocks.getFirst())
do {
BlockInfo *current = &freeBlocks.current();
// Verify that head of free blocks list set correctly
mem_assert(current->bli_fragments);
mem_assert(ptrToBlock(current->bli_fragments)->mbk_prev_fragment == NULL);
// Look over all blocks in list checking that things look kosher
for (FreeMemoryBlock *fragment = current->bli_fragments;
fragment; fragment = fragment->fbk_next_fragment)
{
// Make sure that list is actually doubly linked
if (fragment->fbk_next_fragment)
mem_assert(ptrToBlock(fragment->fbk_next_fragment)->mbk_prev_fragment == fragment);
// Verify that head of free blocks list set correctly
mem_assert(current->bli_fragments);
mem_assert(ptrToBlock(current->bli_fragments)->mbk_prev_fragment == NULL);
// Look over all blocks in list checking that things look kosher
for (FreeMemoryBlock *fragment = current->bli_fragments;
fragment; fragment = fragment->fbk_next_fragment)
{
// Make sure that list is actually doubly linked
if (fragment->fbk_next_fragment)
mem_assert(ptrToBlock(fragment->fbk_next_fragment)->mbk_prev_fragment == fragment);
MemoryBlock *blk = ptrToBlock(fragment);
MemoryBlock *blk = ptrToBlock(fragment);
// Check block flags for correctness
mem_assert(!(blk->mbk_flags & (MBK_LARGE | MBK_PARENT | MBK_USED | MBK_DELAYED)));
// Check block flags for correctness
mem_assert(!(blk->mbk_flags & (MBK_LARGE | MBK_PARENT | MBK_USED | MBK_DELAYED)));
// Check block length
mem_assert(blk->small.mbk_length == current->bli_length);
}
} while (freeBlocks.getNext());
// Check block length
mem_assert(blk->small.mbk_length == current->bli_length);
}
} while (freeBlocks.getNext());
// check each block in each segment for consistency with free blocks structure
for (MemoryExtent *extent = extents; extent; extent = extent->mxt_next) {
@ -846,7 +847,8 @@ bool MemoryPool::verify_pool(bool fast_checks_only) {
if (fast_checks_only) {
foundTree = !(blk->mbk_flags & MBK_USED) &&
(blk->mbk_prev_fragment || ptrToBlock(freeBlocks.current().bli_fragments) == blk);
} else {
}
else {
for (FreeMemoryBlock* freeBlk = freeBlocks.current().bli_fragments; freeBlk; freeBlk = freeBlk->fbk_next_fragment)
if (ptrToBlock(freeBlk) == blk) {
mem_assert(!foundTree); // Block may be present in free blocks tree only once
@ -1295,14 +1297,16 @@ void* MemoryPool::internal_alloc(size_t size, SSHORT type
ptrToBlock(next_free)->mbk_prev_fragment = NULL;
current->bli_fragments = next_free;
addFreeBlock(current_block);
} else {
}
else {
// This is special handling of case when we have single large fragment and
// cut off small pieces from it. This is common and we avoid modification
// of free blocks tree in this case.
bool get_prev_succeeded = freeBlocks.getPrev();
if (!get_prev_succeeded || freeBlocks.current().bli_length < current_block->small.mbk_length) {
current->bli_length = current_block->small.mbk_length;
} else {
}
else {
// Moderately expensive case. We need to modify tree for sure
if (get_prev_succeeded) {
// Recover tree position after failed shortcut attempt

View File

@ -177,7 +177,7 @@ static void testAllocatorOverhead() {
if (items.getFirst()) do {
items.current();
n++;
} while (n < ALLOC_ITEMS/2 && items.getNext());
} while (n < ALLOC_ITEMS / 2 && items.getNext());
// Allocate big items
for (i=0;i<BIG_ITEMS;i++) {
n = n * 47163 - 57412;
@ -214,7 +214,7 @@ static void testAllocatorMemoryPool() {
if (items.getFirst()) do {
pool->deallocate(items.current().item);
n++;
} while (n < ALLOC_ITEMS/2 && items.getNext());
} while (n < ALLOC_ITEMS / 2 && items.getNext());
// Allocate big items
for (i=0;i<BIG_ITEMS;i++) {
n = n * 47163 - 57412;
@ -251,7 +251,7 @@ static void testAllocatorMalloc() {
if (items.getFirst()) do {
free(items.current().item);
n++;
} while (n < ALLOC_ITEMS/2 && items.getNext());
} while (n < ALLOC_ITEMS / 2 && items.getNext());
// Allocate big items
for (i=0;i<BIG_ITEMS;i++) {
n = n * 47163 - 57412;
@ -289,7 +289,7 @@ static void testAllocatorMalloc() {
if (items.getFirst()) do {
pool->deallocate(items.current().item);
n++;
} while (n < ALLOC_ITEMS/2 && items.getNext());
} while (n < ALLOC_ITEMS / 2 && items.getNext());
// Allocate big items
for (i=0;i<BIG_ITEMS;i++) {
n = n * 47163 - 57412;

View File

@ -24,7 +24,7 @@
* Contributor(s): ______________________________________.
*
*
* $Id: class_test.cpp,v 1.25 2005-05-27 22:38:22 asfernandes Exp $
* $Id: class_test.cpp,v 1.26 2006-04-06 08:18:10 robocop Exp $
*
*/
@ -117,7 +117,8 @@ void testBitmap() {
bool result = bitmap.clear(v1[i]);
tree.fastRemove();
fb_assert(result == true);
} else {
}
else {
bool result = bitmap.clear(v1[i]);
fb_assert(result == false);
}
@ -360,7 +361,8 @@ void testBePlusTree() {
if (tree1.fastRemove()) {
if (tree1.current().value != nextValue)
passed = false;
} else {
}
else {
if (nextValue >= 0)
passed = false;
}
@ -379,7 +381,8 @@ void testBePlusTree() {
if (tree2.fastRemove()) {
if (tree2.current().value != nextValue)
passed = false;
} else {
}
else {
if (nextValue >= 0)
passed = false;
}
@ -450,7 +453,8 @@ void testBePlusTree() {
if (tree1.fastRemove()) {
if (tree1.current().value != nextValue)
passed = false;
} else {
}
else {
if (nextValue >= 0)
passed = false;
}
@ -469,7 +473,8 @@ void testBePlusTree() {
if (tree2.fastRemove()) {
if (tree2.current().value != nextValue)
passed = false;
} else {
}
else {
if (nextValue >= 0)
passed = false;
}

View File

@ -371,7 +371,7 @@ extern "C" {
int l = VSNPRINTF(temp, tempsize, format, params);
if (l < 0) {
size_type n = sizeof(temp);
do {
while (true) {
n *= 2;
if (n > max_length())
n = max_length();
@ -382,7 +382,7 @@ extern "C" {
stringBuffer[max_length()] = 0;
return;
}
} while (true);
}
resize(l);
return;
}

View File

@ -115,7 +115,8 @@ namespace Firebird
if (len < INLINE_BUFFER_SIZE) {
stringBuffer = inlineBuffer;
bufferSize = INLINE_BUFFER_SIZE;
} else {
}
else {
stringBuffer = NULL; // Be safe in case of exception
checkLength(len);

View File

@ -231,7 +231,8 @@ public:
}
mutex_unlock(&mu);
} else {
}
else {
//gds__log("Error on semaphore.h: release");
system_call_failed::raise("mutex_lock");
}

View File

@ -24,7 +24,7 @@
* Contributor(s): ______________________________________.
*
*
* $Id: sparse_bitmap.h,v 1.12 2005-05-27 22:38:22 asfernandes Exp $
* $Id: sparse_bitmap.h,v 1.13 2006-04-06 08:18:10 robocop Exp $
*
*/
@ -109,7 +109,8 @@ public:
bucket.start_value = singular_value & ~(T) (BUNCH_BITS - 1);
bucket.bits = BUNCH_ONE << (singular_value - bucket.start_value);
tree.add(bucket);
} else {
}
else {
if (tree.isEmpty()) {
singular = true;
singular_value = value;
@ -121,7 +122,8 @@ public:
BUNCH_T bit_mask = BUNCH_ONE << (value - val_aligned);
if (tree.locate(val_aligned)) {
tree.current().bits |= bit_mask;
} else {
}
else {
Bucket bucket;
bucket.start_value = val_aligned;
bucket.bits = bit_mask;
@ -302,7 +304,8 @@ public:
if (treeAccessor.current().start_value == key_aligned) {
current_value = key;
bit_mask = BUNCH_ONE << (key - key_aligned);
} else {
}
else {
current_value = treeAccessor.current().start_value;
bit_mask = BUNCH_ONE;
}
@ -339,7 +342,8 @@ public:
if (treeAccessor.current().start_value == key_aligned) {
current_value = key;
bit_mask = BUNCH_ONE << (key - key_aligned);
} else {
}
else {
current_value = treeAccessor.current().start_value;
bit_mask = BUNCH_ONE << (BUNCH_BITS - 1);
}
@ -583,7 +587,8 @@ SparseBitmap<T, InternalTypes>::bit_or(
dest = map2;
source = map1;
result = bitmap2;
} else {
}
else {
dest = map1;
source = map2;
result = bitmap1;
@ -642,7 +647,8 @@ SparseBitmap<T, InternalTypes>::bit_or(
break;
}
}
} else {
}
else {
// Add remaining buckets to destination tree and get out
do {
dest->tree.add(source->tree.current());
@ -695,7 +701,8 @@ SparseBitmap<T, InternalTypes>::bit_and(
dest = map2;
source = map1;
result = bitmap2;
} else {
}
else {
dest = map1;
source = map2;
result = bitmap1;
@ -748,7 +755,8 @@ SparseBitmap<T, InternalTypes>::bit_and(
// if (sourceValue > destValue)
if ((destFound = dest->tree.fastRemove()))
destValue = dest->tree.current().start_value;
} else {
}
else {
// Trim out remaining values from destination list and get out
while (dest->tree.fastRemove())
{ }

View File

@ -353,7 +353,8 @@ public:
tree->_removePage(0, curr);
curr = temp;
// The code below will adjust current position if needed
} else {
}
else {
if ( (temp = curr->next) && NEED_MERGE(temp->getCount() + curr->getCount(), LeafCount) ) {
curr->join(*temp);
tree->_removePage(0, temp);
@ -405,7 +406,8 @@ public:
curr = curr->prev;
if (!curr) return false;
curPos = curr->getCount() - 1;
} else
}
else
curPos--;
return true;
case locGreat:
@ -451,7 +453,8 @@ public:
if (curr->next) {
curr = curr->next;
curPos = 0;
} else {
}
else {
// If we reached end of the list just return false and do not invalidate position
curPos--;
return false;
@ -466,7 +469,8 @@ public:
if (curr->prev) {
curr = curr->prev;
curPos = curr->getCount() - 1;
} else {
}
else {
// If we reached beginning of the list just return false and do not invalidate position
curPos = 0;
return false;
@ -678,7 +682,8 @@ bool BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::a
void *lower;
if (recovery_map[curLevel] < 0) {
lower = (*itemL)[0];
} else {
}
else {
lower = (*itemL->prev)[recovery_map[curLevel]];
itemL->prev->remove(recovery_map[curLevel]);
itemL->prev->insert(itemL->prev->getCount(), (*itemL)[0]);

View File

@ -43,7 +43,8 @@ void fill_status(ISC_STATUS *ptr, ISC_STATUS status, va_list status_args)
// Move in status and clone transient strings
*ptr++ = isc_arg_gds;
*ptr++ = status;
do {
while (true)
{
const ISC_STATUS type = *ptr++ = va_arg(status_args, ISC_STATUS);
if (type == isc_arg_end)
break;
@ -68,7 +69,7 @@ void fill_status(ISC_STATUS *ptr, ISC_STATUS status, va_list status_args)
*ptr++ = va_arg(status_args, ISC_STATUS);
break;
}
} while (true);
}
}
} // namespace
@ -88,14 +89,15 @@ status_exception::status_exception(const ISC_STATUS *status_vector, bool permane
{
if (m_status_known) {
ISC_STATUS *ptr = m_status_vector;
do {
while (true)
{
const ISC_STATUS type = *ptr++ = *status_vector++;
if (type == isc_arg_end)
break;
if (type == isc_arg_cstring)
*ptr++ = *status_vector++;
*ptr++ = *status_vector++;
} while (true);
}
}
}
@ -115,7 +117,8 @@ void status_exception::release_vector() throw()
// Free owned strings
ISC_STATUS *ptr = m_status_vector;
do {
while (true)
{
const ISC_STATUS type = *ptr++;
if (type == isc_arg_end)
break;
@ -133,7 +136,7 @@ void status_exception::release_vector() throw()
ptr++;
break;
}
} while (true);
}
}
status_exception::~status_exception() throw()
@ -256,18 +259,20 @@ ISC_STATUS stuff_exception(ISC_STATUS *status_vector, const std::exception& ex,
if (c_ex.strings_permanent())
{
// Copy status vector
do {
while (true)
{
const ISC_STATUS type = *sv++ = *ptr++;
if (type == isc_arg_end)
break;
if (type == isc_arg_cstring)
*sv++ = *ptr++;
*sv++ = *ptr++;
} while (true);
}
}
else {
// Move in status and clone transient strings
do {
while (true)
{
const ISC_STATUS type = *sv++ = *ptr++;
if (type == isc_arg_end)
break;
@ -291,7 +296,7 @@ ISC_STATUS stuff_exception(ISC_STATUS *status_vector, const std::exception& ex,
*sv++ = *ptr++;
break;
}
} while (true);
}
}
}
return status_vector[1];

View File

@ -121,6 +121,7 @@ void Lex::skipWhite()
}
// Just another custom memcmp-like routine.
bool Lex::match(const char *pattern, const char *string)
{
while (*pattern && *string)
@ -231,7 +232,7 @@ void Lex::setCommentString(const char *start, const char *cend)
}
bool Lex::isKeyword(const char *word)
bool Lex::isKeyword(const char *word) const
{
return strcmp (token, word) == 0;
}

View File

@ -76,12 +76,12 @@ public:
JString getName();
JString reparseFilename();
bool match (const char *word);
bool isKeyword (const char *word);
bool isKeyword (const char *word) const;
void setCommentString (const char *start, const char *end);
void setLineComment (const char *string);
void setCharacters (int type, const char *characters);
void getToken();
bool match (const char *pattern, const char *string);
static bool match (const char *pattern, const char *string);
void skipWhite();
Lex(const char *punctuation, int debugFlags);
virtual ~Lex();

View File

@ -696,7 +696,7 @@ ULONG LC_NARROW_canonical(TEXTTYPE obj, ULONG srcLen, const UCHAR* src, ULONG ds
}
else
*dst++ = coll->Primary;
};
}
return src - inbuff;
}

View File

@ -56,7 +56,7 @@ void try_fc(char* c, FUN_PTR f)
void my_err()
{
printf("Error routine called!\n");
};
}
int main(int argc, char** argv)
{
@ -67,7 +67,7 @@ int main(int argc, char** argv)
if (argc <= 1) {
printf("usage: dtest Intl_module_name\n");
return (1);
};
}
char** vector = argv;
#endif
@ -75,7 +75,7 @@ int main(int argc, char** argv)
for (int i = 1; i < argc; i++) {
const int t_type = atoi(vector[i]);
INTL_fn_init(t_type, &this_textobj, my_err);
};
}
return (0);
}

View File

@ -89,7 +89,7 @@ main(int argc, char *argv[])
if (!f) {
fprintf(stderr, "Unable to open file '%s'\n", filename);
exit(1);
};
}
memset((void *) &codepoint_conversion, 0, sizeof(codepoint_conversion));
memset((void *) &unicode_conversion, 0, sizeof(unicode_conversion));
@ -133,7 +133,7 @@ main(int argc, char *argv[])
fprintf(stderr, "Problem in input file - line %d\n",
linecount);
exit(1);
};
}
p = strchr(p, '\t') + 1;
}
@ -142,7 +142,7 @@ main(int argc, char *argv[])
fprintf(stderr, "Problem in input file - line %d\n",
linecount);
exit(1);
};
}
p = strchr(p, '\t') + 1;
if (option_euc)
@ -252,7 +252,7 @@ void declare(unsigned short codepoint, unsigned short unicode, char *name)
unicode, codepoint,
unicode_conversion.table[unicode].equivilant);
}
};
}
}
@ -297,7 +297,7 @@ void print_indexed_table(char *name, TABLE * table,
if (!table->table[codepoint].exists) {
codepoint++;
continue;
};
}
upper_byte[codepoint / 256] = index;
while ((index % 256) < (codepoint % 256)) {
if (replacement == UNICODE_REPLACEMENT_CHARACTER)
@ -370,7 +370,7 @@ void print_condensed_indexed_table(
if (!table->table[codepoint].exists) {
codepoint++;
continue;
};
}
upper_byte[codepoint / 256] = index;
printf("\n");

View File

@ -5628,7 +5628,7 @@ static processing_state parse_arg(int argc,
if (ret == ps_ERR)
break;
switch(swid)
switch (swid)
{
#ifdef DEV_BUILD
case SWITCH_EXTRACTTBL:

View File

@ -955,7 +955,8 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
blb* blob = NULL;
bool materialized_blob; // Set if we materialized temporary blob in this routine
do {
while (true)
{
materialized_blob = false;
blobIndex = NULL;
if (source->bid_internal.bid_relation_id)
@ -1014,7 +1015,7 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
}
break;
} while (true);
}
blob->blb_relation = relation;
destination->set_permanent(relation->rel_id, DPM_store_blob(tdbb, blob, record));
@ -1036,7 +1037,8 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
jrd_req* own_request;
if (blobIndex->bli_request) {
own_request = blobIndex->bli_request;
} else {
}
else {
own_request = request;
while (own_request->req_caller)
own_request = own_request->req_caller;
@ -2307,7 +2309,8 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc
if (blob_request) {
if (blob_request->req_blobs.locate(blob_temp_id)) {
blob_request->req_blobs.fastRemove();
} else {
}
else {
// We should never get here because when bli_request is assigned
// item should be added to req_blobs array
fb_assert(false);
@ -2354,14 +2357,16 @@ static void release_blob(blb* blob, const bool purge_flag)
if (blob_request) {
if (blob_request->req_blobs.locate(blob->blb_temp_id)) {
blob_request->req_blobs.fastRemove();
} else {
}
else {
// We should never get here because when bli_request is assigned
// item should be added to req_blobs array
fb_assert(false);
}
}
transaction->tra_blobs.fastRemove();
} else {
}
else {
// We should never get here because allocate_blob stores each blob object
// in tra_blobs
fb_assert(false);

View File

@ -519,7 +519,7 @@ void BTR_evaluate(thread_db* tdbb, IndexRetrieval* retrieval, RecordBitmap** bit
{
const UCHAR *p = node.data, *q = lower.key_data + node.prefix;
const UCHAR *const end = lower.key_data + lower.key_length;
while(q < end)
while (q < end)
{
if (*p++ != *q++) {
skipLowerKey = false;

View File

@ -5424,7 +5424,8 @@ static ULONG memory_init(thread_db* tdbb, BufferControl* bcb, ULONG number)
memory_size = page_size * (number + 1);
}
do {
while (true)
{
if ( (memory = (UCHAR *)gds__alloc(memory_size)) )
break;
/* Either there's not enough virtual memory or there is
@ -5436,7 +5437,7 @@ static ULONG memory_init(thread_db* tdbb, BufferControl* bcb, ULONG number)
/* Diminishing returns */
return buffers;
}
} while (true);
}
bcb->bcb_memory.push(memory);
memory_end = memory + memory_size;

View File

@ -383,7 +383,8 @@ void CMP_verify_access(thread_db* tdbb, jrd_req* request)
SCL_check_access(sec_class, access->acc_view_id, NULL, prc->prc_name,
access->acc_mask, access->acc_type, access->acc_name);
}
} else {
}
else {
jrd_rel* relation = MET_lookup_relation_id(tdbb, item->exa_rel_id, false);
jrd_rel* view = NULL;
if (item->exa_view_id)

View File

@ -2503,7 +2503,7 @@ static bool delete_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
fb_assert(work->dfw_args);
const DeferredWork* arg = work->dfw_args;
while(arg && (arg->dfw_type != dfw_arg_index_name))
while (arg && (arg->dfw_type != dfw_arg_index_name))
{
arg = arg->dfw_next;
}
@ -2516,7 +2516,7 @@ static bool delete_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
// if index was bound to deleted FK constraint
// then work->dfw_args was set in VIO_erase
const DeferredWork* arg = work->dfw_args;
while(arg && (arg->dfw_type != dfw_arg_partner_rel_id))
while (arg && (arg->dfw_type != dfw_arg_partner_rel_id))
{
arg = arg->dfw_next;
}
@ -3649,7 +3649,8 @@ static Format* make_format(thread_db* tdbb, jrd_rel* relation, USHORT* version,
blob,
reinterpret_cast<const UCHAR*>(&(format->fmt_desc[0])),
(USHORT)(format->fmt_count * sizeof(dsc)));
} else {
}
else {
// Use generic representation of formats with 32-bit offsets
Firebird::Array<Ods::Descriptor> odsDescs;

View File

@ -448,7 +448,8 @@ bool EVL_boolean(thread_db* tdbb, jrd_nod* node)
impure->vlu_desc.dsc_dtype = desc[0]->dsc_dtype;
impure->vlu_desc.dsc_sub_type = desc[0]->dsc_sub_type;
impure->vlu_desc.dsc_scale = desc[0]->dsc_scale;
} else {
}
else {
// Indicate we do not know type of expression.
// This code will force pattern recompile for the next non-null value
impure->vlu_desc.dsc_dtype = 0;
@ -4226,7 +4227,8 @@ static bool string_boolean(thread_db* tdbb, jrd_nod* node, dsc* desc1,
l2 =
MOV_get_string(desc2, &p2, reinterpret_cast<vary*>(temp2),
sizeof(temp2));
} else {
}
else {
l2 =
MOV_make_string2(desc2, type1, &p2, match_str);
}

View File

@ -2824,30 +2824,33 @@ static void release_blobs(thread_db* tdbb, jrd_req* request)
/* Release blobs bound to this request */
if (request->req_blobs.getFirst()) do {
const ULONG blob_temp_id = request->req_blobs.current();
if (transaction->tra_blobs.locate(blob_temp_id)) {
BlobIndex *current = &transaction->tra_blobs.current();
if (current->bli_materialized)
transaction->tra_blobs.fastRemove();
if (request->req_blobs.getFirst())
while (true)
{
const ULONG blob_temp_id = request->req_blobs.current();
if (transaction->tra_blobs.locate(blob_temp_id)) {
BlobIndex *current = &transaction->tra_blobs.current();
if (current->bli_materialized)
transaction->tra_blobs.fastRemove();
else {
// Blob was created by request, is accounted for internal needs,
// but is not materialized. Get rid of it.
BLB_cancel(tdbb, current->bli_blob_object);
// Since the routine above modifies req_blobs
// we need to reestablish accessor position
if (request->req_blobs.locate(Firebird::locGreat, blob_temp_id))
continue;
else
break;
}
}
else {
// Blob was created by request, is accounted for internal needs,
// but is not materialized. Get rid of it.
BLB_cancel(tdbb, current->bli_blob_object);
// Since the routine above modifies req_blobs
// we need to reestablish accessor position
if (request->req_blobs.locate(Firebird::locGreat, blob_temp_id))
continue;
else
break;
// Blob accounting inconsistent
fb_assert(false);
}
} else {
// Blob accounting inconsistent
fb_assert(false);
if (!request->req_blobs.getNext())
break;
}
if (!request->req_blobs.getNext())
break;
} while (true);
request->req_blobs.clear();

View File

@ -321,7 +321,8 @@ static SLONG set_context(const vary* ns_vary, const vary* name_vary, const vary*
return att->att_context_vars.put(name_str,
Firebird::string(value_vary->vary_string, value_vary->vary_length));
} else if (ns_str == USER_TRANSACTION_NAMESPACE) {
}
else if (ns_str == USER_TRANSACTION_NAMESPACE) {
jrd_tra* tra = tdbb->tdbb_transaction;
if (!tra) {
@ -339,7 +340,8 @@ static SLONG set_context(const vary* ns_vary, const vary* name_vary, const vary*
return tra->tra_context_vars.put(name_str,
Firebird::string(value_vary->vary_string, value_vary->vary_length));
} else {
}
else {
// "Invalid namespace name %s passed to %s"
ERR_post(isc_ctx_namespace_invalid,
isc_arg_string, ERR_cstring(ns_str.c_str()),

View File

@ -854,7 +854,8 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number)
break;
}
}
} else {
}
else {
// Use generic representation of formats with 32-bit offsets
const USHORT count = blob->blb_length / sizeof(Ods::Descriptor);

View File

@ -498,7 +498,8 @@ int BackupManager::backup_database_ast(void *ast_object) throw()
CCH_flush_database(tdbb); // This may release database lock
if (ast_status[1])
gds__log_status(new_dbb->dbb_file->fil_string, ast_status);
} else {
}
else {
LCK_release(tdbb, lock);
}

View File

@ -5163,30 +5163,31 @@ static RecordSource* gen_sort(thread_db* tdbb,
for (ptr = &streams[1]; ptr <= end_ptr; ptr++) {
UInt32Bitmap::Accessor accessor(csb->csb_rpt[*ptr].csb_fields);
if (accessor.getFirst()) do {
const ULONG id = accessor.current();
items++;
id_stack.push(id);
stream_stack.push(*ptr);
for (jrd_nod** node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++)
{
jrd_nod* node = *node_ptr;
if (node->nod_type == nod_field
&& (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
&& (USHORT)(IPTR) node->nod_arg[e_fld_id] == id)
if (accessor.getFirst())
do {
const ULONG id = accessor.current();
items++;
id_stack.push(id);
stream_stack.push(*ptr);
for (jrd_nod** node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++)
{
dsc* desc = &descriptor;
CMP_get_desc(tdbb, csb, node, desc);
/* International type text has a computed key */
if (IS_INTL_DATA(desc))
jrd_nod* node = *node_ptr;
if (node->nod_type == nod_field
&& (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
&& (USHORT)(IPTR) node->nod_arg[e_fld_id] == id)
{
dsc* desc = &descriptor;
CMP_get_desc(tdbb, csb, node, desc);
/* International type text has a computed key */
if (IS_INTL_DATA(desc))
break;
--items;
id_stack.pop();
stream_stack.pop();
break;
--items;
id_stack.pop();
stream_stack.pop();
break;
}
}
}
} while (accessor.getNext());
} while (accessor.getNext());
}
/* Now that we know the number of items, allocate a sort map block. Allocate

View File

@ -1874,27 +1874,28 @@ static bool get_record(thread_db* tdbb,
// while (SBM_next(*bitmap, &rpb->rpb_number, mode))
// We assume mode = RSE_get_forward because we do not support
// scrollable cursors at the moment.
if (rpb->rpb_number.isBof() ? bitmap->getFirst() : bitmap->getNext()) do {
rpb->rpb_number.setValue(bitmap->current());
#ifdef SUPERSERVER_V2
/* Prefetch next set of data pages from bitmap. */
if (rpb->rpb_number.isBof() ? bitmap->getFirst() : bitmap->getNext())
do {
rpb->rpb_number.setValue(bitmap->current());
#ifdef SUPERSERVER_V2
/* Prefetch next set of data pages from bitmap. */
if (rpb->rpb_number >
((irsb_index*) impure)->irsb_prefetch_number &&
(mode == RSE_get_forward))
{
((irsb_index*) impure)->irsb_prefetch_number =
DPM_prefetch_bitmap(tdbb, rpb->rpb_relation,
*bitmap, rpb->rpb_number);
}
#endif
if (VIO_get(tdbb, rpb, rsb, request->req_transaction,
request->req_pool))
{
result = true;
break;
}
} while (bitmap->getNext());
if (rpb->rpb_number >
((irsb_index*) impure)->irsb_prefetch_number &&
(mode == RSE_get_forward))
{
((irsb_index*) impure)->irsb_prefetch_number =
DPM_prefetch_bitmap(tdbb, rpb->rpb_relation,
*bitmap, rpb->rpb_number);
}
#endif
if (VIO_get(tdbb, rpb, rsb, request->req_transaction,
request->req_pool))
{
result = true;
break;
}
} while (bitmap->getNext());
if (result)
break;

View File

@ -169,7 +169,8 @@ void TRA_detach_request(Jrd::jrd_req* request) {
if (request->req_tra_prev) {
fb_assert(request->req_tra_prev->req_tra_next == request);
request->req_tra_prev->req_tra_next = request->req_tra_next;
} else {
}
else {
fb_assert(request->req_transaction->tra_requests == request);
request->req_transaction->tra_requests = request->req_tra_next;
}
@ -1060,18 +1061,21 @@ void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction)
**************************************/
SET_TDBB(tdbb);
if (transaction->tra_blobs.getFirst()) do {
BlobIndex *current = &transaction->tra_blobs.current();
if (current->bli_materialized) {
if (!transaction->tra_blobs.getNext())
break;
} else {
ULONG temp_id = current->bli_temp_id;
BLB_cancel(tdbb, current->bli_blob_object);
if (!transaction->tra_blobs.locate(Firebird::locGreat, temp_id))
break;
if (transaction->tra_blobs.getFirst())
while (true)
{
BlobIndex *current = &transaction->tra_blobs.current();
if (current->bli_materialized) {
if (!transaction->tra_blobs.getNext())
break;
}
else {
ULONG temp_id = current->bli_temp_id;
BLB_cancel(tdbb, current->bli_blob_object);
if (!transaction->tra_blobs.locate(Firebird::locGreat, temp_id))
break;
}
}
} while (true);
while (transaction->tra_arrays)
BLB_release_array(transaction->tra_arrays);

View File

@ -1694,14 +1694,15 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation,
if (control && (control->vdr_flags & vdr_records)) {
THREAD_EXIT();
RecordBitmap::Accessor accessor(control->vdr_rel_records);
if (accessor.getFirst()) do {
SINT64 next_number = accessor.current();
if (!RecordBitmap::test(control->vdr_idx_records, next_number)) {
THREAD_ENTER();
return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS,
relation, id + 1);
}
} while (accessor.getNext());
if (accessor.getFirst())
do {
SINT64 next_number = accessor.current();
if (!RecordBitmap::test(control->vdr_idx_records, next_number)) {
THREAD_ENTER();
return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS,
relation, id + 1);
}
} while (accessor.getNext());
THREAD_ENTER();
}

View File

@ -2882,121 +2882,123 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
rpb.rpb_window.win_flags = 0;
rpb.rpb_transaction_nr = transaction->tra_number;
if (sav_point->sav_verb_count) {
if (sav_point->sav_verb_count)
{
/* This savepoint needs to be undone because the
verb_count is not zero. */
RecordBitmap::Accessor accessor(action->vct_records);
if (accessor.getFirst()) do {
rpb.rpb_number.setValue(accessor.current());
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
if (rpb.rpb_flags & rpb_delta) {
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
}
if (rpb.rpb_transaction_nr != transaction->tra_number) {
BUGCHECK(185); /* msg 185 wrong record version */
}
if (!action->vct_undo ||
!action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue()))
{
VIO_backout(tdbb, &rpb, transaction);
}
else {
Record* record = action->vct_undo->current().rec_data;
const bool same_tx = (record->rec_flags & REC_same_tx) != 0;
/* Have we done BOTH an update and delete to this record
in the same transaction? */
if (same_tx) {
if (accessor.getFirst())
do {
rpb.rpb_number.setValue(accessor.current());
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
if (rpb.rpb_flags & rpb_delta) {
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
}
if (rpb.rpb_transaction_nr != transaction->tra_number) {
BUGCHECK(185); /* msg 185 wrong record version */
}
if (!action->vct_undo ||
!action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue()))
{
VIO_backout(tdbb, &rpb, transaction);
/* Nickolay Samofatov, 01 Mar 2003:
If we don't have data for the record and
it was modified and deleted under our savepoint
we need to back it out to the state as it were
before our transaction started */
if (record->rec_length == 0 && record->rec_flags & REC_new_version)
{
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
else {
Record* record = action->vct_undo->current().rec_data;
const bool same_tx = (record->rec_flags & REC_same_tx) != 0;
/* Have we done BOTH an update and delete to this record
in the same transaction? */
if (same_tx) {
VIO_backout(tdbb, &rpb, transaction);
/* Nickolay Samofatov, 01 Mar 2003:
If we don't have data for the record and
it was modified and deleted under our savepoint
we need to back it out to the state as it were
before our transaction started */
if (record->rec_length == 0 && record->rec_flags & REC_new_version)
{
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
if (rpb.rpb_flags & rpb_delta) {
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
}
VIO_backout(tdbb, &rpb, transaction);
}
if (rpb.rpb_flags & rpb_delta) {
}
if (record->rec_length != 0) {
Record* dead_record = rpb.rpb_record;
record_param new_rpb = rpb;
new_rpb.rpb_record = record;
new_rpb.rpb_address = record->rec_data;
new_rpb.rpb_length = record->rec_length;
if (!(rpb.rpb_flags & rpb_delta)) {
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
}
else {
CCH_RELEASE(tdbb, &rpb.rpb_window);
update_in_place(tdbb, transaction, &rpb, &new_rpb);
if (!(transaction->tra_flags & TRA_system)) {
garbage_collect_idx(tdbb, &rpb, &new_rpb, NULL);
}
VIO_backout(tdbb, &rpb, transaction);
rpb.rpb_record = dead_record;
}
}
if (record->rec_length != 0) {
Record* dead_record = rpb.rpb_record;
record_param new_rpb = rpb;
new_rpb.rpb_record = record;
new_rpb.rpb_address = record->rec_data;
new_rpb.rpb_length = record->rec_length;
if (!(rpb.rpb_flags & rpb_delta)) {
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
}
update_in_place(tdbb, transaction, &rpb, &new_rpb);
if (!(transaction->tra_flags & TRA_system)) {
garbage_collect_idx(tdbb, &rpb, &new_rpb, NULL);
}
rpb.rpb_record = dead_record;
}
}
} while (accessor.getNext());
} while (accessor.getNext());
}
else {
/* This savepoint needs to be posted to the previous savepoint. */
RecordBitmap::Accessor accessor(action->vct_records);
if (accessor.getFirst()) do
{
rpb.rpb_number.setValue(accessor.current());
if (!action->vct_undo ||
!action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue()))
{
verb_post(tdbb, transaction, &rpb, 0, 0, false, false);
}
else {
/* Setup more of rpb because verb_post is probably going to
garbage-collect. Note that the data doesn't need to be set up
because old_data will be used. (this guarantees that the
rpb points to the first fragment of the record) */
if (accessor.getFirst())
do {
rpb.rpb_number.setValue(accessor.current());
if (!action->vct_undo ||
!action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue()))
{
verb_post(tdbb, transaction, &rpb, 0, 0, false, false);
}
else {
/* Setup more of rpb because verb_post is probably going to
garbage-collect. Note that the data doesn't need to be set up
because old_data will be used. (this guarantees that the
rpb points to the first fragment of the record) */
if (!DPM_get(tdbb, &rpb, LCK_read)) {
BUGCHECK(186); /* msg 186 record disappeared */
if (!DPM_get(tdbb, &rpb, LCK_read)) {
BUGCHECK(186); /* msg 186 record disappeared */
}
CCH_RELEASE(tdbb, &rpb.rpb_window);
Record* record = action->vct_undo->current().rec_data;
const bool same_tx =
(record->rec_flags & REC_same_tx) != 0;
const bool new_ver =
(record->rec_flags & REC_new_version) != 0;
if (record->rec_length != 0) {
record_param new_rpb = rpb;
new_rpb.rpb_record = record;
new_rpb.rpb_address = record->rec_data;
new_rpb.rpb_length = record->rec_length;
verb_post(tdbb, transaction, &rpb, record,
&new_rpb, same_tx, new_ver);
}
else if (same_tx) {
verb_post(tdbb, transaction, &rpb, 0,
0, true, new_ver);
}
}
CCH_RELEASE(tdbb, &rpb.rpb_window);
Record* record = action->vct_undo->current().rec_data;
const bool same_tx =
(record->rec_flags & REC_same_tx) != 0;
const bool new_ver =
(record->rec_flags & REC_new_version) != 0;
if (record->rec_length != 0) {
record_param new_rpb = rpb;
new_rpb.rpb_record = record;
new_rpb.rpb_address = record->rec_data;
new_rpb.rpb_length = record->rec_length;
verb_post(tdbb, transaction, &rpb, record,
&new_rpb, same_tx, new_ver);
}
else if (same_tx) {
verb_post(tdbb, transaction, &rpb, 0,
0, true, new_ver);
}
}
} while (accessor.getNext());
} while (accessor.getNext());
}
if (rpb.rpb_record) {

View File

@ -8,7 +8,7 @@ void ProcessFile(FILE *in, bool stripFirstComment)
{
char s[256];
bool striping = false;
while(fgets(s, sizeof(s), in)) {
while (fgets(s, sizeof(s), in)) {
if (stripFirstComment) {
char *x = strstr(s, "/*");
if (x) {

View File

@ -3343,7 +3343,8 @@ bool process_packet(rem_port* port,
if (tdrdb->trdb_status_vector) {
status_ptr = tdrdb->trdb_status_vector;
} else {
}
else {
status_ptr = local_status;
}
@ -4297,9 +4298,9 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
*sp++ = p;
v = (ISC_STATUS*) sp;
status_vector++;
USHORT l = (USHORT) (*status_vector++);
SLONG l = (*status_vector++);
const TEXT* q = (TEXT*) * status_vector++;
if (l)
if (l > 0)
do {
*p++ = *q++;
} while (--l && (p < bufferEnd - 1));
@ -4317,8 +4318,7 @@ ISC_STATUS rem_port::send_response( PACKET* sendL,
*v++ = *status_vector++;
continue;
}
const USHORT l = p < bufferEnd ?
(USHORT) fb_interpret(p, bufferEnd - p, &status_vector) : 0;
const int l = p < bufferEnd ? fb_interpret(p, bufferEnd - p, &status_vector) : 0;
if (l == 0)
break;

View File

@ -351,7 +351,7 @@ int common_main(int argc,
#endif //SUPERCLIENT
{
callRemoteServiceManager(status, sHandle, *user_data, data_print, NULL);
if(status[1])
if (status[1])
{
GSEC_print_status(status);
ret = GsecMsg75;
@ -384,7 +384,7 @@ int common_main(int argc,
#endif //SUPERCLIENT
{
callRemoteServiceManager(status, sHandle, *user_data, data_print, NULL);
if(status[1])
if (status[1])
{
GSEC_print_status(status);
ret = GsecMsg75;

View File

@ -815,7 +815,8 @@ static void get_range(
get_switch(*argv, token);
if (token->swc_switch)
return;
if ((*token->swc_string == ':') || (*token->swc_string == ',')) {
if ((*token->swc_string == ':') || (*token->swc_string == ','))
{
const TEXT* p = token->swc_string;
if (*++p) {
if (*p == '*')

View File

@ -42,7 +42,7 @@ public:
virtual void addRef();
RefObject();
virtual ~RefObject();
private:
int useCount;
};