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

Attempted to remove some warnings

This commit is contained in:
Dmitry Yemanov 2020-06-03 09:43:45 +03:00
parent 34cb7c8c25
commit 20f6f76802
10 changed files with 35 additions and 42 deletions

View File

@ -119,8 +119,9 @@ bool MonitoringTableScan::retrieveRecord(thread_db* tdbb, jrd_rel* relation,
if (relation->rel_id == rel_mon_attachments || relation->rel_id == rel_mon_statements)
{
const USHORT fieldId = relation->rel_id == rel_mon_attachments ?
f_mon_att_idle_timer : f_mon_stmt_timer;
const USHORT fieldId = (relation->rel_id == rel_mon_attachments) ?
(USHORT) f_mon_att_idle_timer : (USHORT) f_mon_stmt_timer;
dsc desc;
if (EVL_field(relation, record, fieldId, &desc))
{

View File

@ -2924,7 +2924,7 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
CCH_RELEASE(tdbb, &pp_window);
}
int cntAlloc = 1;
unsigned cntAlloc = 1;
// allocate extent (PAGES_IN_EXTENT contiguous pages) if
// - relation already contains at least PAGES_IN_EXTENT pages, and
// - first empty slot found is at extent boundary, and
@ -2935,7 +2935,7 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
for (USHORT i = 0; i < PAGES_IN_EXTENT; i++)
{
if(ppage->ppg_page[slot + i] != 0)
if (ppage->ppg_page[slot + i] != 0)
{
cntAlloc = 1;
break;
@ -2956,7 +2956,7 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
CCH_precedence(tdbb, &pp_window, window->win_page);
for (int i = 1; i < cntAlloc; i++)
for (unsigned i = 1; i < cntAlloc; i++)
{
window->win_page = firstPage.getPageNum() + i;
@ -2980,7 +2980,7 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
if (type != DPM_primary)
PPG_DP_BIT_SET(bits, slot, ppg_dp_secondary);
for (int i = 1; i < cntAlloc; i++)
for (unsigned i = 1; i < cntAlloc; i++)
{
fb_assert(ppage->ppg_page[slot + i] == 0);
ppage->ppg_page[slot + i] = firstPage.getPageNum() + i;

View File

@ -833,7 +833,7 @@ void ConnectionsPool::removeFromPool(Data* item, FB_SIZE_T pos)
if (item->m_lastUsed != 0)
{
if (pos == -1)
if (pos == (FB_SIZE_T) -1)
m_idleArray.find(*item, pos);
fb_assert(m_idleArray[pos] == item);
@ -1357,8 +1357,8 @@ int ConnectionsPool::Data::verify(ConnectionsPool* connPool, bool active)
bool ConnectionsPool::verifyPool()
{
int cntIdle = 0, cntActive = 0;
int errs = 0;
unsigned cntIdle = 0, cntActive = 0;
unsigned errs = 0;
Data* item = m_idleList;
if (item)

View File

@ -343,10 +343,10 @@ void PIO_extend(thread_db* tdbb, jrd_file* main_file, const ULONG extPages, cons
if (SYSCALL_INTERRUPTED(err))
continue;
if (err == EOPNOTSUPP || err == ENOSYS)
file->fil_flags |= FIL_no_fast_extend;
else
if (err != EOPNOTSUPP && err != ENOSYS)
unix_error("fallocate", file, isc_io_write_err);
file->fil_flags |= FIL_no_fast_extend;
return;
}
@ -357,7 +357,6 @@ void PIO_extend(thread_db* tdbb, jrd_file* main_file, const ULONG extPages, cons
fflush(stderr);
#endif
unix_error("fallocate_retry", file, isc_io_write_err);
return;
}
leftPages -= extendBy;
@ -480,10 +479,7 @@ ULONG PIO_get_number_of_pages(const jrd_file* file, const USHORT pagesize)
**************************************/
if (file->fil_desc == -1)
{
unix_error("fstat", file, isc_io_access_err);
return (0);
}
struct STAT statistics;
if (os_utils::fstat(file->fil_desc, &statistics))
@ -553,14 +549,10 @@ void PIO_header(thread_db* tdbb, UCHAR* address, int length)
for (i = 0; i < IO_RETRY; i++)
{
if ((bytes = os_utils::pread(file->fil_desc, address, length, 0)) < 0)
{
if (SYSCALL_INTERRUPTED(errno))
continue;
unix_error("read", file, isc_io_read_err);
}
else
if ((bytes = os_utils::pread(file->fil_desc, address, length, 0)) == length)
break;
if (bytes < 0 && !SYSCALL_INTERRUPTED(errno))
unix_error("read", file, isc_io_read_err);
}
if (i == IO_RETRY)
@ -762,7 +754,7 @@ bool PIO_read(thread_db* tdbb, jrd_file* file, BufferDesc* bdb, Ods::pag* page,
EngineCheckout cout(tdbb, FB_FUNCTION, true);
const FB_UINT64 size = dbb->dbb_page_size;
const SLONG size = dbb->dbb_page_size;
for (i = 0; i < IO_RETRY; i++)
{

View File

@ -478,7 +478,7 @@ PAG PAG_allocate(thread_db* tdbb, WIN* window)
}
PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, int cntAlloc, bool aligned)
PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, unsigned cntAlloc, bool aligned)
{
/**************************************
*
@ -505,9 +505,8 @@ PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, int cntAlloc, bool aligned)
// Find an allocation page with something on it
int toAlloc = cntAlloc;
ULONG sequence = (cntAlloc >= PAGES_IN_EXTENT ? pageSpace->pipWithExtent : pageSpace->pipHighWater);
for (; toAlloc > 0; sequence++)
for (unsigned toAlloc = cntAlloc; toAlloc; sequence++)
{
WIN pip_window(pageSpace->pageSpaceID,
(sequence == 0) ? pageSpace->pipFirst : sequence * dbb->dbb_page_manager.pagesPerPIP - 1);
@ -628,7 +627,8 @@ PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, int cntAlloc, bool aligned)
{
fb_assert(lastBit - firstBit + 1 == cntAlloc);
if (lastBit + 1 > pipUsed) {
if (lastBit + 1 > pipUsed)
{
pipUsed = ensureDiskSpace(tdbb, &pip_window,
PageNumber(pageSpace->pageSpaceID, lastBit + sequence * pageMgr.pagesPerPIP),
pipUsed);

View File

@ -44,7 +44,7 @@ bool PAG_add_header_entry(Jrd::thread_db* tdbb, Ods::header_page*, USHORT, USHOR
//void PAG_attach_temp_pages(Jrd::thread_db*, USHORT pageSpaceID);
bool PAG_replace_entry_first(Jrd::thread_db* tdbb, Ods::header_page*, USHORT, USHORT, const UCHAR*);
Ods::pag* PAG_allocate(Jrd::thread_db* tdbb, Jrd::win*);
Ods::pag* PAG_allocate_pages(Jrd::thread_db* tdbb, Jrd::win* window, int cntAlloc, bool aligned);
Ods::pag* PAG_allocate_pages(Jrd::thread_db* tdbb, Jrd::win* window, unsigned cntAlloc, bool aligned);
AttNumber PAG_attachment_id(Jrd::thread_db*);
bool PAG_delete_clump_entry(Jrd::thread_db* tdbb, USHORT);
void PAG_format_header(Jrd::thread_db*);

View File

@ -1083,7 +1083,7 @@ SlidingWindow::~SlidingWindow()
// Move in the window without pass partition boundaries.
bool SlidingWindow::moveWithinPartition(SINT64 delta)
{
const SINT64 newPosition = SINT64(savedPosition) + delta;
const auto newPosition = savedPosition + delta;
if (newPosition < partitionStart || newPosition > partitionEnd)
return false;
@ -1104,7 +1104,7 @@ bool SlidingWindow::moveWithinPartition(SINT64 delta)
// Move in the window without pass frame boundaries.
bool SlidingWindow::moveWithinFrame(SINT64 delta)
{
const SINT64 newPosition = SINT64(savedPosition) + delta;
const auto newPosition = savedPosition + delta;
if (newPosition < frameStart || newPosition > frameEnd)
return false;

View File

@ -3538,7 +3538,7 @@ static void transaction_start(thread_db* tdbb, jrd_tra* trans)
!(trans->tra_flags & TRA_read_consistency)) ? number : oldest_active;
static_assert(sizeof(lock->lck_data) == sizeof(lck_data), "Check lock data type !");
if (lock->lck_data != lck_data)
if (lock->lck_data != (SINT64) lck_data)
LCK_write_data(tdbb, lock, lck_data);
// Query the minimum lock data for all active transaction locks.

View File

@ -2834,7 +2834,7 @@ void restoreFlags(UCHAR* byte, UCHAR flags, bool empty)
*byte &= ~bit;
}
void Validation::checkDPinPP(jrd_rel* relation, SLONG page_number)
void Validation::checkDPinPP(jrd_rel* relation, ULONG page_number)
{
/**************************************
*
@ -2847,7 +2847,7 @@ void Validation::checkDPinPP(jrd_rel* relation, SLONG page_number)
WIN window(DB_PAGE_SPACE, page_number);
data_page* dpage;
fetch_page(false, page_number, pag_data, &window, &dpage);
const SLONG sequence = dpage->dpg_sequence;
const ULONG sequence = dpage->dpg_sequence;
const bool dpEmpty = (dpage->dpg_count == 0);
release_page(&window);
@ -2864,7 +2864,7 @@ void Validation::checkDPinPP(jrd_rel* relation, SLONG page_number)
if (slot >= ppage->ppg_count)
{
corrupt(VAL_DATA_PAGE_SLOT_NOT_FOUND, relation, page_number, window.win_page.getPageNum(), slot);
if (vdr_flags & VDR_update && slot < dbb->dbb_dp_per_pp)
if ((vdr_flags & VDR_update) && slot < dbb->dbb_dp_per_pp)
{
CCH_MARK(vdr_tdbb, &window);
for (USHORT i = ppage->ppg_count; i < slot; i++)
@ -2887,7 +2887,7 @@ void Validation::checkDPinPP(jrd_rel* relation, SLONG page_number)
else if (page_number != ppage->ppg_page[slot])
{
corrupt(VAL_DATA_PAGE_SLOT_BAD_VAL, relation, page_number, window.win_page.getPageNum(), slot, ppage->ppg_page[slot]);
if (vdr_flags & VDR_update && !ppage->ppg_page[slot])
if ((vdr_flags & VDR_update) && !ppage->ppg_page[slot])
{
CCH_MARK(vdr_tdbb, &window);
ppage->ppg_page[slot] = page_number;
@ -2905,7 +2905,7 @@ void Validation::checkDPinPP(jrd_rel* relation, SLONG page_number)
release_page(&window);
}
void Validation::checkDPinPIP(jrd_rel* relation, SLONG page_number)
void Validation::checkDPinPIP(jrd_rel* relation, ULONG page_number)
{
/**************************************
*
@ -2920,8 +2920,8 @@ void Validation::checkDPinPIP(jrd_rel* relation, SLONG page_number)
PageSpace* pageSpace = pageMgr.findPageSpace(DB_PAGE_SPACE);
fb_assert(pageSpace);
const SLONG sequence = page_number / pageMgr.pagesPerPIP;
const SLONG relative_bit = page_number % pageMgr.pagesPerPIP;
const ULONG sequence = page_number / pageMgr.pagesPerPIP;
const ULONG relative_bit = page_number % pageMgr.pagesPerPIP;
WIN pip_window(DB_PAGE_SPACE, (sequence == 0) ? pageSpace->pipFirst : sequence * pageMgr.pagesPerPIP - 1);
@ -3002,7 +3002,7 @@ Validation::RTN Validation::walk_relation(jrd_rel* relation)
WIN window(DB_PAGE_SPACE, -1);
header_page* page = NULL;
fetch_page(false, (SLONG) HEADER_PAGE, pag_header, &window, &page);
fetch_page(false, HEADER_PAGE, pag_header, &window, &page);
vdr_max_transaction = Ods::getNT(page);
release_page(&window);
}

View File

@ -156,8 +156,8 @@ private:
Firebird::AutoPtr<Firebird::SimilarToRegex> vdr_idx_incl;
Firebird::AutoPtr<Firebird::SimilarToRegex> vdr_idx_excl;
int vdr_lock_tout;
void checkDPinPP(jrd_rel *relation, SLONG page_number);
void checkDPinPIP(jrd_rel *relation, SLONG page_number);
void checkDPinPP(jrd_rel *relation, ULONG page_number);
void checkDPinPIP(jrd_rel *relation, ULONG page_number);
public:
explicit Validation(thread_db*, Firebird::UtilSvc* uSvc = NULL);