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

Fix signed/unsigned comparisons

This commit is contained in:
brodsom 2004-08-26 21:47:19 +00:00
parent e5f053fda6
commit 15a5a276da
5 changed files with 35 additions and 39 deletions

View File

@ -2505,7 +2505,7 @@ static CONTENTS delete_node(thread_db* tdbb, WIN *window, UCHAR *pointer)
pointer = BTreeNode::writeJumpInfo(page, &jumpInfo);
// Write jump nodes.
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++) {
pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags);
if (walkJumpNode[i].data) {
delete[] walkJumpNode[i].data;
@ -2894,7 +2894,7 @@ static SLONG fast_load(thread_db* tdbb,
// Write jumpnodes on page.
pointer = (UCHAR*)bucket + headerSize;
IndexJumpNode* walkJumpNode = leafJumpNodes->begin();
for (int i = 0; i < leafJumpNodes->getCount(); i++) {
for (size_t i = 0; i < leafJumpNodes->getCount(); i++) {
// Update offset position first.
walkJumpNode[i].offset += totalJumpSize[0];
pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags);
@ -2966,7 +2966,7 @@ static SLONG fast_load(thread_db* tdbb,
if (useJumpInfo) {
// Clear jumplist.
IndexJumpNode* walkJumpNode = leafJumpNodes->begin();
for (int i = 0; i < leafJumpNodes->getCount(); i++) {
for (size_t i = 0; i < leafJumpNodes->getCount(); i++) {
if (walkJumpNode[i].data) {
delete[] walkJumpNode[i].data;
}
@ -3190,7 +3190,7 @@ static SLONG fast_load(thread_db* tdbb,
// Write jumpnodes on page.
levelPointer = (UCHAR*)bucket + headerSize;
IndexJumpNode* walkJumpNode = pageJumpNodes->begin();
for (int i = 0; i < pageJumpNodes->getCount(); i++) {
for (size_t i = 0; i < pageJumpNodes->getCount(); i++) {
// Update offset position first.
walkJumpNode[i].offset += totalJumpSize[level];
levelPointer = BTreeNode::writeJumpNode(&walkJumpNode[i],
@ -3261,7 +3261,7 @@ static SLONG fast_load(thread_db* tdbb,
if (useJumpInfo) {
// Clear jumplist.
IndexJumpNode* walkJumpNode = pageJumpNodes->begin();
for (int i = 0; i < pageJumpNodes->getCount(); i++) {
for (size_t i = 0; i < pageJumpNodes->getCount(); i++) {
if (walkJumpNode[i].data) {
delete[] walkJumpNode[i].data;
}
@ -3352,7 +3352,7 @@ static SLONG fast_load(thread_db* tdbb,
// Write jumpnodes on page.
IndexJumpNode* walkJumpNode = pageJumpNodes->begin();
for (int i = 0; i < pageJumpNodes->getCount(); i++) {
for (size_t i = 0; i < pageJumpNodes->getCount(); i++) {
// Update offset position first.
walkJumpNode[i].offset += totalJumpSize[level];
pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags);
@ -3381,7 +3381,7 @@ static SLONG fast_load(thread_db* tdbb,
{
jumpNodeList* freeJumpNodes = *itr;
IndexJumpNode* walkJumpNode = freeJumpNodes->begin();
for (int i = 0; i < freeJumpNodes->getCount(); i++) {
for (size_t i = 0; i < freeJumpNodes->getCount(); i++) {
if (walkJumpNode[i].data) {
delete[] walkJumpNode[i].data;
}
@ -4561,7 +4561,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
CCH_RELEASE(tdbb, &right_window);
}
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++) {
if (walkJumpNode[i].data) {
delete[] walkJumpNode[i].data;
}
@ -4616,7 +4616,7 @@ static CONTENTS garbage_collect(thread_db* tdbb, WIN * window, SLONG parent_numb
pointer = BTreeNode::writeJumpInfo(left_page, &jumpInfo);
// Write jump nodes.
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++) {
// Update offset to real position with new jump nodes.
walkJumpNode[i].offset += jumpersNewSize;
pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags2);
@ -5218,7 +5218,7 @@ static SLONG insert_node(thread_db* tdbb,
// Write jump nodes.
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++) {
// Update offset to real position with new jump nodes.
walkJumpNode[i].offset += jumpersNewSize - jumpersOriginalSize;
pointer = BTreeNode::writeJumpNode(&walkJumpNode[i], pointer, flags);
@ -5289,8 +5289,7 @@ static SLONG insert_node(thread_db* tdbb,
USHORT index = 1;
IndexJumpNode* jn = 0;
IndexJumpNode* walkJumpNode = jumpNodes->begin();
int i;
for (i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
UCHAR* q = new_key->key_data + walkJumpNode[i].prefix;
memcpy(q, walkJumpNode[i].data, walkJumpNode[i].length);
if (index == splitJumpNodeIndex) {
@ -5310,7 +5309,7 @@ static SLONG insert_node(thread_db* tdbb,
// Rebuild first jumpnode on splitpage
index = 1;
walkJumpNode = jumpNodes->begin();
for (i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
if (index > splitJumpNodeIndex) {
const USHORT length = walkJumpNode[i].prefix + walkJumpNode[i].length;
UCHAR* newData = FB_NEW(*tdbb->getDefaultPool()) UCHAR[length];
@ -5330,7 +5329,7 @@ static SLONG insert_node(thread_db* tdbb,
// Initalize new offsets for original page and split page.
index = 1;
walkJumpNode = jumpNodes->begin();
for (i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
// The jump node where the split is done isn't included anymore!
if (index < splitJumpNodeIndex) {
jumpersNewSize += BTreeNode::getJumpNodeSize(&walkJumpNode[i], flags);
@ -5416,7 +5415,7 @@ static SLONG insert_node(thread_db* tdbb,
// Calculate size that's between header and splitpoint.
const USHORT splitOffset = (splitpoint - (UCHAR*)newBucket);
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
if (index > splitJumpNodeIndex) {
// Update offset to correct position.
walkJumpNode[i].offset = walkJumpNode[i].offset - splitOffset +
@ -5473,7 +5472,7 @@ static SLONG insert_node(thread_db* tdbb,
// Write jump nodes.
USHORT index = 1;
IndexJumpNode* walkJumpNode = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
if (index <= jumpInfo.jumpers) {
// Update offset to correct position.
walkJumpNode[i].offset = walkJumpNode[i].offset +
@ -5489,7 +5488,7 @@ static SLONG insert_node(thread_db* tdbb,
if (fragmentedOffset) {
IndexJumpNode* walkJumpNode2 = jumpNodes->begin();
for (int i = 0; i < jumpNodes->getCount(); i++, index++) {
for (size_t i = 0; i < jumpNodes->getCount(); i++, index++) {
if (walkJumpNode2[i].data) {
delete[] walkJumpNode2[i].data;
}

View File

@ -233,7 +233,7 @@ inline void triggers_external_access(thread_db* tdbb, ExternalAccessList& list,
**************************************/
{
if (vec) {
for (int i = 0; i < vec->getCount(); i++)
for (size_t i = 0; i < vec->getCount(); i++)
{
Trigger& t = (*vec)[i];
t.compile(tdbb);
@ -316,7 +316,7 @@ static void verify_trigger_access(thread_db* tdbb, jrd_rel* owner_relation, trig
return;
}
for (int i = 0; i < triggers->getCount(); i++)
for (size_t i = 0; i < triggers->getCount(); i++)
{
Trigger& t = (*triggers)[i];
t.compile(tdbb);

View File

@ -24,7 +24,7 @@
* Contributor(s): ______________________________________.
*
*
* $Id: evl_string.h,v 1.16 2004-07-07 16:06:19 skidder Exp $
* $Id: evl_string.h,v 1.17 2004-08-26 21:47:19 brodsom Exp $
*
*/
@ -110,7 +110,7 @@ public:
StaticAllocator(MemoryPool& _pool) : chunksToFree(_pool), pool(_pool), allocated(0) {};
~StaticAllocator() {
for (int i = 0; i < chunksToFree.getCount(); i++)
for (size_t i = 0; i < chunksToFree.getCount(); i++)
pool.deallocate(chunksToFree[i]);
}
@ -355,7 +355,7 @@ LikeEvaluator<CharType>::LikeEvaluator(
// Unescape strings, mark direct match items, pre-compile KMP tables and
// optimize out piSkipMore nodes
bool directMatch = true;
for (int i = 0; i < patternItems.getCount();) {
for (size_t i = 0; i < patternItems.getCount();) {
PatternItem *itemL = &patternItems[i];
switch (itemL->type) {
case piEscapedString: {
@ -432,7 +432,7 @@ bool LikeEvaluator<CharType>::processNextChunk(const CharType* data, SSHORT data
SSHORT finishCandidate = -1;
while (data_pos < data_len) {
int branch_number = 0;
size_t branch_number = 0;
while (branch_number < branches.getCount())
{
BranchItem *current_branch = &branches[branch_number];

View File

@ -37,7 +37,7 @@
* 2004.01.16 Vlad Horsun: added support for default parameters
*/
/*
$Id: met.epp,v 1.134 2004-08-26 11:07:57 robocop Exp $
$Id: met.epp,v 1.135 2004-08-26 21:47:19 brodsom Exp $
*/
// This MUST be at the top of the file
#ifdef DARWIN
@ -146,7 +146,7 @@ static void release_cached_triggers(thread_db* tdbb, trig_vec* vector)
return;
}
for (int i = 0; i < vector->getCount(); i++)
for (size_t i = 0; i < vector->getCount(); i++)
{
(*vector)[i].release(tdbb);
}
@ -178,7 +178,7 @@ static void post_used_procedures(trig_vec* vector)
return;
}
for (int i = 0; i < vector->getCount(); i++)
for (size_t i = 0; i < vector->getCount(); i++)
{
jrd_req* r = (*vector)[i].request;
if (r && !CMP_clone_is_active(r))
@ -2525,7 +2525,6 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
jrd_nod* node;
Format* format;
Format::fmt_desc_iterator desc;
SSHORT i;
SET_TDBB(tdbb);
Database* dbb = tdbb->tdbb_database;
@ -2753,7 +2752,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
if (!parse_procedure_blr(tdbb, procedure, &P.RDB$PROCEDURE_BLR, csb))
ERR_post(isc_random, isc_arg_string, "Error while parsing procedure's BLR.", 0);
procedure->prc_request->req_procedure = procedure;
for (i = 0; i < csb->csb_rpt.getCount(); i++)
for (size_t i = 0; i < csb->csb_rpt.getCount(); i++)
{
if ( (node = csb->csb_rpt[i].csb_message) )
{
@ -4057,9 +4056,8 @@ void MET_release_triggers( thread_db* tdbb, trig_vec** vector_ptr)
SET_TDBB(tdbb);
*vector_ptr = NULL;
int i;
for (i = 0; i < vector->getCount(); i++)
for (size_t i = 0; i < vector->getCount(); i++)
{
jrd_req* r = (*vector)[i].request;
if (r && CMP_clone_is_active(r))
@ -4068,7 +4066,7 @@ void MET_release_triggers( thread_db* tdbb, trig_vec** vector_ptr)
}
}
for (i = 0; i < vector->getCount(); i++)
for (size_t i = 0; i < vector->getCount(); i++)
{
jrd_req* r = (*vector)[i].request;
if (r)

View File

@ -288,7 +288,7 @@ bool OPT_access_path(const jrd_req* request,
/* loop through all RSEs in the request,
and describe the rsb tree for that rsb */
SLONG i;
size_t i;
for (i = 0; i < request->req_fors.getCount(); i++) {
RecordSource* rsb = request->req_fors[i];
if (rsb && !dump_rsb(request, rsb, &buffer, &buffer_length))
@ -1199,7 +1199,7 @@ void OPT_set_index(thread_db* tdbb,
/* go out to the vector which stores all rsbs for the
request, and replace the old with the new */
for (int i = 0; i < request->req_fors.getCount(); i++) {
for (size_t i = 0; i < request->req_fors.getCount(); i++) {
if (request->req_fors[i] == old_rsb) {
request->req_fors[i] = new_rsb;
break;
@ -3507,10 +3507,9 @@ static void find_best(thread_db* tdbb,
stream_flags(*tdbb->getDefaultPool()), conjunct_flags(*tdbb->getDefaultPool());
stream_flags.grow(csb->csb_n_stream);
conjunct_flags.grow(opt->opt_base_conjuncts);
int i;
for (i = 0; i < stream_flags.getCount(); i++)
for (size_t i = 0; i < stream_flags.getCount(); i++)
stream_flags[i] = opt->opt_streams[i].opt_stream_flags & opt_stream_used;
for (i = 0; i < conjunct_flags.getCount(); i++)
for (size_t i = 0; i < conjunct_flags.getCount(); i++)
conjunct_flags[i] = opt->opt_conjuncts[i].opt_conjunct_flags & opt_conjunct_used;
// Compute delta and total estimate cost to fetch this stream.
@ -3639,9 +3638,9 @@ static void find_best(thread_db* tdbb,
// Clean up from any changes made for compute the cost for this stream
csb->csb_rpt[stream].csb_flags &= ~csb_active;
for (i = 0; i < stream_flags.getCount(); i++)
for (size_t i = 0; i < stream_flags.getCount(); i++)
opt->opt_streams[i].opt_stream_flags &= stream_flags[i];
for (i = 0; i < conjunct_flags.getCount(); i++)
for (size_t i = 0; i < conjunct_flags.getCount(); i++)
opt->opt_conjuncts[i].opt_conjunct_flags &= conjunct_flags[i];
}
@ -5082,7 +5081,7 @@ static RecordSource* gen_retrieval(thread_db* tdbb,
(idx_tail->opt_lower || idx_tail->opt_upper);
idx_tail++, position++)
{
for (int j = 0; j < conjunct_position_vector.getCount(); j++) {
for (size_t j = 0; j < conjunct_position_vector.getCount(); j++) {
if (conjunct_position_vector[j] == position) {
matching_nodes_vector[j]->opt_conjunct_flags |= opt_conjunct_matched;
}