8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +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"
@ -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;
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;
do {

View File

@ -2041,7 +2041,7 @@ static void get_slice( ICC icc)
ips_sdl = &comm->ips_buffers[IPS_SLICE_SDL];
sdl_length = (SSHORT) ips_sdl->ips_cl_size;
if (sdl_length <= sizeof(sdl_buf))
if (sdl_length <= (SLONG) sizeof(sdl_buf))
sdl = sdl_buf;
else
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];
param_length = (SSHORT) ips_parms->ips_cl_size;
if (param_length <= sizeof(parameters))
if (param_length <= (SLONG) sizeof(parameters))
params = parameters;
else
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 */
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,
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 = *tip_cache_ptr;
if (number < (tip_cache->tpc_base + trans_per_tip))
if (number < (SLONG)(tip_cache->tpc_base + trans_per_tip))
return;
cache_transactions(tdbb, tip_cache_ptr,
@ -169,9 +169,8 @@ void TPC_set_state(TDBB tdbb, SLONG number, SSHORT state)
shift = TRANS_SHIFT(number);
for (tip_cache = dbb->dbb_tip_cache; tip_cache;
tip_cache =
tip_cache->tpc_next) if (number <
tip_cache->tpc_base + trans_per_tip) {
tip_cache = tip_cache->tpc_next)
if (number < (SLONG)(tip_cache->tpc_base + trans_per_tip)) {
address = tip_cache->tpc_transactions + byte;
*address &= ~(TRA_MASK << 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)
{
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 =
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;
header = (HDR) CCH_FETCH(tdbb, &window, LCK_read, pag_header);
top = header->hdr_next_transaction;
oldest = MAX(oldest, header->hdr_oldest_transaction);
oldest = MAX(oldest, (ULONG) header->hdr_oldest_transaction);
CCH_RELEASE(tdbb, &window);
#endif
@ -465,11 +464,10 @@ static int extend_cache(TDBB tdbb, SLONG number)
for (tip_cache = dbb->dbb_tip_cache; tip_cache;
tip_cache =
tip_cache->tpc_next) if (number <
(tip_cache->tpc_base +
trans_per_tip)) return
TRA_state(tip_cache->tpc_transactions, tip_cache->tpc_base,
number);
tip_cache->tpc_next)
if (number < (SLONG) (tip_cache->tpc_base + trans_per_tip))
return TRA_state(tip_cache->tpc_transactions, tip_cache->tpc_base,
number);
/* we should never get to this point, but if we do the
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
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;
#ifndef VMS
/* 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)
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);
/* 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
if (--oldest > dbb->dbb_oldest_transaction)
if (--oldest > (ULONG) dbb->dbb_oldest_transaction)
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;
#else
dbb->dbb_oldest_transaction = oldest - 1;
@ -1899,7 +1899,7 @@ int TRA_sweep(TDBB tdbb, JRD_TRA trans)
active = transaction->tra_oldest_active;
else {
for (active = transaction->tra_oldest;
active < transaction->tra_top; active++) {
active < (ULONG) transaction->tra_top; active++) {
if (transaction->tra_flags & TRA_read_committed) {
if (TPC_cache_state(tdbb, active) == tra_limbo)
break;
@ -1931,7 +1931,7 @@ int TRA_sweep(TDBB tdbb, JRD_TRA trans)
if (header->hdr_oldest_transaction < --transaction_oldest_active) {
CCH_MARK_MUST_WRITE(tdbb, &window);
header->hdr_oldest_transaction =
MIN(active, transaction_oldest_active);
MIN(active, (ULONG) transaction_oldest_active);
if (dbb->dbb_wal) {
journal.jrndh_type = JRNP_DB_HEADER;
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)) {
fake_tid = number + MOD_START_TRAN;
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;
header->hdr_bumped_transaction = fake_tid;
@ -2507,9 +2507,9 @@ static SLONG inventory_page(TDBB tdbb, SLONG sequence)
CHECK_DBB(dbb);
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);
if ((vector = dbb->dbb_t_pages) && sequence < vector->count())
if ((vector = dbb->dbb_t_pages) && sequence < (SLONG) vector->count())
break;
if (!vector)
BUGCHECK(165); /* msg 165 cannot find tip page */
@ -2940,7 +2940,6 @@ static void transaction_options(
TEXT name[32], text[128];
USHORT flags;
USHORT l, level, op, wait;
int id;
SCHAR lock_type;
SET_TDBB(tdbb);
@ -3075,7 +3074,7 @@ static void transaction_options(
/* Try to seize all relation locks.
If any can't be seized, release all and try again. */
id = 0;
USHORT id = 0;
for (; id < vector->count(); 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 "../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. */
while (bytecount > sizeof(GDS_QUAD)) {
while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) {
memcpy(buff, 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. */
while (bytecount > sizeof(GDS_QUAD)) {
while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) {
memcpy(xdrs->x_private, buff, 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. */
while (bytecount > sizeof(GDS_QUAD)) {
while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) {
memcpy(buff, 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. */
while (bytecount > sizeof(GDS_QUAD)) {
while (bytecount > (SLONG) sizeof(GDS_QUAD)) {
if (xdrs->x_handy >= bytecount) {
memcpy(xdrs->x_private, buff, bytecount);
xdrs->x_private += bytecount;