8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +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_end = getBufferEnd();
const UCHAR* buffer_start = getBuffer(); const UCHAR* buffer_start = getBuffer();
switch(kind) switch (kind)
{ {
case Tpb: case Tpb:
case Tagged: case Tagged:
@ -199,7 +199,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
return SingleTpb; return SingleTpb;
case isc_action_svc_backup: case isc_action_svc_backup:
case isc_action_svc_restore: case isc_action_svc_restore:
switch(tag) switch (tag)
{ {
case isc_spb_bkp_file: case isc_spb_bkp_file:
case isc_spb_dbname: case isc_spb_dbname:
@ -219,7 +219,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
invalid_structure("unknown parameter for backup/restore"); invalid_structure("unknown parameter for backup/restore");
break; break;
case isc_action_svc_repair: case isc_action_svc_repair:
switch(tag) switch (tag)
{ {
case isc_spb_dbname: case isc_spb_dbname:
case isc_spb_tra_host_site: 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_delete_user:
case isc_action_svc_modify_user: case isc_action_svc_modify_user:
case isc_action_svc_display_user: case isc_action_svc_display_user:
switch(tag) switch (tag)
{ {
case isc_spb_dbname: case isc_spb_dbname:
case isc_spb_sql_role_name: 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"); invalid_structure("unknown parameter for security database operation");
break; break;
case isc_action_svc_properties: case isc_action_svc_properties:
switch(tag) switch (tag)
{ {
case isc_spb_dbname: case isc_spb_dbname:
return StringSpb; return StringSpb;
@ -291,7 +291,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
// case isc_action_svc_add_license: // case isc_action_svc_add_license:
// case isc_action_svc_remove_license: // case isc_action_svc_remove_license:
case isc_action_svc_db_stats: case isc_action_svc_db_stats:
switch(tag) switch (tag)
{ {
case isc_spb_dbname: case isc_spb_dbname:
return StringSpb; return StringSpb;

View File

@ -45,7 +45,7 @@ ClumpletWriter::ClumpletWriter(Kind k, size_t limit, UCHAR tag) :
void ClumpletWriter::initNewBuffer(UCHAR tag) void ClumpletWriter::initNewBuffer(UCHAR tag)
{ {
switch(kind) switch (kind)
{ {
case SpbAttach: case SpbAttach:
if (tag != isc_spb_version1) if (tag != isc_spb_version1)
@ -290,7 +290,8 @@ void ClumpletWriter::deleteClumplet()
if (buffer_end - clumplet < 2) { if (buffer_end - clumplet < 2) {
// It appears we're erasing EOF marker // It appears we're erasing EOF marker
dynamic_buffer.shrink(cur_offset); dynamic_buffer.shrink(cur_offset);
} else { }
else {
dynamic_buffer.removeCount(cur_offset, getClumpletSize(true, true, true)); 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, result = mmap(0, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON , -1, 0); MAP_PRIVATE | MAP_ANON , -1, 0);
if (result == MAP_FAILED) { if (result == MAP_FAILED) {
//sheet happens! // failure happens!
return NULL; return NULL;
} }
else { else {
@ -746,30 +746,31 @@ bool MemoryPool::verify_pool(bool fast_checks_only) {
size_t blk_mapped_memory = 0; size_t blk_mapped_memory = 0;
// Verify that free blocks tree is consistent and indeed contains free memory blocks // Verify that free blocks tree is consistent and indeed contains free memory blocks
if (freeBlocks.getFirst()) do { if (freeBlocks.getFirst())
BlockInfo *current = &freeBlocks.current(); do {
BlockInfo *current = &freeBlocks.current();
// Verify that head of free blocks list set correctly // Verify that head of free blocks list set correctly
mem_assert(current->bli_fragments); mem_assert(current->bli_fragments);
mem_assert(ptrToBlock(current->bli_fragments)->mbk_prev_fragment == NULL); mem_assert(ptrToBlock(current->bli_fragments)->mbk_prev_fragment == NULL);
// Look over all blocks in list checking that things look kosher // Look over all blocks in list checking that things look kosher
for (FreeMemoryBlock *fragment = current->bli_fragments; for (FreeMemoryBlock *fragment = current->bli_fragments;
fragment; fragment = fragment->fbk_next_fragment) fragment; fragment = fragment->fbk_next_fragment)
{ {
// Make sure that list is actually doubly linked // Make sure that list is actually doubly linked
if (fragment->fbk_next_fragment) if (fragment->fbk_next_fragment)
mem_assert(ptrToBlock(fragment->fbk_next_fragment)->mbk_prev_fragment == 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 // Check block flags for correctness
mem_assert(!(blk->mbk_flags & (MBK_LARGE | MBK_PARENT | MBK_USED | MBK_DELAYED))); mem_assert(!(blk->mbk_flags & (MBK_LARGE | MBK_PARENT | MBK_USED | MBK_DELAYED)));
// Check block length // Check block length
mem_assert(blk->small.mbk_length == current->bli_length); mem_assert(blk->small.mbk_length == current->bli_length);
} }
} while (freeBlocks.getNext()); } while (freeBlocks.getNext());
// check each block in each segment for consistency with free blocks structure // check each block in each segment for consistency with free blocks structure
for (MemoryExtent *extent = extents; extent; extent = extent->mxt_next) { 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) { if (fast_checks_only) {
foundTree = !(blk->mbk_flags & MBK_USED) && foundTree = !(blk->mbk_flags & MBK_USED) &&
(blk->mbk_prev_fragment || ptrToBlock(freeBlocks.current().bli_fragments) == blk); (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) for (FreeMemoryBlock* freeBlk = freeBlocks.current().bli_fragments; freeBlk; freeBlk = freeBlk->fbk_next_fragment)
if (ptrToBlock(freeBlk) == blk) { if (ptrToBlock(freeBlk) == blk) {
mem_assert(!foundTree); // Block may be present in free blocks tree only once 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; ptrToBlock(next_free)->mbk_prev_fragment = NULL;
current->bli_fragments = next_free; current->bli_fragments = next_free;
addFreeBlock(current_block); addFreeBlock(current_block);
} else { }
else {
// This is special handling of case when we have single large fragment and // 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 // cut off small pieces from it. This is common and we avoid modification
// of free blocks tree in this case. // of free blocks tree in this case.
bool get_prev_succeeded = freeBlocks.getPrev(); bool get_prev_succeeded = freeBlocks.getPrev();
if (!get_prev_succeeded || freeBlocks.current().bli_length < current_block->small.mbk_length) { if (!get_prev_succeeded || freeBlocks.current().bli_length < current_block->small.mbk_length) {
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 // Moderately expensive case. We need to modify tree for sure
if (get_prev_succeeded) { if (get_prev_succeeded) {
// Recover tree position after failed shortcut attempt // Recover tree position after failed shortcut attempt

View File

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

View File

@ -24,7 +24,7 @@
* Contributor(s): ______________________________________. * 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]); bool result = bitmap.clear(v1[i]);
tree.fastRemove(); tree.fastRemove();
fb_assert(result == true); fb_assert(result == true);
} else { }
else {
bool result = bitmap.clear(v1[i]); bool result = bitmap.clear(v1[i]);
fb_assert(result == false); fb_assert(result == false);
} }
@ -360,7 +361,8 @@ void testBePlusTree() {
if (tree1.fastRemove()) { if (tree1.fastRemove()) {
if (tree1.current().value != nextValue) if (tree1.current().value != nextValue)
passed = false; passed = false;
} else { }
else {
if (nextValue >= 0) if (nextValue >= 0)
passed = false; passed = false;
} }
@ -379,7 +381,8 @@ void testBePlusTree() {
if (tree2.fastRemove()) { if (tree2.fastRemove()) {
if (tree2.current().value != nextValue) if (tree2.current().value != nextValue)
passed = false; passed = false;
} else { }
else {
if (nextValue >= 0) if (nextValue >= 0)
passed = false; passed = false;
} }
@ -450,7 +453,8 @@ void testBePlusTree() {
if (tree1.fastRemove()) { if (tree1.fastRemove()) {
if (tree1.current().value != nextValue) if (tree1.current().value != nextValue)
passed = false; passed = false;
} else { }
else {
if (nextValue >= 0) if (nextValue >= 0)
passed = false; passed = false;
} }
@ -469,7 +473,8 @@ void testBePlusTree() {
if (tree2.fastRemove()) { if (tree2.fastRemove()) {
if (tree2.current().value != nextValue) if (tree2.current().value != nextValue)
passed = false; passed = false;
} else { }
else {
if (nextValue >= 0) if (nextValue >= 0)
passed = false; passed = false;
} }

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@
* Contributor(s): ______________________________________. * 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.start_value = singular_value & ~(T) (BUNCH_BITS - 1);
bucket.bits = BUNCH_ONE << (singular_value - bucket.start_value); bucket.bits = BUNCH_ONE << (singular_value - bucket.start_value);
tree.add(bucket); tree.add(bucket);
} else { }
else {
if (tree.isEmpty()) { if (tree.isEmpty()) {
singular = true; singular = true;
singular_value = value; singular_value = value;
@ -121,7 +122,8 @@ public:
BUNCH_T bit_mask = BUNCH_ONE << (value - val_aligned); BUNCH_T bit_mask = BUNCH_ONE << (value - val_aligned);
if (tree.locate(val_aligned)) { if (tree.locate(val_aligned)) {
tree.current().bits |= bit_mask; tree.current().bits |= bit_mask;
} else { }
else {
Bucket bucket; Bucket bucket;
bucket.start_value = val_aligned; bucket.start_value = val_aligned;
bucket.bits = bit_mask; bucket.bits = bit_mask;
@ -302,7 +304,8 @@ public:
if (treeAccessor.current().start_value == key_aligned) { if (treeAccessor.current().start_value == key_aligned) {
current_value = key; current_value = key;
bit_mask = BUNCH_ONE << (key - key_aligned); bit_mask = BUNCH_ONE << (key - key_aligned);
} else { }
else {
current_value = treeAccessor.current().start_value; current_value = treeAccessor.current().start_value;
bit_mask = BUNCH_ONE; bit_mask = BUNCH_ONE;
} }
@ -339,7 +342,8 @@ public:
if (treeAccessor.current().start_value == key_aligned) { if (treeAccessor.current().start_value == key_aligned) {
current_value = key; current_value = key;
bit_mask = BUNCH_ONE << (key - key_aligned); bit_mask = BUNCH_ONE << (key - key_aligned);
} else { }
else {
current_value = treeAccessor.current().start_value; current_value = treeAccessor.current().start_value;
bit_mask = BUNCH_ONE << (BUNCH_BITS - 1); bit_mask = BUNCH_ONE << (BUNCH_BITS - 1);
} }
@ -583,7 +587,8 @@ SparseBitmap<T, InternalTypes>::bit_or(
dest = map2; dest = map2;
source = map1; source = map1;
result = bitmap2; result = bitmap2;
} else { }
else {
dest = map1; dest = map1;
source = map2; source = map2;
result = bitmap1; result = bitmap1;
@ -642,7 +647,8 @@ SparseBitmap<T, InternalTypes>::bit_or(
break; break;
} }
} }
} else { }
else {
// Add remaining buckets to destination tree and get out // Add remaining buckets to destination tree and get out
do { do {
dest->tree.add(source->tree.current()); dest->tree.add(source->tree.current());
@ -695,7 +701,8 @@ SparseBitmap<T, InternalTypes>::bit_and(
dest = map2; dest = map2;
source = map1; source = map1;
result = bitmap2; result = bitmap2;
} else { }
else {
dest = map1; dest = map1;
source = map2; source = map2;
result = bitmap1; result = bitmap1;
@ -748,7 +755,8 @@ SparseBitmap<T, InternalTypes>::bit_and(
// if (sourceValue > destValue) // if (sourceValue > destValue)
if ((destFound = dest->tree.fastRemove())) if ((destFound = dest->tree.fastRemove()))
destValue = dest->tree.current().start_value; destValue = dest->tree.current().start_value;
} else { }
else {
// Trim out remaining values from destination list and get out // Trim out remaining values from destination list and get out
while (dest->tree.fastRemove()) while (dest->tree.fastRemove())
{ } { }

View File

@ -353,7 +353,8 @@ public:
tree->_removePage(0, curr); tree->_removePage(0, curr);
curr = temp; curr = temp;
// The code below will adjust current position if needed // The code below will adjust current position if needed
} else { }
else {
if ( (temp = curr->next) && NEED_MERGE(temp->getCount() + curr->getCount(), LeafCount) ) { if ( (temp = curr->next) && NEED_MERGE(temp->getCount() + curr->getCount(), LeafCount) ) {
curr->join(*temp); curr->join(*temp);
tree->_removePage(0, temp); tree->_removePage(0, temp);
@ -405,7 +406,8 @@ public:
curr = curr->prev; curr = curr->prev;
if (!curr) return false; if (!curr) return false;
curPos = curr->getCount() - 1; curPos = curr->getCount() - 1;
} else }
else
curPos--; curPos--;
return true; return true;
case locGreat: case locGreat:
@ -451,7 +453,8 @@ public:
if (curr->next) { if (curr->next) {
curr = curr->next; curr = curr->next;
curPos = 0; curPos = 0;
} else { }
else {
// If we reached end of the list just return false and do not invalidate position // If we reached end of the list just return false and do not invalidate position
curPos--; curPos--;
return false; return false;
@ -466,7 +469,8 @@ public:
if (curr->prev) { if (curr->prev) {
curr = curr->prev; curr = curr->prev;
curPos = curr->getCount() - 1; curPos = curr->getCount() - 1;
} else { }
else {
// If we reached beginning of the list just return false and do not invalidate position // If we reached beginning of the list just return false and do not invalidate position
curPos = 0; curPos = 0;
return false; return false;
@ -678,7 +682,8 @@ bool BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::a
void *lower; void *lower;
if (recovery_map[curLevel] < 0) { if (recovery_map[curLevel] < 0) {
lower = (*itemL)[0]; lower = (*itemL)[0];
} else { }
else {
lower = (*itemL->prev)[recovery_map[curLevel]]; lower = (*itemL->prev)[recovery_map[curLevel]];
itemL->prev->remove(recovery_map[curLevel]); itemL->prev->remove(recovery_map[curLevel]);
itemL->prev->insert(itemL->prev->getCount(), (*itemL)[0]); 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 // Move in status and clone transient strings
*ptr++ = isc_arg_gds; *ptr++ = isc_arg_gds;
*ptr++ = status; *ptr++ = status;
do { while (true)
{
const ISC_STATUS type = *ptr++ = va_arg(status_args, ISC_STATUS); const ISC_STATUS type = *ptr++ = va_arg(status_args, ISC_STATUS);
if (type == isc_arg_end) if (type == isc_arg_end)
break; 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); *ptr++ = va_arg(status_args, ISC_STATUS);
break; break;
} }
} while (true); }
} }
} // namespace } // namespace
@ -88,14 +89,15 @@ status_exception::status_exception(const ISC_STATUS *status_vector, bool permane
{ {
if (m_status_known) { if (m_status_known) {
ISC_STATUS *ptr = m_status_vector; ISC_STATUS *ptr = m_status_vector;
do { while (true)
{
const ISC_STATUS type = *ptr++ = *status_vector++; const ISC_STATUS type = *ptr++ = *status_vector++;
if (type == isc_arg_end) if (type == isc_arg_end)
break; break;
if (type == isc_arg_cstring) if (type == isc_arg_cstring)
*ptr++ = *status_vector++; *ptr++ = *status_vector++;
*ptr++ = *status_vector++; *ptr++ = *status_vector++;
} while (true); }
} }
} }
@ -115,7 +117,8 @@ void status_exception::release_vector() throw()
// Free owned strings // Free owned strings
ISC_STATUS *ptr = m_status_vector; ISC_STATUS *ptr = m_status_vector;
do { while (true)
{
const ISC_STATUS type = *ptr++; const ISC_STATUS type = *ptr++;
if (type == isc_arg_end) if (type == isc_arg_end)
break; break;
@ -133,7 +136,7 @@ void status_exception::release_vector() throw()
ptr++; ptr++;
break; break;
} }
} while (true); }
} }
status_exception::~status_exception() throw() 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()) if (c_ex.strings_permanent())
{ {
// Copy status vector // Copy status vector
do { while (true)
{
const ISC_STATUS type = *sv++ = *ptr++; const ISC_STATUS type = *sv++ = *ptr++;
if (type == isc_arg_end) if (type == isc_arg_end)
break; break;
if (type == isc_arg_cstring) if (type == isc_arg_cstring)
*sv++ = *ptr++; *sv++ = *ptr++;
*sv++ = *ptr++; *sv++ = *ptr++;
} while (true); }
} }
else { else {
// Move in status and clone transient strings // Move in status and clone transient strings
do { while (true)
{
const ISC_STATUS type = *sv++ = *ptr++; const ISC_STATUS type = *sv++ = *ptr++;
if (type == isc_arg_end) if (type == isc_arg_end)
break; break;
@ -291,7 +296,7 @@ ISC_STATUS stuff_exception(ISC_STATUS *status_vector, const std::exception& ex,
*sv++ = *ptr++; *sv++ = *ptr++;
break; break;
} }
} while (true); }
} }
} }
return status_vector[1]; 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) bool Lex::match(const char *pattern, const char *string)
{ {
while (*pattern && *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; return strcmp (token, word) == 0;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -5628,7 +5628,7 @@ static processing_state parse_arg(int argc,
if (ret == ps_ERR) if (ret == ps_ERR)
break; break;
switch(swid) switch (swid)
{ {
#ifdef DEV_BUILD #ifdef DEV_BUILD
case SWITCH_EXTRACTTBL: 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; blb* blob = NULL;
bool materialized_blob; // Set if we materialized temporary blob in this routine bool materialized_blob; // Set if we materialized temporary blob in this routine
do { while (true)
{
materialized_blob = false; materialized_blob = false;
blobIndex = NULL; blobIndex = NULL;
if (source->bid_internal.bid_relation_id) 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; break;
} while (true); }
blob->blb_relation = relation; blob->blb_relation = relation;
destination->set_permanent(relation->rel_id, DPM_store_blob(tdbb, blob, record)); 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; jrd_req* own_request;
if (blobIndex->bli_request) { if (blobIndex->bli_request) {
own_request = blobIndex->bli_request; own_request = blobIndex->bli_request;
} else { }
else {
own_request = request; own_request = request;
while (own_request->req_caller) while (own_request->req_caller)
own_request = 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) {
if (blob_request->req_blobs.locate(blob_temp_id)) { if (blob_request->req_blobs.locate(blob_temp_id)) {
blob_request->req_blobs.fastRemove(); blob_request->req_blobs.fastRemove();
} else { }
else {
// We should never get here because when bli_request is assigned // We should never get here because when bli_request is assigned
// item should be added to req_blobs array // item should be added to req_blobs array
fb_assert(false); fb_assert(false);
@ -2354,14 +2357,16 @@ static void release_blob(blb* blob, const bool purge_flag)
if (blob_request) { if (blob_request) {
if (blob_request->req_blobs.locate(blob->blb_temp_id)) { if (blob_request->req_blobs.locate(blob->blb_temp_id)) {
blob_request->req_blobs.fastRemove(); blob_request->req_blobs.fastRemove();
} else { }
else {
// We should never get here because when bli_request is assigned // We should never get here because when bli_request is assigned
// item should be added to req_blobs array // item should be added to req_blobs array
fb_assert(false); fb_assert(false);
} }
} }
transaction->tra_blobs.fastRemove(); transaction->tra_blobs.fastRemove();
} else { }
else {
// We should never get here because allocate_blob stores each blob object // We should never get here because allocate_blob stores each blob object
// in tra_blobs // in tra_blobs
fb_assert(false); 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 *p = node.data, *q = lower.key_data + node.prefix;
const UCHAR *const end = lower.key_data + lower.key_length; const UCHAR *const end = lower.key_data + lower.key_length;
while(q < end) while (q < end)
{ {
if (*p++ != *q++) { if (*p++ != *q++) {
skipLowerKey = false; 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); memory_size = page_size * (number + 1);
} }
do { while (true)
{
if ( (memory = (UCHAR *)gds__alloc(memory_size)) ) if ( (memory = (UCHAR *)gds__alloc(memory_size)) )
break; break;
/* Either there's not enough virtual memory or there is /* 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 */ /* Diminishing returns */
return buffers; return buffers;
} }
} while (true); }
bcb->bcb_memory.push(memory); bcb->bcb_memory.push(memory);
memory_end = memory + memory_size; 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, SCL_check_access(sec_class, access->acc_view_id, NULL, prc->prc_name,
access->acc_mask, access->acc_type, access->acc_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* relation = MET_lookup_relation_id(tdbb, item->exa_rel_id, false);
jrd_rel* view = NULL; jrd_rel* view = NULL;
if (item->exa_view_id) 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); fb_assert(work->dfw_args);
const DeferredWork* arg = 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; 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 // if index was bound to deleted FK constraint
// then work->dfw_args was set in VIO_erase // then work->dfw_args was set in VIO_erase
const DeferredWork* arg = work->dfw_args; 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; arg = arg->dfw_next;
} }
@ -3649,7 +3649,8 @@ static Format* make_format(thread_db* tdbb, jrd_rel* relation, USHORT* version,
blob, blob,
reinterpret_cast<const UCHAR*>(&(format->fmt_desc[0])), reinterpret_cast<const UCHAR*>(&(format->fmt_desc[0])),
(USHORT)(format->fmt_count * sizeof(dsc))); (USHORT)(format->fmt_count * sizeof(dsc)));
} else { }
else {
// Use generic representation of formats with 32-bit offsets // Use generic representation of formats with 32-bit offsets
Firebird::Array<Ods::Descriptor> odsDescs; 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_dtype = desc[0]->dsc_dtype;
impure->vlu_desc.dsc_sub_type = desc[0]->dsc_sub_type; impure->vlu_desc.dsc_sub_type = desc[0]->dsc_sub_type;
impure->vlu_desc.dsc_scale = desc[0]->dsc_scale; impure->vlu_desc.dsc_scale = desc[0]->dsc_scale;
} else { }
else {
// Indicate we do not know type of expression. // Indicate we do not know type of expression.
// This code will force pattern recompile for the next non-null value // This code will force pattern recompile for the next non-null value
impure->vlu_desc.dsc_dtype = 0; impure->vlu_desc.dsc_dtype = 0;
@ -4226,7 +4227,8 @@ static bool string_boolean(thread_db* tdbb, jrd_nod* node, dsc* desc1,
l2 = l2 =
MOV_get_string(desc2, &p2, reinterpret_cast<vary*>(temp2), MOV_get_string(desc2, &p2, reinterpret_cast<vary*>(temp2),
sizeof(temp2)); sizeof(temp2));
} else { }
else {
l2 = l2 =
MOV_make_string2(desc2, type1, &p2, match_str); 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 */ /* Release blobs bound to this request */
if (request->req_blobs.getFirst()) do { if (request->req_blobs.getFirst())
const ULONG blob_temp_id = request->req_blobs.current(); while (true)
if (transaction->tra_blobs.locate(blob_temp_id)) { {
BlobIndex *current = &transaction->tra_blobs.current(); const ULONG blob_temp_id = request->req_blobs.current();
if (current->bli_materialized) if (transaction->tra_blobs.locate(blob_temp_id)) {
transaction->tra_blobs.fastRemove(); 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 { else {
// Blob was created by request, is accounted for internal needs, // Blob accounting inconsistent
// but is not materialized. Get rid of it. fb_assert(false);
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 { if (!request->req_blobs.getNext())
// Blob accounting inconsistent break;
fb_assert(false);
} }
if (!request->req_blobs.getNext())
break;
} while (true);
request->req_blobs.clear(); 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, return att->att_context_vars.put(name_str,
Firebird::string(value_vary->vary_string, value_vary->vary_length)); 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; jrd_tra* tra = tdbb->tdbb_transaction;
if (!tra) { 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, return tra->tra_context_vars.put(name_str,
Firebird::string(value_vary->vary_string, value_vary->vary_length)); Firebird::string(value_vary->vary_string, value_vary->vary_length));
} else { }
else {
// "Invalid namespace name %s passed to %s" // "Invalid namespace name %s passed to %s"
ERR_post(isc_ctx_namespace_invalid, ERR_post(isc_ctx_namespace_invalid,
isc_arg_string, ERR_cstring(ns_str.c_str()), 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; break;
} }
} }
} else { }
else {
// Use generic representation of formats with 32-bit offsets // Use generic representation of formats with 32-bit offsets
const USHORT count = blob->blb_length / sizeof(Ods::Descriptor); 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 CCH_flush_database(tdbb); // This may release database lock
if (ast_status[1]) if (ast_status[1])
gds__log_status(new_dbb->dbb_file->fil_string, ast_status); gds__log_status(new_dbb->dbb_file->fil_string, ast_status);
} else { }
else {
LCK_release(tdbb, lock); 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++) { for (ptr = &streams[1]; ptr <= end_ptr; ptr++) {
UInt32Bitmap::Accessor accessor(csb->csb_rpt[*ptr].csb_fields); UInt32Bitmap::Accessor accessor(csb->csb_rpt[*ptr].csb_fields);
if (accessor.getFirst()) do { if (accessor.getFirst())
const ULONG id = accessor.current(); do {
items++; const ULONG id = accessor.current();
id_stack.push(id); items++;
stream_stack.push(*ptr); id_stack.push(id);
for (jrd_nod** node_ptr = sort->nod_arg; node_ptr < end_node; node_ptr++) 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)
{ {
dsc* desc = &descriptor; jrd_nod* node = *node_ptr;
CMP_get_desc(tdbb, csb, node, desc); if (node->nod_type == nod_field
/* International type text has a computed key */ && (USHORT)(IPTR) node->nod_arg[e_fld_stream] == *ptr
if (IS_INTL_DATA(desc)) && (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; 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 /* 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)) // while (SBM_next(*bitmap, &rpb->rpb_number, mode))
// We assume mode = RSE_get_forward because we do not support // We assume mode = RSE_get_forward because we do not support
// scrollable cursors at the moment. // scrollable cursors at the moment.
if (rpb->rpb_number.isBof() ? bitmap->getFirst() : bitmap->getNext()) do { if (rpb->rpb_number.isBof() ? bitmap->getFirst() : bitmap->getNext())
rpb->rpb_number.setValue(bitmap->current()); do {
#ifdef SUPERSERVER_V2 rpb->rpb_number.setValue(bitmap->current());
/* Prefetch next set of data pages from bitmap. */ #ifdef SUPERSERVER_V2
/* Prefetch next set of data pages from bitmap. */
if (rpb->rpb_number > if (rpb->rpb_number >
((irsb_index*) impure)->irsb_prefetch_number && ((irsb_index*) impure)->irsb_prefetch_number &&
(mode == RSE_get_forward)) (mode == RSE_get_forward))
{ {
((irsb_index*) impure)->irsb_prefetch_number = ((irsb_index*) impure)->irsb_prefetch_number =
DPM_prefetch_bitmap(tdbb, rpb->rpb_relation, DPM_prefetch_bitmap(tdbb, rpb->rpb_relation,
*bitmap, rpb->rpb_number); *bitmap, rpb->rpb_number);
} }
#endif #endif
if (VIO_get(tdbb, rpb, rsb, request->req_transaction, if (VIO_get(tdbb, rpb, rsb, request->req_transaction,
request->req_pool)) request->req_pool))
{ {
result = true; result = true;
break; break;
} }
} while (bitmap->getNext()); } while (bitmap->getNext());
if (result) if (result)
break; break;

View File

@ -169,7 +169,8 @@ void TRA_detach_request(Jrd::jrd_req* request) {
if (request->req_tra_prev) { if (request->req_tra_prev) {
fb_assert(request->req_tra_prev->req_tra_next == request); fb_assert(request->req_tra_prev->req_tra_next == request);
request->req_tra_prev->req_tra_next = request->req_tra_next; request->req_tra_prev->req_tra_next = request->req_tra_next;
} else { }
else {
fb_assert(request->req_transaction->tra_requests == request); fb_assert(request->req_transaction->tra_requests == request);
request->req_transaction->tra_requests = request->req_tra_next; 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); SET_TDBB(tdbb);
if (transaction->tra_blobs.getFirst()) do { if (transaction->tra_blobs.getFirst())
BlobIndex *current = &transaction->tra_blobs.current(); while (true)
if (current->bli_materialized) { {
if (!transaction->tra_blobs.getNext()) BlobIndex *current = &transaction->tra_blobs.current();
break; if (current->bli_materialized) {
} else { if (!transaction->tra_blobs.getNext())
ULONG temp_id = current->bli_temp_id; break;
BLB_cancel(tdbb, current->bli_blob_object); }
if (!transaction->tra_blobs.locate(Firebird::locGreat, temp_id)) else {
break; 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) while (transaction->tra_arrays)
BLB_release_array(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)) { if (control && (control->vdr_flags & vdr_records)) {
THREAD_EXIT(); THREAD_EXIT();
RecordBitmap::Accessor accessor(control->vdr_rel_records); RecordBitmap::Accessor accessor(control->vdr_rel_records);
if (accessor.getFirst()) do { if (accessor.getFirst())
SINT64 next_number = accessor.current(); do {
if (!RecordBitmap::test(control->vdr_idx_records, next_number)) { SINT64 next_number = accessor.current();
THREAD_ENTER(); if (!RecordBitmap::test(control->vdr_idx_records, next_number)) {
return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS, THREAD_ENTER();
relation, id + 1); return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS,
} relation, id + 1);
} while (accessor.getNext()); }
} while (accessor.getNext());
THREAD_ENTER(); 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_window.win_flags = 0;
rpb.rpb_transaction_nr = transaction->tra_number; 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 /* This savepoint needs to be undone because the
verb_count is not zero. */ verb_count is not zero. */
RecordBitmap::Accessor accessor(action->vct_records); RecordBitmap::Accessor accessor(action->vct_records);
if (accessor.getFirst()) do { if (accessor.getFirst())
rpb.rpb_number.setValue(accessor.current()); do {
if (!DPM_get(tdbb, &rpb, LCK_write)) { rpb.rpb_number.setValue(accessor.current());
BUGCHECK(186); /* msg 186 record disappeared */ 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()); if (rpb.rpb_flags & rpb_delta) {
} VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
else { }
CCH_RELEASE(tdbb, &rpb.rpb_window); else {
} CCH_RELEASE(tdbb, &rpb.rpb_window);
if (rpb.rpb_transaction_nr != transaction->tra_number) { }
BUGCHECK(185); /* msg 185 wrong record version */ 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())) 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) {
VIO_backout(tdbb, &rpb, transaction); VIO_backout(tdbb, &rpb, transaction);
/* Nickolay Samofatov, 01 Mar 2003: }
If we don't have data for the record and else {
it was modified and deleted under our savepoint Record* record = action->vct_undo->current().rec_data;
we need to back it out to the state as it were const bool same_tx = (record->rec_flags & REC_same_tx) != 0;
before our transaction started */
if (record->rec_length == 0 && record->rec_flags & REC_new_version) /* Have we done BOTH an update and delete to this record
{ in the same transaction? */
if (!DPM_get(tdbb, &rpb, LCK_write)) {
BUGCHECK(186); /* msg 186 record disappeared */ 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()); VIO_data(tdbb, &rpb, tdbb->getDefaultPool());
} }
else { update_in_place(tdbb, transaction, &rpb, &new_rpb);
CCH_RELEASE(tdbb, &rpb.rpb_window); if (!(transaction->tra_flags & TRA_system)) {
garbage_collect_idx(tdbb, &rpb, &new_rpb, NULL);
} }
rpb.rpb_record = dead_record;
VIO_backout(tdbb, &rpb, transaction);
} }
} }
if (record->rec_length != 0) { } while (accessor.getNext());
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());
} }
else { else {
/* This savepoint needs to be posted to the previous savepoint. */ /* This savepoint needs to be posted to the previous savepoint. */
RecordBitmap::Accessor accessor(action->vct_records); RecordBitmap::Accessor accessor(action->vct_records);
if (accessor.getFirst()) do if (accessor.getFirst())
{ do {
rpb.rpb_number.setValue(accessor.current()); rpb.rpb_number.setValue(accessor.current());
if (!action->vct_undo || if (!action->vct_undo ||
!action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue())) !action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue()))
{ {
verb_post(tdbb, transaction, &rpb, 0, 0, false, false); verb_post(tdbb, transaction, &rpb, 0, 0, false, false);
} }
else { else {
/* Setup more of rpb because verb_post is probably going to /* Setup more of rpb because verb_post is probably going to
garbage-collect. Note that the data doesn't need to be set up garbage-collect. Note that the data doesn't need to be set up
because old_data will be used. (this guarantees that the because old_data will be used. (this guarantees that the
rpb points to the first fragment of the record) */ rpb points to the first fragment of the record) */
if (!DPM_get(tdbb, &rpb, LCK_read)) { if (!DPM_get(tdbb, &rpb, LCK_read)) {
BUGCHECK(186); /* msg 186 record disappeared */ 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); } while (accessor.getNext());
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());
} }
if (rpb.rpb_record) { if (rpb.rpb_record) {

View File

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

View File

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

View File

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

View File

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

View File

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