From 3e0d279d4b458da33c018d8148ab4ebb641a37ef Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 7 Dec 2016 18:54:30 +1300 Subject: [PATCH] Fix whitespace irregularities in code (cherry picked from commit 1164ee52364d2eb953e90a34236bd0f4502dd233) --- xapian-applications/omega/omega.cc | 3 +-- xapian-applications/omega/pkglibbindir.cc | 2 +- xapian-applications/omega/query.cc | 6 ++--- xapian-applications/omega/templates/godmode | 2 +- xapian-applications/omega/transform.cc | 2 +- xapian-applications/omega/urldecode.h | 4 ++-- .../python/docs/examples/simplematchdecider.py | 2 +- xapian-bindings/python/extra.i | 8 +++---- xapian-bindings/python/generate-python-exceptions | 2 +- .../python3/docs/examples/simplematchdecider.py | 2 +- xapian-bindings/python3/extra.i | 8 +++---- xapian-bindings/python3/generate-python-exceptions | 2 +- xapian-bindings/ruby/docs/examples/simpleexpand.rb | 2 +- xapian-bindings/ruby/smoketest.rb | 18 +++++++------- xapian-bindings/ruby/xapian.rb | 28 +++++++++++----------- xapian-bindings/xapian-bindings.spec.in | 2 +- xapian-core/api/compactor.cc | 2 +- xapian-core/api/omenquire.cc | 2 +- xapian-core/backends/chert/chert_check.cc | 4 ++-- xapian-core/backends/chert/chert_cursor.cc | 4 ++-- xapian-core/backends/chert/chert_database.h | 2 +- xapian-core/backends/chert/chert_table.cc | 2 +- xapian-core/backends/chert/chert_table.h | 2 +- xapian-core/backends/glass/glass_check.cc | 6 ++--- xapian-core/backends/glass/glass_cursor.cc | 4 ++-- xapian-core/backends/glass/glass_database.h | 2 +- xapian-core/backends/glass/glass_inverter.h | 2 +- xapian-core/backends/glass/glass_table.h | 2 +- xapian-core/backends/inmemory/inmemory_database.cc | 22 ++++++++--------- xapian-core/backends/inmemory/inmemory_database.h | 16 ++++++------- xapian-core/backends/multi/multi_postlist.h | 8 +++---- xapian-core/backends/multi/multi_termlist.h | 2 +- xapian-core/backends/remote/net_termlist.h | 2 +- xapian-core/common/bitstream.h | 2 +- xapian-core/common/omassert.h | 4 ++-- xapian-core/configure.ac | 2 +- xapian-core/include/xapian/database.h | 2 +- xapian-core/include/xapian/geospatial.h | 2 +- xapian-core/include/xapian/weight.h | 10 ++++---- xapian-core/languages/steminternal.cc | 6 ++--- xapian-core/matcher/andmaybepostlist.h | 4 ++-- xapian-core/matcher/andnotpostlist.h | 4 ++-- xapian-core/matcher/extraweightpostlist.h | 2 +- xapian-core/matcher/mergepostlist.h | 4 ++-- xapian-core/matcher/orpostlist.h | 4 ++-- xapian-core/net/remoteserver.cc | 2 +- xapian-core/queryparser/queryparser.lemony | 2 +- xapian-core/tests/api_anydb.cc | 10 ++++---- xapian-core/tests/api_backend.cc | 2 +- xapian-core/tests/api_collapse.cc | 2 +- xapian-core/tests/api_db.cc | 5 ++-- xapian-core/tests/api_qpbackend.cc | 2 +- xapian-core/tests/api_query.cc | 2 +- xapian-core/tests/api_queryparser.cc | 8 +++---- xapian-core/tests/api_sorting.cc | 10 ++++---- xapian-core/tests/api_unicode.cc | 14 +++++------ xapian-core/tests/api_weight.cc | 6 ++--- xapian-core/tests/api_wrdb.cc | 8 +++---- xapian-core/tests/harness/testsuite.h | 2 +- xapian-core/tests/perftest/get_machine_info.in | 8 +++---- xapian-core/tests/perftest/perftest.cc | 2 +- xapian-core/tests/submitperftest.in | 2 +- xapian-core/weight/lmweight.cc | 8 +++---- xapian-core/weight/weightinternal.cc | 2 +- xapian-core/weight/weightinternal.h | 4 ++-- 65 files changed, 161 insertions(+), 163 deletions(-) diff --git a/xapian-applications/omega/omega.cc b/xapian-applications/omega/omega.cc index 34cc12697..545d44ed0 100644 --- a/xapian-applications/omega/omega.cc +++ b/xapian-applications/omega/omega.cc @@ -167,8 +167,7 @@ try { db.add_database(Xapian::Database(map_dbname_to_dir(dbname))); } enquire = new Xapian::Enquire(db); - } - catch (const Xapian::Error &) { + } catch (const Xapian::Error &) { enquire = NULL; } diff --git a/xapian-applications/omega/pkglibbindir.cc b/xapian-applications/omega/pkglibbindir.cc index 68a908a85..04f84100a 100644 --- a/xapian-applications/omega/pkglibbindir.cc +++ b/xapian-applications/omega/pkglibbindir.cc @@ -33,7 +33,7 @@ const string & get_pkglibbindir() { static string result; - if (result.empty()) { + if (result.empty()) { const char * p = getenv("XAPIAN_OMEGA_PKGLIBBINDIR"); if (p && *p) { result = p; diff --git a/xapian-applications/omega/query.cc b/xapian-applications/omega/query.cc index e600f152b..97c67e4ac 100644 --- a/xapian-applications/omega/query.cc +++ b/xapian-applications/omega/query.cc @@ -854,7 +854,7 @@ Fields::read_fields(Xapian::docid did) const n = names.find('\t', n); string::size_type i0 = i; i = data.find('\n', i); - fields.insert(make_pair(names.substr(n0, n - n0), + fields.insert(make_pair(names.substr(n0, n - n0), data.substr(i0, i - i0))); } while (++n && ++i); } else { @@ -1052,7 +1052,7 @@ T(hitsperpage, 0, 0, N, 0), // hits per page T(hostname, 1, 1, N, 0), // extract hostname from URL T(html, 1, 1, N, 0), // html escape string (<>&") T(htmlstrip, 1, 1, N, 0), // html strip tags string (s/<[^>]*>?//g) -T(httpheader, 2, 2, N, 0), // arbitrary HTTP header +T(httpheader, 2, 2, N, 0), // arbitrary HTTP header T(id, 0, 0, N, 0), // docid of current doc T(if, 2, 3, 1, 0), // conditional T(include, 1, 1, 1, 0), // include another file @@ -1099,7 +1099,7 @@ T(relevants, 0, 0, N, Q), // return list of relevant documents T(score, 0, 0, N, 0), // score (0-10) of current hit T(set, 2, 2, N, 0), // set option value T(setmap, 1, N, N, 0), // set map of option values -T(setrelevant, 0, 1, N, Q), // set rset +T(setrelevant, 0, 1, N, Q), // set rset T(slice, 2, 2, N, 0), // slice a list using a second list T(snippet, 1, 2, N, M), // generate snippet from text T(split, 1, 2, N, 0), // split a string to give a list diff --git a/xapian-applications/omega/templates/godmode b/xapian-applications/omega/templates/godmode index 7a13b6919..ba34c230f 100644 --- a/xapian-applications/omega/templates/godmode +++ b/xapian-applications/omega/templates/godmode @@ -14,7 +14,7 @@ Choose what to Inspect}} $if{$cgi{ID}, $setrelevant{$cgi{ID}}

Document #$html{$cgi{ID}}

- +

Terms indexing this document

diff --git a/xapian-applications/omega/transform.cc b/xapian-applications/omega/transform.cc index 618802d1e..5aea85d68 100644 --- a/xapian-applications/omega/transform.cc +++ b/xapian-applications/omega/transform.cc @@ -58,7 +58,7 @@ void omegascript_match(string & value, const vector & args) { int offsets[30]; - int options=0; + int options = 0; if (args.size() > 2) { const string &opts = args[2]; for (string::const_iterator i = opts.begin(); i != opts.end(); ++i) { diff --git a/xapian-applications/omega/urldecode.h b/xapian-applications/omega/urldecode.h index 2754cdb35..b6bb23554 100644 --- a/xapian-applications/omega/urldecode.h +++ b/xapian-applications/omega/urldecode.h @@ -113,7 +113,7 @@ class CStringItor { if (!*p) p = NULL; } - unsigned char operator *() const { return *p; } + unsigned char operator*() const { return *p; } CStringItor & operator++() { if (!*++p) p = NULL; @@ -148,7 +148,7 @@ class StdinItor { explicit StdinItor(size_t count_) : count(count_), current(256) { } - unsigned char operator *() const { + unsigned char operator*() const { if (current == 256) current = std::getchar(); return current; diff --git a/xapian-bindings/python/docs/examples/simplematchdecider.py b/xapian-bindings/python/docs/examples/simplematchdecider.py index 77b17bf8f..f6f9302c1 100644 --- a/xapian-bindings/python/docs/examples/simplematchdecider.py +++ b/xapian-bindings/python/docs/examples/simplematchdecider.py @@ -35,7 +35,7 @@ class mymatchdecider(xapian.MatchDecider): def __init__(self, avoidvalue): xapian.MatchDecider.__init__(self) self.avoidvalue = avoidvalue - + def __call__(self, doc): return doc.get_value(0) != self.avoidvalue diff --git a/xapian-bindings/python/extra.i b/xapian-bindings/python/extra.i index 6b5087cd2..3703035a0 100644 --- a/xapian-bindings/python/extra.i +++ b/xapian-bindings/python/extra.i @@ -191,7 +191,7 @@ class ESetIter(object): def _eset_gen_iter(self): """Return an iterator over the ESet. - + The iterator will return ESetItem objects. """ @@ -568,7 +568,7 @@ Document.termlist = _document_gen_termlist_iter # Modify QueryParser to add a "stoplist()" method. def _queryparser_gen_stoplist_iter(self): """Get an iterator over all the stopped terms from the previous query. - + This returns an iterator over all the terms which were omitted from the previously parsed query due to being considered to be stopwords. Each instance of a word omitted from the query is represented in the returned @@ -584,7 +584,7 @@ QueryParser.stoplist = _queryparser_gen_stoplist_iter # Modify QueryParser to add an "unstemlist()" method. def _queryparser_gen_unstemlist_iter(self, tname): """Get an iterator over all the unstemmed forms of a stemmed term. - + This returns an iterator which returns all the unstemmed words which were stemmed to the stemmed form specified by `tname` when parsing the previous query. Each instance of a word which stems to `tname` is returned by the @@ -953,7 +953,7 @@ class PositionIter(object): # Modify Database to add a "positionlist()" method. def _database_gen_positionlist_iter(self, docid, tname): """Get an iterator over all the positions in a given document of a term. - + The iterator will return integers, in ascending order. """ diff --git a/xapian-bindings/python/generate-python-exceptions b/xapian-bindings/python/generate-python-exceptions index 8eb22192e..f5419bfcd 100644 --- a/xapian-bindings/python/generate-python-exceptions +++ b/xapian-bindings/python/generate-python-exceptions @@ -30,7 +30,7 @@ my @directorclasses = qw( ); my @posting_source_virtual_methods = qw( - get_termfreq_min + get_termfreq_min get_termfreq_est get_termfreq_max get_maxweight diff --git a/xapian-bindings/python3/docs/examples/simplematchdecider.py b/xapian-bindings/python3/docs/examples/simplematchdecider.py index ec7ba356e..0bd17aa19 100755 --- a/xapian-bindings/python3/docs/examples/simplematchdecider.py +++ b/xapian-bindings/python3/docs/examples/simplematchdecider.py @@ -35,7 +35,7 @@ class mymatchdecider(xapian.MatchDecider): def __init__(self, avoidvalue): xapian.MatchDecider.__init__(self) self.avoidvalue = avoidvalue - + def __call__(self, doc): return doc.get_value(0) != self.avoidvalue diff --git a/xapian-bindings/python3/extra.i b/xapian-bindings/python3/extra.i index 312b6ec87..8e0f49a82 100644 --- a/xapian-bindings/python3/extra.i +++ b/xapian-bindings/python3/extra.i @@ -191,7 +191,7 @@ class ESetIter(object): def _eset_gen_iter(self): """Return an iterator over the ESet. - + The iterator will return ESetItem objects. """ @@ -568,7 +568,7 @@ Document.termlist = _document_gen_termlist_iter # Modify QueryParser to add a "stoplist()" method. def _queryparser_gen_stoplist_iter(self): """Get an iterator over all the stopped terms from the previous query. - + This returns an iterator over all the terms which were omitted from the previously parsed query due to being considered to be stopwords. Each instance of a word omitted from the query is represented in the returned @@ -584,7 +584,7 @@ QueryParser.stoplist = _queryparser_gen_stoplist_iter # Modify QueryParser to add an "unstemlist()" method. def _queryparser_gen_unstemlist_iter(self, tname): """Get an iterator over all the unstemmed forms of a stemmed term. - + This returns an iterator which returns all the unstemmed words which were stemmed to the stemmed form specified by `tname` when parsing the previous query. Each instance of a word which stems to `tname` is returned by the @@ -953,7 +953,7 @@ class PositionIter(object): # Modify Database to add a "positionlist()" method. def _database_gen_positionlist_iter(self, docid, tname): """Get an iterator over all the positions in a given document of a term. - + The iterator will return integers, in ascending order. """ diff --git a/xapian-bindings/python3/generate-python-exceptions b/xapian-bindings/python3/generate-python-exceptions index 8eb22192e..f5419bfcd 100644 --- a/xapian-bindings/python3/generate-python-exceptions +++ b/xapian-bindings/python3/generate-python-exceptions @@ -30,7 +30,7 @@ my @directorclasses = qw( ); my @posting_source_virtual_methods = qw( - get_termfreq_min + get_termfreq_min get_termfreq_est get_termfreq_max get_maxweight diff --git a/xapian-bindings/ruby/docs/examples/simpleexpand.rb b/xapian-bindings/ruby/docs/examples/simpleexpand.rb index cfa7f5365..ddc45c702 100755 --- a/xapian-bindings/ruby/docs/examples/simpleexpand.rb +++ b/xapian-bindings/ruby/docs/examples/simpleexpand.rb @@ -82,7 +82,7 @@ unless query.empty? puts "#{m.rank + 1}: #{m.percent}% docid=#{m.docid} [#{m.document.data}]\n" } end - + # Put the top 5 (at most) docs into the rset if rset is empty if relevant_docs.empty? matchset.matches[0..4].each {|match| diff --git a/xapian-bindings/ruby/smoketest.rb b/xapian-bindings/ruby/smoketest.rb index 4c3ee4ca9..bcd760180 100644 --- a/xapian-bindings/ruby/smoketest.rb +++ b/xapian-bindings/ruby/smoketest.rb @@ -36,7 +36,7 @@ end class XapianSmoketest < Test::Unit::TestCase - def setup + def setup @stem = Xapian::Stem.new("english") @doc = Xapian::Document.new() @@ -45,7 +45,7 @@ class XapianSmoketest < Test::Unit::TestCase @doc.add_posting(@stem.call("there"), 2) @doc.add_posting(@stem.call("anybody"), 3) @doc.add_posting(@stem.call("out"), 4) - @doc.add_posting(@stem.call("there"), 5) + @doc.add_posting(@stem.call("there"), 5) @doc.add_term("XYzzy") @db = Xapian::inmemory_open() @@ -63,7 +63,7 @@ class XapianSmoketest < Test::Unit::TestCase end # test_version def test_stem - assert_equal("Xapian::Stem(english)", @stem.description()) + assert_equal("Xapian::Stem(english)", @stem.description()) assert_equal("is", @stem.call("is")) assert_equal("go", @stem.call("going")) @@ -102,9 +102,9 @@ class XapianSmoketest < Test::Unit::TestCase assert_equal("Query((smoke PHRASE 3 test PHRASE 3 tuple))", phrase_query.description()) assert_equal("Query((smoke XOR (smoke PHRASE 3 test PHRASE 3 tuple) XOR string))", xor_query.description()) - assert_equal([Xapian::Term.new("smoke", 1), - Xapian::Term.new("string", 1), - Xapian::Term.new("test", 1), + assert_equal([Xapian::Term.new("smoke", 1), + Xapian::Term.new("string", 1), + Xapian::Term.new("test", 1), Xapian::Term.new("tuple", 1)], xor_query.terms()) assert_equal(Xapian::Query::OP_ELITE_SET, 10) @@ -116,7 +116,7 @@ class XapianSmoketest < Test::Unit::TestCase def test_003_enquire @enq = Xapian::Enquire.new(@db) assert_not_nil(@enq) - + @enq.query = Xapian::Query.new(Xapian::Query::OP_OR, "there", "is") mset = @enq.mset(0, 10) @@ -131,7 +131,7 @@ class XapianSmoketest < Test::Unit::TestCase def test_004_mset_iterator @enq = Xapian::Enquire.new(@db) assert_not_nil(@enq) - + @enq.query = Xapian::Query.new(Xapian::Query::OP_OR, "there", "is") mset = @enq.mset(0, 10) @@ -160,7 +160,7 @@ class XapianSmoketest < Test::Unit::TestCase assert_equal(1, ou_terms.size()) assert_equal('out', ou_terms[0].term) end - + # Feature test for Database.postlist def test_007_database_postlist assert_equal(1, @db.postlist("there").size()) diff --git a/xapian-bindings/ruby/xapian.rb b/xapian-bindings/ruby/xapian.rb index 508977b35..8280809df 100644 --- a/xapian-bindings/ruby/xapian.rb +++ b/xapian-bindings/ruby/xapian.rb @@ -51,17 +51,17 @@ module Xapian # underlying Iterator def _safelyIterate(dangerousStart, dangerousEnd) #:nodoc: retval = Array.new - + item = dangerousStart lastTerm = dangerousEnd - + return retval if dangerousStart.equals(dangerousEnd) - begin + begin retval.push(yield(item)) item.next() - end while not item.equals(lastTerm) # must use primitive C++ comparator - + end while not item.equals(lastTerm) # must use primitive C++ comparator + return retval end # _safelyIterate module_function :_safelyIterate @@ -87,7 +87,7 @@ module Xapian # non-iterative data. # (MSetIterator is not dangerous, but it is inconvenient to use from a Ruby # idiom, so we wrap it..) - class Xapian::Match + class Xapian::Match attr_accessor :docid, :document, :rank, :weight, :collapse_count, :percent def initialize(docid, document, rank, weight, collapse_count, percent) @@ -100,7 +100,7 @@ module Xapian end # initialize def ==(other) - return other.is_a?(Xapian::Match) && other.docid == @docid && other.rank == @rank && + return other.is_a?(Xapian::Match) && other.docid == @docid && other.rank == @rank && other.weight == @weight && other.collapse_count == @collapse_count && other.percent == @percent end end # class Xapian::Match @@ -125,7 +125,7 @@ module Xapian # Ruby wrapper for Xapian::ValueIterator class Xapian::Value attr_accessor :value, :valueno, :docid - + def initialize(value, valueno, docid) @value = value @valueno = valueno @@ -180,7 +180,7 @@ module Xapian # Get matching terms for some document. # document can be either a Xapian::DocID or a Xapian::MSetIterator def matching_terms(document) - Xapian._safelyIterate(self._dangerous_matching_terms_begin(document), + Xapian._safelyIterate(self._dangerous_matching_terms_begin(document), self._dangerous_matching_terms_end(document)) { |item| Xapian::Term.new(item.term, item.wdf) } @@ -195,7 +195,7 @@ module Xapian # programming idiom. So we wrap them. class Xapian::MSet def matches - Xapian._safelyIterate(self._begin(), + Xapian._safelyIterate(self._begin(), self._end()) { |item| Xapian::Match.new(item.docid, item.document, item.rank, item.weight, item.collapse_count, item.percent) } @@ -211,7 +211,7 @@ module Xapian # programming idiom. So we wrap them. class Xapian::ESet def terms - Xapian._safelyIterate(self._begin(), + Xapian._safelyIterate(self._begin(), self._end()) { |item| # note: in the ExpandTerm wrapper, we implicitly rename # ESetIterator#term() (defined in xapian-headers.i) to ExpandTerm#term() @@ -256,10 +256,10 @@ module Xapian # Returns an Array of Xapian::Postings for the given term. # term is a string. def postlist(term) - Xapian._safelyIterate(self._dangerous_postlist_begin(term), + Xapian._safelyIterate(self._dangerous_postlist_begin(term), self._dangerous_postlist_end(term)) { |item| Xapian::Posting.new(item.docid, item.doclength, item.wdf) - } + } end # postlist(term) # Returns an Array of Terms for the given docid. @@ -269,7 +269,7 @@ module Xapian Xapian::Term.new(item.term, item.wdf, item.termfreq) } end # termlist(docid) - + # Returns an Array of Xapian::Termpos objects for the given term (a String) # in the given docid. def positionlist(docid, term) diff --git a/xapian-bindings/xapian-bindings.spec.in b/xapian-bindings/xapian-bindings.spec.in index 51d6ec408..0707c7f5d 100644 --- a/xapian-bindings/xapian-bindings.spec.in +++ b/xapian-bindings/xapian-bindings.spec.in @@ -54,7 +54,7 @@ BuildRequires: ruby-devel >= 1.8 BuildRequires: tcl-devel >= 8.1 %endif %if 0%{?!_without_csharp:1} -BuildRequires: mono-devel >= 1.1 +BuildRequires: mono-devel >= 1.1 %endif %if 0%{?!_without_perl:1} # http://fedoraproject.org/wiki/Packaging/Perl diff --git a/xapian-core/api/compactor.cc b/xapian-core/api/compactor.cc index bdb6251e4..c02fda43d 100644 --- a/xapian-core/api/compactor.cc +++ b/xapian-core/api/compactor.cc @@ -375,7 +375,7 @@ Database::compact_(const string * output_ptr, int fd, unsigned flags, } if (errno) { string msg = destdir; - msg += ": cannot create directory"; + msg += ": cannot create directory"; throw Xapian::DatabaseError(msg, errno); } } diff --git a/xapian-core/api/omenquire.cc b/xapian-core/api/omenquire.cc index d8cf14c45..356d268da 100644 --- a/xapian-core/api/omenquire.cc +++ b/xapian-core/api/omenquire.cc @@ -422,7 +422,7 @@ MSet::Internal::read_docs() const // MSetIterator Xapian::docid -MSetIterator::operator *() const +MSetIterator::operator*() const { Assert(mset.internal.get()); Xapian::doccount size = mset.internal->items.size(); diff --git a/xapian-core/backends/chert/chert_check.cc b/xapian-core/backends/chert/chert_check.cc index f7883f8c4..bb7918f4a 100644 --- a/xapian-core/backends/chert/chert_check.cc +++ b/xapian-core/backends/chert/chert_check.cc @@ -81,7 +81,7 @@ void ChertTableCheck::report_block_full(int m, int n, const byte * p) const *out << '\n'; print_spaces(m); *out << "Block [" << n << "] level " << j << ", revision *" << REVISION(p) - << " items (" << (dir_end - DIR_START)/D2 << ") usage " + << " items (" << (dir_end - DIR_START) / D2 << ") usage " << block_usage(p) << "%:\n"; for (int c = DIR_START; c < dir_end; c += D2) { print_spaces(m); @@ -109,7 +109,7 @@ void ChertTableCheck::report_block(int m, int n, const byte * p) const int c; print_spaces(m); *out << "[" << n << "] *" << REVISION(p) << " (" - << (dir_end - DIR_START)/D2 << ") " << block_usage(p) << "% "; + << (dir_end - DIR_START) / D2 << ") " << block_usage(p) << "% "; for (c = DIR_START; c < dir_end; c += D2) { if (c >= DIR_START + 6 && c < dir_end - 6) { diff --git a/xapian-core/backends/chert/chert_cursor.cc b/xapian-core/backends/chert/chert_cursor.cc index 05ea839d6..7361333e7 100644 --- a/xapian-core/backends/chert/chert_cursor.cc +++ b/xapian-core/backends/chert/chert_cursor.cc @@ -40,8 +40,8 @@ hex_display_encode(const string & input) for (string::const_iterator i = input.begin(); i != input.end(); ++i) { unsigned char val = *i; result += "\\x"; - result += table[val/16]; - result += table[val%16]; + result += table[val / 16]; + result += table[val % 16]; } return result; diff --git a/xapian-core/backends/chert/chert_database.h b/xapian-core/backends/chert/chert_database.h index b38f2a145..55160f424 100644 --- a/xapian-core/backends/chert/chert_database.h +++ b/xapian-core/backends/chert/chert_database.h @@ -261,7 +261,7 @@ class ChertDatabase : public Xapian::Database::Internal { /** Virtual methods of Database::Internal. */ //@{ - Xapian::doccount get_doccount() const; + Xapian::doccount get_doccount() const; Xapian::docid get_lastdocid() const; totlen_t get_total_length() const; Xapian::termcount get_doclength(Xapian::docid did) const; diff --git a/xapian-core/backends/chert/chert_table.cc b/xapian-core/backends/chert/chert_table.cc index 69234fa72..34b04b9a9 100644 --- a/xapian-core/backends/chert/chert_table.cc +++ b/xapian-core/backends/chert/chert_table.cc @@ -1403,7 +1403,7 @@ ChertTable::basic_open(bool revision_supplied, chert_revision_number_t revision_ basep = &bases[i]; // FIXME: assuming only two bases for other_base - size_t otherbase_num = 1-i; + size_t otherbase_num = 1 - i; if (base_ok[otherbase_num]) { other_base = &bases[otherbase_num]; } diff --git a/xapian-core/backends/chert/chert_table.h b/xapian-core/backends/chert/chert_table.h index 55004d956..8eff1b579 100644 --- a/xapian-core/backends/chert/chert_table.h +++ b/xapian-core/backends/chert/chert_table.h @@ -389,7 +389,7 @@ class ChertTable { * * @param permanent If true, the Btree will not reopen on demand. */ - void close(bool permanent=false); + void close(bool permanent = false); bool readahead_key(const string &key) const; diff --git a/xapian-core/backends/glass/glass_check.cc b/xapian-core/backends/glass/glass_check.cc index 6c15cfde3..9d5717273 100644 --- a/xapian-core/backends/glass/glass_check.cc +++ b/xapian-core/backends/glass/glass_check.cc @@ -94,7 +94,7 @@ void GlassTableCheck::report_block_full(int m, int n, const byte * p) const *out << '\n'; print_spaces(m); *out << "Block [" << n << "] level " << j << ", revision *" << REVISION(p) - << " items (" << (dir_end - DIR_START)/D2 << ") usage " + << " items (" << (dir_end - DIR_START) / D2 << ") usage " << block_usage(p) << "%:\n"; for (int c = DIR_START; c < dir_end; c += D2) { print_spaces(m); @@ -122,7 +122,7 @@ void GlassTableCheck::report_block(int m, int n, const byte * p) const int c; print_spaces(m); *out << "[" << n << "] *" << REVISION(p) << " (" - << (dir_end - DIR_START)/D2 << ") " << block_usage(p) << "% "; + << (dir_end - DIR_START) / D2 << ") " << block_usage(p) << "% "; for (c = DIR_START; c < dir_end; c += D2) { if (c >= DIR_START + 6 && c < dir_end - 6) { @@ -298,7 +298,7 @@ GlassTableCheck::check(const char * tablename, const string & path, int fd, if (opts & Xapian::DBCHECK_SHOW_STATS) { *out << "blocksize=" << B->block_size / 1024 << "K" - " items=" << B->item_count + " items=" << B->item_count << " firstunused=" << B->free_list.get_first_unused_block() << " revision=" << B->revision_number << " levels=" << B->level diff --git a/xapian-core/backends/glass/glass_cursor.cc b/xapian-core/backends/glass/glass_cursor.cc index 1c3930e36..77796e877 100644 --- a/xapian-core/backends/glass/glass_cursor.cc +++ b/xapian-core/backends/glass/glass_cursor.cc @@ -42,8 +42,8 @@ hex_display_encode(const string & input) for (string::const_iterator i = input.begin(); i != input.end(); ++i) { unsigned char val = *i; result += "\\x"; - result += table[val/16]; - result += table[val%16]; + result += table[val / 16]; + result += table[val % 16]; } return result; diff --git a/xapian-core/backends/glass/glass_database.h b/xapian-core/backends/glass/glass_database.h index 6145cc340..d94c3722c 100644 --- a/xapian-core/backends/glass/glass_database.h +++ b/xapian-core/backends/glass/glass_database.h @@ -245,7 +245,7 @@ class GlassDatabase : public Xapian::Database::Internal { /** Virtual methods of Database::Internal. */ //@{ - Xapian::doccount get_doccount() const; + Xapian::doccount get_doccount() const; Xapian::docid get_lastdocid() const; totlen_t get_total_length() const; Xapian::termcount get_doclength(Xapian::docid did) const; diff --git a/xapian-core/backends/glass/glass_inverter.h b/xapian-core/backends/glass/glass_inverter.h index 252b6e964..9e7018b4e 100644 --- a/xapian-core/backends/glass/glass_inverter.h +++ b/xapian-core/backends/glass/glass_inverter.h @@ -202,7 +202,7 @@ class Inverter { doclen_changes[did] = DELETED_POSTING; } - bool get_doclength(Xapian::docid did, Xapian::termcount & doclen) const { + bool get_doclength(Xapian::docid did, Xapian::termcount & doclen) const { std::map::const_iterator i; i = doclen_changes.find(did); if (i == doclen_changes.end()) diff --git a/xapian-core/backends/glass/glass_table.h b/xapian-core/backends/glass/glass_table.h index a9c317973..a495794d7 100644 --- a/xapian-core/backends/glass/glass_table.h +++ b/xapian-core/backends/glass/glass_table.h @@ -479,7 +479,7 @@ class GlassTable { * * @param permanent If true, the Btree will not reopen on demand. */ - void close(bool permanent=false); + void close(bool permanent = false); bool readahead_key(const string &key) const; diff --git a/xapian-core/backends/inmemory/inmemory_database.cc b/xapian-core/backends/inmemory/inmemory_database.cc index 23a9d3470..eeae65dd8 100644 --- a/xapian-core/backends/inmemory/inmemory_database.cc +++ b/xapian-core/backends/inmemory/inmemory_database.cc @@ -613,7 +613,7 @@ InMemoryDatabase::positionlist_count(Xapian::docid did, if (!doc_exists(did)) { return 0; } - const InMemoryDoc &doc = termlists[did-1]; + const InMemoryDoc &doc = termlists[did - 1]; vector::const_iterator i; for (i = doc.terms.begin(); i != doc.terms.end(); ++i) { @@ -630,7 +630,7 @@ InMemoryDatabase::open_position_list(Xapian::docid did, { if (closed) InMemoryDatabase::throw_database_closed(); if (usual(doc_exists(did))) { - const InMemoryDoc &doc = termlists[did-1]; + const InMemoryDoc &doc = termlists[did - 1]; vector::const_iterator i; for (i = doc.terms.begin(); i != doc.terms.end(); ++i) { @@ -650,7 +650,7 @@ InMemoryDatabase::add_values(Xapian::docid did, if (did > valuelists.size()) { valuelists.resize(did); } - valuelists[did-1] = values_; + valuelists[did - 1] = values_; // Update the statistics. map::const_iterator j; @@ -696,10 +696,10 @@ InMemoryDatabase::delete_document(Xapian::docid did) throw Xapian::DocNotFoundError(string("Docid ") + str(did) + string(" not found")); } - termlists[did-1].is_valid = false; - doclists[did-1] = string(); + termlists[did - 1].is_valid = false; + doclists[did - 1] = string(); map::const_iterator j; - for (j = valuelists[did-1].begin(); j != valuelists[did-1].end(); ++j) { + for (j = valuelists[did - 1].begin(); j != valuelists[did - 1].end(); ++j) { map::iterator i; i = valuestats.find(j->first); if (--(i->second.freq) == 0) { @@ -707,10 +707,10 @@ InMemoryDatabase::delete_document(Xapian::docid did) i->second.upper_bound.resize(0); } } - valuelists[did-1].clear(); + valuelists[did - 1].clear(); - totlen -= doclengths[did-1]; - doclengths[did-1] = 0; + totlen -= doclengths[did - 1]; + doclengths[did - 1] = 0; totdocs--; // A crude check, but it's hard to be more precise with the current // InMemory structure without being very inefficient. @@ -733,7 +733,7 @@ InMemoryDatabase::delete_document(Xapian::docid did) ++posting; } } - termlists[did-1].terms.clear(); + termlists[did - 1].terms.clear(); } void @@ -746,7 +746,7 @@ InMemoryDatabase::replace_document(Xapian::docid did, if (doc_exists(did)) { map::const_iterator j; - for (j = valuelists[did-1].begin(); j != valuelists[did-1].end(); ++j) { + for (j = valuelists[did - 1].begin(); j != valuelists[did - 1].end(); ++j) { map::iterator i; i = valuestats.find(j->first); if (--(i->second.freq) == 0) { diff --git a/xapian-core/backends/inmemory/inmemory_database.h b/xapian-core/backends/inmemory/inmemory_database.h index e6a53c615..4366a0df0 100644 --- a/xapian-core/backends/inmemory/inmemory_database.h +++ b/xapian-core/backends/inmemory/inmemory_database.h @@ -153,10 +153,10 @@ class InMemoryPostList : public LeafPostList { public: Xapian::doccount get_termfreq() const; - Xapian::docid get_docid() const; // Gets current docid - Xapian::termcount get_doclength() const; // Length of current document - Xapian::termcount get_unique_terms() const; // number of terms in current document - Xapian::termcount get_wdf() const; // Within Document Frequency + Xapian::docid get_docid() const; // Gets current docid + Xapian::termcount get_doclength() const; // Length of current document + Xapian::termcount get_unique_terms() const; // number of terms in current document + Xapian::termcount get_wdf() const; // Within Document Frequency PositionList * read_position_list(); PositionList * open_position_list() const; @@ -183,10 +183,10 @@ class InMemoryAllDocsPostList : public LeafPostList { public: Xapian::doccount get_termfreq() const; - Xapian::docid get_docid() const; // Gets current docid - Xapian::termcount get_doclength() const; // Length of current document - Xapian::termcount get_unique_terms() const; // number of terms in current document - Xapian::termcount get_wdf() const; // Within Document Frequency + Xapian::docid get_docid() const; // Gets current docid + Xapian::termcount get_doclength() const; // Length of current document + Xapian::termcount get_unique_terms() const; // number of terms in current document + Xapian::termcount get_wdf() const; // Within Document Frequency PositionList * read_position_list(); PositionList * open_position_list() const; diff --git a/xapian-core/backends/multi/multi_postlist.h b/xapian-core/backends/multi/multi_postlist.h index 675b28598..ab760df16 100644 --- a/xapian-core/backends/multi/multi_postlist.h +++ b/xapian-core/backends/multi/multi_postlist.h @@ -33,8 +33,8 @@ class MultiPostList : public PostList { const Xapian::Database &this_db; - bool finished; - Xapian::docid currdoc; + bool finished; + Xapian::docid currdoc; Xapian::doccount multiplier; @@ -51,14 +51,14 @@ class MultiPostList : public PostList { double get_weight() const; double recalc_maxweight(); - Xapian::docid get_docid() const; // Gets current docid + Xapian::docid get_docid() const; // Gets current docid Xapian::termcount get_doclength() const; // Get length of current document Xapian::termcount get_unique_terms() const; // Get number of unique term in current document Xapian::termcount get_wdf() const; // Within Document Frequency PositionList * open_position_list() const; PostList *next(double w_min); // Moves to next docid PostList *skip_to(Xapian::docid did, double w_min);// Moves to next docid >= specified docid - bool at_end() const; // True if we're off the end of the list + bool at_end() const; // True if we're off the end of the list std::string get_description() const; }; diff --git a/xapian-core/backends/multi/multi_termlist.h b/xapian-core/backends/multi/multi_termlist.h index 906308bb8..299a44169 100644 --- a/xapian-core/backends/multi/multi_termlist.h +++ b/xapian-core/backends/multi/multi_termlist.h @@ -48,7 +48,7 @@ class MultiTermList : public TermList { Xapian::doccount get_termfreq() const; // Number of docs indexed by term TermList * next(); TermList * skip_to(const std::string & term); - bool at_end() const; + bool at_end() const; Xapian::termcount positionlist_count() const; diff --git a/xapian-core/backends/remote/net_termlist.h b/xapian-core/backends/remote/net_termlist.h index f510a73e2..b9ca29220 100644 --- a/xapian-core/backends/remote/net_termlist.h +++ b/xapian-core/backends/remote/net_termlist.h @@ -119,7 +119,7 @@ class NetworkTermList : public TermList { Xapian::doccount get_termfreq() const; TermList * next(); TermList * skip_to(const std::string &term); - bool at_end() const; + bool at_end() const; Xapian::termcount positionlist_count() const; Xapian::PositionIterator positionlist_begin() const; diff --git a/xapian-core/common/bitstream.h b/xapian-core/common/bitstream.h index eb15a13d1..de01f4a0f 100644 --- a/xapian-core/common/bitstream.h +++ b/xapian-core/common/bitstream.h @@ -85,7 +85,7 @@ class BitReader { k = k_; pos_k = pos_k_; } - void uninit() { + void uninit() { j = 1; k = 0; } diff --git a/xapian-core/common/omassert.h b/xapian-core/common/omassert.h index e5895b1ec..2c38ccf7e 100644 --- a/xapian-core/common/omassert.h +++ b/xapian-core/common/omassert.h @@ -101,8 +101,8 @@ bool within_DBL_EPSILON(double a, double b); #define AssertEqDouble(A,B) \ do {\ using Xapian::Internal::within_DBL_EPSILON;\ - if (rare(!within_DBL_EPSILON(A,B))) {\ - std::string xapian_assertion_msg(XAPIAN_ASSERT_LOCATION(within_DBL_EPSILON(A,B)));\ + if (rare(!within_DBL_EPSILON(A, B))) {\ + std::string xapian_assertion_msg(XAPIAN_ASSERT_LOCATION(within_DBL_EPSILON(A, B)));\ xapian_assertion_msg += " : values were ";\ xapian_assertion_msg += str(A);\ xapian_assertion_msg += " and ";\ diff --git a/xapian-core/configure.ac b/xapian-core/configure.ac index 16882e71c..3ae8e4e0c 100644 --- a/xapian-core/configure.ac +++ b/xapian-core/configure.ac @@ -603,7 +603,7 @@ if test -n "${VALGRIND-unset}" ; then else AC_MSG_RESULT([yes]) AC_CHECK_HEADERS([valgrind/memcheck.h], [], [VALGRIND=], [ ]) - fi + fi else dnl The valgrind detected doesn't seem to work! Perhaps this is an dnl x86_64 box with a 32 bit valgrind. diff --git a/xapian-core/include/xapian/database.h b/xapian-core/include/xapian/database.h index dbee055d9..f011b8531 100644 --- a/xapian-core/include/xapian/database.h +++ b/xapian-core/include/xapian/database.h @@ -904,7 +904,7 @@ class XAPIAN_VISIBILITY_DEFAULT WritableDatabase : public Database { * called at an invalid time, such as when a transaction * is already in progress. */ - void begin_transaction(bool flushed=true); + void begin_transaction(bool flushed = true); /** Complete the transaction currently in progress. * diff --git a/xapian-core/include/xapian/geospatial.h b/xapian-core/include/xapian/geospatial.h index 85b91297f..baa60336b 100644 --- a/xapian-core/include/xapian/geospatial.h +++ b/xapian-core/include/xapian/geospatial.h @@ -178,7 +178,7 @@ class XAPIAN_VISIBILITY_DEFAULT LatLongCoordsIterator { LatLongCoordsIterator() {} /** Get the LatLongCoord for the current position. */ - const LatLongCoord & operator *() const { + const LatLongCoord & operator*() const { return *iter; } diff --git a/xapian-core/include/xapian/weight.h b/xapian-core/include/xapian/weight.h index 49cf0c8bc..ac8ccf2f9 100644 --- a/xapian-core/include/xapian/weight.h +++ b/xapian-core/include/xapian/weight.h @@ -893,7 +893,7 @@ class XAPIAN_VISIBILITY_DEFAULT IfB2Weight : public Weight { */ explicit IfB2Weight(double c); - IfB2Weight( ) : param_c(1.0) { + IfB2Weight() : param_c(1.0) { need_stat(AVERAGE_LENGTH); need_stat(DOC_LENGTH); need_stat(DOC_LENGTH_MIN); @@ -964,7 +964,7 @@ class XAPIAN_VISIBILITY_DEFAULT IneB2Weight : public Weight { */ explicit IneB2Weight(double c); - IneB2Weight( ) : param_c(1.0) { + IneB2Weight() : param_c(1.0) { need_stat(AVERAGE_LENGTH); need_stat(DOC_LENGTH); need_stat(DOC_LENGTH_MIN); @@ -1040,7 +1040,7 @@ class XAPIAN_VISIBILITY_DEFAULT BB2Weight : public Weight { */ explicit BB2Weight(double c); - BB2Weight( ) : param_c(1.0) { + BB2Weight() : param_c(1.0) { need_stat(AVERAGE_LENGTH); need_stat(DOC_LENGTH); need_stat(DOC_LENGTH_MIN); @@ -1185,7 +1185,7 @@ class XAPIAN_VISIBILITY_DEFAULT PL2Weight : public Weight { */ explicit PL2Weight(double c); - PL2Weight( ) : param_c(1.0) { + PL2Weight() : param_c(1.0) { need_stat(AVERAGE_LENGTH); need_stat(DOC_LENGTH); need_stat(DOC_LENGTH_MIN); @@ -1262,7 +1262,7 @@ class XAPIAN_VISIBILITY_DEFAULT PL2PlusWeight : public Weight { */ PL2PlusWeight(double c, double delta); - PL2PlusWeight( ) + PL2PlusWeight() : param_c(1.0), param_delta(0.8) { need_stat(AVERAGE_LENGTH); need_stat(DOC_LENGTH); diff --git a/xapian-core/languages/steminternal.cc b/xapian-core/languages/steminternal.cc index 7631aa3ab..1cf79fe2d 100644 --- a/xapian-core/languages/steminternal.cc +++ b/xapian-core/languages/steminternal.cc @@ -461,15 +461,15 @@ void SnowballStemImplementation::debug(int number, int line_count) { int i; int limit = SIZE(p); /*if (number >= 0) printf("%3d (line %4d): '", number, line_count);*/ - if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit); + if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count, limit); for (i = 0; i <= limit; i++) { if (lb == i) printf("{"); if (bra == i) printf("["); if (c == i) printf("|"); if (ket == i) printf("]"); if (l == i) printf("}"); - if (i < limit) - { int ch = p[i]; + if (i < limit) { + int ch = p[i]; if (ch == 0) ch = '#'; printf("%c", ch); } diff --git a/xapian-core/matcher/andmaybepostlist.h b/xapian-core/matcher/andmaybepostlist.h index 696c53a3b..ad3dc894e 100644 --- a/xapian-core/matcher/andmaybepostlist.h +++ b/xapian-core/matcher/andmaybepostlist.h @@ -66,7 +66,7 @@ class AndMaybePostList : public BranchPostList { TermFreqs get_termfreq_est_using_stats( const Xapian::Weight::Internal & stats) const; - Xapian::docid get_docid() const; + Xapian::docid get_docid() const; double get_weight() const; double get_maxweight() const; @@ -74,7 +74,7 @@ class AndMaybePostList : public BranchPostList { PostList *next(double w_min); PostList *skip_to(Xapian::docid did, double w_min); - bool at_end() const; + bool at_end() const; std::string get_description() const; diff --git a/xapian-core/matcher/andnotpostlist.h b/xapian-core/matcher/andnotpostlist.h index 221a0c604..b3cc1d12a 100644 --- a/xapian-core/matcher/andnotpostlist.h +++ b/xapian-core/matcher/andnotpostlist.h @@ -47,7 +47,7 @@ class AndNotPostList : public BranchPostList { TermFreqs get_termfreq_est_using_stats( const Xapian::Weight::Internal & stats) const; - Xapian::docid get_docid() const; + Xapian::docid get_docid() const; double get_weight() const; double get_maxweight() const; @@ -55,7 +55,7 @@ class AndNotPostList : public BranchPostList { PostList *next(double w_min); PostList *skip_to(Xapian::docid did, double w_min); - bool at_end() const; + bool at_end() const; std::string get_description() const; diff --git a/xapian-core/matcher/extraweightpostlist.h b/xapian-core/matcher/extraweightpostlist.h index 2614a6175..dc53bdf6d 100644 --- a/xapian-core/matcher/extraweightpostlist.h +++ b/xapian-core/matcher/extraweightpostlist.h @@ -50,7 +50,7 @@ class ExtraWeightPostList : public PostList { return pl->get_termfreq_est(); } - Xapian::docid get_docid() const { return pl->get_docid(); } + Xapian::docid get_docid() const { return pl->get_docid(); } double get_weight() const { /* Second parameter of get_sumextra is number of unique terms in doc, which has been put diff --git a/xapian-core/matcher/mergepostlist.h b/xapian-core/matcher/mergepostlist.h index d35d02a72..58690d5aa 100644 --- a/xapian-core/matcher/mergepostlist.h +++ b/xapian-core/matcher/mergepostlist.h @@ -65,7 +65,7 @@ class MergePostList : public PostList { Xapian::doccount get_termfreq_min() const; Xapian::doccount get_termfreq_est() const; - Xapian::docid get_docid() const; + Xapian::docid get_docid() const; double get_weight() const; const string * get_sort_key() const; const string * get_collapse_key() const; @@ -76,7 +76,7 @@ class MergePostList : public PostList { PostList *next(double w_min); PostList *skip_to(Xapian::docid did, double w_min); - bool at_end() const; + bool at_end() const; string get_description() const; diff --git a/xapian-core/matcher/orpostlist.h b/xapian-core/matcher/orpostlist.h index c6aa6004e..52867c4cb 100644 --- a/xapian-core/matcher/orpostlist.h +++ b/xapian-core/matcher/orpostlist.h @@ -48,7 +48,7 @@ class OrPostList : public BranchPostList { TermFreqs get_termfreq_est_using_stats( const Xapian::Weight::Internal & stats) const; - Xapian::docid get_docid() const; + Xapian::docid get_docid() const; double get_weight() const; double get_maxweight() const; @@ -57,7 +57,7 @@ class OrPostList : public BranchPostList { PostList *next(double w_min); PostList *skip_to(Xapian::docid did, double w_min); PostList *check(Xapian::docid did, double w_min, bool &valid); - bool at_end() const; + bool at_end() const; std::string get_description() const; diff --git a/xapian-core/net/remoteserver.cc b/xapian-core/net/remoteserver.cc index 09a5d1bcf..8185bc035 100644 --- a/xapian-core/net/remoteserver.cc +++ b/xapian-core/net/remoteserver.cc @@ -196,7 +196,7 @@ RemoteServer::run() string message; size_t type = get_message(idle_timeout, message); - if (type >= sizeof(dispatch)/sizeof(dispatch[0]) || !dispatch[type]) { + if (type >= sizeof(dispatch) / sizeof(dispatch[0]) || !dispatch[type]) { string errmsg("Unexpected message type "); errmsg += str(type); throw Xapian::InvalidArgumentError(errmsg); diff --git a/xapian-core/queryparser/queryparser.lemony b/xapian-core/queryparser/queryparser.lemony index 06d76da5d..d54b9a6e9 100644 --- a/xapian-core/queryparser/queryparser.lemony +++ b/xapian-core/queryparser/queryparser.lemony @@ -343,7 +343,7 @@ class SynonymIterator { typedef Xapian::Query * pointer; typedef Xapian::Query & reference; }; - + Query Term::get_query_with_synonyms() const { diff --git a/xapian-core/tests/api_anydb.cc b/xapian-core/tests/api_anydb.cc index 739e0affd..39d619572 100644 --- a/xapian-core/tests/api_anydb.cc +++ b/xapian-core/tests/api_anydb.cc @@ -636,8 +636,8 @@ class myExpandFunctor : public Xapian::ExpandDecider { public: bool operator()(const string & tname) const { unsigned long sum = 0; - for (string::const_iterator i=tname.begin(); i!=tname.end(); ++i) { - sum += *i; + for (unsigned ch : tname) { + sum += ch; } // if (verbose) { // tout << tname << "==> " << sum << "\n"; @@ -2333,7 +2333,7 @@ DEFINE_TESTCASE(scaleweight2, backend) { DEFINE_TESTCASE(bm25weight1, backend) { Xapian::Enquire enquire(get_database("apitest_simpledata")); enquire.set_weighting_scheme(Xapian::BM25Weight(1, 25, 1, 0.01, 0.5)); - enquire.set_query(Xapian::Query("word") ); + enquire.set_query(Xapian::Query("word")); Xapian::MSet mset = enquire.get_mset(0, 25); @@ -2344,13 +2344,13 @@ DEFINE_TESTCASE(bm25weight1, backend) { DEFINE_TESTCASE(tradweight1, backend) { Xapian::Enquire enquire(get_database("apitest_simpledata")); enquire.set_weighting_scheme(Xapian::TradWeight()); - enquire.set_query(Xapian::Query("word") ); + enquire.set_query(Xapian::Query("word")); Xapian::MSet mset = enquire.get_mset(0, 25); TEST_EQUAL(mset.size(), 2); enquire.set_weighting_scheme(Xapian::TradWeight(0)); - enquire.set_query(Xapian::Query("this") ); + enquire.set_query(Xapian::Query("this")); mset = enquire.get_mset(0, 25); TEST_EQUAL(mset.size(), 6); diff --git a/xapian-core/tests/api_backend.cc b/xapian-core/tests/api_backend.cc index 176c1f407..6e511faa3 100644 --- a/xapian-core/tests/api_backend.cc +++ b/xapian-core/tests/api_backend.cc @@ -857,7 +857,7 @@ DEFINE_TESTCASE(bm25weight2, backend) { return true; } -DEFINE_TESTCASE(unigramlmweight2,backend) { +DEFINE_TESTCASE(unigramlmweight2, backend) { Xapian::Database db(get_database("etext")); Xapian::Enquire enquire(db); enquire.set_query(Xapian::Query("the")); diff --git a/xapian-core/tests/api_collapse.cc b/xapian-core/tests/api_collapse.cc index b36f7c0d6..ba66bf34e 100644 --- a/xapian-core/tests/api_collapse.cc +++ b/xapian-core/tests/api_collapse.cc @@ -30,7 +30,7 @@ using namespace std; /// Simple test of collapsing with collapse_max > 1. -DEFINE_TESTCASE(collapsekey5,backend) { +DEFINE_TESTCASE(collapsekey5, backend) { Xapian::Database db(get_database("apitest_simpledata")); Xapian::Enquire enquire(db); // "this" matches all documents. diff --git a/xapian-core/tests/api_db.cc b/xapian-core/tests/api_db.cc index fa94eab9e..5f589f2a5 100644 --- a/xapian-core/tests/api_db.cc +++ b/xapian-core/tests/api_db.cc @@ -1182,7 +1182,7 @@ DEFINE_TESTCASE(specialterms1, backend) { TEST(value.size() > 263); TEST_EQUAL(static_cast(value[262]), 255); for (int k = 0; k < 256; k++) { - TEST_EQUAL(static_cast(value[k+7]), k); + TEST_EQUAL(static_cast(value[k + 7]), k); } } } @@ -1540,8 +1540,7 @@ DEFINE_TESTCASE(consistency1, backend && !remote) { } } } - } - catch (const Xapian::NetworkTimeoutError &) { + } catch (const Xapian::NetworkTimeoutError &) { // consistency1 is a long test - may timeout with the remote backend... SKIP_TEST("Test taking too long"); } diff --git a/xapian-core/tests/api_qpbackend.cc b/xapian-core/tests/api_qpbackend.cc index 901b766b7..96c2c61ec 100644 --- a/xapian-core/tests/api_qpbackend.cc +++ b/xapian-core/tests/api_qpbackend.cc @@ -56,7 +56,7 @@ DEFINE_TESTCASE(qpsynonympartial1, synonyms) { { "world ~hello", "(world@1 OR (hello@2 SYNONYM hi@2 SYNONYM howdy@2))" }, { NULL, NULL } }; - static const test test_queries_partial_auto[] = { + static const test test_queries_partial_auto[] = { { "hello", "((SYNONYM WILDCARD OR hello) OR hello@1)" }, { "~hello", "((SYNONYM WILDCARD OR hello) OR hello@1)" }, { "hello world", "((hello@1 SYNONYM hi@1 SYNONYM howdy@1) OR ((SYNONYM WILDCARD OR world) OR world@2))" }, diff --git a/xapian-core/tests/api_query.cc b/xapian-core/tests/api_query.cc index bd9ace7cb..d3b50d283 100644 --- a/xapian-core/tests/api_query.cc +++ b/xapian-core/tests/api_query.cc @@ -365,7 +365,7 @@ DEFINE_TESTCASE(wildcard2, backend) { q = Xapian::Query(q.OP_OR, q, q2); enq.set_query(q); Xapian::MSet mset = enq.get_mset(0, 10); - TEST_EQUAL(mset.size(), 6); + TEST_EQUAL(mset.size(), 6); return true; } diff --git a/xapian-core/tests/api_queryparser.cc b/xapian-core/tests/api_queryparser.cc index 6b896c605..3419570cd 100644 --- a/xapian-core/tests/api_queryparser.cc +++ b/xapian-core/tests/api_queryparser.cc @@ -2248,7 +2248,7 @@ DEFINE_TESTCASE(qp_spell1, spelling) { Xapian::Query q; q = qp.parse_query(p->query, Xapian::QueryParser::FLAG_SPELLING_CORRECTION | - Xapian::QueryParser::FLAG_BOOLEAN ); + Xapian::QueryParser::FLAG_BOOLEAN); tout << "Query: " << p->query << endl; TEST_STRINGS_EQUAL(qp.get_corrected_query_string(), p->expect); } @@ -2283,7 +2283,7 @@ DEFINE_TESTCASE(qp_spell2, spelling) Xapian::Query q; q = qp.parse_query(p->query, Xapian::QueryParser::FLAG_SPELLING_CORRECTION | - Xapian::QueryParser::FLAG_BOOLEAN ); + Xapian::QueryParser::FLAG_BOOLEAN); tout << "Query: " << p->query << endl; TEST_STRINGS_EQUAL(qp.get_corrected_query_string(), p->expect); } @@ -2506,7 +2506,7 @@ DEFINE_TESTCASE(qp_synonym3, synonyms) { Xapian::QueryParser::FLAG_SYNONYM | Xapian::QueryParser::FLAG_BOOLEAN | Xapian::QueryParser::FLAG_LOVEHATE | - Xapian::QueryParser::FLAG_PHRASE ); + Xapian::QueryParser::FLAG_PHRASE); tout << "Query: " << p->query << endl; TEST_STRINGS_EQUAL(q.get_description(), expect); } @@ -2951,7 +2951,7 @@ DEFINE_TESTCASE(qp_default_op3, !backend) { }; const qp_default_op3_test * p; for (p = tests; p - tests != sizeof(tests) / sizeof(*tests); ++p) { - tout << p ->op<< endl; + tout << p->op << endl; qp.set_default_op(p->op); // Check that get_default_op() returns what we just set. TEST_EQUAL(qp.get_default_op(), p->op); diff --git a/xapian-core/tests/api_sorting.cc b/xapian-core/tests/api_sorting.cc index afcc3d118..e449ec3ea 100644 --- a/xapian-core/tests/api_sorting.cc +++ b/xapian-core/tests/api_sorting.cc @@ -30,7 +30,7 @@ using namespace std; -DEFINE_TESTCASE(sortfunctor1,backend && !remote) { +DEFINE_TESTCASE(sortfunctor1, backend && !remote) { Xapian::Enquire enquire(get_database("apitest_sortrel")); enquire.set_query(Xapian::Query("woman")); @@ -78,7 +78,7 @@ DEFINE_TESTCASE(sortfunctor1,backend && !remote) { } /// Test reverse sort functor. -DEFINE_TESTCASE(sortfunctor2,writable && !remote) { +DEFINE_TESTCASE(sortfunctor2, writable && !remote) { Xapian::WritableDatabase db = get_writable_database(); Xapian::Document doc; doc.add_term("foo"); @@ -258,7 +258,7 @@ DEFINE_TESTCASE(changesorter1, backend && !remote) { } /// Regression test - an empty MultiValueSorter hung in 1.0.9 and earlier. -DEFINE_TESTCASE(sortfunctorempty1,backend && !remote) { +DEFINE_TESTCASE(sortfunctorempty1, backend && !remote) { Xapian::Enquire enquire(get_database("apitest_sortrel")); enquire.set_query(Xapian::Query("woman")); @@ -274,7 +274,7 @@ DEFINE_TESTCASE(sortfunctorempty1,backend && !remote) { return true; } -DEFINE_TESTCASE(multivaluekeymaker1,!backend) { +DEFINE_TESTCASE(multivaluekeymaker1, !backend) { const int keys[] = { 0, 1, 2, 3 }; Xapian::MultiValueKeyMaker sorter(keys, keys + 4); @@ -309,7 +309,7 @@ DEFINE_TESTCASE(multivaluekeymaker1,!backend) { return true; } -DEFINE_TESTCASE(sortfunctorremote1,remote) { +DEFINE_TESTCASE(sortfunctorremote1, remote) { Xapian::Enquire enquire(get_database(string())); NeverUseMeKeyMaker sorter; enquire.set_query(Xapian::Query("word")); diff --git a/xapian-core/tests/api_unicode.cc b/xapian-core/tests/api_unicode.cc index e431525ed..1b207898e 100644 --- a/xapian-core/tests/api_unicode.cc +++ b/xapian-core/tests/api_unicode.cc @@ -87,7 +87,7 @@ static const testcase testcases[] = { }; // Test handling of invalid UTF-8 is as desired. -DEFINE_TESTCASE(utf8iterator1,!backend) { +DEFINE_TESTCASE(utf8iterator1, !backend) { const testcase * p; for (p = testcases; p->a; ++p) { tout.str(string()); @@ -131,7 +131,7 @@ static const testcase2 testcases2[] = { }; // Test decoding of UTF-8. -DEFINE_TESTCASE(utf8iterator2,!backend) { +DEFINE_TESTCASE(utf8iterator2, !backend) { const testcase2 * p; for (p = testcases2; p->a; ++p) { Xapian::Utf8Iterator a(p->a); @@ -144,7 +144,7 @@ DEFINE_TESTCASE(utf8iterator2,!backend) { } // Test Unicode categorisation. -DEFINE_TESTCASE(unicode1,!backend) { +DEFINE_TESTCASE(unicode1, !backend) { using namespace Xapian; TEST_EQUAL(Unicode::get_category('a'), Unicode::LOWERCASE_LETTER); TEST_EQUAL(Unicode::get_category('0'), Unicode::DECIMAL_DIGIT_NUMBER); @@ -282,7 +282,7 @@ DEFINE_TESTCASE(unicode1,!backend) { return true; } -DEFINE_TESTCASE(caseconvert1,!backend) { +DEFINE_TESTCASE(caseconvert1, !backend) { using namespace Xapian; for (unsigned ch = 0; ch < 128; ++ch) { TEST_EQUAL(Unicode::tolower(ch), unsigned(tolower(ch))); @@ -324,7 +324,7 @@ DEFINE_TESTCASE(caseconvert1,!backend) { } /// Test Unicode 5.1 and later support. -DEFINE_TESTCASE(caseconvert2,!backend) { +DEFINE_TESTCASE(caseconvert2, !backend) { using namespace Xapian; TEST_EQUAL(Unicode::toupper(0x250), 0x2c6f); @@ -395,7 +395,7 @@ DEFINE_TESTCASE(caseconvert2,!backend) { return true; } -DEFINE_TESTCASE(utf8convert1,!backend) { +DEFINE_TESTCASE(utf8convert1, !backend) { string s; Xapian::Unicode::append_utf8(s, 'a'); Xapian::Unicode::append_utf8(s, 128); @@ -420,7 +420,7 @@ DEFINE_TESTCASE(utf8convert1,!backend) { return true; } -DEFINE_TESTCASE(unicodepredicates1,!backend) { +DEFINE_TESTCASE(unicodepredicates1, !backend) { const unsigned wordchars[] = { // DECIMAL_DIGIT_NUMER '0', '7', '9', diff --git a/xapian-core/tests/api_weight.cc b/xapian-core/tests/api_weight.cc index 194ee4f28..caa2f2de4 100644 --- a/xapian-core/tests/api_weight.cc +++ b/xapian-core/tests/api_weight.cc @@ -464,7 +464,7 @@ DEFINE_TESTCASE(bb2weight3, backend) { // Test with OP_SCALE_WEIGHT and a small factor (regression test, as we // were applying the factor to the upper bound twice). - enquire.set_query(Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, query, 1.0/1024)); + enquire.set_query(Xapian::Query(Xapian::Query::OP_SCALE_WEIGHT, query, 1.0 / 1024)); enquire.set_weighting_scheme(Xapian::BB2Weight(2.0)); Xapian::MSet mset3; @@ -708,7 +708,7 @@ DEFINE_TESTCASE(pl2plusweight5, backend) { Xapian::MSet mset; enquire.set_weighting_scheme(Xapian::PL2PlusWeight(1.0, 0.8)); - mset = enquire.get_mset(0,10); + mset = enquire.get_mset(0, 10); // Expect MSet contains two documents having query "word". TEST_EQUAL(mset.size(), 2); // Expect Document 2 has higher weight than document 4 because @@ -1279,7 +1279,7 @@ DEFINE_TESTCASE(checkstatsweight3, backend && !remote && !multi) { } make_heap(postlists.begin(), postlists.end(), PlCmp()); Xapian::docid did = 0; - Xapian::termcount wdf= 0; + Xapian::termcount wdf = 0; while (!postlists.empty()) { pop_heap(postlists.begin(), postlists.end(), PlCmp()); Xapian::docid did_new = *postlists.back(); diff --git a/xapian-core/tests/api_wrdb.cc b/xapian-core/tests/api_wrdb.cc index 580bf53ab..333bf1799 100644 --- a/xapian-core/tests/api_wrdb.cc +++ b/xapian-core/tests/api_wrdb.cc @@ -358,7 +358,7 @@ DEFINE_TESTCASE(adddoc5, writable) { Xapian::docid did2 = database.add_document(document_in2); TEST_EQUAL(database.get_doccount(), 2); TEST_NOT_EQUAL(did, did2); - TEST_EQUAL(database.get_avlength(), 5.0/2.0); + TEST_EQUAL(database.get_avlength(), 5.0 / 2.0); TEST_EQUAL(database.get_termfreq("foobar"), 2); TEST_EQUAL(database.get_collection_freq("foobar"), 3); @@ -380,7 +380,7 @@ DEFINE_TESTCASE(adddoc5, writable) { did = database.add_document(document_in); TEST_EQUAL(database.get_doccount(), 2); - TEST_EQUAL(database.get_avlength(), 5.0/2.0); + TEST_EQUAL(database.get_avlength(), 5.0 / 2.0); TEST_EQUAL(database.get_termfreq("foobar"), 2); TEST_EQUAL(database.get_collection_freq("foobar"), 3); @@ -885,7 +885,7 @@ DEFINE_TESTCASE(replacedoc1, writable) { doc1.add_posting("foo", 1); doc1.add_posting("foo", 2); - doc1.add_posting("gone",3); + doc1.add_posting("gone", 3); doc1.add_posting("bar", 4); doc1.add_posting("foo", 5); Xapian::docid did; @@ -931,7 +931,7 @@ DEFINE_TESTCASE(replacedoc2, writable) { doc1.add_posting("foo", 1); doc1.add_posting("foo", 2); - doc1.add_posting("gone",3); + doc1.add_posting("gone", 3); doc1.add_posting("bar", 4); doc1.add_posting("foo", 5); Xapian::docid did = 31770; diff --git a/xapian-core/tests/harness/testsuite.h b/xapian-core/tests/harness/testsuite.h index adf6545d6..4f82ba982 100644 --- a/xapian-core/tests/harness/testsuite.h +++ b/xapian-core/tests/harness/testsuite.h @@ -183,7 +183,7 @@ class test_driver { private: /** Prevent copying */ test_driver(const test_driver &); - test_driver & operator = (const test_driver &); + test_driver & operator=(const test_driver &); typedef enum { PASS = 1, FAIL = 0, SKIP = -1 } test_result; diff --git a/xapian-core/tests/perftest/get_machine_info.in b/xapian-core/tests/perftest/get_machine_info.in index 7055262a5..46a493293 100755 --- a/xapian-core/tests/perftest/get_machine_info.in +++ b/xapian-core/tests/perftest/get_machine_info.in @@ -25,12 +25,12 @@ BEGIN{$^W = 1} # equivalent of -w # Rights Reserved. # complete rewrite by Ken Estes, Mail.com (kestes@staff.mail.com). -# Contributor(s): +# Contributor(s): # $Revision: 1.14 $ # $Date: 2002/01/02 18:09:59 $ # $Author: kestes%walrus.com $ -# $Name: $ +# $Name: $ use strict; @@ -80,7 +80,7 @@ if (lc $OS eq "linux") { } } } - } elsif (open F, "/etc/redhat-release") { + } elsif (open F, "/etc/redhat-release") { # e.g. "Red Hat Linux release 7.2 (Enigma)" # or "Red Hat Enterprise Linux AS release 3 (Taroon Update 1)" # or "Red Hat Enterprise Linux ES release 3 (Taroon Update 3)" @@ -96,7 +96,7 @@ if (lc $OS eq "linux") { $distro = "RH $1"; } } elsif (open F, "/etc/SuSE-release") { - # e.g. "SuSE Linux 8.1 (i386)" "VERSION = 8.1" + # e.g. "SuSE Linux 8.1 (i386)" "VERSION = 8.1" ; chomp($_ = ); /VERSION *= *(.*)/; diff --git a/xapian-core/tests/perftest/perftest.cc b/xapian-core/tests/perftest/perftest.cc index f635f1d6f..5e69492aa 100644 --- a/xapian-core/tests/perftest/perftest.cc +++ b/xapian-core/tests/perftest/perftest.cc @@ -95,7 +95,7 @@ get_hostname() { #ifdef __WIN32__ char buf[256]; - WORD WSAVerReq = MAKEWORD(1,1); + WORD WSAVerReq = MAKEWORD(1, 1); WSADATA WSAData; if (WSAStartup(WSAVerReq, &WSAData) != 0) { diff --git a/xapian-core/tests/submitperftest.in b/xapian-core/tests/submitperftest.in index e5e87c142..210666950 100755 --- a/xapian-core/tests/submitperftest.in +++ b/xapian-core/tests/submitperftest.in @@ -73,7 +73,7 @@ def submit_perftest(filepath): return print "Successful submission: server said:\n" print '\n'.join(lines[1:]) - + def main(): submit_perftest(os.path.join(r"@builddir@", "perflog.xml")) diff --git a/xapian-core/weight/lmweight.cc b/xapian-core/weight/lmweight.cc index 7b8ae00ad..ba6bf3457 100644 --- a/xapian-core/weight/lmweight.cc +++ b/xapian-core/weight/lmweight.cc @@ -37,7 +37,7 @@ using namespace std; namespace Xapian { LMWeight * -LMWeight::clone() const { +LMWeight::clone() const { return new LMWeight(param_log, select_smoothing, param_smoothing1, param_smoothing2); } @@ -109,9 +109,9 @@ LMWeight::serialise() const LMWeight * LMWeight::unserialise(const string & s) const { - const char *ptr = s.data(); + const char *ptr = s.data(); const char *end = ptr + s.size(); - double param_log_ = unserialise_double(&ptr,end); + double param_log_ = unserialise_double(&ptr, end); type_smoothing select_smoothing_ = static_cast(*(ptr)++); double param_smoothing1_ = unserialise_double(&ptr, end); double param_smoothing2_ = unserialise_double(&ptr, end); @@ -205,7 +205,7 @@ LMWeight::get_maxpart() const upper_bound = (1 + (wdf_max / (param_smoothing1 * wt_coll))) * (1 + (param_smoothing2 / (param_smoothing1 * wt_coll))); } else if (select_smoothing == ABSOLUTE_DISCOUNT_SMOOTHING) { - upper_bound = param_smoothing1 * wt_coll + 1; + upper_bound = param_smoothing1 * wt_coll + 1; } else { upper_bound = (((1 - param_smoothing1) * (get_doclength_upper_bound() + (param_smoothing2 * wt_coll)) / (get_doclength_upper_bound() + param_smoothing2)) + (param_smoothing1 * wt_coll)); } diff --git a/xapian-core/weight/weightinternal.cc b/xapian-core/weight/weightinternal.cc index c261cdcc7..4e764d72c 100644 --- a/xapian-core/weight/weightinternal.cc +++ b/xapian-core/weight/weightinternal.cc @@ -52,7 +52,7 @@ TermFreqs::get_description() const { namespace Xapian { Weight::Internal & -Weight::Internal::operator +=(const Weight::Internal & inc) +Weight::Internal::operator+=(const Weight::Internal & inc) { #ifdef XAPIAN_ASSERTIONS Assert(!finalised); diff --git a/xapian-core/weight/weightinternal.h b/xapian-core/weight/weightinternal.h index 88d007672..2c62a396a 100644 --- a/xapian-core/weight/weightinternal.h +++ b/xapian-core/weight/weightinternal.h @@ -51,7 +51,7 @@ struct TermFreqs { collfreq(collfreq_), max_part(max_part_) {} - void operator +=(const TermFreqs & other) { + void operator+=(const TermFreqs & other) { termfreq += other.termfreq; reltermfreq += other.reltermfreq; collfreq += other.collfreq; @@ -121,7 +121,7 @@ class Weight::Internal { * Used for remote databases, where we pass across a serialised stats * object, unserialise it, and add it to our total. */ - Internal & operator +=(const Internal & inc); + Internal & operator+=(const Internal & inc); void set_query(const Xapian::Query &query_) { AssertEq(subdbs, 0); -- 2.11.4.GIT