From 514fe7355f6347792b8fd3b16dfed477abcbcf9c Mon Sep 17 00:00:00 2001 From: robocop Date: Wed, 30 Sep 2009 06:09:05 +0000 Subject: [PATCH] Misc. --- src/jrd/dfw.epp | 16 ++++++++++------ src/jrd/pcmet.epp | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index 1ec9c9722a..c7d741870a 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -269,7 +269,8 @@ public: static size_t hash(const DeferredWork& work, size_t hashSize) { - char key[sizeof work.dfw_type + sizeof work.dfw_id + 32]; + const int nameLimit = 32; + char key[sizeof work.dfw_type + sizeof work.dfw_id + nameLimit]; memset(key, 0, sizeof key); char* place = key; @@ -279,7 +280,7 @@ public: memcpy(place, &work.dfw_id, sizeof work.dfw_id); place += sizeof work.dfw_id; - work.dfw_name.copyTo(place, 32); // It's good enough to have first 32 bytes + work.dfw_name.copyTo(place, nameLimit); // It's good enough to have first 32 bytes return DefaultHash::hash(key, sizeof key, hashSize); } @@ -376,6 +377,8 @@ static bool grant_privileges(thread_db*, SSHORT, DeferredWork*, jrd_tra*); /* ---------------------------------------------------------------- */ +static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, + jrd_tra* transaction); static void check_computed_dependencies(thread_db* tdbb, jrd_tra* transaction, const Firebird::MetaName& fieldName); static void check_dependencies(thread_db*, const TEXT*, const TEXT*, int, jrd_tra*); @@ -1501,7 +1504,7 @@ static bool user_management(thread_db* tdbb, } -bool grant_privileges(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra* transaction) +static bool grant_privileges(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra* transaction) { /************************************** * @@ -1531,7 +1534,8 @@ bool grant_privileges(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra } -bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_tra* transaction) +static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, + jrd_tra* transaction) { /************************************** * @@ -4134,7 +4138,7 @@ static bool find_depend_in_dfw(thread_db* tdbb, } // Look to see if an object of the desired type is being deleted. - for (DeferredWork* work = transaction->tra_deferred_job->work; work; work = work->getNext()) + for (const DeferredWork* work = transaction->tra_deferred_job->work; work; work = work->getNext()) { if ((work->dfw_type == dfw_type || (work->dfw_type == dfw_modify_procedure && dfw_type == dfw_delete_procedure)) && @@ -4154,7 +4158,7 @@ static bool find_depend_in_dfw(thread_db* tdbb, { for (size_t i = 0; i < work->dfw_args.getCount(); ++i) { - DeferredWork* arg = work->dfw_args[i]; + const DeferredWork* arg = work->dfw_args[i]; if (arg->dfw_type == dfw_arg_index_name && arg->dfw_name == object_name) { diff --git a/src/jrd/pcmet.epp b/src/jrd/pcmet.epp index cf927a5765..8ccb9d2113 100644 --- a/src/jrd/pcmet.epp +++ b/src/jrd/pcmet.epp @@ -200,8 +200,8 @@ void PCMET_expression_index(thread_db* tdbb, const string& name, USHORT id, jrd_ fb_assert(id <= dbb->dbb_max_idx); idx.idx_id = id; - IDX_create_index(tdbb, relation, &idx, name.c_str(), &id, - transaction, selectivity); + IDX_create_index(tdbb, relation, &idx, name.c_str(), &id, transaction, selectivity); + fb_assert(id == idx.idx_id); TRA_detach_request(idx.idx_expression_request);