From e47b8cc55eda6f09c38b996ef381ebb10a2aa5df Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Sat, 9 Jan 2016 23:01:43 +1300 Subject: [PATCH] Use CHERT_MAX_DOCID and GLASS_MAX_DOCID more --- xapian-core/backends/chert/chert_values.cc | 6 ++---- xapian-core/backends/dbcheck.cc | 10 ++++------ xapian-core/backends/glass/glass_values.cc | 6 ++---- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/xapian-core/backends/chert/chert_values.cc b/xapian-core/backends/chert/chert_values.cc index 280f3f1d5..a387cdc58 100644 --- a/xapian-core/backends/chert/chert_values.cc +++ b/xapian-core/backends/chert/chert_values.cc @@ -1,7 +1,7 @@ /** @file chert_values.cc * @brief ChertValueManager class */ -/* Copyright (C) 2008,2009,2011,2012 Olly Betts +/* Copyright (C) 2008,2009,2011,2012,2016 Olly Betts * Copyright (C) 2008,2009 Lemur Consulting Ltd * * This program is free software; you can redistribute it and/or modify @@ -192,8 +192,6 @@ ChertValueManager::get_chunk_containing_did(Xapian::valueno slot, static const size_t CHUNK_SIZE_THRESHOLD = 2000; -static const Xapian::docid MAX_DOCID = static_cast(-1); - class ValueUpdater { ChertPostListTable * table; @@ -268,7 +266,7 @@ class ValueUpdater { last_allowed_did = 0; } if (last_allowed_did == 0) { - last_allowed_did = MAX_DOCID; + last_allowed_did = CHERT_MAX_DOCID; Assert(tag.empty()); new_first_did = 0; AutoPtr cursor(table->cursor_get()); diff --git a/xapian-core/backends/dbcheck.cc b/xapian-core/backends/dbcheck.cc index c089a8456..c3b23d9d5 100644 --- a/xapian-core/backends/dbcheck.cc +++ b/xapian-core/backends/dbcheck.cc @@ -2,7 +2,7 @@ * @brief Check the consistency of a database or table. */ /* Copyright 1999,2000,2001 BrightStation PLC - * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015 Olly Betts + * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Olly Betts * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -132,7 +132,7 @@ check_db_dir(const string & path, int opts, std::ostream *out) // If we can't read the last docid, set it to its maximum value // to suppress errors. - Xapian::docid db_last_docid = static_cast(-1); + Xapian::docid db_last_docid = CHERT_MAX_DOCID; chert_revision_number_t rev = 0; chert_revision_number_t * rev_ptr = &rev; try { @@ -320,9 +320,8 @@ check_if_db_table(const string & path, int opts, std::ostream *out) GlassVersion version_file(dir); version_file.read(); // Set the last docid to its maximum value to suppress errors. - Xapian::docid db_last_docid = static_cast(-1); return check_glass_table(tablename.c_str(), dir, version_file, opts, - doclens, db_last_docid, out); + doclens, GLASS_MAX_DOCID, out); #endif } @@ -341,9 +340,8 @@ check_if_db_table(const string & path, int opts, std::ostream *out) throw Xapian::FeatureUnavailableError("Chert database support isn't enabled"); #else // Set the last docid to its maximum value to suppress errors. - Xapian::docid db_last_docid = static_cast(-1); return check_chert_table(tablename.c_str(), filename, NULL, opts, - doclens, db_last_docid, out); + doclens, CHERT_MAX_DOCID, out); #endif } diff --git a/xapian-core/backends/glass/glass_values.cc b/xapian-core/backends/glass/glass_values.cc index f09f8f54a..5d9b52fda 100644 --- a/xapian-core/backends/glass/glass_values.cc +++ b/xapian-core/backends/glass/glass_values.cc @@ -1,7 +1,7 @@ /** @file glass_values.cc * @brief GlassValueManager class */ -/* Copyright (C) 2008,2009,2010,2011,2012 Olly Betts +/* Copyright (C) 2008,2009,2010,2011,2012,2016 Olly Betts * Copyright (C) 2008,2009 Lemur Consulting Ltd * * This program is free software; you can redistribute it and/or modify @@ -193,8 +193,6 @@ GlassValueManager::get_chunk_containing_did(Xapian::valueno slot, static const size_t CHUNK_SIZE_THRESHOLD = 2000; -static const Xapian::docid MAX_DOCID = static_cast(-1); - namespace Glass { class ValueUpdater { @@ -271,7 +269,7 @@ class ValueUpdater { last_allowed_did = 0; } if (last_allowed_did == 0) { - last_allowed_did = MAX_DOCID; + last_allowed_did = GLASS_MAX_DOCID; Assert(tag.empty()); new_first_did = 0; AutoPtr cursor(table->cursor_get()); -- 2.11.4.GIT