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

Avoid signed unsigned comparison

This commit is contained in:
brodsom 2003-04-03 17:19:10 +00:00
parent 4e5aef02ca
commit c246f9d897
6 changed files with 30 additions and 33 deletions

View File

@ -28,7 +28,7 @@
* *
*/ */
/* /*
$Id: canonical.cpp,v 1.17 2003-03-18 01:35:11 brodsom Exp $ $Id: canonical.cpp,v 1.18 2003-04-03 17:14:22 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -283,7 +283,7 @@ static bool_t burp_getbytes(XDR* xdrs, SCHAR* buff, u_int bytecount)
* *
**************************************/ **************************************/
if (bytecount && xdrs->x_handy >= bytecount) if (bytecount && xdrs->x_handy >= (int) bytecount)
{ {
xdrs->x_handy -= bytecount; xdrs->x_handy -= bytecount;
do { do {
@ -379,7 +379,7 @@ static bool_t burp_putbytes(XDR* xdrs, SCHAR* buff, u_int bytecount)
* *
**************************************/ **************************************/
if (bytecount && xdrs->x_handy >= bytecount) if (bytecount && xdrs->x_handy >= (int) bytecount)
{ {
xdrs->x_handy -= bytecount; xdrs->x_handy -= bytecount;
do { do {

View File

@ -2041,7 +2041,7 @@ static void get_slice( ICC icc)
ips_sdl = &comm->ips_buffers[IPS_SLICE_SDL]; ips_sdl = &comm->ips_buffers[IPS_SLICE_SDL];
sdl_length = (SSHORT) ips_sdl->ips_cl_size; sdl_length = (SSHORT) ips_sdl->ips_cl_size;
if (sdl_length <= sizeof(sdl_buf)) if (sdl_length <= (SLONG) sizeof(sdl_buf))
sdl = sdl_buf; sdl = sdl_buf;
else else
sdl = get_buffer(comm, sdl_length, IPS_SLICE_SDL); sdl = get_buffer(comm, sdl_length, IPS_SLICE_SDL);
@ -2052,7 +2052,7 @@ static void get_slice( ICC icc)
ips_parms = &comm->ips_buffers[IPS_SLICE_PARAM]; ips_parms = &comm->ips_buffers[IPS_SLICE_PARAM];
param_length = (SSHORT) ips_parms->ips_cl_size; param_length = (SSHORT) ips_parms->ips_cl_size;
if (param_length <= sizeof(parameters)) if (param_length <= (SLONG) sizeof(parameters))
params = parameters; params = parameters;
else else
params = (ULONG *) get_buffer(comm, param_length, IPS_SLICE_PARAM); params = (ULONG *) get_buffer(comm, param_length, IPS_SLICE_PARAM);

View File

@ -84,7 +84,7 @@ int TPC_cache_state(TDBB tdbb, SLONG number)
/* locate the specific TIP cache block for the transaction */ /* locate the specific TIP cache block for the transaction */
for (; tip_cache; tip_cache = tip_cache->tpc_next) for (; tip_cache; tip_cache = tip_cache->tpc_next)
if (number < tip_cache->tpc_base + dbb->dbb_pcontrol->pgc_tpt) { if (number < (SLONG) (tip_cache->tpc_base + dbb->dbb_pcontrol->pgc_tpt)) {
return TRA_state(tip_cache->tpc_transactions, return TRA_state(tip_cache->tpc_transactions,
tip_cache->tpc_base, number); tip_cache->tpc_base, number);
} }
@ -133,7 +133,7 @@ void TPC_initialize_tpc(TDBB tdbb, SLONG number)
tip_cache_ptr = &(*tip_cache_ptr)->tpc_next) tip_cache_ptr = &(*tip_cache_ptr)->tpc_next)
tip_cache = *tip_cache_ptr; tip_cache = *tip_cache_ptr;
if (number < (tip_cache->tpc_base + trans_per_tip)) if (number < (SLONG)(tip_cache->tpc_base + trans_per_tip))
return; return;
cache_transactions(tdbb, tip_cache_ptr, cache_transactions(tdbb, tip_cache_ptr,
@ -169,9 +169,8 @@ void TPC_set_state(TDBB tdbb, SLONG number, SSHORT state)
shift = TRANS_SHIFT(number); shift = TRANS_SHIFT(number);
for (tip_cache = dbb->dbb_tip_cache; tip_cache; for (tip_cache = dbb->dbb_tip_cache; tip_cache;
tip_cache = tip_cache = tip_cache->tpc_next)
tip_cache->tpc_next) if (number < if (number < (SLONG)(tip_cache->tpc_base + trans_per_tip)) {
tip_cache->tpc_base + trans_per_tip) {
address = tip_cache->tpc_transactions + byte; address = tip_cache->tpc_transactions + byte;
*address &= ~(TRA_MASK << shift); *address &= ~(TRA_MASK << shift);
*address |= state << shift; *address |= state << shift;
@ -226,7 +225,7 @@ int TPC_snapshot_state(TDBB tdbb, SLONG number)
for (; tip_cache; tip_cache = tip_cache->tpc_next) for (; tip_cache; tip_cache = tip_cache->tpc_next)
{ {
if (number < tip_cache->tpc_base + dbb->dbb_pcontrol->pgc_tpt) if (number < (SLONG) (tip_cache->tpc_base + dbb->dbb_pcontrol->pgc_tpt))
{ {
const USHORT state = const USHORT state =
TRA_state( tip_cache->tpc_transactions, TRA_state( tip_cache->tpc_transactions,
@ -405,7 +404,7 @@ static void cache_transactions(TDBB tdbb, TPC * tip_cache_ptr, ULONG oldest)
window.win_flags = 0; window.win_flags = 0;
header = (HDR) CCH_FETCH(tdbb, &window, LCK_read, pag_header); header = (HDR) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
top = header->hdr_next_transaction; top = header->hdr_next_transaction;
oldest = MAX(oldest, header->hdr_oldest_transaction); oldest = MAX(oldest, (ULONG) header->hdr_oldest_transaction);
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
#endif #endif
@ -465,11 +464,10 @@ static int extend_cache(TDBB tdbb, SLONG number)
for (tip_cache = dbb->dbb_tip_cache; tip_cache; for (tip_cache = dbb->dbb_tip_cache; tip_cache;
tip_cache = tip_cache =
tip_cache->tpc_next) if (number < tip_cache->tpc_next)
(tip_cache->tpc_base + if (number < (SLONG) (tip_cache->tpc_base + trans_per_tip))
trans_per_tip)) return return TRA_state(tip_cache->tpc_transactions, tip_cache->tpc_base,
TRA_state(tip_cache->tpc_transactions, tip_cache->tpc_base, number);
number);
/* we should never get to this point, but if we do the /* we should never get to this point, but if we do the
safest thing to do is return active */ safest thing to do is return active */

View File

@ -1647,7 +1647,7 @@ JRD_TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
computed value then there is no need to continue. There can't be computed value then there is no need to continue. There can't be
an older lock data in the remaining active transactions. */ an older lock data in the remaining active transactions. */
if (trans->tra_oldest_active == oldest_snapshot) if (trans->tra_oldest_active == (SLONG) oldest_snapshot)
break; break;
#ifndef VMS #ifndef VMS
/* Query the minimum lock data for all active transaction locks. /* Query the minimum lock data for all active transaction locks.
@ -1665,7 +1665,7 @@ JRD_TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
/* Put the TID of the oldest active transaction (just calculated) /* Put the TID of the oldest active transaction (just calculated)
in the new transaction's lock. */ in the new transaction's lock. */
if (lock->lck_data != oldest_active) if (lock->lck_data != (SLONG) oldest_active)
LCK_write_data(lock, oldest_active); LCK_write_data(lock, oldest_active);
/* Scan commit retaining transactions which have started after us but which /* Scan commit retaining transactions which have started after us but which
@ -1699,10 +1699,10 @@ JRD_TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
} }
#ifdef MULTI_THREAD #ifdef MULTI_THREAD
if (--oldest > dbb->dbb_oldest_transaction) if (--oldest > (ULONG) dbb->dbb_oldest_transaction)
dbb->dbb_oldest_transaction = oldest; dbb->dbb_oldest_transaction = oldest;
if (oldest_active > dbb->dbb_oldest_active) if (oldest_active > (ULONG) dbb->dbb_oldest_active)
dbb->dbb_oldest_active = oldest_active; dbb->dbb_oldest_active = oldest_active;
#else #else
dbb->dbb_oldest_transaction = oldest - 1; dbb->dbb_oldest_transaction = oldest - 1;
@ -1899,7 +1899,7 @@ int TRA_sweep(TDBB tdbb, JRD_TRA trans)
active = transaction->tra_oldest_active; active = transaction->tra_oldest_active;
else { else {
for (active = transaction->tra_oldest; for (active = transaction->tra_oldest;
active < transaction->tra_top; active++) { active < (ULONG) transaction->tra_top; active++) {
if (transaction->tra_flags & TRA_read_committed) { if (transaction->tra_flags & TRA_read_committed) {
if (TPC_cache_state(tdbb, active) == tra_limbo) if (TPC_cache_state(tdbb, active) == tra_limbo)
break; break;
@ -1931,7 +1931,7 @@ int TRA_sweep(TDBB tdbb, JRD_TRA trans)
if (header->hdr_oldest_transaction < --transaction_oldest_active) { if (header->hdr_oldest_transaction < --transaction_oldest_active) {
CCH_MARK_MUST_WRITE(tdbb, &window); CCH_MARK_MUST_WRITE(tdbb, &window);
header->hdr_oldest_transaction = header->hdr_oldest_transaction =
MIN(active, transaction_oldest_active); MIN(active, (ULONG) transaction_oldest_active);
if (dbb->dbb_wal) { if (dbb->dbb_wal) {
journal.jrndh_type = JRNP_DB_HEADER; journal.jrndh_type = JRNP_DB_HEADER;
journal.jrndh_nti = header->hdr_next_transaction; journal.jrndh_nti = header->hdr_next_transaction;
@ -2226,7 +2226,7 @@ static HDR bump_transaction_id(TDBB tdbb, WIN * window)
if ((number % MOD_START_TRAN == 0) || (new_tip)) { if ((number % MOD_START_TRAN == 0) || (new_tip)) {
fake_tid = number + MOD_START_TRAN; fake_tid = number + MOD_START_TRAN;
sequence = number / dbb->dbb_pcontrol->pgc_tpt; sequence = number / dbb->dbb_pcontrol->pgc_tpt;
if (sequence != ((fake_tid + 1) / dbb->dbb_pcontrol->pgc_tpt)) if (sequence != (SLONG) ((fake_tid + 1) / dbb->dbb_pcontrol->pgc_tpt))
fake_tid = ((sequence + 1) * dbb->dbb_pcontrol->pgc_tpt) - 1; fake_tid = ((sequence + 1) * dbb->dbb_pcontrol->pgc_tpt) - 1;
header->hdr_bumped_transaction = fake_tid; header->hdr_bumped_transaction = fake_tid;
@ -2507,9 +2507,9 @@ static SLONG inventory_page(TDBB tdbb, SLONG sequence)
CHECK_DBB(dbb); CHECK_DBB(dbb);
window.win_flags = 0; window.win_flags = 0;
while (!(vector = dbb->dbb_t_pages) || sequence >= vector->count()) { while (!(vector = dbb->dbb_t_pages) || sequence >= (SLONG) vector->count()) {
DPM_scan_pages(tdbb); DPM_scan_pages(tdbb);
if ((vector = dbb->dbb_t_pages) && sequence < vector->count()) if ((vector = dbb->dbb_t_pages) && sequence < (SLONG) vector->count())
break; break;
if (!vector) if (!vector)
BUGCHECK(165); /* msg 165 cannot find tip page */ BUGCHECK(165); /* msg 165 cannot find tip page */
@ -2940,7 +2940,6 @@ static void transaction_options(
TEXT name[32], text[128]; TEXT name[32], text[128];
USHORT flags; USHORT flags;
USHORT l, level, op, wait; USHORT l, level, op, wait;
int id;
SCHAR lock_type; SCHAR lock_type;
SET_TDBB(tdbb); SET_TDBB(tdbb);
@ -3075,7 +3074,7 @@ static void transaction_options(
/* Try to seize all relation locks. /* Try to seize all relation locks.
If any can't be seized, release all and try again. */ If any can't be seized, release all and try again. */
id = 0; USHORT id = 0;
for (; id < vector->count(); id++) { for (; id < vector->count(); id++) {
if (!(lock = (LCK) (*vector)[id])) if (!(lock = (LCK) (*vector)[id]))

View File

@ -41,7 +41,7 @@
* *
*/ */
/* /*
$Id: inet.cpp,v 1.65 2003-04-01 11:35:44 brodsom Exp $ $Id: inet.cpp,v 1.66 2003-04-03 17:16:01 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -3012,7 +3012,7 @@ static bool_t inet_getbytes( XDR * xdrs, SCHAR * buff, u_int count)
/* Use memcpy to optimize bulk transfers. */ /* Use memcpy to optimize bulk transfers. */
while (bytecount > sizeof(GDS_QUAD)) { while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) { if (xdrs->x_handy >= bytecount) {
memcpy(buff, xdrs->x_private, bytecount); memcpy(buff, xdrs->x_private, bytecount);
xdrs->x_private += bytecount; xdrs->x_private += bytecount;
@ -3211,7 +3211,7 @@ static bool_t inet_putbytes( XDR * xdrs, SCHAR * buff, u_int count)
/* Use memcpy to optimize bulk transfers. */ /* Use memcpy to optimize bulk transfers. */
while (bytecount > sizeof(GDS_QUAD)) { while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) { if (xdrs->x_handy >= bytecount) {
memcpy(xdrs->x_private, buff, bytecount); memcpy(xdrs->x_private, buff, bytecount);
xdrs->x_private += bytecount; xdrs->x_private += bytecount;

View File

@ -1385,7 +1385,7 @@ static bool_t wnet_getbytes( XDR * xdrs, SCHAR * buff, u_int count)
/* Use memcpy to optimize bulk transfers. */ /* Use memcpy to optimize bulk transfers. */
while (bytecount > sizeof(GDS_QUAD)) { while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) { if (xdrs->x_handy >= bytecount) {
memcpy(buff, xdrs->x_private, bytecount); memcpy(buff, xdrs->x_private, bytecount);
xdrs->x_private += bytecount; xdrs->x_private += bytecount;
@ -1506,7 +1506,7 @@ static bool_t wnet_putbytes( XDR * xdrs, SCHAR * buff, u_int count)
/* Use memcpy to optimize bulk transfers. */ /* Use memcpy to optimize bulk transfers. */
while (bytecount > sizeof(GDS_QUAD)) { while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) { if (xdrs->x_handy >= bytecount) {
memcpy(xdrs->x_private, buff, bytecount); memcpy(xdrs->x_private, buff, bytecount);
xdrs->x_private += bytecount; xdrs->x_private += bytecount;