From 3f1020237f1e491906ed8e1a68edc32643cfef9e Mon Sep 17 00:00:00 2001 From: robocop Date: Sat, 28 Nov 2009 08:56:39 +0000 Subject: [PATCH] Cleanup. --- src/jrd/nbak.cpp | 2 +- src/jrd/pag.cpp | 34 +++++++++++----------------------- src/jrd/pag_proto.h | 2 +- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/jrd/nbak.cpp b/src/jrd/nbak.cpp index e40b46445d..27ccb046ca 100644 --- a/src/jrd/nbak.cpp +++ b/src/jrd/nbak.cpp @@ -704,7 +704,7 @@ void BackupManager::setDifference(thread_db* tdbb, const char* filename) } else { - PAG_delete_clump_entry(tdbb, HEADER_PAGE, Ods::HDR_difference_file); + PAG_delete_clump_entry(tdbb, Ods::HDR_difference_file); generateFilename(); } } diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index 64c2d8bcc5..6dd2a56a24 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -108,9 +108,7 @@ using namespace Jrd; using namespace Ods; using namespace Firebird; -static void add_clump(thread_db* tdbb, - SLONG page_num, USHORT type, - USHORT len, const UCHAR* entry, ClumpOper mode); // bool must_write +static void add_clump(thread_db* tdbb, USHORT type, USHORT len, const UCHAR* entry, ClumpOper mode); static void attach_temp_pages(thread_db* tdbb, USHORT pageSpaceID); static int blocking_ast_attachment(void*); static void find_clump_space(thread_db* tdbb, WIN*, pag**, USHORT, USHORT, const UCHAR*); @@ -128,9 +126,7 @@ static const int MIN_EXTEND_BYTES = 128 * 1024; // 128KB // CVC: Since nobody checks the result from this function (strange!), I changed // bool to void as the return type but left the result returned as comment. -static void add_clump(thread_db* tdbb, - SLONG page_num, USHORT type, - USHORT len, const UCHAR* entry, ClumpOper mode) // bool must_write +static void add_clump(thread_db* tdbb, USHORT type, USHORT len, const UCHAR* entry, ClumpOper mode) { /*********************************************** * @@ -155,10 +151,7 @@ static void add_clump(thread_db* tdbb, err_post_if_database_is_readonly(dbb); - if (page_num != HEADER_PAGE) - ERR_post(Arg::Gds(isc_page_type_err)); - - WIN window(DB_PAGE_SPACE, page_num); + WIN window(DB_PAGE_SPACE, HEADER_PAGE); pag* page = CCH_FETCH(tdbb, &window, LCK_write, pag_header); header_page* header = (header_page*) page; USHORT* end_addr = &header->hdr_end; @@ -219,7 +212,7 @@ static void add_clump(thread_db* tdbb, // refetch the page - window.win_page = page_num; + window.win_page = HEADER_PAGE; page = CCH_FETCH(tdbb, &window, LCK_write, pag_header); header = (header_page*) page; end_addr = &header->hdr_end; @@ -331,10 +324,9 @@ USHORT PAG_add_file(thread_db* tdbb, const TEXT* file_name, SLONG start) } else { - add_clump(tdbb, HEADER_PAGE, HDR_file, strlen(file_name), - reinterpret_cast(file_name), CLUMP_REPLACE); //, true; - add_clump(tdbb, HEADER_PAGE, HDR_last_page, sizeof(SLONG), - (UCHAR*) &start, CLUMP_REPLACE); //, true + add_clump(tdbb, HDR_file, strlen(file_name), + reinterpret_cast(file_name), CLUMP_REPLACE); + add_clump(tdbb, HDR_last_page, sizeof(SLONG), (UCHAR*) &start, CLUMP_REPLACE); } header->hdr_header.pag_checksum = CCH_checksum(window.win_bdb); @@ -759,7 +751,7 @@ SLONG PAG_attachment_id(thread_db* tdbb) } -bool PAG_delete_clump_entry(thread_db* tdbb, SLONG page_num, USHORT type) +bool PAG_delete_clump_entry(thread_db* tdbb, USHORT type) { /*********************************************** * @@ -777,10 +769,7 @@ bool PAG_delete_clump_entry(thread_db* tdbb, SLONG page_num, USHORT type) err_post_if_database_is_readonly(dbb); - if (page_num != HEADER_PAGE) - ERR_post(Arg::Gds(isc_page_type_err)); - - WIN window(DB_PAGE_SPACE, page_num); + WIN window(DB_PAGE_SPACE, HEADER_PAGE); pag* page = CCH_FETCH(tdbb, &window, LCK_write, pag_header); @@ -1034,7 +1023,7 @@ void PAG_header(thread_db* tdbb, bool info) Arg::Str(attachment->att_filename)); } - const bool useFSCache = dbb->dbb_bcb->bcb_count < Config::getFileSystemCacheThreshold(); + const bool useFSCache = dbb->dbb_bcb->bcb_count < ULONG(Config::getFileSystemCacheThreshold()); if ((header->hdr_flags & hdr_force_write) || !useFSCache) { @@ -1691,8 +1680,7 @@ void PAG_sweep_interval(thread_db* tdbb, SLONG interval) **************************************/ SET_TDBB(tdbb); - add_clump(tdbb, HEADER_PAGE, HDR_sweep_interval, sizeof(SLONG), - (UCHAR*) &interval, CLUMP_REPLACE); //, true + add_clump(tdbb, HDR_sweep_interval, sizeof(SLONG), (UCHAR*) &interval, CLUMP_REPLACE); } diff --git a/src/jrd/pag_proto.h b/src/jrd/pag_proto.h index 86c61f1622..e4186a811b 100644 --- a/src/jrd/pag_proto.h +++ b/src/jrd/pag_proto.h @@ -45,7 +45,7 @@ bool PAG_add_header_entry(Jrd::thread_db* tdbb, Ods::header_page*, USHORT, USHOR 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*); SLONG PAG_attachment_id(Jrd::thread_db*); -bool PAG_delete_clump_entry(Jrd::thread_db* tdbb, SLONG, USHORT); +bool PAG_delete_clump_entry(Jrd::thread_db* tdbb, USHORT); void PAG_format_header(Jrd::thread_db*); void PAG_format_pip(Jrd::thread_db*, Jrd::PageSpace& pageSpace); #ifdef NOT_USED_OR_REPLACED