Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:linkedprojecttest
mingw32-xapian-core
xapian-core-1.4.21-std-fixes.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xapian-core-1.4.21-std-fixes.patch of Package mingw32-xapian-core
diff -ur xapian-core-1.4.21/api/compactor.cc xapian-core-1.4.21/api/compactor.cc --- xapian-core-1.4.21/api/compactor.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/compactor.cc 2022-11-08 16:44:15.468461543 +0100 @@ -65,11 +65,11 @@ using namespace std; class CmpByFirstUsed { - const vector<pair<Xapian::docid, Xapian::docid>>& used_ranges; + const std::vector<pair<Xapian::docid, Xapian::docid>>& used_ranges; public: explicit - CmpByFirstUsed(const vector<pair<Xapian::docid, Xapian::docid>>& ur) + CmpByFirstUsed(const std::vector<pair<Xapian::docid, Xapian::docid>>& ur) : used_ranges(ur) { } bool operator()(size_t a, size_t b) const { @@ -82,11 +82,11 @@ class Compactor::Internal : public Xapian::Internal::intrusive_base { friend class Compactor; - string destdir_compat; + std::string destdir_compat; size_t block_size; unsigned flags; - vector<string> srcdirs_compat; + std::vector<string> srcdirs_compat; public: Internal() : block_size(8192), flags(FULL) { } @@ -109,13 +109,13 @@ } void -Compactor::set_destdir(const string & destdir) +Compactor::set_destdir(const std::string & destdir) { internal->destdir_compat = destdir; } void -Compactor::add_source(const string & srcdir) +Compactor::add_source(const std::string & srcdir) { internal->srcdirs_compat.push_back(srcdir); } @@ -132,14 +132,14 @@ } void -Compactor::set_status(const string & table, const string & status) +Compactor::set_status(const std::string & table, const std::string & status) { (void)table; (void)status; } string -Compactor::resolve_duplicate_metadata(const string & key, +Compactor::resolve_duplicate_metadata(const std::string & key, size_t num_tags, const std::string tags[]) { (void)key; @@ -152,15 +152,15 @@ XAPIAN_NORETURN( static void backend_mismatch(const Xapian::Database & db, int backend1, - const string &dbpath2, int backend2) + const std::string &dbpath2, int backend2) ); static void backend_mismatch(const Xapian::Database & db, int backend1, - const string &dbpath2, int backend2) + const std::string &dbpath2, int backend2) { - string dbpath1; + std::string dbpath1; db.internal[0]->get_backend_info(&dbpath1); - string msg = "All databases must be the same type ('"; + std::string msg = "All databases must be the same type ('"; msg += dbpath1; msg += "' is "; msg += backend_name(backend1); @@ -175,7 +175,7 @@ namespace Xapian { void -Database::compact_(const string * output_ptr, int fd, unsigned flags, +Database::compact_(const std::string * output_ptr, int fd, unsigned flags, int block_size, Xapian::Compactor * compactor) const { @@ -184,7 +184,7 @@ bool renumber = !(flags & DBCOMPACT_NO_RENUMBER); enum { STUB_NO, STUB_FILE, STUB_DIR } compact_to_stub = STUB_NO; - string destdir; + std::string destdir; if (output_ptr) { // We need a modifiable destdir in this function. destdir = *output_ptr; @@ -204,7 +204,7 @@ int backend = BACKEND_UNKNOWN; for (const auto& it : internal) { - string srcdir; + std::string srcdir; int type = it->get_backend_info(&srcdir); // Check destdir isn't the same as any source directory, unless it // is a stub database or we're compacting to an fd. @@ -226,9 +226,9 @@ Xapian::docid tot_off = 0; Xapian::docid last_docid = 0; - vector<Xapian::docid> offset; - vector<pair<Xapian::docid, Xapian::docid> > used_ranges; - vector<Xapian::Database::Internal *> internals; + std::vector<Xapian::docid> offset; + std::vector<pair<Xapian::docid, Xapian::docid> > used_ranges; + std::vector<Xapian::Database::Internal *> internals; offset.reserve(internal.size()); used_ranges.reserve(internal.size()); internals.reserve(internal.size()); @@ -308,14 +308,14 @@ internals_.push_back(internals[n]); used_ranges_.push_back(used_ranges[n]); - const pair<Xapian::docid, Xapian::docid> p = used_ranges[n]; + const std::pair<Xapian::docid, Xapian::docid> p = used_ranges[n]; // Skip empty databases. if (p.first == 0 && p.second == 0) continue; // Check for overlap with the previous database's range. if (p.first <= last_end) { - string tmp; - string msg = "when merging databases, --no-renumber is only currently supported if the databases have disjoint ranges of used document ids: "; + std::string tmp; + std::string msg = "when merging databases, --no-renumber is only currently supported if the databases have disjoint ranges of used document ids: "; internals_[j - 1]->get_backend_info(&tmp); msg += tmp; msg += " has range "; @@ -339,7 +339,7 @@ swap(used_ranges, used_ranges_); } - string stub_file; + std::string stub_file; if (compact_to_stub) { stub_file = destdir; if (compact_to_stub == STUB_DIR) { @@ -356,7 +356,7 @@ if (mkdir(destdir.c_str(), 0755) == 0) break; if (errno != EEXIST) { - string msg = destdir; + std::string msg = destdir; msg += ": mkdir failed"; throw Xapian::DatabaseError(msg, errno); } @@ -369,7 +369,7 @@ // that name. int mkdir_errno = errno; if (mkdir_errno != EEXIST || !dir_exists(destdir)) { - string msg = destdir; + std::string msg = destdir; msg += ": cannot create directory"; throw Xapian::DatabaseError(msg, mkdir_errno); } @@ -417,7 +417,7 @@ } if (compact_to_stub) { - string new_stub_file = destdir; + std::string new_stub_file = destdir; new_stub_file += "/new_stub.tmp"; { ofstream new_stub(new_stub_file.c_str()); @@ -425,7 +425,7 @@ new_stub << "auto " << destdir.substr(slash + 1) << '\n'; } if (!io_tmp_rename(new_stub_file, stub_file)) { - string msg = "Cannot rename '"; + std::string msg = "Cannot rename '"; msg += new_stub_file; msg += "' to '"; msg += stub_file; diff -ur xapian-core-1.4.21/api/documentterm.h xapian-core-1.4.21/api/documentterm.h --- xapian-core-1.4.21/api/documentterm.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/documentterm.h 2022-11-08 16:44:01.016512919 +0100 @@ -31,7 +31,8 @@ #include <xapian/types.h> -using namespace std; +using std::string; +using std::vector; /// A term in a document. class OmDocumentTerm { @@ -73,7 +74,7 @@ /** Merge sorted ranges before and after @a split. */ void merge() const; - typedef vector<Xapian::termpos> term_positions; + typedef std::vector<Xapian::termpos> term_positions; private: /** Positional information. @@ -182,8 +183,8 @@ */ bool is_deleted() const { return positions.empty() && split > 0; } - /// Return a string describing this object. - string get_description() const; + /// Return a std::string describing this object. + std::string get_description() const; }; #endif // OM_HGUARD_DOCUMENTTERM_H diff -ur xapian-core-1.4.21/api/documentvaluelist.cc xapian-core-1.4.21/api/documentvaluelist.cc --- xapian-core-1.4.21/api/documentvaluelist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/documentvaluelist.cc 2022-11-08 16:44:15.452461600 +0100 @@ -76,7 +76,7 @@ string DocumentValueList::get_description() const { - string desc = "DocumentValueList("; + std::string desc = "DocumentValueList("; if (!at_end()) { desc += "slot="; desc += str(get_valueno()); diff -ur xapian-core-1.4.21/api/error.cc xapian-core-1.4.21/api/error.cc --- xapian-core-1.4.21/api/error.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/error.cc 2022-11-08 16:44:15.476461514 +0100 @@ -92,7 +92,7 @@ string Xapian::Error::get_description() const { - string desc(get_type()); + std::string desc(get_type()); desc += ": "; desc += msg; if (!context.empty()) { diff -ur xapian-core-1.4.21/api/expanddecider.cc xapian-core-1.4.21/api/expanddecider.cc --- xapian-core-1.4.21/api/expanddecider.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/expanddecider.cc 2022-11-08 16:44:15.464461558 +0100 @@ -30,13 +30,13 @@ ExpandDecider::~ExpandDecider() { } bool -ExpandDeciderAnd::operator()(const string &term) const +ExpandDeciderAnd::operator()(const std::string &term) const { return (*first)(term) && (*second)(term); } bool -ExpandDeciderFilterTerms::operator()(const string &term) const +ExpandDeciderFilterTerms::operator()(const std::string &term) const { /* Some older compilers (such as Sun's CC) return an iterator from find() * and a const_iterator from end() in this situation, and then can't @@ -47,7 +47,7 @@ } bool -ExpandDeciderFilterPrefix::operator()(const string &term) const +ExpandDeciderFilterPrefix::operator()(const std::string &term) const { return startswith(term, prefix); } diff -ur xapian-core-1.4.21/api/keymaker.cc xapian-core-1.4.21/api/keymaker.cc --- xapian-core-1.4.21/api/keymaker.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/keymaker.cc 2022-11-08 16:44:15.448461615 +0100 @@ -37,7 +37,7 @@ string MultiValueKeyMaker::operator()(const Xapian::Document & doc) const { - string result; + std::string result; auto i = slots.begin(); // Don't crash if slots is empty. @@ -49,7 +49,7 @@ // be adjusted. // // FIXME: allow Xapian::BAD_VALUENO to mean "relevance?" - string v = doc.get_value(i->slot); + std::string v = doc.get_value(i->slot); bool reverse_sort = i->reverse; if (v.empty()) { diff -ur xapian-core-1.4.21/api/leafpostlist.cc xapian-core-1.4.21/api/leafpostlist.cc --- xapian-core-1.4.21/api/leafpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/leafpostlist.cc 2022-11-08 16:44:15.476461514 +0100 @@ -101,7 +101,7 @@ stats.rset_size, stats.total_length)); } - map<string, TermFreqs>::const_iterator i = stats.termfreqs.find(term); + std::map<string, TermFreqs>::const_iterator i = stats.termfreqs.find(term); Assert(i != stats.termfreqs.end()); RETURN(i->second); } diff -ur xapian-core-1.4.21/api/maptermlist.h xapian-core-1.4.21/api/maptermlist.h --- xapian-core-1.4.21/api/maptermlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/maptermlist.h 2022-11-08 16:44:01.012512934 +0100 @@ -30,7 +30,7 @@ #include "omassert.h" -using namespace std; +using std::string; class MapTermList : public TermList { private: @@ -52,7 +52,7 @@ } // Gets current termname - string get_termname() const { + std::string get_termname() const { Assert(started); Assert(!at_end()); return it->first; diff -ur xapian-core-1.4.21/api/matchspy.cc xapian-core-1.4.21/api/matchspy.cc --- xapian-core-1.4.21/api/matchspy.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/matchspy.cc 2022-11-08 16:44:15.472461529 +0100 @@ -66,7 +66,7 @@ } MatchSpy * -MatchSpy::unserialise(const string &, const Registry &) const { +MatchSpy::unserialise(const std::string &, const Registry &) const { throw UnimplementedError("MatchSpy not suitable for use with remote searches - unserialise() method unimplemented"); } @@ -76,7 +76,7 @@ } void -MatchSpy::merge_results(const string &) { +MatchSpy::merge_results(const std::string &) { throw UnimplementedError("MatchSpy not suitable for use with remote searches - merge_results() method unimplemented"); } @@ -93,7 +93,7 @@ /// A termlist iterator over the contents of a ValueCountMatchSpy class ValueCountTermList final : public TermList { private: - map<string, Xapian::doccount>::const_iterator it; + std::map<string, Xapian::doccount>::const_iterator it; bool started; intrusive_ptr<Xapian::ValueCountMatchSpy::Internal> spy; public: @@ -105,7 +105,7 @@ started = false; } - string get_termname() const { + std::string get_termname() const { Assert(started); Assert(!at_end()); return it->first; @@ -127,7 +127,7 @@ return NULL; } - TermList * skip_to(const string & term) { + TermList * skip_to(const std::string & term) { while (it != spy->values.end() && it->first < term) { ++it; } @@ -149,7 +149,7 @@ Xapian::termcount positionlist_count() const { unsupported_method(); return 0; } }; -/** A string with a corresponding frequency. +/** A std::string with a corresponding frequency. */ class StringAndFrequency { std::string str; @@ -189,10 +189,10 @@ /// A termlist iterator over a vector of StringAndFrequency objects. class StringAndFreqTermList final : public TermList { private: - vector<StringAndFrequency>::const_iterator it; + std::vector<StringAndFrequency>::const_iterator it; bool started; public: - vector<StringAndFrequency> values; + std::vector<StringAndFrequency> values; /** init should be called after the values have been set, but before * iteration begins. @@ -202,7 +202,7 @@ started = false; } - string get_termname() const { + std::string get_termname() const { Assert(started); Assert(!at_end()); return it->get_string(); @@ -224,7 +224,7 @@ return NULL; } - TermList * skip_to(const string & term) { + TermList * skip_to(const std::string & term) { while (it != values.end() && it->get_string() < term) { ++it; } @@ -246,7 +246,7 @@ Xapian::termcount positionlist_count() const { unsupported_method(); return 0; } }; -/** Get the most frequent items from a map from string to frequency. +/** Get the most frequent items from a map from std::string to frequency. * * This takes input such as that in ValueCountMatchSpy::Internal::values and * returns a vector of the most frequent items in the input. @@ -256,14 +256,14 @@ * the same frequency will be sorted in ascending * alphabetical order. * - * @param items The map from string to frequency, from which the most + * @param items The map from std::string to frequency, from which the most * frequent items will be selected. * * @param maxitems The maximum number of items to return. */ static void get_most_frequent_items(vector<StringAndFrequency> & result, - const map<string, doccount> & items, + const std::map<string, doccount> & items, size_t maxitems) { result.clear(); @@ -271,7 +271,7 @@ StringAndFreqCmpByFreq cmpfn; bool is_heap(false); - for (map<string, doccount>::const_iterator i = items.begin(); + for (std::map<string, doccount>::const_iterator i = items.begin(); i != items.end(); ++i) { Assert(result.size() <= maxitems); result.push_back(StringAndFrequency(i->first, i->second)); @@ -301,7 +301,7 @@ ValueCountMatchSpy::operator()(const Document &doc, double) { Assert(internal.get()); ++(internal->total); - string val(doc.get_value(internal->slot)); + std::string val(doc.get_value(internal->slot)); if (!val.empty()) ++(internal->values[val]); } @@ -336,13 +336,13 @@ string ValueCountMatchSpy::serialise() const { Assert(internal.get()); - string result; + std::string result; result += encode_length(internal->slot); return result; } MatchSpy * -ValueCountMatchSpy::unserialise(const string & s, const Registry &) const +ValueCountMatchSpy::unserialise(const std::string & s, const Registry &) const { const char * p = s.data(); const char * end = p + s.size(); @@ -360,10 +360,10 @@ ValueCountMatchSpy::serialise_results() const { LOGCALL(REMOTE, string, "ValueCountMatchSpy::serialise_results", NO_ARGS); Assert(internal.get()); - string result; + std::string result; result += encode_length(internal->total); result += encode_length(internal->values.size()); - for (map<string, doccount>::const_iterator i = internal->values.begin(); + for (std::map<string, doccount>::const_iterator i = internal->values.begin(); i != internal->values.end(); ++i) { result += encode_length(i->first.size()); result += i->first; @@ -373,7 +373,7 @@ } void -ValueCountMatchSpy::merge_results(const string & s) { +ValueCountMatchSpy::merge_results(const std::string & s) { LOGCALL_VOID(REMOTE, "ValueCountMatchSpy::merge_results", s); Assert(internal.get()); const char * p = s.data(); @@ -383,12 +383,12 @@ decode_length(&p, end, n); internal->total += n; - map<string, doccount>::size_type items; + std::map<string, doccount>::size_type items; decode_length(&p, end, items); while (items != 0) { size_t vallen; decode_length_and_check(&p, end, vallen); - string val(p, vallen); + std::string val(p, vallen); p += vallen; doccount freq; decode_length(&p, end, freq); @@ -403,7 +403,7 @@ string ValueCountMatchSpy::get_description() const { - string d = "ValueCountMatchSpy("; + std::string d = "ValueCountMatchSpy("; if (internal.get()) { d += str(internal->total); d += " docs seen, looking in "; diff -ur xapian-core-1.4.21/api/omdatabase.cc xapian-core-1.4.21/api/omdatabase.cc --- xapian-core-1.4.21/api/omdatabase.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/omdatabase.cc 2022-11-08 16:44:15.464461558 +0100 @@ -126,7 +126,7 @@ { LOGCALL(API, bool, "Database::reopen", NO_ARGS); bool maybe_changed = false; - vector<intrusive_ptr<Database::Internal> >::iterator i; + std::vector<intrusive_ptr<Database::Internal> >::iterator i; for (i = internal.begin(); i != internal.end(); ++i) { if ((*i)->reopen()) maybe_changed = true; @@ -138,7 +138,7 @@ Database::close() { LOGCALL_VOID(API, "Database::close", NO_ARGS); - vector<intrusive_ptr<Database::Internal> >::iterator i; + std::vector<intrusive_ptr<Database::Internal> >::iterator i; for (i = internal.begin(); i != internal.end(); ++i) { (*i)->close(); } @@ -152,14 +152,14 @@ LOGLINE(API, "Database added to itself"); throw Xapian::InvalidArgumentError("Can't add a Database to itself"); } - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = database.internal.begin(); i != database.internal.end(); ++i) { internal.push_back(*i); } } PostingIterator -Database::postlist_begin(const string &tname) const +Database::postlist_begin(const std::string &tname) const { LOGCALL(API, PostingIterator, "Database::postlist_begin", tname); @@ -174,7 +174,7 @@ if (rare(internal.empty())) RETURN(PostingIterator()); - vector<LeafPostList *> pls; + std::vector<LeafPostList *> pls; try { vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { @@ -239,7 +239,7 @@ { LOGCALL(API, bool, "Database::has_positions", NO_ARGS); // If any sub-database has positions, the combined database does. - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { if ((*i)->has_positions()) RETURN(true); } @@ -247,7 +247,7 @@ } PositionIterator -Database::positionlist_begin(Xapian::docid did, const string &tname) const +Database::positionlist_begin(Xapian::docid did, const std::string &tname) const { LOGCALL(API, PositionIterator, "Database::positionlist_begin", did | tname); if (tname.empty()) @@ -268,7 +268,7 @@ { LOGCALL(API, Xapian::doccount, "Database::get_doccount", NO_ARGS); Xapian::doccount docs = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { docs += (*i)->get_doccount(); } @@ -296,7 +296,7 @@ Xapian::doccount docs = 0; Xapian::totallength totlen = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { docs += (*i)->get_doccount(); totlen += (*i)->get_total_length(); @@ -320,13 +320,13 @@ } Xapian::doccount -Database::get_termfreq(const string & tname) const +Database::get_termfreq(const std::string & tname) const { LOGCALL(API, Xapian::doccount, "Database::get_termfreq", tname); if (tname.empty()) RETURN(get_doccount()); Xapian::doccount tf = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { Xapian::doccount sub_tf; (*i)->get_freqs(tname, &sub_tf, NULL); @@ -336,13 +336,13 @@ } Xapian::termcount -Database::get_collection_freq(const string & tname) const +Database::get_collection_freq(const std::string & tname) const { LOGCALL(API, Xapian::termcount, "Database::get_collection_freq", tname); if (tname.empty()) RETURN(get_doccount()); Xapian::termcount cf = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { Xapian::termcount sub_cf; (*i)->get_freqs(tname, NULL, &sub_cf); @@ -357,7 +357,7 @@ LOGCALL(API, Xapian::doccount, "Database::get_value_freq", slot); Xapian::doccount vf = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { vf += (*i)->get_value_freq(slot); } @@ -371,9 +371,9 @@ if (rare(internal.empty())) RETURN(string()); - string full_lb; + std::string full_lb; for (auto&& subdb : internal) { - string lb = subdb->get_value_lower_bound(slot); + std::string lb = subdb->get_value_lower_bound(slot); if (lb.empty()) continue; if (full_lb.empty() || lb < full_lb) @@ -388,7 +388,7 @@ LOGCALL(API, std::string, "Database::get_value_upper_bound", slot); std::string full_ub; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { std::string ub = (*i)->get_value_upper_bound(slot); if (ub > full_ub) @@ -405,7 +405,7 @@ if (rare(internal.empty())) RETURN(0); Xapian::termcount full_lb = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { // Skip sub-databases which are empty or only contain documents with // doclen==0. @@ -423,7 +423,7 @@ LOGCALL(API, Xapian::termcount, "Database::get_doclength_upper_bound", NO_ARGS); Xapian::termcount full_ub = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { Xapian::termcount ub = (*i)->get_doclength_upper_bound(); if (ub > full_ub) full_ub = ub; @@ -432,13 +432,13 @@ } Xapian::termcount -Database::get_wdf_upper_bound(const string & term) const +Database::get_wdf_upper_bound(const std::string & term) const { LOGCALL(API, Xapian::termcount, "Database::get_wdf_upper_bound", term); if (term.empty()) RETURN(0); Xapian::termcount full_ub = 0; - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { Xapian::termcount ub = (*i)->get_wdf_upper_bound(term); if (ub > full_ub) full_ub = ub; @@ -521,13 +521,13 @@ } bool -Database::term_exists(const string & tname) const +Database::term_exists(const std::string & tname) const { LOGCALL(API, bool, "Database::term_exists", tname); if (tname.empty()) { RETURN(get_doccount() != 0); } - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { if ((*i)->term_exists(tname)) RETURN(true); } @@ -538,7 +538,7 @@ Database::keep_alive() { LOGCALL_VOID(API, "Database::keep_alive", NO_ARGS); - vector<intrusive_ptr<Database::Internal> >::const_iterator i; + std::vector<intrusive_ptr<Database::Internal> >::const_iterator i; for (i = internal.begin(); i != internal.end(); ++i) { (*i)->keep_alive(); } @@ -564,11 +564,11 @@ #define VEC_SIZE 64 static int -freq_edit_lower_bound(const vector<unsigned> & a, const vector<unsigned> & b) +freq_edit_lower_bound(const std::vector<unsigned> & a, const std::vector<unsigned> & b) { int vec[VEC_SIZE]; memset(vec, 0, sizeof(vec)); - vector<unsigned>::const_iterator i; + std::vector<unsigned>::const_iterator i; for (i = a.begin(); i != a.end(); ++i) { ++vec[(*i) % VEC_SIZE]; } @@ -591,7 +591,7 @@ #define TRIGRAM_SCORE_THRESHOLD 2 string -Database::get_spelling_suggestion(const string &word, +Database::get_spelling_suggestion(const std::string &word, unsigned max_edit_distance) const { LOGCALL(API, string, "Database::get_spelling_suggestion", word | max_edit_distance); @@ -616,12 +616,12 @@ // Convert word to UTF-32. // Extra brackets needed to avoid this being misparsed as a function // prototype. - vector<unsigned> utf32_word((Utf8Iterator(word)), Utf8Iterator()); + std::vector<unsigned> utf32_word((Utf8Iterator(word)), Utf8Iterator()); - vector<unsigned> utf32_term; + std::vector<unsigned> utf32_term; Xapian::termcount best = 1; - string result; + std::string result; int edist_best = max_edit_distance; Xapian::doccount freq_best = 0; Xapian::doccount freq_exact = 0; @@ -631,7 +631,7 @@ if (merger->at_end()) break; - string term = merger->get_termname(); + std::string term = merger->get_termname(); Xapian::termcount score = merger->get_wdf(); LOGLINE(SPELLING, "Term \"" << term << "\" ngram score " << score); @@ -755,7 +755,7 @@ } string -Database::get_metadata(const string & key) const +Database::get_metadata(const std::string & key) const { LOGCALL(API, string, "Database::get_metadata", key); if (rare(key.empty())) @@ -776,9 +776,9 @@ Database::get_uuid() const { LOGCALL(API, std::string, "Database::get_uuid", NO_ARGS); - string uuid; + std::string uuid; for (size_t i = 0; i < internal.size(); ++i) { - string sub_uuid = internal[i]->get_uuid(); + std::string sub_uuid = internal[i]->get_uuid(); // If any of the sub-databases have no uuid, we can't make a uuid for // the combined database. if (sub_uuid.empty()) @@ -1061,7 +1061,7 @@ } void -WritableDatabase::set_metadata(const string & key, const string & value) +WritableDatabase::set_metadata(const std::string & key, const std::string & value) { LOGCALL_VOID(API, "WritableDatabase::set_metadata", key | value); if (rare(key.empty())) diff -ur xapian-core-1.4.21/api/omdocument.cc xapian-core-1.4.21/api/omdocument.cc --- xapian-core-1.4.21/api/omdocument.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/omdocument.cc 2022-11-08 16:44:15.452461600 +0100 @@ -75,7 +75,7 @@ } void -Document::set_data(const string &data) +Document::set_data(const std::string &data) { LOGCALL_VOID(API, "Document::set_data", data); internal->set_data(data); @@ -104,7 +104,7 @@ } void -Document::add_value(Xapian::valueno slot, const string &value) +Document::add_value(Xapian::valueno slot, const std::string &value) { LOGCALL_VOID(API, "Document::add_value", slot | value); internal->add_value(slot, value); @@ -125,7 +125,7 @@ } void -Document::add_posting(const string & tname, +Document::add_posting(const std::string & tname, Xapian::termpos tpos, Xapian::termcount wdfinc) { @@ -137,7 +137,7 @@ } void -Document::add_term(const string & tname, Xapian::termcount wdfinc) +Document::add_term(const std::string & tname, Xapian::termcount wdfinc) { LOGCALL_VOID(API, "Document::add_term", tname | wdfinc); if (tname.empty()) { @@ -147,7 +147,7 @@ } void -Document::remove_posting(const string & tname, Xapian::termpos tpos, +Document::remove_posting(const std::string & tname, Xapian::termpos tpos, Xapian::termcount wdfdec) { LOGCALL_VOID(API, "Document::remove_posting", tname | tpos | wdfdec); @@ -174,7 +174,7 @@ } void -Document::remove_term(const string & tname) +Document::remove_term(const std::string & tname) { LOGCALL_VOID(API, "Document::remove_term", tname); internal->remove_term(tname); @@ -296,7 +296,7 @@ // Search for the position the term occurs at. Use binary chop to // search, since this is a sorted list. - vector<Xapian::termpos>::iterator i; + std::vector<Xapian::termpos>::iterator i; i = lower_bound(positions.begin(), positions.end(), tpos); if (i == positions.end() || *i != tpos) { auto new_split = positions.size(); @@ -387,7 +387,7 @@ string OmDocumentTerm::get_description() const { - string description; + std::string description; description = "OmDocumentTerm(wdf = "; description += str(wdf); description += ", positions["; @@ -400,7 +400,7 @@ Xapian::Document::Internal::get_value(Xapian::valueno slot) const { if (values_here) { - map<Xapian::valueno, string>::const_iterator i; + std::map<Xapian::valueno, string>::const_iterator i; i = values.find(slot); if (i == values.end()) return string(); return i->second; @@ -419,7 +419,7 @@ } void -Xapian::Document::Internal::set_data(const string &data_) +Xapian::Document::Internal::set_data(const std::string &data_) { data = data_; data_here = true; @@ -437,7 +437,7 @@ } void -Xapian::Document::Internal::add_value(Xapian::valueno slot, const string &value) +Xapian::Document::Internal::add_value(Xapian::valueno slot, const std::string &value) { need_values(); if (!value.empty()) { @@ -453,7 +453,7 @@ Xapian::Document::Internal::remove_value(Xapian::valueno slot) { need_values(); - map<Xapian::valueno, string>::iterator i = values.find(slot); + std::map<Xapian::valueno, string>::iterator i = values.find(slot); if (i == values.end()) { throw Xapian::InvalidArgumentError("Value #" + str(slot) + " is not present in document, in " @@ -470,13 +470,13 @@ } void -Xapian::Document::Internal::add_posting(const string & tname, Xapian::termpos tpos, +Xapian::Document::Internal::add_posting(const std::string & tname, Xapian::termpos tpos, Xapian::termcount wdfinc) { need_terms(); positions_modified = true; - map<string, OmDocumentTerm>::iterator i; + std::map<string, OmDocumentTerm>::iterator i; i = terms.find(tname); if (i == terms.end()) { ++termlist_size; @@ -490,11 +490,11 @@ } void -Xapian::Document::Internal::add_term(const string & tname, Xapian::termcount wdfinc) +Xapian::Document::Internal::add_term(const std::string & tname, Xapian::termcount wdfinc) { need_terms(); - map<string, OmDocumentTerm>::iterator i; + std::map<string, OmDocumentTerm>::iterator i; i = terms.find(tname); if (i == terms.end()) { ++termlist_size; @@ -507,13 +507,13 @@ } void -Xapian::Document::Internal::remove_posting(const string & tname, +Xapian::Document::Internal::remove_posting(const std::string & tname, Xapian::termpos tpos, Xapian::termcount wdfdec) { need_terms(); - map<string, OmDocumentTerm>::iterator i; + std::map<string, OmDocumentTerm>::iterator i; i = terms.find(tname); if (i == terms.end() || i->second.is_deleted()) { if (tname.empty()) @@ -559,10 +559,10 @@ } void -Xapian::Document::Internal::remove_term(const string & tname) +Xapian::Document::Internal::remove_term(const std::string & tname) { need_terms(); - map<string, OmDocumentTerm>::iterator i; + std::map<string, OmDocumentTerm>::iterator i; i = terms.find(tname); if (i == terms.end() || i->second.is_deleted()) { if (tname.empty()) @@ -633,7 +633,7 @@ string Xapian::Document::Internal::get_description() const { - string desc = "Document("; + std::string desc = "Document("; // description_append ? if (data_here) { diff -ur xapian-core-1.4.21/api/omenquire.cc xapian-core-1.4.21/api/omenquire.cc --- xapian-core-1.4.21/api/omenquire.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/omenquire.cc 2022-11-08 16:44:15.476461514 +0100 @@ -128,7 +128,7 @@ string RSet::Internal::get_description() const { - string description("RSet::Internal("); + std::string description("RSet::Internal("); set<Xapian::docid>::const_iterator i; for (i = items.begin(); i != items.end(); ++i) { @@ -148,7 +148,7 @@ string MSetItem::get_description() const { - string description; + std::string description; description = str(did) + ", " + str(wt) + ", " + collapse_key; @@ -203,7 +203,7 @@ } Xapian::doccount -MSet::get_termfreq(const string &tname) const +MSet::get_termfreq(const std::string &tname) const { LOGCALL(API, Xapian::doccount, "Xapian::MSet::get_termfreq", tname); Assert(internal.get() != 0); @@ -219,7 +219,7 @@ } double -MSet::get_termweight(const string &tname) const +MSet::get_termweight(const std::string &tname) const { LOGCALL(API, double, "Xapian::MSet::get_termweight", tname); Assert(internal.get() != 0); @@ -228,7 +228,7 @@ } double termweight; if (!internal->stats->get_termweight(tname, termweight)) { - string msg = tname; + std::string msg = tname; msg += ": termweight not available"; throw InvalidArgumentError(msg); } @@ -301,13 +301,13 @@ } string -MSet::snippet(const string & text, +MSet::snippet(const std::string & text, size_t length, const Xapian::Stem & stemmer, unsigned flags, - const string & hi_start, - const string & hi_end, - const string & omit) const + const std::string & hi_start, + const std::string & hi_end, + const std::string & omit) const { Assert(internal.get() != 0); return internal->snippet(text, length, stemmer, flags, @@ -351,7 +351,7 @@ { LOGCALL(MATCH, Document, "Xapian::MSet::Internal::get_doc_by_index", index); index += firstitem; - map<Xapian::doccount, Document>::const_iterator doc; + std::map<Xapian::doccount, Document>::const_iterator doc; doc = indexeddocs.find(index); if (doc != indexeddocs.end()) { RETURN(doc->second); @@ -384,7 +384,7 @@ if (last > items.size() - 1) last = items.size() - 1; for (Xapian::doccount i = first; i <= last; ++i) { - map<Xapian::doccount, Document>::const_iterator doc; + std::map<Xapian::doccount, Document>::const_iterator doc; doc = indexeddocs.find(i); if (doc == indexeddocs.end()) { /* We don't have the document cached */ @@ -402,7 +402,7 @@ string MSet::Internal::get_description() const { - string description = "Xapian::MSet::Internal("; + std::string description = "Xapian::MSet::Internal("; description += "firstitem=" + str(firstitem) + ", " + "matches_lower_bound=" + str(matches_lower_bound) + ", " + @@ -639,13 +639,13 @@ class ByQueryIndexCmp { private: - typedef map<string, unsigned int> tmap_t; + typedef std::map<string, unsigned int> tmap_t; const tmap_t &tmap; public: explicit ByQueryIndexCmp(const tmap_t &tmap_) : tmap(tmap_) {} - bool operator()(const string &left, - const string &right) const { + bool operator()(const std::string &left, + const std::string &right) const { tmap_t::const_iterator l, r; l = tmap.find(left); r = tmap.find(right); @@ -667,26 +667,26 @@ // copy the list of query terms into a map for faster access. // FIXME: a hash would be faster than a map, if this becomes // a problem. - map<string, unsigned int> tmap; + std::map<string, unsigned int> tmap; unsigned int index = 1; for ( ; qt != query.get_terms_end(); ++qt) { if (tmap.find(*qt) == tmap.end()) tmap[*qt] = index++; } - vector<string> matching_terms; + std::vector<string> matching_terms; TermIterator docterms = db.termlist_begin(did); TermIterator docterms_end = db.termlist_end(did); while (docterms != docterms_end) { - string term = *docterms; - map<string, unsigned int>::iterator t = tmap.find(term); + std::string term = *docterms; + std::map<string, unsigned int>::iterator t = tmap.find(term); if (t != tmap.end()) matching_terms.push_back(term); ++docterms; } // sort the resulting list by query position. - sort(matching_terms.begin(), matching_terms.end(), ByQueryIndexCmp(tmap)); + std::sort(matching_terms.begin(), matching_terms.end(), ByQueryIndexCmp(tmap)); return TermIterator(new VectorTermList(matching_terms.begin(), matching_terms.end())); @@ -701,7 +701,7 @@ } Xapian::doccount -Enquire::Internal::get_termfreq(const string &tname) const +Enquire::Internal::get_termfreq(const std::string &tname) const { return db.get_termfreq(tname); } @@ -709,7 +709,7 @@ string Enquire::Internal::get_description() const { - string description = db.get_description(); + std::string description = db.get_description(); description += ", "; description += query.get_description(); return description; diff -ur xapian-core-1.4.21/api/omenquireinternal.h xapian-core-1.4.21/api/omenquireinternal.h --- xapian-core-1.4.21/api/omenquireinternal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/omenquireinternal.h 2022-11-08 16:44:01.020512905 +0100 @@ -40,7 +40,7 @@ #include "weight/weightinternal.h" -using namespace std; +using std::string; class OmExpand; class MultiMatch; @@ -60,10 +60,10 @@ MSetItem(double wt_, Xapian::docid did_) : wt(wt_), did(did_), collapse_count(0) {} - MSetItem(double wt_, Xapian::docid did_, const string &key_) + MSetItem(double wt_, Xapian::docid did_, const std::string &key_) : wt(wt_), did(did_), collapse_key(key_), collapse_count(0) {} - MSetItem(double wt_, Xapian::docid did_, const string &key_, + MSetItem(double wt_, Xapian::docid did_, const std::string &key_, Xapian::doccount collapse_count_) : wt(wt_), did(did_), collapse_key(key_), collapse_count(collapse_count_) {} @@ -93,7 +93,7 @@ * of each key value (apart from the null string) will be present in * the items in the returned Xapian::MSet. */ - string collapse_key; + std::string collapse_key; /** Count of collapses done on collapse_key so far * @@ -104,10 +104,10 @@ Xapian::doccount collapse_count; /** Used when sorting by value. */ - string sort_key; + std::string sort_key; - /// Return a string describing this object. - string get_description() const; + /// Return a std::string describing this object. + std::string get_description() const; }; } @@ -167,7 +167,7 @@ /// The parameter required for TradWeight query expansion. double expand_k; - vector<Xapian::Internal::opt_intrusive_ptr<MatchSpy>> spies; + std::vector<Xapian::Internal::opt_intrusive_ptr<MatchSpy>> spies; explicit Internal(const Xapian::Database &databases); ~Internal(); @@ -195,9 +195,9 @@ TermIterator get_matching_terms(Xapian::docid did) const; TermIterator get_matching_terms(const Xapian::MSetIterator &it) const; - Xapian::doccount get_termfreq(const string &tname) const; + Xapian::doccount get_termfreq(const std::string &tname) const; - string get_description() const; + std::string get_description() const; }; class MSet::Internal : public Xapian::Internal::intrusive_base { @@ -209,10 +209,10 @@ /** The set of documents which have been requested but not yet * collected. */ - mutable set<Xapian::doccount> requested_docs; + mutable std::set<Xapian::doccount> requested_docs; /// Cache of documents, indexed by MSet index. - mutable map<Xapian::doccount, Xapian::Document> indexeddocs; + mutable std::map<Xapian::doccount, Xapian::Document> indexeddocs; /// Read and cache the documents so far requested. void read_docs() const; @@ -232,7 +232,7 @@ Xapian::Weight::Internal * stats; /// A list of items comprising the (selected part of the) MSet. - vector<Xapian::Internal::MSetItem> items; + std::vector<Xapian::Internal::MSetItem> items; /// Rank of first item in MSet. Xapian::doccount firstitem; @@ -276,7 +276,7 @@ Xapian::doccount uncollapsed_estimated_, double max_possible_, double max_attained_, - vector<Xapian::Internal::MSetItem> &items_, + std::vector<Xapian::Internal::MSetItem> &items_, double percent_factor_) : percent_factor(percent_factor_), stats(NULL), @@ -307,8 +307,8 @@ const std::string & hi_end, const std::string & omit) const; - /// Return a string describing this object. - string get_description() const; + /// Return a std::string describing this object. + std::string get_description() const; /** Fetch items specified into the document cache. */ @@ -320,13 +320,13 @@ private: /// Items in the relevance set. - set<Xapian::docid> items; + std::set<Xapian::docid> items; public: - const set<Xapian::docid> & get_items() const { return items; } + const std::set<Xapian::docid> & get_items() const { return items; } - /// Return a string describing this object. - string get_description() const; + /// Return a std::string describing this object. + std::string get_description() const; }; } diff -ur xapian-core-1.4.21/api/positioniterator.cc xapian-core-1.4.21/api/positioniterator.cc --- xapian-core-1.4.21/api/positioniterator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/positioniterator.cc 2022-11-08 16:44:15.460461571 +0100 @@ -112,7 +112,7 @@ PositionIterator::get_description() const { #if 0 // FIXME: Add PositionIterator::Internal::get_description() method. - string desc = "PositionIterator("; + std::string desc = "PositionIterator("; if (internal) desc += internal->get_description(); desc += ')'; diff -ur xapian-core-1.4.21/api/postingiterator.cc xapian-core-1.4.21/api/postingiterator.cc --- xapian-core-1.4.21/api/postingiterator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/postingiterator.cc 2022-11-08 16:44:15.472461529 +0100 @@ -159,7 +159,7 @@ std::string PostingIterator::get_description() const { - string desc = "PostingIterator("; + std::string desc = "PostingIterator("; if (internal) desc += internal->get_description(); desc += ')'; diff -ur xapian-core-1.4.21/api/postingsource.cc xapian-core-1.4.21/api/postingsource.cc --- xapian-core-1.4.21/api/postingsource.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/postingsource.cc 2022-11-08 16:44:15.456461586 +0100 @@ -99,7 +99,7 @@ } PostingSource * -PostingSource::unserialise(const string &) const +PostingSource::unserialise(const std::string &) const { throw Xapian::UnimplementedError("unserialise() not supported for this PostingSource"); } @@ -256,7 +256,7 @@ } ValueWeightPostingSource * -ValueWeightPostingSource::unserialise(const string &s) const +ValueWeightPostingSource::unserialise(const std::string &s) const { const char * p = s.data(); const char * end = p + s.size(); @@ -275,7 +275,7 @@ { ValuePostingSource::init(db_); - string upper_bound = get_database().get_value_upper_bound(get_slot()); + std::string upper_bound = get_database().get_value_upper_bound(get_slot()); if (upper_bound.empty()) { // This should only happen if there are no entries, in which case the // maxweight is 0. @@ -288,7 +288,7 @@ string ValueWeightPostingSource::get_description() const { - string desc("Xapian::ValueWeightPostingSource(slot="); + std::string desc("Xapian::ValueWeightPostingSource(slot="); desc += str(get_slot()); desc += ")"; return desc; @@ -303,7 +303,7 @@ } void -ValueMapPostingSource::add_mapping(const string & key, double wt) +ValueMapPostingSource::add_mapping(const std::string & key, double wt) { weight_map[key] = wt; max_weight_in_map = max(wt, max_weight_in_map); @@ -325,7 +325,7 @@ double ValueMapPostingSource::get_weight() const { - map<string, double>::const_iterator wit = weight_map.find(get_value()); + std::map<string, double>::const_iterator wit = weight_map.find(get_value()); if (wit == weight_map.end()) { return default_weight; } @@ -336,7 +336,7 @@ ValueMapPostingSource::clone() const { AutoPtr<ValueMapPostingSource> res(new ValueMapPostingSource(get_slot())); - map<string, double>::const_iterator i; + std::map<string, double>::const_iterator i; for (i = weight_map.begin(); i != weight_map.end(); ++i) { res->add_mapping(i->first, i->second); } @@ -353,10 +353,10 @@ string ValueMapPostingSource::serialise() const { - string result = encode_length(get_slot()); + std::string result = encode_length(get_slot()); result += serialise_double(default_weight); - map<string, double>::const_iterator i; + std::map<string, double>::const_iterator i; for (i = weight_map.begin(); i != weight_map.end(); ++i) { result.append(encode_length(i->first.size())); result.append(i->first); @@ -367,7 +367,7 @@ } ValueMapPostingSource * -ValueMapPostingSource::unserialise(const string &s) const +ValueMapPostingSource::unserialise(const std::string &s) const { const char * p = s.data(); const char * end = p + s.size(); @@ -379,7 +379,7 @@ while (p != end) { size_t keylen; decode_length_and_check(&p, end, keylen); - string key(p, keylen); + std::string key(p, keylen); p += keylen; res->add_mapping(key, unserialise_double(&p, end)); } @@ -396,7 +396,7 @@ string ValueMapPostingSource::get_description() const { - string desc("Xapian::ValueMapPostingSource(slot="); + std::string desc("Xapian::ValueMapPostingSource(slot="); desc += str(get_slot()); desc += ")"; return desc; @@ -521,7 +521,7 @@ } FixedWeightPostingSource * -FixedWeightPostingSource::unserialise(const string &s) const +FixedWeightPostingSource::unserialise(const std::string &s) const { const char * p = s.data(); const char * s_end = p + s.size(); @@ -544,7 +544,7 @@ string FixedWeightPostingSource::get_description() const { - string desc("Xapian::FixedWeightPostingSource(wt="); + std::string desc("Xapian::FixedWeightPostingSource(wt="); desc += str(get_maxweight()); desc += ")"; return desc; diff -ur xapian-core-1.4.21/api/postlist.cc xapian-core-1.4.21/api/postlist.cc --- xapian-core-1.4.21/api/postlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/postlist.cc 2022-11-08 16:44:15.448461615 +0100 @@ -46,13 +46,13 @@ throw Xapian::InvalidOperationError("get_wdf() not meaningful for this PostingIterator"); } -const string * +const std::string * PostingIterator::Internal::get_sort_key() const { return NULL; } -const string * +const std::string * PostingIterator::Internal::get_collapse_key() const { return NULL; diff -ur xapian-core-1.4.21/api/postlist.h xapian-core-1.4.21/api/postlist.h --- xapian-core-1.4.21/api/postlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/postlist.h 2022-11-08 16:44:01.016512919 +0100 @@ -205,7 +205,7 @@ /// Gather PositionList* objects for a subtree. virtual void gather_position_lists(OrPositionList* orposlist); - /// Return a string description of this object. + /// Return a std::string description of this object. virtual std::string get_description() const = 0; }; diff -ur xapian-core-1.4.21/api/query.cc xapian-core-1.4.21/api/query.cc --- xapian-core-1.4.21/api/query.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/query.cc 2022-11-08 16:44:15.456461586 +0100 @@ -40,7 +40,7 @@ const Query Query::MatchNothing; -Query::Query(const string & term, Xapian::termcount wqf, Xapian::termpos pos) +Query::Query(const std::string & term, Xapian::termcount wqf, Xapian::termpos pos) : internal(new Xapian::Internal::QueryTerm(term, wqf, pos)) { LOGCALL_CTOR(API, "Query", term | wqf | pos); @@ -137,12 +137,12 @@ if (!internal.get()) return TermIterator(); - vector<pair<Xapian::termpos, string>> terms; + std::vector<pair<Xapian::termpos, string>> terms; internal->gather_terms(static_cast<void*>(&terms)); sort(terms.begin(), terms.end()); - vector<string> v; - const string * old_term = NULL; + std::vector<string> v; + const std::string * old_term = NULL; Xapian::termpos old_pos = 0; for (auto && i : terms) { // Remove duplicates (same term at the same position). @@ -162,16 +162,16 @@ if (!internal.get()) return TermIterator(); - vector<pair<Xapian::termpos, string>> terms; + std::vector<pair<Xapian::termpos, string>> terms; internal->gather_terms(static_cast<void*>(&terms)); sort(terms.begin(), terms.end(), []( - const pair<Xapian::termpos, string>& a, - const pair<Xapian::termpos, string>& b) { + const std::pair<Xapian::termpos, string>& a, + const std::pair<Xapian::termpos, string>& b) { return a.second < b.second; }); - vector<string> v; - const string * old_term = NULL; + std::vector<string> v; + const std::string * old_term = NULL; for (auto && i : terms) { // Remove duplicate term names. if (old_term && *old_term == i.second) @@ -192,14 +192,14 @@ string Query::serialise() const { - string result; + std::string result; if (internal.get()) internal->serialise(result); return result; } const Query -Query::unserialise(const string & s, const Registry & reg) +Query::unserialise(const std::string & s, const Registry & reg) { const char * p = s.data(); const char * end = p + s.size(); @@ -231,7 +231,7 @@ string Query::get_description() const { - string desc = "Query("; + std::string desc = "Query("; if (internal.get()) desc += internal->get_description(); desc += ")"; diff -ur xapian-core-1.4.21/api/queryinternal.cc xapian-core-1.4.21/api/queryinternal.cc --- xapian-core-1.4.21/api/queryinternal.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/queryinternal.cc 2022-11-08 16:44:15.468461543 +0100 @@ -122,7 +122,7 @@ protected: QueryOptimiser* qopt; - vector<PostList*> pls; + std::vector<PostList*> pls; public: Context(QueryOptimiser* qopt_, size_t reserve); @@ -199,7 +199,7 @@ void OrContext::select_most_frequent(size_t set_size) { - vector<PostList*>::iterator begin = pls.begin(); + std::vector<PostList*>::iterator begin = pls.begin(); nth_element(begin, begin + set_size - 1, pls.end(), ComparePostListTermFreqAscending()); shrink(set_size); @@ -307,10 +307,10 @@ Xapian::termcount window_) : op_(op__), begin(begin_), end(end_), window(window_) { } - PostList * postlist(PostList * pl, const vector<PostList*>& pls) const; + PostList * postlist(PostList * pl, const std::vector<PostList*>& pls) const; }; - list<PosFilter> pos_filters; + std::list<PosFilter> pos_filters; AutoPtr<OrContext> not_ctx; @@ -342,10 +342,10 @@ }; PostList * -AndContext::PosFilter::postlist(PostList * pl, const vector<PostList*>& pls) const +AndContext::PosFilter::postlist(PostList * pl, const std::vector<PostList*>& pls) const try { - vector<PostList *>::const_iterator terms_begin = pls.begin() + begin; - vector<PostList *>::const_iterator terms_end = pls.begin() + end; + std::vector<PostList *>::const_iterator terms_begin = pls.begin() + begin; + std::vector<PostList *>::const_iterator terms_end = pls.begin() + end; if (op_ == Xapian::Query::OP_NEAR) { pl = new NearPostList(pl, window, terms_begin, terms_end); @@ -531,7 +531,7 @@ } if (size_t(end - *p) < len) throw SerialisationError("Not enough data"); - string term(*p, len); + std::string term(*p, len); *p += len; int code = ((ch >> 4) & 0x03); @@ -561,7 +561,7 @@ } size_t len; decode_length_and_check(p, end, len); - string begin(*p, len); + std::string begin(*p, len); *p += len; if (ch & 0x10) { // OP_VALUE_GE @@ -570,7 +570,7 @@ // OP_VALUE_RANGE decode_length_and_check(p, end, len); - string end_(*p, len); + std::string end_(*p, len); *p += len; if (begin.empty()) // FIXME: is this right? return new Xapian::Internal::QueryValueLE(slot, end_); @@ -595,7 +595,7 @@ op combiner = static_cast<op>(*(*p)++); size_t len; decode_length_and_check(p, end, len); - string pattern(*p, len); + std::string pattern(*p, len); *p += len; return new Xapian::Internal::QueryWildcard(pattern, max_expansion, @@ -605,12 +605,12 @@ case 0x0c: { // PostingSource size_t len; decode_length_and_check(p, end, len); - string name(*p, len); + std::string name(*p, len); *p += len; const PostingSource * reg_source = reg.get_posting_source(name); if (!reg_source) { - string m = "PostingSource "; + std::string m = "PostingSource "; m += name; m += " not registered"; throw SerialisationError(m); @@ -644,7 +644,7 @@ break; } } - string msg = "Unknown Query serialisation: "; + std::string msg = "Unknown Query serialisation: "; msg += str(ch); throw SerialisationError(msg); } @@ -684,7 +684,7 @@ string QueryTerm::get_description() const { - string desc; + std::string desc; if (term.empty()) { desc = "<alldocuments>"; } else { @@ -724,7 +724,7 @@ string QueryPostingSource::get_description() const { - string desc = "PostingSource("; + std::string desc = "PostingSource("; desc += source->get_description(); desc += ')'; return desc; @@ -759,7 +759,7 @@ QueryScaleWeight::get_description() const { Assert(subquery.internal.get()); - string desc = str(scale_factor); + std::string desc = str(scale_factor); desc += " * "; desc += subquery.internal->get_description(); return desc; @@ -816,7 +816,7 @@ if (factor != 0.0) qopt->inc_total_subqs(); const Xapian::Database::Internal & db = qopt->db; - const string & lb = db.get_value_lower_bound(slot); + const std::string & lb = db.get_value_lower_bound(slot); if (lb.empty()) { // This should only happen if there are no values in this slot (which // could be because the backend just doesn't support values at all). @@ -828,7 +828,7 @@ if (end < lb) { RETURN(new EmptyPostList); } - const string & ub = db.get_value_upper_bound(slot); + const std::string & ub = db.get_value_upper_bound(slot); if (begin > ub) { RETURN(new EmptyPostList); } @@ -843,7 +843,7 @@ RETURN(db.open_post_list(string())); } // Otherwise we can at least replace the lower bound with an empty - // string for a small efficiency gain. + // std::string for a small efficiency gain. RETURN(new ValueGePostList(&db, slot, string())); } RETURN(new ValueGePostList(&db, slot, begin)); @@ -875,7 +875,7 @@ string QueryValueRange::get_description() const { - string desc = "VALUE_RANGE "; + std::string desc = "VALUE_RANGE "; desc += str(slot); desc += ' '; description_append(desc, begin); @@ -891,7 +891,7 @@ if (factor != 0.0) qopt->inc_total_subqs(); const Xapian::Database::Internal & db = qopt->db; - const string & lb = db.get_value_lower_bound(slot); + const std::string & lb = db.get_value_lower_bound(slot); if (lb.empty()) { // This should only happen if there are no values in this slot (which // could be because the backend just doesn't support values at all). @@ -941,7 +941,7 @@ string QueryValueLE::get_description() const { - string desc = "VALUE_LE "; + std::string desc = "VALUE_LE "; desc += str(slot); desc += ' '; description_append(desc, limit); @@ -955,7 +955,7 @@ if (factor != 0.0) qopt->inc_total_subqs(); const Xapian::Database::Internal & db = qopt->db; - const string & lb = db.get_value_lower_bound(slot); + const std::string & lb = db.get_value_lower_bound(slot); if (lb.empty()) { // This should only happen if there are no values in this slot (which // could be because the backend just doesn't support values at all). @@ -1002,7 +1002,7 @@ string QueryValueGE::get_description() const { - string desc = "VALUE_GE "; + std::string desc = "VALUE_GE "; desc += str(slot); desc += ' '; description_append(desc, limit); @@ -1043,7 +1043,7 @@ if (expansions_left-- == 0) { if (max_type == Xapian::Query::WILDCARD_LIMIT_FIRST) break; - string msg("Wildcard "); + std::string msg("Wildcard "); msg += pattern; msg += "* expands to more than "; msg += str(max_expansion); @@ -1051,7 +1051,7 @@ throw Xapian::WildcardError(msg); } } - const string & term = t->get_termname(); + const std::string & term = t->get_termname(); ctx.add_postlist(qopt->open_lazy_post_list(term, 1, or_factor)); } @@ -1124,7 +1124,7 @@ string QueryWildcard::get_description() const { - string desc = "WILDCARD "; + std::string desc = "WILDCARD "; switch (combiner) { case Query::OP_SYNONYM: desc += "SYNONYM "; @@ -1399,7 +1399,7 @@ QueryBranch::get_description_helper(const char * op, Xapian::termcount parameter) const { - string desc = "("; + std::string desc = "("; QueryVector::const_iterator i; for (i = subqueries.begin(); i != subqueries.end(); ++i) { if (desc.size() > 1) { @@ -1497,11 +1497,11 @@ { result += static_cast<char>(0x0c); - const string & n = source->name(); + const std::string & n = source->name(); result += encode_length(n.size()); result += n; - const string & s = source->serialise(); + const std::string & s = source->serialise(); result += encode_length(s.size()); result += s; } @@ -2003,7 +2003,7 @@ QuerySynonym::get_description() const { if (subqueries.size() == 1) { - string d = "(SYNONYM "; + std::string d = "(SYNONYM "; d += subqueries[0].internal->get_description(); d += ")"; return d; diff -ur xapian-core-1.4.21/api/registry.cc xapian-core-1.4.21/api/registry.cc --- xapian-core-1.4.21/api/registry.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/registry.cc 2022-11-08 16:44:15.464461558 +0100 @@ -75,14 +75,14 @@ template<class T> static inline void -register_object(map<string, T*> & registry, const T & obj) +register_object(std::map<string, T*> & registry, const T & obj) { - string name = obj.name(); + std::string name = obj.name(); if (rare(name.empty())) { throw Xapian::InvalidOperationError("Unable to register object - name() method returned empty string"); } - pair<typename map<string, T *>::iterator, bool> r; + std::pair<typename std::map<string, T *>::iterator, bool> r; r = registry.insert(make_pair(name, static_cast<T*>(NULL))); if (!r.second) { // Existing element with this key, so replace the pointer with NULL @@ -108,9 +108,9 @@ template<class T> static inline const T * -lookup_object(map<string, T*> registry, const string & name) +lookup_object(std::map<string, T*> registry, const std::string & name) { - typename map<string, T*>::const_iterator i = registry.find(name); + typename std::map<string, T*>::const_iterator i = registry.find(name); if (i == registry.end()) { return NULL; } @@ -193,7 +193,7 @@ void Registry::Internal::clear_weighting_schemes() { - map<string, Xapian::Weight*>::const_iterator i; + std::map<string, Xapian::Weight*>::const_iterator i; for (i = wtschemes.begin(); i != wtschemes.end(); ++i) { delete i->second; } @@ -202,7 +202,7 @@ void Registry::Internal::clear_posting_sources() { - map<string, Xapian::PostingSource *>::const_iterator i; + std::map<string, Xapian::PostingSource *>::const_iterator i; for (i = postingsources.begin(); i != postingsources.end(); ++i) { delete i->second; } @@ -211,7 +211,7 @@ void Registry::Internal::clear_match_spies() { - map<string, Xapian::MatchSpy *>::const_iterator i; + std::map<string, Xapian::MatchSpy *>::const_iterator i; for (i = matchspies.begin(); i != matchspies.end(); ++i) { delete i->second; } @@ -220,7 +220,7 @@ void Registry::Internal::clear_lat_long_metrics() { - map<string, Xapian::LatLongMetric *>::const_iterator i; + std::map<string, Xapian::LatLongMetric *>::const_iterator i; for (i = lat_long_metrics.begin(); i != lat_long_metrics.end(); ++i) { delete i->second; } @@ -269,7 +269,7 @@ } const Xapian::Weight * -Registry::get_weighting_scheme(const string & name) const +Registry::get_weighting_scheme(const std::string & name) const { LOGCALL(API, const Xapian::Weight *, "Xapian::Registry::get_weighting_scheme", name); RETURN(lookup_object(internal->wtschemes, name)); @@ -283,7 +283,7 @@ } const Xapian::PostingSource * -Registry::get_posting_source(const string & name) const +Registry::get_posting_source(const std::string & name) const { LOGCALL(API, const Xapian::PostingSource *, "Xapian::Registry::get_posting_source", name); RETURN(lookup_object(internal->postingsources, name)); @@ -297,7 +297,7 @@ } const Xapian::MatchSpy * -Registry::get_match_spy(const string & name) const +Registry::get_match_spy(const std::string & name) const { LOGCALL(API, const Xapian::MatchSpy *, "Xapian::Registry::get_match_spy", name); RETURN(lookup_object(internal->matchspies, name)); @@ -311,7 +311,7 @@ } const Xapian::LatLongMetric * -Registry::get_lat_long_metric(const string & name) const +Registry::get_lat_long_metric(const std::string & name) const { LOGCALL(API, const Xapian::LatLongMetric *, "Xapian::Registry::get_lat_long_metric", name); RETURN(lookup_object(internal->lat_long_metrics, name)); diff -ur xapian-core-1.4.21/api/replication.cc xapian-core-1.4.21/api/replication.cc --- xapian-core-1.4.21/api/replication.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/replication.cc 2022-11-08 16:44:15.460461571 +0100 @@ -68,7 +68,7 @@ void DatabaseMaster::write_changesets_to_fd(int fd, - const string & start_revision, + const std::string & start_revision, ReplicationInfo * info) const { LOGCALL_VOID(REPLICA, "DatabaseMaster::write_changesets_to_fd", fd | start_revision | info); @@ -90,7 +90,7 @@ // Extract the UUID from start_revision and compare it to the database. bool need_whole_db = false; - string revision; + std::string revision; if (start_revision.empty()) { need_whole_db = true; } else { @@ -98,9 +98,9 @@ const char * end = ptr + start_revision.size(); size_t uuid_length; decode_length_and_check(&ptr, end, uuid_length); - string request_uuid(ptr, uuid_length); + std::string request_uuid(ptr, uuid_length); ptr += uuid_length; - string db_uuid = db.internal[0]->get_uuid(); + std::string db_uuid = db.internal[0]->get_uuid(); if (request_uuid != db_uuid) { need_whole_db = true; } @@ -113,7 +113,7 @@ string DatabaseMaster::get_description() const { - string desc = "DatabaseMaster("; + std::string desc = "DatabaseMaster("; description_append(desc, path); desc += ")"; return desc; @@ -128,7 +128,7 @@ Internal(const Internal &); /// The path to the replica directory. - string path; + std::string path; /// The id of the currently live database in the replica (0 or 1). int live_id; @@ -152,16 +152,16 @@ /** The revision that the secondary database has been updated to. */ - string offline_revision; + std::string offline_revision; /** The UUID of the secondary database. */ - string offline_uuid; + std::string offline_uuid; /** The revision that the secondary database must reach before it can be * made live. */ - string offline_needed_revision; + std::string offline_needed_revision; /** The time at which a changeset was last applied to the live database. * @@ -201,8 +201,8 @@ */ bool possibly_make_offline_live(); - string get_replica_path(int id) const { - string p = path; + std::string get_replica_path(int id) const { + std::string p = path; p += "/replica_"; p += char('0' + id); return p; @@ -210,13 +210,13 @@ public: /// Open a new DatabaseReplica::Internal for the specified path. - explicit Internal(const string & path_); + explicit Internal(const std::string & path_); /// Destructor. ~Internal() { delete conn; } - /// Get a string describing the current revision of the replica. - string get_revision_info() const; + /// Get a std::string describing the current revision of the replica. + std::string get_revision_info() const; /// Set the file descriptor to read changesets from. void set_read_fd(int fd); @@ -225,13 +225,13 @@ bool apply_next_changeset(ReplicationInfo * info, double reader_close_time); - /// Return a string describing this object. - string get_description() const { return path; } + /// Return a std::string describing this object. + std::string get_description() const { return path; } }; // Methods of DatabaseReplica -DatabaseReplica::DatabaseReplica(const string & path) +DatabaseReplica::DatabaseReplica(const std::string & path) : internal(new DatabaseReplica::Internal(path)) { LOGCALL_CTOR(REPLICA, "DatabaseReplica", path); @@ -270,7 +270,7 @@ string DatabaseReplica::get_description() const { - string desc("DatabaseReplica("); + std::string desc("DatabaseReplica("); desc += internal->get_description(); desc += ')'; return desc; @@ -281,9 +281,9 @@ void DatabaseReplica::Internal::update_stub_database() const { - string stub_path = path; + std::string stub_path = path; stub_path += "/XAPIANDB"; - string tmp_path = stub_path; + std::string tmp_path = stub_path; tmp_path += ".tmp"; { ofstream stub(tmp_path.c_str()); @@ -291,13 +291,13 @@ "auto replica_" << live_id << endl; } if (!io_tmp_rename(tmp_path, stub_path)) { - string msg("Failed to update stub db file for replica: "); + std::string msg("Failed to update stub db file for replica: "); msg += path; throw Xapian::DatabaseOpeningError(msg, errno); } } -DatabaseReplica::Internal::Internal(const string & path_) +DatabaseReplica::Internal::Internal(const std::string & path_) : path(path_), live_id(0), live_db(), have_offline_db(false), need_copy_next(false), offline_revision(), offline_needed_revision(), last_live_changeset_time(), conn(NULL) @@ -323,7 +323,7 @@ if (!dir_exists(path)) { throw DatabaseOpeningError("Replica path must be a directory"); } - string stub_path = path; + std::string stub_path = path; stub_path += "/XAPIANDB"; try { live_db = WritableDatabase(stub_path, @@ -336,7 +336,7 @@ } // FIXME: simplify all this? ifstream stub(stub_path.c_str()); - string line; + std::string line; while (getline(stub, line)) { if (!line.empty() && line[0] != '#') { live_id = line[line.size() - 1] - '0'; @@ -358,8 +358,8 @@ if (live_db.internal[0].get() == NULL) RETURN(string()); - string uuid = (live_db.internal[0])->get_uuid(); - string buf = encode_length(uuid.size()); + std::string uuid = (live_db.internal[0])->get_uuid(); + std::string buf = encode_length(uuid.size()); buf += uuid; buf += (live_db.internal[0])->get_revision_info(); RETURN(buf); @@ -378,7 +378,7 @@ { have_offline_db = true; last_live_changeset_time = 0; - string offline_path = get_replica_path(live_id ^ 1); + std::string offline_path = get_replica_path(live_id ^ 1); // If there's already an offline database, discard it. This happens if one // copy of the database was sent, but further updates were needed before it // could be made live, and the remote end was then unable to send those @@ -391,7 +391,7 @@ } { - string buf; + std::string buf; int type = conn->get_message(buf, end_time); check_message_type(type, REPL_REPLY_DB_HEADER); const char * ptr = buf.data(); @@ -404,7 +404,7 @@ // Now, read the files for the database from the connection and create it. while (true) { - string filename; + std::string filename; int type = conn->sniff_next_message_type(end_time); if (type < 0 || type == REPL_REPLY_FAIL) return; @@ -424,7 +424,7 @@ if (type < 0 || type == REPL_REPLY_FAIL) return; - string filepath = offline_path + "/" + filename; + std::string filepath = offline_path + "/" + filename; type = conn->receive_file(filepath, end_time); if (type < 0) throw_connection_closed_unexpectedly(); @@ -441,7 +441,7 @@ if (type != expected) { if (type < 0) throw_connection_closed_unexpectedly(); - string m = "Expected replication protocol message type #"; + std::string m = "Expected replication protocol message type #"; m += str(expected); m += ", got #"; m += str(type); @@ -452,7 +452,7 @@ bool DatabaseReplica::Internal::possibly_make_offline_live() { - string replica_path(get_replica_path(live_id ^ 1)); + std::string replica_path(get_replica_path(live_id ^ 1)); AutoPtr<DatabaseReplicator> replicator; try { replicator.reset(DatabaseReplicator::open(replica_path)); @@ -467,7 +467,7 @@ return false; } - string replicated_uuid = replicator->get_uuid(); + std::string replicated_uuid = replicator->get_uuid(); if (replicated_uuid.empty()) { return false; } @@ -502,7 +502,7 @@ int type = conn->sniff_next_message_type(0.0); switch (type) { case REPL_REPLY_END_OF_CHANGES: { - string buf; + std::string buf; type = conn->get_message(buf, 0.0); check_message_type(type, REPL_REPLY_END_OF_CHANGES); RETURN(false); @@ -513,7 +513,7 @@ apply_db_copy(0.0); if (info != NULL) ++(info->fullcopy_count); - string replica_uuid; + std::string replica_uuid; { AutoPtr<DatabaseReplicator> replicator( DatabaseReplicator::open(get_replica_path(live_id ^ 1))); @@ -544,7 +544,7 @@ } if (!have_offline_db) { // Close the live db. - string replica_path(get_replica_path(live_id)); + std::string replica_path(get_replica_path(live_id)); live_db = WritableDatabase(); if (last_live_changeset_time != 0.0) { @@ -595,7 +595,7 @@ } RETURN(true); case REPL_REPLY_FAIL: { - string buf; + std::string buf; if (conn->get_message(buf, 0.0) < 0) throw_connection_closed_unexpectedly(); throw NetworkError("Unable to fully synchronise: " + buf); diff -ur xapian-core-1.4.21/api/replication.h xapian-core-1.4.21/api/replication.h --- xapian-core-1.4.21/api/replication.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/replication.h 2022-11-08 16:44:01.020512905 +0100 @@ -89,7 +89,7 @@ * * @param start_revision The starting revision of the database that the * changesets are to be applied to. Specify an empty - * string to get a "creation" changeset, which + * std::string to get a "creation" changeset, which * includes the creation of the database. The * revision will include the unique identifier for the * database, if one is available. @@ -102,7 +102,7 @@ const std::string & start_revision, ReplicationInfo * info) const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -141,7 +141,7 @@ */ explicit DatabaseReplica(const std::string & path); - /** Get a string describing the current revision of the replica. + /** Get a std::string describing the current revision of the replica. * * The revision information includes a unique identifier for the master * database that the replica is of, as well as information about the exact @@ -193,7 +193,7 @@ bool apply_next_changeset(ReplicationInfo * info, double reader_close_time); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/api/roundestimate.h xapian-core-1.4.21/api/roundestimate.h --- xapian-core-1.4.21/api/roundestimate.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/roundestimate.h 2022-11-08 16:44:01.016512919 +0100 @@ -36,13 +36,13 @@ inline Xapian::doccount round_estimate(T lb, T ub, T est) { - using namespace std; + using std::string; // We round based on the difference between the bounds, or the estimate if // that's smaller - for example, consider lb=11, est=24, ub=1234 where // rounding est to a multiple of 10 is reasonable but rounding it to a // multiple of 1000 isn't. - T scale = min(ub - lb, est); + T scale = std::min(ub - lb, est); if (scale <= 10) { // Estimate is either too close to exact or too small to round. return est; diff -ur xapian-core-1.4.21/api/sortable-serialise.cc xapian-core-1.4.21/api/sortable-serialise.cc --- xapian-core-1.4.21/api/sortable-serialise.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/sortable-serialise.cc 2022-11-08 16:44:15.472461529 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Serialise floating point values to string which sort the same way. + * @brief Serialise floating point values to std::string which sort the same way. */ /* Copyright (C) 2007,2009,2015,2016 Olly Betts * @@ -174,7 +174,7 @@ } /// Get a number from the character at a given position in a string, returning -/// 0 if the string isn't long enough. +/// 0 if the std::string isn't long enough. static inline unsigned char numfromstr(const std::string & str, std::string::size_type pos) { diff -ur xapian-core-1.4.21/api/termiterator.cc xapian-core-1.4.21/api/termiterator.cc --- xapian-core-1.4.21/api/termiterator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/termiterator.cc 2022-11-08 16:44:15.452461600 +0100 @@ -138,7 +138,7 @@ } void -TermIterator::skip_to(const string & term) +TermIterator::skip_to(const std::string & term) { LOGCALL_VOID(API, "TermIterator::skip_to", term); if (internal) @@ -149,7 +149,7 @@ TermIterator::get_description() const { #if 0 // FIXME: Add TermIterator::Internal::get_description() method. - string desc = "TermIterator("; + std::string desc = "TermIterator("; if (internal) desc += internal->get_description(); desc += ')'; diff -ur xapian-core-1.4.21/api/termlist.cc xapian-core-1.4.21/api/termlist.cc --- xapian-core-1.4.21/api/termlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/termlist.cc 2022-11-08 16:44:15.460461571 +0100 @@ -37,7 +37,7 @@ Assert(false); } -// Default implementation for when the positions aren't in vector<termpos>. +// Default implementation for when the positions aren't in std::vector<termpos>. const std::vector<Xapian::termpos> * TermIterator::Internal::get_vector_termpos() const { diff -ur xapian-core-1.4.21/api/termlist.h xapian-core-1.4.21/api/termlist.h --- xapian-core-1.4.21/api/termlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/termlist.h 2022-11-08 16:44:01.012512934 +0100 @@ -94,13 +94,13 @@ /// Return the length of the position list for the current position. virtual Xapian::termcount positionlist_count() const = 0; - /** Get pointer to vector<termpos> if that's the internal representation. + /** Get pointer to std::vector<termpos> if that's the internal representation. * * This avoids unnecessary copying of positions in the common cases - the * case it doesn't help with is adding a document back with unmodified * positions *AND* a different docid, which is an unusual thing to do. * - * @return Pointer to vector<termpos> or NULL. + * @return Pointer to std::vector<termpos> or NULL. */ virtual const std::vector<Xapian::termpos> * get_vector_termpos() const; diff -ur xapian-core-1.4.21/api/valueiterator.cc xapian-core-1.4.21/api/valueiterator.cc --- xapian-core-1.4.21/api/valueiterator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/valueiterator.cc 2022-11-08 16:44:15.460461571 +0100 @@ -144,7 +144,7 @@ std::string ValueIterator::get_description() const { - string desc = "ValueIterator("; + std::string desc = "ValueIterator("; if (internal) desc += internal->get_description(); desc += ')'; diff -ur xapian-core-1.4.21/api/valuerangeproc.cc xapian-core-1.4.21/api/valuerangeproc.cc --- xapian-core-1.4.21/api/valuerangeproc.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/valuerangeproc.cc 2022-11-08 16:44:15.456461586 +0100 @@ -33,7 +33,7 @@ namespace Xapian { Xapian::valueno -StringValueRangeProcessor::operator()(string &begin, string &end) +StringValueRangeProcessor::operator()(string &begin, std::string &end) { if (str.size()) { if (prefix) { @@ -64,7 +64,7 @@ } static bool -decode_xxy(const string & s, int & x1, int &x2, int &y) +decode_xxy(const std::string & s, int & x1, int &x2, int &y) { if (s.size() == 0) { x1 = x2 = y = -1; @@ -108,7 +108,7 @@ // NB Assumes the length has been checked to be 10 already. static bool -is_yyyy_mm_dd(const string &s) +is_yyyy_mm_dd(const std::string &s) { return (s.find_first_not_of("0123456789") == 4 && s.find_first_not_of("0123456789", 5) == 7 && @@ -141,7 +141,7 @@ } Xapian::valueno -DateValueRangeProcessor::operator()(string &begin, string &end) +DateValueRangeProcessor::operator()(string &begin, std::string &end) { if (StringValueRangeProcessor::operator()(begin, end) == BAD_VALUENO) return BAD_VALUENO; @@ -212,7 +212,7 @@ } Xapian::valueno -NumberValueRangeProcessor::operator()(string &begin, string &end) +NumberValueRangeProcessor::operator()(string &begin, std::string &end) { if (StringValueRangeProcessor::operator()(begin, end) == BAD_VALUENO) return BAD_VALUENO; @@ -321,7 +321,7 @@ (e.size() == 10 || e.size() == 0)) { if ((b.empty() || is_yyyy_mm_dd(b)) && (e.empty() || is_yyyy_mm_dd(e))) { - string begin = b, end = e; + std::string begin = b, end = e; // YYYY-MM-DD if (!begin.empty()) { begin.erase(7, 1); @@ -396,7 +396,7 @@ char * endptr; num_b = strtod(startptr, &endptr); if (endptr != startptr + b.size() || errno) { - // Invalid characters in string || overflow or underflow. + // Invalid characters in std::string || overflow or underflow. goto not_our_range; } } else { @@ -410,7 +410,7 @@ char * endptr; num_e = strtod(startptr, &endptr); if (endptr != startptr + e.size() || errno) { - // Invalid characters in string || overflow or underflow. + // Invalid characters in std::string || overflow or underflow. goto not_our_range; } } else { diff -ur xapian-core-1.4.21/api/valuesetmatchdecider.cc xapian-core-1.4.21/api/valuesetmatchdecider.cc --- xapian-core-1.4.21/api/valuesetmatchdecider.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/valuesetmatchdecider.cc 2022-11-08 16:44:15.480461501 +0100 @@ -33,7 +33,7 @@ bool ValueSetMatchDecider::operator()(const Xapian::Document& doc) const { - string value = doc.get_value(valuenum); + std::string value = doc.get_value(valuenum); set<string>::const_iterator it = testset.find(value); if (inclusive) return it != testset.end(); diff -ur xapian-core-1.4.21/api/vectortermlist.cc xapian-core-1.4.21/api/vectortermlist.cc --- xapian-core-1.4.21/api/vectortermlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/vectortermlist.cc 2022-11-08 16:44:15.472461529 +0100 @@ -79,7 +79,7 @@ } TermList * -VectorTermList::skip_to(const string &) +VectorTermList::skip_to(const std::string &) { // skip_to only makes sense for termlists which are in sorted order. throw Xapian::InvalidOperationError("VectorTermList::skip_to() not meaningful"); diff -ur xapian-core-1.4.21/api/vectortermlist.h xapian-core-1.4.21/api/vectortermlist.h --- xapian-core-1.4.21/api/vectortermlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/api/vectortermlist.h 2022-11-08 16:44:01.016512919 +0100 @@ -28,7 +28,7 @@ /** This class stores a list of terms. * - * To be memory efficient, we store the terms in a single string using a + * To be memory efficient, we store the terms in a single std::string using a * suitable simple encoding. This way the number of bytes needed will * usually be the sum of the lengths of all the terms plus the number of * terms. If we used std::vector<std::string> here like we used to, that diff -ur xapian-core-1.4.21/backends/byte_length_strings.h xapian-core-1.4.21/backends/byte_length_strings.h --- xapian-core-1.4.21/backends/byte_length_strings.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/byte_length_strings.h 2022-11-08 16:44:00.968513089 +0100 @@ -75,7 +75,7 @@ }; struct ByteLengthPrefixedStringItorGt { - /// Return true if and only if a's string is strictly greater than b's. + /// Return true if and only if a's std::string is strictly greater than b's. bool operator()(const ByteLengthPrefixedStringItor *a, const ByteLengthPrefixedStringItor *b) const { return (**a > **b); diff -ur xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.cc xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.cc --- xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.cc 2022-11-08 16:44:15.388461828 +0100 @@ -31,7 +31,7 @@ ChertAllDocsModifiedPostList::ChertAllDocsModifiedPostList(intrusive_ptr<const ChertDatabase> db_, Xapian::doccount doccount_, - const map<Xapian::docid, Xapian::termcount> & doclens_) + const std::map<Xapian::docid, Xapian::termcount> & doclens_) : ChertAllDocsPostList(db_, doccount_), doclens(doclens_), doclens_it(doclens.begin()) @@ -137,7 +137,7 @@ string ChertAllDocsModifiedPostList::get_description() const { - string desc = "ChertAllDocsModifiedPostList(did="; + std::string desc = "ChertAllDocsModifiedPostList(did="; desc += str(get_docid()); desc += ')'; return desc; diff -ur xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.h xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.h --- xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_alldocsmodifiedpostlist.h 2022-11-08 16:44:00.952513146 +0100 @@ -28,10 +28,10 @@ class ChertAllDocsModifiedPostList : public ChertAllDocsPostList { /// Modifications to apply to the ChertAllDocsPostList. - map<Xapian::docid, Xapian::termcount> doclens; + std::map<Xapian::docid, Xapian::termcount> doclens; /// Current position in the doclens list. - map<Xapian::docid, Xapian::termcount>::const_iterator doclens_it; + std::map<Xapian::docid, Xapian::termcount>::const_iterator doclens_it; /// Don't allow assignment. void operator=(const ChertAllDocsModifiedPostList &); @@ -45,7 +45,7 @@ public: ChertAllDocsModifiedPostList(Xapian::Internal::intrusive_ptr<const ChertDatabase> db_, Xapian::doccount doccount_, - const map<Xapian::docid, Xapian::termcount> & doclens_); + const std::map<Xapian::docid, Xapian::termcount> & doclens_); Xapian::docid get_docid() const; diff -ur xapian-core-1.4.21/backends/chert/chert_alldocspostlist.cc xapian-core-1.4.21/backends/chert/chert_alldocspostlist.cc --- xapian-core-1.4.21/backends/chert/chert_alldocspostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_alldocspostlist.cc 2022-11-08 16:44:15.404461770 +0100 @@ -80,7 +80,7 @@ string ChertAllDocsPostList::get_description() const { - string desc = "ChertAllDocsPostList(did="; + std::string desc = "ChertAllDocsPostList(did="; desc += str(get_docid()); desc += ",doccount="; desc += str(doccount); diff -ur xapian-core-1.4.21/backends/chert/chert_alltermslist.cc xapian-core-1.4.21/backends/chert/chert_alltermslist.cc --- xapian-core-1.4.21/backends/chert/chert_alltermslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_alltermslist.cc 2022-11-08 16:44:15.416461728 +0100 @@ -85,7 +85,7 @@ if (prefix.empty()) { (void)cursor->find_entry_ge(string("\x00\xff", 2)); } else { - const string & key = pack_chert_postlist_key(prefix); + const std::string & key = pack_chert_postlist_key(prefix); if (cursor->find_entry_ge(key)) { // The exact term we asked for is there, so just copy it rather // than wasting effort unpacking it from the key. @@ -126,7 +126,7 @@ } TermList * -ChertAllTermsList::skip_to(const string &term) +ChertAllTermsList::skip_to(const std::string &term) { LOGCALL(DB, TermList *, "ChertAllTermsList::skip_to", term); Assert(!at_end()); @@ -139,7 +139,7 @@ Assert(cursor); // The postlist table isn't optional. } - string key = pack_chert_postlist_key(term); + std::string key = pack_chert_postlist_key(term); if (cursor->find_entry_ge(key)) { // The exact term we asked for is there, so just copy it rather than // wasting effort unpacking it from the key. diff -ur xapian-core-1.4.21/backends/chert/chert_btreebase.cc xapian-core-1.4.21/backends/chert/chert_btreebase.cc --- xapian-core-1.4.21/backends/chert/chert_btreebase.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_btreebase.cc 2022-11-08 16:44:15.384461842 +0100 @@ -115,8 +115,8 @@ /** Do most of the error handling from unpack_uint() */ static bool do_unpack_uint(const char **start, const char *end, - uint4 *dest, string &err_msg, - const string &basename, + uint4 *dest, std::string &err_msg, + const std::string &basename, const char *varname) { bool result = unpack_uint(start, end, dest); @@ -132,8 +132,8 @@ static bool do_unpack_uint(const char **start, const char *end, - chert_tablesize_t *dest, string &err_msg, - const string &basename, + chert_tablesize_t *dest, std::string &err_msg, + const std::string &basename, const char *varname) { bool result = unpack_uint(start, end, dest); @@ -163,10 +163,10 @@ #define REASONABLE_BASE_SIZE 1024 bool -ChertTable_base::read(const string & name, char ch, bool read_bitmap, - string &err_msg) +ChertTable_base::read(const std::string & name, char ch, bool read_bitmap, + std::string &err_msg) { - string basename = name + "base" + ch; + std::string basename = name + "base" + ch; FD h(posixy_open(basename.c_str(), O_RDONLY | O_CLOEXEC)); if (h == -1) { err_msg += "Couldn't open "; @@ -276,15 +276,15 @@ } void -ChertTable_base::write_to_file(const string &filename, +ChertTable_base::write_to_file(const std::string &filename, char base_letter, - const string &tablename, + const std::string &tablename, int changes_fd, - const string * changes_tail) + const std::string * changes_tail) { calculate_last_block(); - string buf; + std::string buf; pack_uint(buf, revision); pack_uint(buf, CURR_FORMAT); pack_uint(buf, block_size); @@ -303,7 +303,7 @@ FD h(posixy_open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)); if (h < 0) { - string message("Couldn't open base "); + std::string message("Couldn't open base "); message += filename; message += " to write: "; errno_to_string(errno, message); @@ -311,7 +311,7 @@ } if (changes_fd >= 0) { - string changes_buf; + std::string changes_buf; pack_uint(changes_buf, 1u); // Indicate the item is a base file. pack_string(changes_buf, tablename); changes_buf += base_letter; // The base file letter. diff -ur xapian-core-1.4.21/backends/chert/chert_btreebase.h xapian-core-1.4.21/backends/chert/chert_btreebase.h --- xapian-core-1.4.21/backends/chert/chert_btreebase.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_btreebase.h 2022-11-08 16:44:00.956513132 +0100 @@ -40,7 +40,7 @@ * @param name The base of the filename * @param ch The suffix * @param read_bitmap True if we should read the bitmap - * @param err_msg An error string which will be appended + * @param err_msg An error std::string which will be appended * to for some errors instead of throwing * an exception. * diff -ur xapian-core-1.4.21/backends/chert/chert_check.cc xapian-core-1.4.21/backends/chert/chert_check.cc --- xapian-core-1.4.21/backends/chert/chert_check.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_check.cc 2022-11-08 16:44:15.400461785 +0100 @@ -49,10 +49,10 @@ void ChertTableCheck::print_key(const uint8_t * p, int c, int j) const { Item item(p, c); - string key; + std::string key; if (item.key().length() >= 0) item.key().read(&key); - string escaped; + std::string escaped; description_append(escaped, key); *out << escaped; if (j == 0) { @@ -64,9 +64,9 @@ { Item item(p, c); if (j == 0) { - string tag; + std::string tag; item.append_chunk(&tag); - string escaped; + std::string escaped; description_append(escaped, tag); *out << '/' << item.components_of() << ' ' << escaped; } else { @@ -232,18 +232,18 @@ } void -ChertTableCheck::check(const char * tablename, const string & path, +ChertTableCheck::check(const char * tablename, const std::string & path, chert_revision_number_t * rev_ptr, int opts, ostream *out) { - string faked_base; + std::string faked_base; ChertTableCheck B(tablename, path, false, out); try { if (rev_ptr && *rev_ptr) { // On failure, fake exception to be caught below. if (!B.open(*rev_ptr)) { - string msg = "Failed to open "; + std::string msg = "Failed to open "; msg += tablename; msg += " table at revision "; msg += str(*rev_ptr); @@ -371,7 +371,7 @@ // And retry the open. if (!B.open(revision)) { - string msg = "Root guess of blk "; + std::string msg = "Root guess of blk "; msg += str(root); msg += " rev "; msg += str(revision); @@ -450,7 +450,7 @@ } B.base.set_item_count(B.check_item_count); B.base.set_sequential(B.check_sequential); - string base_name = path; + std::string base_name = path; base_name += "base"; base_name += B.base_letter; B.base.write_to_file(base_name, B.base_letter, string(), -1, NULL); @@ -462,7 +462,7 @@ } if (B.check_item_count != B.get_entry_count()) { - string err = "Table entry count says "; + std::string err = "Table entry count says "; err += str(B.get_entry_count()); err += " but actually counted "; err += str(B.check_item_count); diff -ur xapian-core-1.4.21/backends/chert/chert_compact.cc xapian-core-1.4.21/backends/chert/chert_compact.cc --- xapian-core-1.4.21/backends/chert/chert_compact.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_compact.cc 2022-11-08 16:44:15.412461742 +0100 @@ -52,31 +52,31 @@ namespace ChertCompact { static inline bool -is_metainfo_key(const string & key) +is_metainfo_key(const std::string & key) { return key.size() == 1 && key[0] == '\0'; } static inline bool -is_user_metadata_key(const string & key) +is_user_metadata_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xc0'; } static inline bool -is_valuestats_key(const string & key) +is_valuestats_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xd0'; } static inline bool -is_valuechunk_key(const string & key) +is_valuechunk_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xd8'; } static inline bool -is_doclenchunk_key(const string & key) +is_doclenchunk_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xe0'; } @@ -85,7 +85,7 @@ Xapian::docid offset; public: - string key, tag; + std::string key, tag; Xapian::docid firstdid; Xapian::termcount tf, cf; @@ -133,7 +133,7 @@ if (is_doclenchunk_key(key)) { d += 2; } else { - string tname; + std::string tname; if (!unpack_string_preserving_sort(&d, e, tname)) throw Xapian::DatabaseCorruptError("Bad postlist key"); } @@ -178,9 +178,9 @@ static string encode_valuestats(Xapian::doccount freq, - const string & lbound, const string & ubound) + const std::string & lbound, const std::string & ubound) { - string value; + std::string value; pack_uint(value, freq); pack_string(value, lbound); // We don't store or count empty values, so neither of the bounds @@ -192,7 +192,7 @@ static void merge_postlists(Xapian::Compactor * compactor, - ChertTable * out, vector<Xapian::docid>::const_iterator offset, + ChertTable * out, std::vector<Xapian::docid>::const_iterator offset, vector<ChertTable*>::const_iterator b, vector<ChertTable*>::const_iterator e, Xapian::docid last_docid) @@ -201,7 +201,7 @@ Xapian::termcount doclen_lbound = static_cast<Xapian::termcount>(-1); Xapian::termcount wdf_ubound = 0; Xapian::termcount doclen_ubound = 0; - priority_queue<PostlistCursor *, vector<PostlistCursor *>, PostlistCursorGt> pq; + priority_queue<PostlistCursor *, std::vector<PostlistCursor *>, PostlistCursorGt> pq; for ( ; b != e; ++b, ++offset) { ChertTable *in = *b; if (in->empty()) { @@ -263,7 +263,7 @@ if (last_docid) { if (doclen_lbound > doclen_ubound) doclen_lbound = doclen_ubound; - string tag; + std::string tag; pack_uint(tag, last_docid); pack_uint(tag, doclen_lbound); pack_uint(tag, wdf_ubound); @@ -272,7 +272,7 @@ out->add(string(1, '\0'), tag); } - string last_key; + std::string last_key; { // Merge user metadata. vector<string> tags; @@ -288,7 +288,7 @@ // FIXME: It would be better to merge all duplicates // for a key in one call, but currently we don't in // multipass mode. - const string & resolved_tag = + const std::string & resolved_tag = compactor->resolve_duplicate_metadata(last_key, tags.size(), &tags[0]); @@ -314,7 +314,7 @@ if (!tags.empty()) { if (tags.size() > 1 && compactor) { Assert(!last_key.empty()); - const string & resolved_tag = + const std::string & resolved_tag = compactor->resolve_duplicate_metadata(last_key, tags.size(), &tags[0]); @@ -330,7 +330,7 @@ { // Merge valuestats. Xapian::doccount freq = 0; - string lbound, ubound; + std::string lbound, ubound; while (!pq.empty()) { PostlistCursor * cur = pq.top(); @@ -347,13 +347,13 @@ last_key = key; } - const string & tag = cur->tag; + const std::string & tag = cur->tag; const char * pos = tag.data(); const char * end = pos + tag.size(); Xapian::doccount f; - string l, u; + std::string l, u; if (!unpack_uint(&pos, end, &f)) { if (*pos == 0) throw Xapian::DatabaseCorruptError("Incomplete stats item in value table"); throw Xapian::RangeError("Frequency statistic in value table is too large"); @@ -394,7 +394,7 @@ // Merge valuestream chunks. while (!pq.empty()) { PostlistCursor * cur = pq.top(); - const string & key = cur->key; + const std::string & key = cur->key; if (!is_valuechunk_key(key)) break; Assert(!is_user_metadata_key(key)); out->add(key, cur->tag); @@ -407,7 +407,7 @@ } Xapian::termcount tf = 0, cf = 0; // Initialise to avoid warnings. - vector<pair<Xapian::docid, string> > tags; + std::vector<pair<Xapian::docid, string> > tags; while (true) { PostlistCursor * cur = NULL; if (!pq.empty()) { @@ -417,16 +417,16 @@ Assert(cur == NULL || !is_user_metadata_key(cur->key)); if (cur == NULL || cur->key != last_key) { if (!tags.empty()) { - string first_tag; + std::string first_tag; pack_uint(first_tag, tf); pack_uint(first_tag, cf); pack_uint(first_tag, tags[0].first - 1); - string tag = tags[0].second; + std::string tag = tags[0].second; tag[0] = (tags.size() == 1) ? '1' : '0'; first_tag += tag; out->add(last_key, first_tag); - string term; + std::string term; if (!is_doclenchunk_key(last_key)) { const char * p = last_key.data(); const char * end = p + last_key.size(); @@ -479,7 +479,7 @@ vector<ChertTable*>::const_iterator b, vector<ChertTable*>::const_iterator e) { - priority_queue<MergeCursor *, vector<MergeCursor *>, CursorGt> pq; + priority_queue<MergeCursor *, std::vector<MergeCursor *>, CursorGt> pq; for ( ; b != e; ++b) { ChertTable *in = *b; if (!in->empty()) { @@ -491,7 +491,7 @@ MergeCursor * cur = pq.top(); pq.pop(); - string key = cur->current_key; + std::string key = cur->current_key; if (pq.empty() || pq.top()->current_key > key) { // No need to merge the tags, just copy the (possibly compressed) // tag value. @@ -506,17 +506,17 @@ } // Merge tag values with the same key: - string tag; + std::string tag; if (key[0] != 'W') { // We just want the union of words, so copy over the first instance // and skip any identical ones. priority_queue<PrefixCompressedStringItor *, - vector<PrefixCompressedStringItor *>, + std::vector<PrefixCompressedStringItor *>, PrefixCompressedStringItorGt> pqtag; // Stick all the MergeCursor pointers in a vector because their // current_tag members must remain valid while we're merging their // tags, but we need to call next() on them all afterwards. - vector<MergeCursor *> vec; + std::vector<MergeCursor *> vec; vec.reserve(pq.size()); while (true) { @@ -529,11 +529,11 @@ } PrefixCompressedStringWriter wr(tag); - string lastword; + std::string lastword; while (!pqtag.empty()) { PrefixCompressedStringItor * it = pqtag.top(); pqtag.pop(); - string word = **it; + std::string word = **it; if (word != lastword) { lastword = word; wr.append(lastword); @@ -546,7 +546,7 @@ } } - vector<MergeCursor *>::const_iterator i; + std::vector<MergeCursor *>::const_iterator i; for (i = vec.begin(); i != vec.end(); ++i) { cur = *i; if (cur->next()) { @@ -585,10 +585,10 @@ static void merge_synonyms(ChertTable * out, - vector<ChertTable*>::const_iterator b, - vector<ChertTable*>::const_iterator e) + std::vector<ChertTable*>::const_iterator b, + std::vector<ChertTable*>::const_iterator e) { - priority_queue<MergeCursor *, vector<MergeCursor *>, CursorGt> pq; + priority_queue<MergeCursor *, std::vector<MergeCursor *>, CursorGt> pq; for ( ; b != e; ++b) { ChertTable *in = *b; if (!in->empty()) { @@ -600,7 +600,7 @@ MergeCursor * cur = pq.top(); pq.pop(); - string key = cur->current_key; + std::string key = cur->current_key; if (pq.empty() || pq.top()->current_key > key) { // No need to merge the tags, just copy the (possibly compressed) // tag value. @@ -615,12 +615,12 @@ } // Merge tag values with the same key: - string tag; + std::string tag; // We just want the union of words, so copy over the first instance // and skip any identical ones. priority_queue<ByteLengthPrefixedStringItor *, - vector<ByteLengthPrefixedStringItor *>, + std::vector<ByteLengthPrefixedStringItor *>, ByteLengthPrefixedStringItorGt> pqtag; vector<MergeCursor *> vec; @@ -633,7 +633,7 @@ pq.pop(); } - string lastword; + std::string lastword; while (!pqtag.empty()) { ByteLengthPrefixedStringItor * it = pqtag.top(); pqtag.pop(); @@ -667,8 +667,8 @@ static void multimerge_postlists(Xapian::Compactor * compactor, ChertTable * out, const char * tmpdir, - vector<ChertTable *> tmp, - vector<Xapian::docid> off, + std::vector<ChertTable *> tmp, + std::vector<Xapian::docid> off, Xapian::docid last_docid) { unsigned int c = 0; @@ -681,7 +681,7 @@ j = i + 2; if (j == tmp.size() - 1) ++j; - string dest = tmpdir; + std::string dest = tmpdir; char buf[64]; sprintf(buf, "/tmp%u_%u.", c, i / 2); dest += buf; @@ -726,8 +726,8 @@ } static void -merge_docid_keyed(ChertTable *out, const vector<ChertTable*> & inputs, - const vector<Xapian::docid> & offset) +merge_docid_keyed(ChertTable *out, const std::vector<ChertTable*> & inputs, + const std::vector<Xapian::docid> & offset) { for (size_t i = 0; i < inputs.size(); ++i) { Xapian::docid off = offset[i]; @@ -738,7 +738,7 @@ ChertCursor cur(in); cur.find_entry(string()); - string key; + std::string key; while (cur.next()) { // Adjust the key if this isn't the first database. if (off) { @@ -746,7 +746,7 @@ const char * d = cur.current_key.data(); const char * e = d + cur.current_key.size(); if (!C_unpack_uint_preserving_sort(&d, e, &did)) { - string msg = "Bad key in "; + std::string msg = "Bad key in "; msg += inputs[i]->get_path(); msg += "DB"; throw Xapian::DatabaseCorruptError(msg); @@ -774,8 +774,8 @@ void ChertDatabase::compact(Xapian::Compactor * compactor, const char * destdir, - const vector<Xapian::Database::Internal*> & sources, - const vector<Xapian::docid> & offset, + const std::vector<Xapian::Database::Internal*> & sources, + const std::vector<Xapian::docid> & offset, size_t block_size, Xapian::Compactor::compaction_level compaction, unsigned flags, @@ -831,14 +831,14 @@ FlintLock lock(destdir); { - string explanation; + std::string explanation; FlintLock::reason why = lock.lock(true, false, explanation); if (why != FlintLock::SUCCESS) { lock.throw_databaselockerror(why, destdir, explanation); } } - vector<ChertTable *> tabs; + std::vector<ChertTable *> tabs; tabs.reserve(tables_end - tables); for (const table_list * t = tables; t < tables_end; ++t) { // The postlist table requires an N-way merge, adjusting the @@ -849,7 +849,7 @@ if (compactor) compactor->set_status(t->name, string()); - string dest = destdir; + std::string dest = destdir; dest += '/'; dest += t->name; dest += '.'; @@ -910,7 +910,7 @@ if (t->type == TERMLIST && inputs_present != sources.size()) { if (inputs_present != 0) { if (compactor) { - string m = str(inputs_present); + std::string m = str(inputs_present); m += " of "; m += str(sources.size()); m += " inputs present, so suppressing output"; @@ -978,7 +978,7 @@ if (compactor) compactor->set_status(t->name, "Done (couldn't stat all the DB files)"); } else { - string status; + std::string status; if (out_size == in_size) { status = "Size unchanged ("; } else { diff -ur xapian-core-1.4.21/backends/chert/chert_cursor.cc xapian-core-1.4.21/backends/chert/chert_cursor.cc --- xapian-core-1.4.21/backends/chert/chert_cursor.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_cursor.cc 2022-11-08 16:44:15.392461814 +0100 @@ -33,10 +33,10 @@ #ifdef XAPIAN_DEBUG_LOG static string -hex_display_encode(const string & input) +hex_display_encode(const std::string & input) { const char * table = "0123456789abcdef"; - string result; + std::string result; for (string::const_iterator i = input.begin(); i != input.end(); ++i) { unsigned char val = *i; result += "\\x"; @@ -192,7 +192,7 @@ } bool -ChertCursor::find_entry(const string &key) +ChertCursor::find_entry(const std::string &key) { LOGCALL(DB, bool, "ChertCursor::find_entry", key); if (B->cursor_version != version) { @@ -240,7 +240,7 @@ } bool -ChertCursor::find_entry_ge(const string &key) +ChertCursor::find_entry_ge(const std::string &key) { LOGCALL(DB, bool, "ChertCursor::find_entry_ge", key); if (B->cursor_version != version) { diff -ur xapian-core-1.4.21/backends/chert/chert_cursor.h xapian-core-1.4.21/backends/chert/chert_cursor.h --- xapian-core-1.4.21/backends/chert/chert_cursor.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_cursor.h 2022-11-08 16:44:00.944513174 +0100 @@ -115,7 +115,7 @@ * e.g. * * ChertCursor BC(&btree); - * string key; + * std::string key; * * // Now do something to each key in the Btree * BC.find_entry(string()); // must give result true @@ -146,12 +146,12 @@ /** Current key pointed to by cursor. */ - string current_key; + std::string current_key; /** Current tag pointed to by cursor. You must call read_tag to * make this value available. */ - string current_tag; + std::string current_tag; /** Read the tag from the table and store it in current_tag. * @@ -212,10 +212,10 @@ * @return true if the exact key was found in the table, false * otherwise. */ - bool find_entry(const string &key); + bool find_entry(const std::string &key); /// Position the cursor on the highest entry with key < @a key. - void find_entry_lt(const string &key) { + void find_entry_lt(const std::string &key) { if (find_entry(key)) prev(); } @@ -224,7 +224,7 @@ * @return true if the exact key was found in the table, false * otherwise. */ - bool find_entry_ge(const string &key); + bool find_entry_ge(const std::string &key); /** Set the cursor to be off the end of the table. */ diff -ur xapian-core-1.4.21/backends/chert/chert_database.cc xapian-core-1.4.21/backends/chert/chert_database.cc --- xapian-core-1.4.21/backends/chert/chert_database.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_database.cc 2022-11-08 16:44:15.396461799 +0100 @@ -78,7 +78,7 @@ // The maximum safe term length is determined by the postlist. There we // store the term using pack_string_preserving_sort() which takes the -// length of the string plus an extra byte (assuming the string doesn't +// length of the std::string plus an extra byte (assuming the std::string doesn't // contain any zero bytes), followed by the docid with encoded with // C_pack_uint_preserving_sort() which takes up to 5 bytes. // @@ -102,7 +102,7 @@ * determining the current and next revision numbers, and stores handles * to the tables. */ -ChertDatabase::ChertDatabase(const string &chert_dir, int flags, +ChertDatabase::ChertDatabase(const std::string &chert_dir, int flags, unsigned int block_size) : db_dir(chert_dir), readonly(flags == Xapian::DB_READONLY_), @@ -335,13 +335,13 @@ } void -ChertDatabase::get_changeset_revisions(const string & path, +ChertDatabase::get_changeset_revisions(const std::string & path, chert_revision_number_t * startrev, chert_revision_number_t * endrev) const { FD changes_fd(posixy_open(path.c_str(), O_RDONLY | O_CLOEXEC)); if (changes_fd < 0) { - string message = string("Couldn't open changeset ") + std::string message = string("Couldn't open changeset ") + path + " to read"; throw Xapian::DatabaseError(message, errno); } @@ -353,7 +353,7 @@ throw Xapian::DatabaseError("Changeset too short at " + path); if (memcmp(start, CHANGES_MAGIC_STRING, CONST_STRLEN(CHANGES_MAGIC_STRING)) != 0) { - string message = string("Changeset at ") + std::string message = string("Changeset at ") + path + " does not contain valid magic string"; throw Xapian::DatabaseError(message); } @@ -391,7 +391,7 @@ record_table.flush_db(); int changes_fd = -1; - string changes_name; + std::string changes_name; const char *p = getenv("XAPIAN_MAX_CHANGESETS"); if (p) { @@ -413,7 +413,7 @@ try { FD closefd(changes_fd); if (changes_fd >= 0) { - string buf; + std::string buf; chert_revision_number_t old_revision = get_revision_number(); buf += CHANGES_MAGIC_STRING; pack_uint(buf, CHANGES_VERSION); @@ -446,7 +446,7 @@ synonym_table.commit(new_revision, changes_fd); spelling_table.commit(new_revision, changes_fd); - string changes_tail; // Data to be appended to the changes file + std::string changes_tail; // Data to be appended to the changes file if (changes_fd >= 0) { changes_tail += '\0'; pack_uint(changes_tail, new_revision); @@ -481,7 +481,7 @@ { Xapian::TermIterator t; for (t = query.get_unique_terms_begin(); t != Xapian::TermIterator(); ++t) { - const string & term = *t; + const std::string & term = *t; if (!postlist_table.readahead_key(ChertPostListTable::make_key(term))) break; } @@ -512,12 +512,12 @@ ChertDatabase::get_database_write_lock(int flags, bool creating) { LOGCALL_VOID(DB, "ChertDatabase::get_database_write_lock", flags|creating); - string explanation; + std::string explanation; bool retry = flags & Xapian::DB_RETRY_LOCK; FlintLock::reason why = lock.lock(true, retry, explanation); if (why != FlintLock::SUCCESS) { if (why == FlintLock::UNKNOWN && !creating && !database_exists()) { - string msg("No chert database found at path '"); + std::string msg("No chert database found at path '"); msg += db_dir; msg += '\''; throw Xapian::DatabaseNotFoundError(msg); @@ -532,8 +532,8 @@ LOGCALL_VOID(DB, "ChertDatabase::send_whole_database", conn | end_time); #ifdef XAPIAN_HAS_REMOTE_BACKEND // Send the current revision number in the header. - string buf; - string uuid = get_uuid(); + std::string buf; + std::string uuid = get_uuid(); buf += encode_length(uuid.size()); buf += uuid; pack_uint(buf, get_revision_number()); @@ -549,10 +549,10 @@ "\x0b""position.DB""\x0e""position.baseA\x0e""position.baseB" "\x0b""postlist.DB""\x0e""postlist.baseA\x0e""postlist.baseB" "\x08""iamchert"; - string filepath = db_dir; + std::string filepath = db_dir; filepath += '/'; for (const char * p = filenames; *p; p += *p + 1) { - string leaf(p + 1, size_t(static_cast<unsigned char>(*p))); + std::string leaf(p + 1, size_t(static_cast<unsigned char>(*p))); filepath.replace(db_dir.size() + 1, string::npos, leaf); FD fd(posixy_open(filepath.c_str(), O_RDONLY | O_CLOEXEC)); if (fd >= 0) { @@ -568,7 +568,7 @@ void ChertDatabase::write_changesets_to_fd(int fd, - const string & revision, + const std::string & revision, bool need_whole_db, ReplicationInfo * info) { @@ -576,7 +576,7 @@ #ifdef XAPIAN_HAS_REMOTE_BACKEND int whole_db_copies_left = MAX_DB_COPIES_PER_CONVERSATION; chert_revision_number_t start_rev_num = 0; - string start_uuid = get_uuid(); + std::string start_uuid = get_uuid(); chert_revision_number_t needed_rev_num = 0; @@ -623,7 +623,7 @@ // The update must proceed to that revision number before the // copy is safe to make live. - string buf; + std::string buf; needed_rev_num = get_revision_number(); pack_uint(buf, needed_rev_num); conn.send_message(REPL_REPLY_DB_FOOTER, buf, 0.0); @@ -638,7 +638,7 @@ // because the next message is going to be the start of a new // database transfer. - string buf; + std::string buf; pack_uint(buf, start_rev_num + 1); conn.send_message(REPL_REPLY_DB_FOOTER, buf, 0.0); need_whole_db = true; @@ -657,7 +657,7 @@ } // Look for the changeset for revision start_rev_num. - string changes_name = db_dir + "/changes" + str(start_rev_num); + std::string changes_name = db_dir + "/changes" + str(start_rev_num); FD fd_changes(posixy_open(changes_name.c_str(), O_RDONLY | O_CLOEXEC)); if (fd_changes >= 0) { // Send it, and also update start_rev_num to the new value @@ -813,7 +813,7 @@ } void -ChertDatabase::get_freqs(const string & term, +ChertDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { @@ -856,7 +856,7 @@ } Xapian::termcount -ChertDatabase::get_wdf_upper_bound(const string & term) const +ChertDatabase::get_wdf_upper_bound(const std::string & term) const { Xapian::termcount cf; get_freqs(term, NULL, &cf); @@ -864,7 +864,7 @@ } bool -ChertDatabase::term_exists(const string & term) const +ChertDatabase::term_exists(const std::string & term) const { LOGCALL(DB, bool, "ChertDatabase::term_exists", term); Assert(!term.empty()); @@ -928,7 +928,7 @@ } PositionList * -ChertDatabase::open_position_list(Xapian::docid did, const string & term) const +ChertDatabase::open_position_list(Xapian::docid did, const std::string & term) const { Assert(did != 0); @@ -943,7 +943,7 @@ } TermList * -ChertDatabase::open_allterms(const string & prefix) const +ChertDatabase::open_allterms(const std::string & prefix) const { LOGCALL(DB, TermList *, "ChertDatabase::open_allterms", NO_ARGS); RETURN(new ChertAllTermsList(intrusive_ptr<const ChertDatabase>(this), @@ -951,7 +951,7 @@ } TermList * -ChertDatabase::open_spelling_termlist(const string & word) const +ChertDatabase::open_spelling_termlist(const std::string & word) const { return spelling_table.open_termlist(word); } @@ -966,19 +966,19 @@ } Xapian::doccount -ChertDatabase::get_spelling_frequency(const string & word) const +ChertDatabase::get_spelling_frequency(const std::string & word) const { return spelling_table.get_word_frequency(word); } TermList * -ChertDatabase::open_synonym_termlist(const string & term) const +ChertDatabase::open_synonym_termlist(const std::string & term) const { return synonym_table.open_termlist(term); } TermList * -ChertDatabase::open_synonym_keylist(const string & prefix) const +ChertDatabase::open_synonym_keylist(const std::string & prefix) const { ChertCursor * cursor = synonym_table.cursor_get(); if (!cursor) return NULL; @@ -987,12 +987,12 @@ } string -ChertDatabase::get_metadata(const string & key) const +ChertDatabase::get_metadata(const std::string & key) const { LOGCALL(DB, string, "ChertDatabase::get_metadata", key); - string btree_key("\x00\xc0", 2); + std::string btree_key("\x00\xc0", 2); btree_key += key; - string tag; + std::string tag; (void)postlist_table.get_exact_entry(btree_key, tag); RETURN(tag); } @@ -1011,7 +1011,7 @@ ChertDatabase::get_revision_info() const { LOGCALL(DB, string, "ChertDatabase::get_revision_info", NO_ARGS); - string buf; + std::string buf; pack_uint(buf, get_revision_number()); RETURN(buf); } @@ -1060,7 +1060,7 @@ /////////////////////////////////////////////////////////////////////////// -ChertWritableDatabase::ChertWritableDatabase(const string &dir, int action, +ChertWritableDatabase::ChertWritableDatabase(const std::string &dir, int action, int block_size) : ChertDatabase(dir, action, block_size), freq_deltas(), @@ -1145,11 +1145,11 @@ } void -ChertWritableDatabase::add_freq_delta(const string & tname, +ChertWritableDatabase::add_freq_delta(const std::string & tname, Xapian::termcount_diff tf_delta, Xapian::termcount_diff cf_delta) { - map<string, pair<termcount_diff, termcount_diff> >::iterator i; + std::map<string, std::pair<termcount_diff, termcount_diff> >::iterator i; i = freq_deltas.find(tname); if (i == freq_deltas.end()) { freq_deltas.insert(make_pair(tname, make_pair(tf_delta, cf_delta))); @@ -1161,14 +1161,14 @@ void ChertWritableDatabase::insert_mod_plist(Xapian::docid did, - const string & tname, + const std::string & tname, Xapian::termcount wdf) { // Find or make the appropriate entry in mod_plists. - map<string, map<docid, pair<char, termcount> > >::iterator j; + std::map<string, std::map<docid, std::pair<char, termcount> > >::iterator j; j = mod_plists.find(tname); if (j == mod_plists.end()) { - map<docid, pair<char, termcount> > m; + std::map<docid, std::pair<char, termcount> > m; j = mod_plists.insert(make_pair(tname, m)).first; } j->second[did] = make_pair('A', wdf); @@ -1176,19 +1176,19 @@ void ChertWritableDatabase::update_mod_plist(Xapian::docid did, - const string & tname, + const std::string & tname, char type, Xapian::termcount wdf) { // Find or make the appropriate entry in mod_plists. - map<string, map<docid, pair<char, termcount> > >::iterator j; + std::map<string, std::map<docid, std::pair<char, termcount> > >::iterator j; j = mod_plists.find(tname); if (j == mod_plists.end()) { - map<docid, pair<char, termcount> > m; + std::map<docid, std::pair<char, termcount> > m; j = mod_plists.insert(make_pair(tname, m)).first; } - map<docid, pair<char, termcount> >::iterator k; + std::map<docid, std::pair<char, termcount> >::iterator k; k = j->second.find(did); if (k == j->second.end()) { j->second.insert(make_pair(did, make_pair(type, wdf))); @@ -1235,7 +1235,7 @@ new_doclen += wdf; stats.check_wdf(wdf); - string tname = *term; + std::string tname = *term; if (tname.size() > MAX_SAFE_TERM_LENGTH) throw Xapian::InvalidArgumentError("Term too long (> " STRINGIZE(MAX_SAFE_TERM_LENGTH) "): " + tname); add_freq_delta(tname, 1, wdf); @@ -1306,7 +1306,7 @@ termlist.next(); while (!termlist.at_end()) { - string tname = termlist.get_termname(); + std::string tname = termlist.get_termname(); position_table.delete_positionlist(did, tname); termcount wdf = termlist.get_wdf(); @@ -1394,7 +1394,7 @@ stats.delete_document(old_doclen); chert_doclen_t new_doclen = old_doclen; - string old_tname, new_tname; + std::string old_tname, new_tname; termlist.next(); while (!termlist.at_end() || term != document.termlist_end()) { @@ -1521,7 +1521,7 @@ ChertWritableDatabase::get_doclength(Xapian::docid did) const { LOGCALL(DB, Xapian::termcount, "ChertWritableDatabase::get_doclength", did); - map<docid, termcount>::const_iterator i = doclens.find(did); + std::map<docid, termcount>::const_iterator i = doclens.find(did); if (i != doclens.end()) { Xapian::termcount doclen = i->second; if (doclen == static_cast<Xapian::termcount>(-1)) { @@ -1542,7 +1542,7 @@ // get_unique_terms() really ought to only count terms with wdf > 0, but // that's expensive to calculate on demand, so for now let's just ensure // unique_terms <= doclen. - map<docid, termcount>::const_iterator i = doclens.find(did); + std::map<docid, termcount>::const_iterator i = doclens.find(did); if (i != doclens.end()) { Xapian::termcount doclen = i->second; if (doclen == static_cast<Xapian::termcount>(-1)) { @@ -1556,14 +1556,14 @@ } void -ChertWritableDatabase::get_freqs(const string & term, +ChertWritableDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { LOGCALL_VOID(DB, "ChertWritableDatabase::get_freqs", term | termfreq_ptr | collfreq_ptr); Assert(!term.empty()); ChertDatabase::get_freqs(term, termfreq_ptr, collfreq_ptr); - map<string, pair<termcount_diff, termcount_diff> >::const_iterator i; + std::map<string, std::pair<termcount_diff, termcount_diff> >::const_iterator i; i = freq_deltas.find(term); if (i != freq_deltas.end()) { if (termfreq_ptr) @@ -1577,7 +1577,7 @@ ChertWritableDatabase::get_value_freq(Xapian::valueno slot) const { LOGCALL(DB, Xapian::doccount, "ChertWritableDatabase::get_value_freq", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.freq); RETURN(ChertDatabase::get_value_freq(slot)); @@ -1587,7 +1587,7 @@ ChertWritableDatabase::get_value_lower_bound(Xapian::valueno slot) const { LOGCALL(DB, std::string, "ChertWritableDatabase::get_value_lower_bound", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.lower_bound); RETURN(ChertDatabase::get_value_lower_bound(slot)); @@ -1597,14 +1597,14 @@ ChertWritableDatabase::get_value_upper_bound(Xapian::valueno slot) const { LOGCALL(DB, std::string, "ChertWritableDatabase::get_value_upper_bound", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.upper_bound); RETURN(ChertDatabase::get_value_upper_bound(slot)); } bool -ChertWritableDatabase::term_exists(const string & tname) const +ChertWritableDatabase::term_exists(const std::string & tname) const { LOGCALL(DB, bool, "ChertWritableDatabase::term_exists", tname); Xapian::doccount tf; @@ -1629,7 +1629,7 @@ RETURN(new ChertAllDocsModifiedPostList(ptrtothis, doccount, doclens)); } - map<string, map<docid, pair<char, termcount> > >::const_iterator j; + std::map<string, std::map<docid, std::pair<char, termcount> > >::const_iterator j; j = mod_plists.find(tname); if (j != mod_plists.end()) { // We've got buffered changes to this term's postlist, so we need to @@ -1652,7 +1652,7 @@ } TermList * -ChertWritableDatabase::open_allterms(const string & prefix) const +ChertWritableDatabase::open_allterms(const std::string & prefix) const { LOGCALL(DB, TermList *, "ChertWritableDatabase::open_allterms", NO_ARGS); // If there are changes, terms may have been added or removed, and so we @@ -1675,14 +1675,14 @@ } void -ChertWritableDatabase::add_spelling(const string & word, +ChertWritableDatabase::add_spelling(const std::string & word, Xapian::termcount freqinc) const { spelling_table.add_word(word, freqinc); } void -ChertWritableDatabase::remove_spelling(const string & word, +ChertWritableDatabase::remove_spelling(const std::string & word, Xapian::termcount freqdec) const { spelling_table.remove_word(word, freqdec); @@ -1696,37 +1696,37 @@ } TermList * -ChertWritableDatabase::open_synonym_keylist(const string & prefix) const +ChertWritableDatabase::open_synonym_keylist(const std::string & prefix) const { synonym_table.merge_changes(); return ChertDatabase::open_synonym_keylist(prefix); } void -ChertWritableDatabase::add_synonym(const string & term, - const string & synonym) const +ChertWritableDatabase::add_synonym(const std::string & term, + const std::string & synonym) const { synonym_table.add_synonym(term, synonym); } void -ChertWritableDatabase::remove_synonym(const string & term, - const string & synonym) const +ChertWritableDatabase::remove_synonym(const std::string & term, + const std::string & synonym) const { synonym_table.remove_synonym(term, synonym); } void -ChertWritableDatabase::clear_synonyms(const string & term) const +ChertWritableDatabase::clear_synonyms(const std::string & term) const { synonym_table.clear_synonyms(term); } void -ChertWritableDatabase::set_metadata(const string & key, const string & value) +ChertWritableDatabase::set_metadata(const std::string & key, const std::string & value) { LOGCALL_VOID(DB, "ChertWritableDatabase::set_metadata", key | value); - string btree_key("\x00\xc0", 2); + std::string btree_key("\x00\xc0", 2); btree_key += key; if (value.empty()) { postlist_table.del(btree_key); diff -ur xapian-core-1.4.21/backends/chert/chert_database.h xapian-core-1.4.21/backends/chert/chert_database.h --- xapian-core-1.4.21/backends/chert/chert_database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_database.h 2022-11-08 16:44:00.952513146 +0100 @@ -192,7 +192,7 @@ /** Called if a modifications fail. * - * @param msg is a string description of the exception that was + * @param msg is a std::string description of the exception that was * raised when the modifications failed. */ void modifications_failed(chert_revision_number_t old_revision, @@ -219,7 +219,7 @@ /** Get the revision stored in a changeset. */ - void get_changeset_revisions(const string & path, + void get_changeset_revisions(const std::string & path, chert_revision_number_t * startrev, chert_revision_number_t * endrev) const; public: @@ -242,7 +242,7 @@ * correct value, when the database is being * created. */ - ChertDatabase(const string &db_dir_, int action = Xapian::DB_READONLY_, + ChertDatabase(const std::string &db_dir_, int action = Xapian::DB_READONLY_, unsigned int block_size = 0u); ~ChertDatabase(); @@ -266,7 +266,7 @@ Xapian::totallength get_total_length() const; Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_unique_terms(Xapian::docid did) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; Xapian::doccount get_value_freq(Xapian::valueno slot) const; @@ -274,33 +274,33 @@ std::string get_value_upper_bound(Xapian::valueno slot) const; Xapian::termcount get_doclength_lower_bound() const; Xapian::termcount get_doclength_upper_bound() const; - Xapian::termcount get_wdf_upper_bound(const string & term) const; - bool term_exists(const string & tname) const; + Xapian::termcount get_wdf_upper_bound(const std::string & term) const; + bool term_exists(const std::string & tname) const; bool has_positions() const; - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; ValueList * open_value_list(Xapian::valueno slot) const; Xapian::Document::Internal * open_document(Xapian::docid did, bool lazy) const; - PositionList * open_position_list(Xapian::docid did, const string & term) const; + PositionList * open_position_list(Xapian::docid did, const std::string & term) const; TermList * open_term_list(Xapian::docid did) const; - TermList * open_allterms(const string & prefix) const; + TermList * open_allterms(const std::string & prefix) const; - TermList * open_spelling_termlist(const string & word) const; + TermList * open_spelling_termlist(const std::string & word) const; TermList * open_spelling_wordlist() const; - Xapian::doccount get_spelling_frequency(const string & word) const; + Xapian::doccount get_spelling_frequency(const std::string & word) const; - TermList * open_synonym_termlist(const string & term) const; - TermList * open_synonym_keylist(const string & prefix) const; + TermList * open_synonym_termlist(const std::string & term) const; + TermList * open_synonym_keylist(const std::string & prefix) const; - string get_metadata(const string & key) const; + std::string get_metadata(const std::string & key) const; TermList * open_metadata_keylist(const std::string &prefix) const; void write_changesets_to_fd(int fd, - const string & start_revision, + const std::string & start_revision, bool need_whole_db, Xapian::ReplicationInfo * info); - string get_revision_info() const; - string get_uuid() const; + std::string get_revision_info() const; + std::string get_uuid() const; void request_document(Xapian::docid /*did*/) const; void readahead_for_query(const Xapian::Query &query); @@ -335,17 +335,17 @@ */ class ChertWritableDatabase : public ChertDatabase { /** Unflushed changes to term frequencies and collection frequencies. */ - mutable map<string, pair<Xapian::termcount_diff, Xapian::termcount_diff> > + mutable std::map<string, std::pair<Xapian::termcount_diff, Xapian::termcount_diff> > freq_deltas; /** Document lengths of new and modified documents which haven't been flushed yet. */ - mutable map<Xapian::docid, Xapian::termcount> doclens; + mutable std::map<Xapian::docid, Xapian::termcount> doclens; /// Modifications to posting lists. - mutable map<string, map<Xapian::docid, - pair<char, Xapian::termcount> > > mod_plists; + mutable std::map<string, std::map<Xapian::docid, + std::pair<char, Xapian::termcount> > > mod_plists; - mutable map<Xapian::valueno, ValueStats> value_stats; + mutable std::map<Xapian::valueno, ValueStats> value_stats; /** The number of documents added, deleted, or replaced since the last * flush. @@ -388,7 +388,7 @@ * @param tf_delta The change in the term frequency delta. * @param cf_delta The change in the collection frequency delta. */ - void add_freq_delta(const string & tname, + void add_freq_delta(const std::string & tname, Xapian::termcount_diff tf_delta, Xapian::termcount_diff cf_delta); @@ -399,7 +399,7 @@ * @param wdf The new wdf value to store. */ void insert_mod_plist(Xapian::docid did, - const string & tname, + const std::string & tname, Xapian::termcount wdf); /** Update the stored modifications to the postlists. @@ -414,7 +414,7 @@ * cases, the stored type is simply the value supplied. */ void update_mod_plist(Xapian::docid did, - const string & tname, + const std::string & tname, char type, Xapian::termcount wdf); @@ -458,7 +458,7 @@ * * @param dir directory holding chert tables */ - ChertWritableDatabase(const string &dir, int action, int block_size); + ChertWritableDatabase(const std::string &dir, int action, int block_size); ~ChertWritableDatabase(); @@ -466,28 +466,28 @@ //@{ Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_unique_terms(Xapian::docid did) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; Xapian::doccount get_value_freq(Xapian::valueno slot) const; std::string get_value_lower_bound(Xapian::valueno slot) const; std::string get_value_upper_bound(Xapian::valueno slot) const; - bool term_exists(const string & tname) const; + bool term_exists(const std::string & tname) const; - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; ValueList * open_value_list(Xapian::valueno slot) const; - TermList * open_allterms(const string & prefix) const; + TermList * open_allterms(const std::string & prefix) const; - void add_spelling(const string & word, Xapian::termcount freqinc) const; - void remove_spelling(const string & word, Xapian::termcount freqdec) const; + void add_spelling(const std::string & word, Xapian::termcount freqinc) const; + void remove_spelling(const std::string & word, Xapian::termcount freqdec) const; TermList * open_spelling_wordlist() const; - TermList * open_synonym_keylist(const string & prefix) const; - void add_synonym(const string & word, const string & synonym) const; - void remove_synonym(const string & word, const string & synonym) const; - void clear_synonyms(const string & word) const; + TermList * open_synonym_keylist(const std::string & prefix) const; + void add_synonym(const std::string & word, const std::string & synonym) const; + void remove_synonym(const std::string & word, const std::string & synonym) const; + void clear_synonyms(const std::string & word) const; - void set_metadata(const string & key, const string & value); + void set_metadata(const std::string & key, const std::string & value); void invalidate_doc_object(Xapian::Document::Internal * obj) const; //@} diff -ur xapian-core-1.4.21/backends/chert/chert_databasereplicator.cc xapian-core-1.4.21/backends/chert/chert_databasereplicator.cc --- xapian-core-1.4.21/backends/chert/chert_databasereplicator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_databasereplicator.cc 2022-11-08 16:44:15.392461814 +0100 @@ -58,7 +58,7 @@ using namespace std; using namespace Xapian; -ChertDatabaseReplicator::ChertDatabaseReplicator(const string & db_dir_) +ChertDatabaseReplicator::ChertDatabaseReplicator(const std::string & db_dir_) : db_dir(db_dir_), max_changesets(0) { @@ -68,8 +68,8 @@ } bool -ChertDatabaseReplicator::check_revision_at_least(const string & rev, - const string & target) const +ChertDatabaseReplicator::check_revision_at_least(const std::string & rev, + const std::string & target) const { LOGCALL(DB, bool, "ChertDatabaseReplicator::check_revision_at_least", rev | target); @@ -79,21 +79,21 @@ const char * ptr = rev.data(); const char * end = ptr + rev.size(); if (!unpack_uint(&ptr, end, &rev_val)) { - throw NetworkError("Invalid revision string supplied to check_revision_at_least"); + throw NetworkError("Invalid revision std::string supplied to check_revision_at_least"); } ptr = target.data(); end = ptr + target.size(); if (!unpack_uint(&ptr, end, &target_val)) { - throw NetworkError("Invalid revision string supplied to check_revision_at_least"); + throw NetworkError("Invalid revision std::string supplied to check_revision_at_least"); } RETURN(rev_val >= target_val); } void -ChertDatabaseReplicator::process_changeset_chunk_base(const string & tablename, - string & buf, +ChertDatabaseReplicator::process_changeset_chunk_base(const std::string & tablename, + std::string & buf, RemoteConnection & conn, double end_time, int changes_fd) const @@ -125,11 +125,11 @@ } // Write base_size bytes from start of buf to base file for tablename - string tmp_path = db_dir + "/" + tablename + "tmp"; - string base_path = db_dir + "/" + tablename + ".base" + letter; + std::string tmp_path = db_dir + "/" + tablename + "tmp"; + std::string base_path = db_dir + "/" + tablename + ".base" + letter; int fd = posixy_open(tmp_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666); if (fd == -1) { - string msg = "Failed to open "; + std::string msg = "Failed to open "; msg += tmp_path; throw DatabaseError(msg, errno); } @@ -144,7 +144,7 @@ write_and_clear_changes(changes_fd, buf, base_size); if (!io_tmp_rename(tmp_path, base_path)) { - string msg("Couldn't update base file "); + std::string msg("Couldn't update base file "); msg += tablename; msg += ".base"; msg += letter; @@ -153,8 +153,8 @@ } void -ChertDatabaseReplicator::process_changeset_chunk_blocks(const string & tablename, - string & buf, +ChertDatabaseReplicator::process_changeset_chunk_blocks(const std::string & tablename, + std::string & buf, RemoteConnection & conn, double end_time, int changes_fd) const @@ -167,10 +167,10 @@ throw NetworkError("Invalid blocksize in changeset"); write_and_clear_changes(changes_fd, buf, ptr - buf.data()); - string db_path = db_dir + "/" + tablename + ".DB"; + std::string db_path = db_dir + "/" + tablename + ".DB"; int fd = posixy_open(db_path.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0666); if (fd == -1) { - string msg = "Failed to open "; + std::string msg = "Failed to open "; msg += db_path; throw DatabaseError(msg, errno); } @@ -216,7 +216,7 @@ // Lock the database to perform modifications. FlintLock lock(db_dir); - string explanation; + std::string explanation; FlintLock::reason why = lock.lock(true, false, explanation); if (why != FlintLock::SUCCESS) { lock.throw_databaselockerror(why, db_dir, explanation); @@ -227,7 +227,7 @@ throw_connection_closed_unexpectedly(); AssertEq(type, REPL_REPLY_CHANGESET); - string buf; + std::string buf; // Read enough to be certain that we've got the header part of the // changeset. @@ -262,7 +262,7 @@ throw NetworkError("Unexpected end of changeset (1)"); FD changes_fd; - string changes_name; + std::string changes_name; if (max_changesets > 0) { changes_fd = create_changeset_file(db_dir, "changes" + str(startrev), changes_name); @@ -305,7 +305,7 @@ break; // Get the tablename. - string tablename; + std::string tablename; if (!unpack_string(&ptr, end, tablename)) throw NetworkError("Unexpected end of changeset (3)"); if (tablename.empty()) diff -ur xapian-core-1.4.21/backends/chert/chert_dbcheck.cc xapian-core-1.4.21/backends/chert/chert_dbcheck.cc --- xapian-core-1.4.21/backends/chert/chert_dbcheck.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_dbcheck.cc 2022-11-08 16:44:15.400461785 +0100 @@ -44,7 +44,7 @@ using namespace std; static inline bool -is_user_metadata_key(const string & key) +is_user_metadata_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xc0'; } @@ -58,11 +58,11 @@ size_t check_chert_table(const char * tablename, const string& dir, chert_revision_number_t * rev_ptr, int opts, - vector<Xapian::termcount> & doclens, + std::vector<Xapian::termcount> & doclens, Xapian::doccount doccount, Xapian::docid db_last_docid, ostream * out) { - string filename = dir; + std::string filename = dir; filename += '/'; filename += tablename; filename += '.'; @@ -96,8 +96,8 @@ if (strcmp(tablename, "postlist") == 0) { // Now check the structure of each postlist in the table. - map<Xapian::valueno, VStats> valuestats; - string current_term; + std::map<Xapian::valueno, VStats> valuestats; + std::string current_term; Xapian::docid lastdid = 0; Xapian::termcount termfreq = 0, collfreq = 0; Xapian::termcount tf = 0, cf = 0; @@ -150,7 +150,7 @@ bool seen_doclen_initial_chunk = false; for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; if (is_user_metadata_key(key)) { // User metadata can be anything, so we can't do any particular @@ -393,7 +393,7 @@ end = p + cursor->current_tag.size(); while (true) { - string value; + std::string value; if (!unpack_string(&p, end, value)) { if (out) *out << "Failed to unpack value from chunk" << endl; @@ -458,7 +458,7 @@ pos = key.data(); end = pos + key.size(); - string term; + std::string term; Xapian::docid did; if (!unpack_string_preserving_sort(&pos, end, term)) { if (out) @@ -636,7 +636,7 @@ ++errors; } - map<Xapian::valueno, VStats>::const_iterator i; + std::map<Xapian::valueno, VStats>::const_iterator i; for (i = valuestats.begin(); i != valuestats.end(); ++i) { if (i->second.freq != i->second.freq_real) { if (out) @@ -658,7 +658,7 @@ // Now check the contents of the record table. Any data is valid as // the tag so we don't check the tags. for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); @@ -688,7 +688,7 @@ Xapian::doccount num_termlists = 0; Xapian::doccount num_slotsused_entries = 0; for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); @@ -803,7 +803,7 @@ } Xapian::termcount actual_doclen = 0, actual_termlist_size = 0; - string current_tname; + std::string current_tname; bool bad = false; while (pos != end) { @@ -886,7 +886,7 @@ } else if (strcmp(tablename, "position") == 0) { // Now check the contents of the position table. for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); @@ -927,7 +927,7 @@ cursor->read_tag(); - const string & data = cursor->current_tag; + const std::string & data = cursor->current_tag; pos = data.data(); end = pos + data.size(); diff -ur xapian-core-1.4.21/backends/chert/chert_dbstats.cc xapian-core-1.4.21/backends/chert/chert_dbstats.cc --- xapian-core-1.4.21/backends/chert/chert_dbstats.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_dbstats.cc 2022-11-08 16:44:15.412461742 +0100 @@ -27,12 +27,12 @@ using namespace std; /// The key in the postlist table which we use to store our encoded statistics. -static const string DATABASE_STATS_KEY(1, '\0'); +static const std::string DATABASE_STATS_KEY(1, '\0'); void ChertDatabaseStats::read(ChertPostListTable & postlist_table) { - string data; + std::string data; if (!postlist_table.get_exact_entry(DATABASE_STATS_KEY, data)) { // If there's no entry yet, then all the values are zero. total_doclen = 0; @@ -67,7 +67,7 @@ void ChertDatabaseStats::write(ChertPostListTable & postlist_table) const { - string data; + std::string data; pack_uint(data, last_docid); pack_uint(data, doclen_lbound); pack_uint(data, wdf_ubound); diff -ur xapian-core-1.4.21/backends/chert/chert_document.cc xapian-core-1.4.21/backends/chert/chert_document.cc --- xapian-core-1.4.21/backends/chert/chert_document.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_document.cc 2022-11-08 16:44:15.412461742 +0100 @@ -43,7 +43,7 @@ /** Retrieve all value values from the database */ void -ChertDocument::do_get_all_values(map<Xapian::valueno, string> & values_) const +ChertDocument::do_get_all_values(std::map<Xapian::valueno, string> & values_) const { LOGCALL_VOID(DB, "ChertDocument::do_get_all_values", values_); value_manager->get_all_values(values_, did); diff -ur xapian-core-1.4.21/backends/chert/chert_document.h xapian-core-1.4.21/backends/chert/chert_document.h --- xapian-core-1.4.21/backends/chert/chert_document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_document.h 2022-11-08 16:44:00.956513132 +0100 @@ -53,9 +53,9 @@ public: /** Implementation of virtual methods @{ */ - string do_get_value(Xapian::valueno slot) const; - void do_get_all_values(map<Xapian::valueno, string> & values_) const; - string do_get_data() const; + std::string do_get_value(Xapian::valueno slot) const; + void do_get_all_values(std::map<Xapian::valueno, string> & values_) const; + std::string do_get_data() const; /** @} */ }; diff -ur xapian-core-1.4.21/backends/chert/chert_metadata.cc xapian-core-1.4.21/backends/chert/chert_metadata.cc --- xapian-core-1.4.21/backends/chert/chert_metadata.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_metadata.cc 2022-11-08 16:44:15.384461842 +0100 @@ -33,7 +33,7 @@ ChertMetadataTermList::ChertMetadataTermList( intrusive_ptr<const Xapian::Database::Internal> database_, ChertCursor * cursor_, - const string &prefix_) + const std::string &prefix_) : database(database_), cursor(cursor_), prefix(string("\x00\xc0", 2) + prefix_) { LOGCALL_CTOR(DB, "ChertMetadataTermList", database_ | cursor_ | prefix_); @@ -80,7 +80,7 @@ } TermList * -ChertMetadataTermList::skip_to(const string &key) +ChertMetadataTermList::skip_to(const std::string &key) { LOGCALL(DB, TermList *, "ChertMetadataTermList::skip_to", key); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.cc xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.cc --- xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.cc 2022-11-08 16:44:15.380461857 +0100 @@ -59,7 +59,7 @@ if (it == mods.end()) return ChertPostList::get_docid(); if (ChertPostList::at_end()) return it->first; Assert(it->second.first != 'D'); - return min(it->first, ChertPostList::get_docid()); + return std::min(it->first, ChertPostList::get_docid()); } Xapian::termcount diff -ur xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.h xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.h --- xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_modifiedpostlist.h 2022-11-08 16:44:00.948513161 +0100 @@ -24,7 +24,7 @@ #include <map> #include <string> -using namespace std; +using std::string; #include "chert_database.h" #include "chert_postlist.h" @@ -32,8 +32,8 @@ class ChertModifiedPostList : public ChertPostList { /// Modifications to apply to the ChertPostList. //@{ - map<Xapian::docid, pair<char, Xapian::termcount> > mods; - map<Xapian::docid, pair<char, Xapian::termcount> >::const_iterator it; + std::map<Xapian::docid, std::pair<char, Xapian::termcount> > mods; + std::map<Xapian::docid, std::pair<char, Xapian::termcount> >::const_iterator it; //@} /// Pointer to PositionList returned from read_position_list to be deleted. @@ -45,8 +45,8 @@ public: /// Constructor. ChertModifiedPostList(Xapian::Internal::intrusive_ptr<const ChertDatabase> this_db_, - const string & term_, - const map<Xapian::docid, pair<char, Xapian::termcount> > & mods_) + const std::string & term_, + const std::map<Xapian::docid, std::pair<char, Xapian::termcount> > & mods_) : ChertPostList(this_db_, term_, true), mods(mods_), it(mods.begin()), poslist(0) { } diff -ur xapian-core-1.4.21/backends/chert/chert_positionlist.cc xapian-core-1.4.21/backends/chert/chert_positionlist.cc --- xapian-core-1.4.21/backends/chert/chert_positionlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_positionlist.cc 2022-11-08 16:44:15.404461770 +0100 @@ -35,7 +35,7 @@ void ChertPositionListTable::set_positionlist(Xapian::docid did, - const string & tname, + const std::string & tname, Xapian::PositionIterator pos, const Xapian::PositionIterator &pos_end, bool check_for_update) @@ -44,11 +44,11 @@ Assert(pos != pos_end); // FIXME: avoid the need for this copy! - vector<Xapian::termpos> poscopy(pos, pos_end); + std::vector<Xapian::termpos> poscopy(pos, pos_end); - string key = make_key(did, tname); + std::string key = make_key(did, tname); - string s; + std::string s; pack_uint(s, poscopy.back()); if (poscopy.size() > 1) { @@ -60,7 +60,7 @@ } if (check_for_update) { - string old_tag; + std::string old_tag; if (get_exact_entry(key, old_tag) && s == old_tag) return; } @@ -69,11 +69,11 @@ Xapian::termcount ChertPositionListTable::positionlist_count(Xapian::docid did, - const string & term) const + const std::string & term) const { LOGCALL(DB, Xapian::termcount, "ChertPositionListTable::positionlist_count", did | term); - string data; + std::string data; if (!get_exact_entry(make_key(did, term), data)) { RETURN(0); } @@ -100,13 +100,13 @@ bool ChertPositionList::read_data(const ChertTable * table, Xapian::docid did, - const string & tname) + const std::string & tname) { LOGCALL(DB, bool, "ChertPositionList::read_data", table | did | tname); have_started = false; - string data; + std::string data; if (!table->get_exact_entry(ChertPositionListTable::make_key(did, tname), data)) { // There's no positional information for this term. size = 0; diff -ur xapian-core-1.4.21/backends/chert/chert_positionlist.h xapian-core-1.4.21/backends/chert/chert_positionlist.h --- xapian-core-1.4.21/backends/chert/chert_positionlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_positionlist.h 2022-11-08 16:44:00.944513174 +0100 @@ -31,12 +31,12 @@ #include <string> -using namespace std; +using std::string; class ChertPositionListTable : public ChertLazyTable { public: - static string make_key(Xapian::docid did, const string & term) { - string key; + static std::string make_key(Xapian::docid did, const std::string & term) { + std::string key; C_pack_uint_preserving_sort(key, did); key += term; return key; @@ -50,7 +50,7 @@ * @param dbdir The directory the chert database is stored in. * @param readonly true if we're opening read-only, else false. */ - ChertPositionListTable(const string & dbdir, bool readonly) + ChertPositionListTable(const std::string & dbdir, bool readonly) : ChertLazyTable("position", dbdir + "/position.", readonly, DONT_COMPRESS) { } @@ -59,19 +59,19 @@ * @param check_for_update If true, check if the new list is the same as * the existing list (if there is one). */ - void set_positionlist(Xapian::docid did, const string & tname, + void set_positionlist(Xapian::docid did, const std::string & tname, Xapian::PositionIterator pos, const Xapian::PositionIterator &pos_end, bool check_for_update); /// Delete the position list for term tname in document did. - void delete_positionlist(Xapian::docid did, const string & tname) { + void delete_positionlist(Xapian::docid did, const std::string & tname) { del(make_key(did, tname)); } /// Return the number of entries in specified position list. Xapian::termcount positionlist_count(Xapian::docid did, - const string & term) const; + const std::string & term) const; }; /** A position list in a chert database. */ @@ -103,7 +103,7 @@ /// Construct and initialise with data. ChertPositionList(const ChertTable * table, Xapian::docid did, - const string & tname) { + const std::string & tname) { (void)read_data(table, did, tname); } @@ -112,7 +112,7 @@ * @return true if position data was read. */ bool read_data(const ChertTable * table, Xapian::docid did, - const string & tname); + const std::string & tname); /// Returns size of position list. Xapian::termcount get_approx_size() const; diff -ur xapian-core-1.4.21/backends/chert/chert_postlist.cc xapian-core-1.4.21/backends/chert/chert_postlist.cc --- xapian-core-1.4.21/backends/chert/chert_postlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_postlist.cc 2022-11-08 16:44:15.404461770 +0100 @@ -34,12 +34,12 @@ using Xapian::Internal::intrusive_ptr; void -ChertPostListTable::get_freqs(const string & term, +ChertPostListTable::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { - string key = make_key(term); - string tag; + std::string key = make_key(term); + std::string tag; if (!get_exact_entry(key, tag)) { if (termfreq_ptr) *termfreq_ptr = 0; @@ -92,9 +92,9 @@ */ class Chert::PostlistChunkWriter { public: - PostlistChunkWriter(const string &orig_key_, + PostlistChunkWriter(const std::string &orig_key_, bool is_first_chunk_, - const string &tname_, + const std::string &tname_, bool is_last_chunk_); /// Append an entry to this chunk. @@ -103,7 +103,7 @@ /// Append a block of raw entries to this chunk. void raw_append(Xapian::docid first_did_, Xapian::docid current_did_, - const string & s) { + const std::string & s) { Assert(!started); first_did = first_did_; current_did = current_did_; @@ -120,8 +120,8 @@ void flush(ChertTable *table); private: - string orig_key; - string tname; + std::string orig_key; + std::string tname; bool is_first_chunk; bool is_last_chunk; bool started; @@ -129,7 +129,7 @@ Xapian::docid first_did; Xapian::docid current_did; - string chunk; + std::string chunk; }; using Chert::PostlistChunkWriter; @@ -151,15 +151,15 @@ } static inline bool get_tname_from_key(const char **src, const char *end, - string &tname) + std::string &tname) { return unpack_string_preserving_sort(src, end, tname); } static inline bool -check_tname_in_key_lite(const char **keypos, const char *keyend, const string &tname) +check_tname_in_key_lite(const char **keypos, const char *keyend, const std::string &tname) { - string tname_in_key; + std::string tname_in_key; if (keyend - *keypos >= 2 && (*keypos)[0] == '\0' && (*keypos)[1] == '\xe0') { *keypos += 2; @@ -174,7 +174,7 @@ } static inline bool -check_tname_in_key(const char **keypos, const char *keyend, const string &tname) +check_tname_in_key(const char **keypos, const char *keyend, const std::string &tname) { if (*keypos == keyend) return false; @@ -251,7 +251,7 @@ * entries in a postlist. */ class Chert::PostlistChunkReader { - string data; + std::string data; const char *pos; const char *end; @@ -265,9 +265,9 @@ /** Initialise the postlist chunk reader. * * @param first_did First document id in this chunk. - * @param data The tag string with the header removed. + * @param data The tag std::string with the header removed. */ - PostlistChunkReader(Xapian::docid first_did, const string & data_) + PostlistChunkReader(Xapian::docid first_did, const std::string & data_) : data(data_), pos(data.data()), end(pos + data.length()), at_end(data.empty()), did(first_did) { if (!at_end) read_wdf(&pos, end, &wdf); @@ -302,9 +302,9 @@ } } -PostlistChunkWriter::PostlistChunkWriter(const string &orig_key_, +PostlistChunkWriter::PostlistChunkWriter(const std::string &orig_key_, bool is_first_chunk_, - const string &tname_, + const std::string &tname_, bool is_last_chunk_) : orig_key(orig_key_), tname(tname_), is_first_chunk(is_first_chunk_), @@ -348,7 +348,7 @@ Xapian::termcount collectionfreq, Xapian::docid new_did) { - string chunk; + std::string chunk; pack_uint(chunk, entries); pack_uint(chunk, collectionfreq); pack_uint(chunk, new_did - 1); @@ -363,7 +363,7 @@ Xapian::docid new_final_did) { Assert(new_final_did >= new_first_did); - string chunk; + std::string chunk; pack_bool(chunk, new_is_last_chunk); pack_uint(chunk, new_final_did - new_first_did); return chunk; @@ -477,13 +477,13 @@ read_start_of_chunk(&tagpos, tagend, new_first_did, &new_is_last_chunk); - string chunk_data(tagpos, tagend); + std::string chunk_data(tagpos, tagend); // First remove the renamed tag table->del(cursor->current_key); // And now write it as the first chunk - string tag; + std::string tag; tag = make_start_of_first_chunk(num_ent, coll_freq, new_first_did); tag += make_start_of_chunk(new_is_last_chunk, new_first_did, @@ -520,7 +520,7 @@ // Now update the last_chunk cursor->read_tag(); - string tag = cursor->current_tag; + std::string tag = cursor->current_tag; const char *tagpos = tag.data(); const char *tagend = tagpos + tag.size(); @@ -558,7 +558,7 @@ * * The subcases just affect the chunk header. */ - string tag; + std::string tag; /* First write the header, which depends on whether this is the * first chunk. @@ -568,7 +568,7 @@ * and we just have to write this one back to disk. */ LOGLINE(DB, "PostlistChunkWriter::flush(): rewriting the first chunk, which still has items in it"); - string key = ChertPostListTable::make_key(tname); + std::string key = ChertPostListTable::make_key(tname); bool ok = table->get_exact_entry(key, tag); (void)ok; Assert(ok); @@ -612,7 +612,7 @@ if (!C_unpack_uint_preserving_sort(&keypos, keyend, &initial_did)) { report_read_error(keypos); } - string new_key; + std::string new_key; if (initial_did != first_did) { /* The fiddlier case: * Create a new tag with the correct key, and replace @@ -667,7 +667,7 @@ * standard chunk. */ ChertPostList::ChertPostList(intrusive_ptr<const ChertDatabase> this_db_, - const string & term_, + const std::string & term_, bool keep_reference) : LeafPostList(term_), this_db(keep_reference ? this_db_ : NULL), @@ -676,7 +676,7 @@ cursor(this_db_->postlist_table.cursor_get()) { LOGCALL_CTOR(DB, "ChertPostList", this_db_.get() | term_ | keep_reference); - string key = ChertPostListTable::make_key(term); + std::string key = ChertPostListTable::make_key(term); int found = cursor->find_entry(key); if (!found) { LOGLINE(DB, "postlist for term not found"); @@ -701,7 +701,7 @@ read_wdf(&pos, end, &wdf); // This works even if there's only one entry (when wdf == collfreq) // or when collfreq is 0 (=> wdf is 0 too). - wdf_upper_bound = max(collfreq - wdf, wdf); + wdf_upper_bound = std::max(collfreq - wdf, wdf); LOGLINE(DB, "Initial docid " << did); } @@ -988,13 +988,13 @@ // Returns the last did to allow in this chunk. Xapian::docid -ChertPostListTable::get_chunk(const string &tname, +ChertPostListTable::get_chunk(const std::string &tname, Xapian::docid did, bool adding, PostlistChunkReader ** from, PostlistChunkWriter **to) { LOGCALL(DB, Xapian::docid, "ChertPostListTable::get_chunk", tname | did | adding | from | to); // Get chunk containing entry - string key = make_key(tname, did); + std::string key = make_key(tname, did); // Find the right chunk AutoPtr<ChertCursor> cursor(cursor_get()); @@ -1070,9 +1070,9 @@ void ChertPostListTable::merge_changes( - const map<string, map<Xapian::docid, pair<char, Xapian::termcount> > > & mod_plists, - const map<Xapian::docid, Xapian::termcount> & doclens, - const map<string, pair<Xapian::termcount_diff, Xapian::termcount_diff> > & freq_deltas) + const std::map<string, std::map<Xapian::docid, std::pair<char, Xapian::termcount> > > & mod_plists, + const std::map<Xapian::docid, Xapian::termcount> & doclens, + const std::map<string, std::pair<Xapian::termcount_diff, Xapian::termcount_diff> > & freq_deltas) { LOGCALL_VOID(DB, "ChertPostListTable::merge_changes", mod_plists | doclens | freq_deltas); @@ -1082,15 +1082,15 @@ LOGVALUE(DB, doclens.size()); if (!doclens.empty()) { // Ensure there's a first chunk. - string current_key = make_key(string()); + std::string current_key = make_key(string()); if (!key_exists(current_key)) { LOGLINE(DB, "Adding dummy first chunk"); - string newtag = make_start_of_first_chunk(0, 0, 0); + std::string newtag = make_start_of_first_chunk(0, 0, 0); newtag += make_start_of_chunk(true, 0, 0); add(current_key, newtag); } - map<Xapian::docid, Xapian::termcount>::const_iterator j; + std::map<Xapian::docid, Xapian::termcount>::const_iterator j; j = doclens.begin(); Assert(j != doclens.end()); // This case is caught above. @@ -1138,18 +1138,18 @@ delete to; } - map<string, map<Xapian::docid, pair<char, Xapian::termcount> > >::const_iterator i; + std::map<string, std::map<Xapian::docid, std::pair<char, Xapian::termcount> > >::const_iterator i; for (i = mod_plists.begin(); i != mod_plists.end(); ++i) { if (i->second.empty()) continue; - string tname = i->first; + std::string tname = i->first; { // Rewrite the first chunk of this posting list with the updated // termfreq and collfreq. - map<string, pair<Xapian::termcount_diff, Xapian::termcount_diff> >::const_iterator deltas = freq_deltas.find(tname); + std::map<string, std::pair<Xapian::termcount_diff, Xapian::termcount_diff> >::const_iterator deltas = freq_deltas.find(tname); Assert(deltas != freq_deltas.end()); - string current_key = make_key(tname); - string tag; + std::string current_key = make_key(tname); + std::string tag; (void)get_exact_entry(current_key, tag); // Read start of first chunk to get termfreq and collfreq. @@ -1195,7 +1195,7 @@ collfreq += deltas->second.second; // Rewrite start of first chunk to update termfreq and collfreq. - string newhdr = make_start_of_first_chunk(termfreq, collfreq, firstdid); + std::string newhdr = make_start_of_first_chunk(termfreq, collfreq, firstdid); newhdr += make_start_of_chunk(islast, firstdid, lastdid); if (pos == end) { add(current_key, newhdr); @@ -1205,7 +1205,7 @@ add(current_key, tag); } } - map<Xapian::docid, pair<char, Xapian::termcount> >::const_iterator j; + std::map<Xapian::docid, std::pair<char, Xapian::termcount> >::const_iterator j; j = i->second.begin(); Assert(j != i->second.end()); // This case is caught above. diff -ur xapian-core-1.4.21/backends/chert/chert_postlist.h xapian-core-1.4.21/backends/chert/chert_postlist.h --- xapian-core-1.4.21/backends/chert/chert_postlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_postlist.h 2022-11-08 16:44:00.960513118 +0100 @@ -36,7 +36,7 @@ #include <map> #include <string> -using namespace std; +using std::string; class ChertCursor; class ChertDatabase; @@ -65,7 +65,7 @@ * @param readonly_ - whether to open the table for read only * access. */ - ChertPostListTable(const string & path_, bool readonly_) + ChertPostListTable(const std::string & path_, bool readonly_) : ChertTable("postlist", path_ + "/postlist.", readonly_), doclen_pl() { } @@ -77,26 +77,26 @@ /// Merge added, removed, and changed entries. void merge_changes( - const map<string, map<Xapian::docid, pair<char, Xapian::termcount> > > & mod_plists, - const map<Xapian::docid, Xapian::termcount> & doclens, - const map<string, pair<Xapian::termcount_diff, Xapian::termcount_diff> > & freq_deltas); + const std::map<string, std::map<Xapian::docid, std::pair<char, Xapian::termcount> > > & mod_plists, + const std::map<Xapian::docid, Xapian::termcount> & doclens, + const std::map<string, std::pair<Xapian::termcount_diff, Xapian::termcount_diff> > & freq_deltas); - Xapian::docid get_chunk(const string &tname, + Xapian::docid get_chunk(const std::string &tname, Xapian::docid did, bool adding, Chert::PostlistChunkReader ** from, Chert::PostlistChunkWriter **to); /// Compose a key from a termname and docid. - static string make_key(const string & term, Xapian::docid did) { + static std::string make_key(const std::string & term, Xapian::docid did) { return pack_chert_postlist_key(term, did); } /// Compose a key from a termname. - static string make_key(const string & term) { + static std::string make_key(const std::string & term) { return pack_chert_postlist_key(term); } - bool term_exists(const string & term) const { + bool term_exists(const std::string & term) const { return key_exists(make_key(term)); } @@ -231,7 +231,7 @@ public: /// Default constructor. ChertPostList(Xapian::Internal::intrusive_ptr<const ChertDatabase> this_db_, - const string & term, + const std::string & term, bool keep_reference); /// Destructor. diff -ur xapian-core-1.4.21/backends/chert/chert_record.cc xapian-core-1.4.21/backends/chert/chert_record.cc --- xapian-core-1.4.21/backends/chert/chert_record.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_record.cc 2022-11-08 16:44:15.388461828 +0100 @@ -34,7 +34,7 @@ inline string make_key(Xapian::docid did) { - string key; + std::string key; C_pack_uint_preserving_sort(key, did); return key; } @@ -43,9 +43,9 @@ ChertRecordTable::get_record(Xapian::docid did) const { LOGCALL(DB, string, "ChertRecordTable::get_record", did); - string tag; + std::string tag; // get_document() checks that the docid is valid, unless DOC_ASSUME_VALID - // is used in which case returning an empty string here is the most + // is used in which case returning an empty std::string here is the most // sensible behaviour. (void)get_exact_entry(make_key(did), tag); RETURN(tag); @@ -65,7 +65,7 @@ } void -ChertRecordTable::replace_record(const string & data, Xapian::docid did) +ChertRecordTable::replace_record(const std::string & data, Xapian::docid did) { LOGCALL_VOID(DB, "ChertRecordTable::replace_record", data | did); add(make_key(did), data); diff -ur xapian-core-1.4.21/backends/chert/chert_record.h xapian-core-1.4.21/backends/chert/chert_record.h --- xapian-core-1.4.21/backends/chert/chert_record.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_record.h 2022-11-08 16:44:00.944513174 +0100 @@ -30,7 +30,7 @@ #include "chert_types.h" #include "chert_table.h" -using namespace std; +using std::string; /** A record in a chert database. */ @@ -48,12 +48,12 @@ * @param readonly_ - whether to open the table for read only * access. */ - ChertRecordTable(const string & path_, bool readonly_) + ChertRecordTable(const std::string & path_, bool readonly_) : ChertTable("record", path_ + "/record.", readonly_, Z_DEFAULT_STRATEGY) { } /** Retrieve a document from the table. */ - string get_record(Xapian::docid did) const; + std::string get_record(Xapian::docid did) const; /** Get the number of records in the table. */ @@ -63,7 +63,7 @@ * * @param did The document ID to use. */ - void replace_record(const string & data, Xapian::docid did); + void replace_record(const std::string & data, Xapian::docid did); /** Delete a record from the table. */ diff -ur xapian-core-1.4.21/backends/chert/chert_replicate_internal.h xapian-core-1.4.21/backends/chert/chert_replicate_internal.h --- xapian-core-1.4.21/backends/chert/chert_replicate_internal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_replicate_internal.h 2022-11-08 16:44:00.948513161 +0100 @@ -22,7 +22,7 @@ #ifndef XAPIAN_INCLUDED_CHERT_REPLICATE_INTERNAL_H #define XAPIAN_INCLUDED_CHERT_REPLICATE_INTERNAL_H -// Magic string used to recognise a changeset file. +// Magic std::string used to recognise a changeset file. #define CHANGES_MAGIC_STRING "ChertChanges" // The current version of changeset files. diff -ur xapian-core-1.4.21/backends/chert/chert_spelling.cc xapian-core-1.4.21/backends/chert/chert_spelling.cc --- xapian-core-1.4.21/backends/chert/chert_spelling.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_spelling.cc 2022-11-08 16:44:15.388461828 +0100 @@ -50,14 +50,14 @@ auto d = changes.begin(); if (d == changes.end()) continue; - string updated; - string current; + std::string updated; + std::string current; PrefixCompressedStringWriter out(updated); if (get_exact_entry(key, current)) { PrefixCompressedStringItor in(current); updated.reserve(current.size()); // FIXME plus some? while (!in.at_end() && d != changes.end()) { - const string & word = *in; + const std::string & word = *in; Assert(d != changes.end()); int cmp = word.compare(*d); if (cmp < 0) { @@ -91,11 +91,11 @@ } termlist_deltas.clear(); - map<string, Xapian::termcount>::const_iterator j; + std::map<string, Xapian::termcount>::const_iterator j; for (j = wordfreq_changes.begin(); j != wordfreq_changes.end(); ++j) { - string key = "W" + j->first; + std::string key = "W" + j->first; if (j->second) { - string tag; + std::string tag; pack_uint_last(tag, j->second); add(key, tag); } else { @@ -106,7 +106,7 @@ } void -ChertSpellingTable::toggle_fragment(fragment frag, const string & word) +ChertSpellingTable::toggle_fragment(fragment frag, const std::string & word) { auto i = termlist_deltas.find(frag); if (i == termlist_deltas.end()) { @@ -122,11 +122,11 @@ } void -ChertSpellingTable::add_word(const string & word, Xapian::termcount freqinc) +ChertSpellingTable::add_word(const std::string & word, Xapian::termcount freqinc) { if (word.size() <= 1) return; - map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); + std::map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { // Word "word" already exists and has been modified. if (i->second) { @@ -137,8 +137,8 @@ // we need to execute the code below to re-add trigrams for it. i->second = freqinc; } else { - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (get_exact_entry(key, data)) { // Word "word" already exists, so increment its count. Xapian::termcount freq; @@ -157,11 +157,11 @@ } void -ChertSpellingTable::remove_word(const string & word, Xapian::termcount freqdec) +ChertSpellingTable::remove_word(const std::string & word, Xapian::termcount freqdec) { if (word.size() <= 1) return; - map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); + std::map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { if (i->second == 0) { // Word has already been deleted. @@ -176,8 +176,8 @@ // Mark word as deleted. i->second = 0; } else { - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (!get_exact_entry(key, data)) { // This word doesn't exist. return; @@ -201,7 +201,7 @@ } void -ChertSpellingTable::toggle_word(const string & word) +ChertSpellingTable::toggle_word(const std::string & word) { fragment buf; // Head: @@ -251,7 +251,7 @@ }; TermList * -ChertSpellingTable::open_termlist(const string & word) +ChertSpellingTable::open_termlist(const std::string & word) { // This should have been handled by Database::get_spelling_suggestion(). AssertRel(word.size(),>,1); @@ -262,9 +262,9 @@ // Build a priority queue of TermList objects which returns those of // greatest approximate size first. - priority_queue<TermList*, vector<TermList*>, TermListGreaterApproxSize> pq; + priority_queue<TermList*, std::vector<TermList*>, TermListGreaterApproxSize> pq; try { - string data; + std::string data; fragment buf; // Head: @@ -367,17 +367,17 @@ } Xapian::doccount -ChertSpellingTable::get_word_frequency(const string & word) const +ChertSpellingTable::get_word_frequency(const std::string & word) const { - map<string, Xapian::termcount>::const_iterator i; + std::map<string, Xapian::termcount>::const_iterator i; i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { // Modified frequency for word: return i->second; } - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (get_exact_entry(key, data)) { // Word "word" already exists. Xapian::termcount freq; @@ -442,7 +442,7 @@ } TermList * -ChertSpellingTermList::skip_to(const string & term) +ChertSpellingTermList::skip_to(const std::string & term) { while (!data.empty() && current_term < term) { (void)ChertSpellingTermList::next(); diff -ur xapian-core-1.4.21/backends/chert/chert_spellingwordslist.cc xapian-core-1.4.21/backends/chert/chert_spellingwordslist.cc --- xapian-core-1.4.21/backends/chert/chert_spellingwordslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_spellingwordslist.cc 2022-11-08 16:44:15.388461828 +0100 @@ -82,7 +82,7 @@ } TermList * -ChertSpellingWordsList::skip_to(const string &tname) +ChertSpellingWordsList::skip_to(const std::string &tname) { LOGCALL(DB, TermList *, "ChertSpellingWordsList::skip_to", tname); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/chert/chert_synonym.cc xapian-core-1.4.21/backends/chert/chert_synonym.cc --- xapian-core-1.4.21/backends/chert/chert_synonym.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_synonym.cc 2022-11-08 16:44:15.384461842 +0100 @@ -47,11 +47,11 @@ if (last_synonyms.empty()) { del(last_term); } else { - string tag; + std::string tag; set<string>::const_iterator i; for (i = last_synonyms.begin(); i != last_synonyms.end(); ++i) { - const string & synonym = *i; + const std::string & synonym = *i; tag += uint8_t(synonym.size() ^ MAGIC_XOR_VALUE); tag += synonym; } @@ -63,13 +63,13 @@ } void -ChertSynonymTable::add_synonym(const string & term, const string & synonym) +ChertSynonymTable::add_synonym(const std::string & term, const std::string & synonym) { if (last_term != term) { merge_changes(); last_term = term; - string tag; + std::string tag; if (get_exact_entry(term, tag)) { const char * p = tag.data(); const char * end = p + tag.size(); @@ -89,13 +89,13 @@ } void -ChertSynonymTable::remove_synonym(const string & term, const string & synonym) +ChertSynonymTable::remove_synonym(const std::string & term, const std::string & synonym) { if (last_term != term) { merge_changes(); last_term = term; - string tag; + std::string tag; if (get_exact_entry(term, tag)) { const char * p = tag.data(); const char * end = p + tag.size(); @@ -115,7 +115,7 @@ } void -ChertSynonymTable::clear_synonyms(const string & term) +ChertSynonymTable::clear_synonyms(const std::string & term) { // We don't actually ever need to merge_changes() here, but it's quite // likely that someone might clear_synonyms() and then add_synonym() for @@ -131,9 +131,9 @@ } TermList * -ChertSynonymTable::open_termlist(const string & term) +ChertSynonymTable::open_termlist(const std::string & term) { - vector<string> synonyms; + std::vector<string> synonyms; if (last_term == term) { if (last_synonyms.empty()) return NULL; @@ -144,7 +144,7 @@ synonyms.push_back(*i); } } else { - string tag; + std::string tag; if (!get_exact_entry(term, tag)) return NULL; const char * p = tag.data(); @@ -203,7 +203,7 @@ } TermList * -ChertSynonymTermList::skip_to(const string &tname) +ChertSynonymTermList::skip_to(const std::string &tname) { LOGCALL(DB, TermList *, "ChertSynonymTermList::skip_to", tname); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/chert/chert_synonym.h xapian-core-1.4.21/backends/chert/chert_synonym.h --- xapian-core-1.4.21/backends/chert/chert_synonym.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_synonym.h 2022-11-08 16:44:00.956513132 +0100 @@ -126,12 +126,12 @@ ChertCursor * cursor; /// The prefix to restrict the terms to. - string prefix; + std::string prefix; public: ChertSynonymTermList(Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> database_, ChertCursor * cursor_, - const string & prefix_) + const std::string & prefix_) : database(database_), cursor(cursor_), prefix(prefix_) { // Position the cursor on the highest key before the first key we want, @@ -153,7 +153,7 @@ * Either next() or skip_to() must have been called before this * method can be called. */ - string get_termname() const; + std::string get_termname() const; /// Return the term frequency for the term at the current position. Xapian::doccount get_termfreq() const; @@ -162,7 +162,7 @@ TermList * next(); /// Advance to the first term which is >= tname. - TermList * skip_to(const string &tname); + TermList * skip_to(const std::string &tname); /// True if we're off the end of the list bool at_end() const; diff -ur xapian-core-1.4.21/backends/chert/chert_table.cc xapian-core-1.4.21/backends/chert/chert_table.cc --- xapian-core-1.4.21/backends/chert/chert_table.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_table.cc 2022-11-08 16:44:15.408461757 +0100 @@ -183,7 +183,7 @@ int dir_end = DIR_END(p); if (rare(dir_end < DIR_START || unsigned(dir_end) > block_size)) { - string msg("dir_end invalid in block "); + std::string msg("dir_end invalid in block "); msg += str(n); throw Xapian::DatabaseCorruptError(msg); } @@ -303,7 +303,7 @@ } if (rare(j != GET_LEVEL(p))) { - string msg = "Expected block "; + std::string msg = "Expected block "; msg += str(n); msg += " to be level "; msg += str(j); @@ -945,7 +945,7 @@ K set accordingly. c is set to 1. */ -void ChertTable::form_key(const string & key) const +void ChertTable::form_key(const std::string & key) const { LOGCALL_VOID(DB, "ChertTable::form_key", key); kt.form_key(key); @@ -975,7 +975,7 @@ */ void -ChertTable::add(const string &key, string tag, bool already_compressed) +ChertTable::add(const std::string &key, std::string tag, bool already_compressed) { LOGCALL_VOID(DB, "ChertTable::add", key | tag | already_compressed); Assert(writable); @@ -1102,7 +1102,7 @@ */ bool -ChertTable::del(const string &key) +ChertTable::del(const std::string &key) { LOGCALL(DB, bool, "ChertTable::del", key); Assert(writable); @@ -1138,7 +1138,7 @@ } bool -ChertTable::readahead_key(const string &key) const +ChertTable::readahead_key(const std::string &key) const { LOGCALL(DB, bool, "ChertTable::readahead_key", key); Assert(!key.empty()); @@ -1184,7 +1184,7 @@ } bool -ChertTable::get_exact_entry(const string &key, string & tag) const +ChertTable::get_exact_entry(const std::string &key, std::string & tag) const { LOGCALL(DB, bool, "ChertTable::get_exact_entry", key | tag); Assert(!key.empty()); @@ -1207,7 +1207,7 @@ } bool -ChertTable::key_exists(const string &key) const +ChertTable::key_exists(const std::string &key) const { LOGCALL(DB, bool, "ChertTable::key_exists", key); Assert(!key.empty()); @@ -1220,7 +1220,7 @@ } bool -ChertTable::read_tag(Cursor * C_, string *tag, bool keep_compressed) const +ChertTable::read_tag(Cursor * C_, std::string *tag, bool keep_compressed) const { LOGCALL(DB, bool, "ChertTable::read_tag", Literal("C_") | tag | keep_compressed); Item item(C_[0].p, C_[0].c); @@ -1250,7 +1250,7 @@ // don't need both the full compressed and uncompressed tags in memory // at once. - string utag; + std::string utag; // May not be enough for a compressed tag, but it's a reasonable guess. utag.reserve(tag->size() + tag->size() / 2); @@ -1279,7 +1279,7 @@ if (err != Z_OK && err != Z_STREAM_END) { if (err == Z_MEM_ERROR) throw std::bad_alloc(); - string msg = "inflate failed"; + std::string msg = "inflate failed"; if (inflate_zstream->msg) { msg += " ("; msg += inflate_zstream->msg; @@ -1292,7 +1292,7 @@ inflate_zstream->next_out - buf); } if (utag.size() != inflate_zstream->total_out) { - string msg = "compressed tag didn't expand to the expected size: "; + std::string msg = "compressed tag didn't expand to the expected size: "; msg += str(utag.size()); msg += " != "; // OpenBSD's zlib.h uses off_t instead of uLong for total_out. @@ -1337,7 +1337,7 @@ { const size_t BTREE_BASES = 2; - string err_msg; + std::string err_msg; static const char basenames[BTREE_BASES] = { 'A', 'B' }; ChertTable_base bases[BTREE_BASES]; @@ -1362,7 +1362,7 @@ ::close(handle); handle = -1; } - string message = "Error opening table '"; + std::string message = "Error opening table '"; message += name; message += "':\n"; message += err_msg; @@ -1520,7 +1520,7 @@ revision_number = revision_; RETURN(true); } - string message(create_db ? "Couldn't create " : "Couldn't open "); + std::string message(create_db ? "Couldn't create " : "Couldn't open "); message += name; message += "DB read/write: "; errno_to_string(errno, message); @@ -1557,7 +1557,7 @@ RETURN(true); } -ChertTable::ChertTable(const char * tablename_, const string & path_, +ChertTable::ChertTable(const char * tablename_, const std::string & path_, bool readonly_, int compress_strategy_, bool lazy_) : tablename(tablename_), revision_number(0), @@ -1633,7 +1633,7 @@ deflate_zstream = 0; throw std::bad_alloc(); } - string msg = "deflateInit2 failed ("; + std::string msg = "deflateInit2 failed ("; if (deflate_zstream->msg) { msg += deflate_zstream->msg; } else { @@ -1670,7 +1670,7 @@ inflate_zstream = 0; throw std::bad_alloc(); } - string msg = "inflateInit2 failed ("; + std::string msg = "inflateInit2 failed ("; if (inflate_zstream->msg) { msg += inflate_zstream->msg; } else { @@ -1822,7 +1822,7 @@ void ChertTable::commit(chert_revision_number_t revision, int changes_fd, - const string * changes_tail) + const std::string * changes_tail) { LOGCALL_VOID(DB, "ChertTable::commit", revision | changes_fd | changes_tail); Assert(writable); @@ -1868,9 +1868,9 @@ // Save to "<table>.tmp" and then rename to "<table>.base<letter>" so // that a reader can't try to read a partially written base file. - string tmp = name; + std::string tmp = name; tmp += "tmp"; - string basefile = name; + std::string basefile = name; basefile += "base"; basefile += char(base_letter); base.write_to_file(tmp, base_letter, tablename, changes_fd, changes_tail); @@ -1886,7 +1886,7 @@ } if (!io_tmp_rename(tmp, basefile)) { - string msg("Couldn't update base file "); + std::string msg("Couldn't update base file "); msg += basefile; throw Xapian::DatabaseError(msg, errno); } @@ -1911,7 +1911,7 @@ if (handle < 0) return; if (faked_root_block) return; - string buf; + std::string buf; pack_uint(buf, 2u); // Indicate the item is a list of blocks pack_string(buf, tablename); pack_uint(buf, block_size); @@ -1963,7 +1963,7 @@ // This causes problems: if (!Btree_modified) return; - string err_msg; + std::string err_msg; if (!base.read(name, base_letter, writable, err_msg)) { throw Xapian::DatabaseCorruptError(string("Couldn't reread base ") + base_letter); } @@ -2013,7 +2013,7 @@ revision_number = revision_; RETURN(true); } - string message("Couldn't open "); + std::string message("Couldn't open "); message += name; message += "DB to read: "; errno_to_string(errno, message); diff -ur xapian-core-1.4.21/backends/chert/chert_table.h xapian-core-1.4.21/backends/chert/chert_table.h --- xapian-core-1.4.21/backends/chert/chert_table.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_table.h 2022-11-08 16:44:00.960513118 +0100 @@ -391,7 +391,7 @@ */ void close(bool permanent = false); - bool readahead_key(const string &key) const; + bool readahead_key(const std::string &key) const; /** Determine whether the btree exists on disk. */ @@ -669,7 +669,7 @@ /// Throw an exception indicating that the database is closed. XAPIAN_NORETURN(static void throw_database_closed()); - string get_path() const { + std::string get_path() const { return name; } diff -ur xapian-core-1.4.21/backends/chert/chert_termlist.cc xapian-core-1.4.21/backends/chert/chert_termlist.cc --- xapian-core-1.4.21/backends/chert/chert_termlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_termlist.cc 2022-11-08 16:44:15.392461814 +0100 @@ -170,7 +170,7 @@ } TermList * -ChertTermList::skip_to(const string & term) +ChertTermList::skip_to(const std::string & term) { LOGCALL(API, TermList *, "ChertTermList::skip_to", term); while (pos != NULL && current_term < term) { diff -ur xapian-core-1.4.21/backends/chert/chert_termlisttable.cc xapian-core-1.4.21/backends/chert/chert_termlisttable.cc --- xapian-core-1.4.21/backends/chert/chert_termlisttable.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_termlisttable.cc 2022-11-08 16:44:15.392461814 +0100 @@ -42,7 +42,7 @@ { LOGCALL_VOID(DB, "ChertTermListTable::set_termlist", did | doc | doclen); - string tag; + std::string tag; pack_uint(tag, doclen); Xapian::doccount termlist_size = doc.termlist_count(); @@ -57,7 +57,7 @@ Xapian::TermIterator t = doc.termlist_begin(); if (t != doc.termlist_end()) { pack_uint(tag, termlist_size); - string prev_term = *t; + std::string prev_term = *t; tag += prev_term.size(); tag += prev_term; @@ -65,7 +65,7 @@ --termlist_size; while (++t != doc.termlist_end()) { - const string & term = *t; + const std::string & term = *t; // If there's a shared prefix with the previous term, we don't // store it explicitly, but just store the length of the shared // prefix. In general, this is a big win. diff -ur xapian-core-1.4.21/backends/chert/chert_valuelist.cc xapian-core-1.4.21/backends/chert/chert_valuelist.cc --- xapian-core-1.4.21/backends/chert/chert_valuelist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_valuelist.cc 2022-11-08 16:44:15.384461842 +0100 @@ -36,7 +36,7 @@ if (!first_did) return false; cursor->read_tag(); - const string & tag = cursor->current_tag; + const std::string & tag = cursor->current_tag; reader.assign(tag.data(), tag.size(), first_did); return true; } @@ -164,7 +164,7 @@ string ChertValueList::get_description() const { - string desc("ChertValueList(slot="); + std::string desc("ChertValueList(slot="); desc += str(slot); desc += ')'; return desc; diff -ur xapian-core-1.4.21/backends/chert/chert_values.cc xapian-core-1.4.21/backends/chert/chert_values.cc --- xapian-core-1.4.21/backends/chert/chert_values.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_values.cc 2022-11-08 16:44:15.412461742 +0100 @@ -51,7 +51,7 @@ // Add an extra character so that it can't clash with a termlist entry key // and will sort just after the corresponding termlist entry key. // FIXME: should we store this in the *same entry* as the list of terms? - string key; + std::string key; C_pack_uint_preserving_sort(key, did); key += '\0'; RETURN(key); @@ -62,7 +62,7 @@ make_valuestats_key(Xapian::valueno slot) { LOGCALL_STATIC(DB, string, "make_valuestats_key", slot); - string key("\0\xd0", 2); + std::string key("\0\xd0", 2); pack_uint_last(key, slot); RETURN(key); } @@ -130,12 +130,12 @@ void ChertValueManager::add_value(Xapian::docid did, Xapian::valueno slot, - const string & val) + const std::string & val) { - map<Xapian::valueno, map<Xapian::docid, string> >::iterator i; + std::map<Xapian::valueno, std::map<Xapian::docid, string> >::iterator i; i = changes.find(slot); if (i == changes.end()) { - i = changes.insert(make_pair(slot, map<Xapian::docid, string>())).first; + i = changes.insert(make_pair(slot, std::map<Xapian::docid, string>())).first; } i->second[did] = val; } @@ -143,10 +143,10 @@ void ChertValueManager::remove_value(Xapian::docid did, Xapian::valueno slot) { - map<Xapian::valueno, map<Xapian::docid, string> >::iterator i; + std::map<Xapian::valueno, std::map<Xapian::docid, string> >::iterator i; i = changes.find(slot); if (i == changes.end()) { - i = changes.insert(make_pair(slot, map<Xapian::docid, string>())).first; + i = changes.insert(make_pair(slot, std::map<Xapian::docid, string>())).first; } i->second[did] = string(); } @@ -154,7 +154,7 @@ Xapian::docid ChertValueManager::get_chunk_containing_did(Xapian::valueno slot, Xapian::docid did, - string &chunk) const + std::string &chunk) const { LOGCALL(DB, Xapian::docid, "ChertValueManager::get_chunk_containing_did", slot | did | chunk); if (!cursor.get()) @@ -197,11 +197,11 @@ Xapian::valueno slot; - string ctag; + std::string ctag; ValueChunkReader reader; - string tag; + std::string tag; Xapian::docid prev_did; @@ -211,7 +211,7 @@ Xapian::docid last_allowed_did; - void append_to_stream(Xapian::docid did, const string & value) { + void append_to_stream(Xapian::docid did, const std::string & value) { Assert(did); if (tag.empty()) { new_first_did = did; @@ -249,13 +249,13 @@ write_tag(); } - void update(Xapian::docid did, const string & value) { + void update(Xapian::docid did, const std::string & value) { if (last_allowed_did && did > last_allowed_did) { // The next change needs to go in a later existing chunk than the // one we're currently updating, so we copy over the rest of the // entries from the current chunk, write out the updated chunk and // drop through to the case below will read in that later chunk. - // FIXME: use some string splicing magic instead of this loop. + // FIXME: use some std::string splicing magic instead of this loop. while (!reader.at_end()) { // last_allowed_did should be an upper bound for this chunk. AssertRel(reader.get_docid(),<=,last_allowed_did); @@ -294,7 +294,7 @@ reader.assign(ctag.data(), ctag.size(), first_did); } if (cursor->next()) { - const string & key = cursor->current_key; + const std::string & key = cursor->current_key; Xapian::docid next_first_did = docid_from_key(slot, key); if (next_first_did) last_allowed_did = next_first_did - 1; Assert(last_allowed_did); @@ -321,10 +321,10 @@ ChertValueManager::merge_changes() { if (termlist_table->is_open()) { - map<Xapian::docid, string>::const_iterator i; + std::map<Xapian::docid, string>::const_iterator i; for (i = slots.begin(); i != slots.end(); ++i) { - const string & enc = i->second; - string key = make_slot_key(i->first); + const std::string & enc = i->second; + std::string key = make_slot_key(i->first); if (!enc.empty()) { termlist_table->add(key, i->second); } else { @@ -335,12 +335,12 @@ } { - map<Xapian::valueno, map<Xapian::docid, string> >::const_iterator i; + std::map<Xapian::valueno, std::map<Xapian::docid, string> >::const_iterator i; for (i = changes.begin(); i != changes.end(); ++i) { Xapian::valueno slot = i->first; ValueUpdater updater(postlist_table, slot); - const map<Xapian::docid, string> & slot_changes = i->second; - map<Xapian::docid, string>::const_iterator j; + const std::map<Xapian::docid, string> & slot_changes = i->second; + std::map<Xapian::docid, string>::const_iterator j; for (j = slot_changes.begin(); j != slot_changes.end(); ++j) { updater.update(j->first, j->second); } @@ -351,16 +351,16 @@ void ChertValueManager::add_document(Xapian::docid did, const Xapian::Document &doc, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { // FIXME: Use BitWriter and interpolative coding? Or is it not worthwhile // for this? - string slots_used; + std::string slots_used; Xapian::valueno prev_slot = static_cast<Xapian::valueno>(-1); Xapian::ValueIterator it = doc.values_begin(); while (it != doc.values_end()) { Xapian::valueno slot = it.get_valueno(); - string value = *it; + std::string value = *it; Assert(!value.empty()); // Update the statistics. @@ -403,11 +403,11 @@ void ChertValueManager::delete_document(Xapian::docid did, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { Assert(termlist_table->is_open()); - map<Xapian::docid, string>::iterator it = slots.find(did); - string s; + std::map<Xapian::docid, string>::iterator it = slots.find(did); + std::string s; if (it != slots.end()) { swap(s, it->second); } else { @@ -448,7 +448,7 @@ void ChertValueManager::replace_document(Xapian::docid did, const Xapian::Document &doc, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { // Load the values into the document from the database, if they haven't // been already. (If we don't do this before deleting the old values, @@ -461,16 +461,16 @@ string ChertValueManager::get_value(Xapian::docid did, Xapian::valueno slot) const { - map<Xapian::valueno, map<Xapian::docid, string> >::const_iterator i; + std::map<Xapian::valueno, std::map<Xapian::docid, string> >::const_iterator i; i = changes.find(slot); if (i != changes.end()) { - map<Xapian::docid, string>::const_iterator j; + std::map<Xapian::docid, string>::const_iterator j; j = i->second.find(did); if (j != i->second.end()) return j->second; } // Read it from the table. - string chunk; + std::string chunk; Xapian::docid first_did; first_did = get_chunk_containing_did(slot, did, chunk); if (first_did == 0) return string(); @@ -482,7 +482,7 @@ } void -ChertValueManager::get_all_values(map<Xapian::valueno, string> & values, +ChertValueManager::get_all_values(std::map<Xapian::valueno, string> & values, Xapian::docid did) const { Assert(values.empty()); @@ -493,8 +493,8 @@ ChertTable::throw_database_closed(); throw Xapian::FeatureUnavailableError("Database has no termlist"); } - map<Xapian::docid, string>::const_iterator i = slots.find(did); - string s; + std::map<Xapian::docid, string>::const_iterator i = slots.find(did); + std::string s; if (i != slots.end()) { s = i->second; } else { @@ -532,7 +532,7 @@ // Invalidate the cache first in case an exception is thrown. mru_slot = Xapian::BAD_VALUENO; - string tag; + std::string tag; if (postlist_table->get_exact_entry(make_valuestats_key(slot), tag)) { const char * pos = tag.data(); const char * end = pos + tag.size(); @@ -567,15 +567,15 @@ } void -ChertValueManager::set_value_stats(map<Xapian::valueno, ValueStats> & value_stats) +ChertValueManager::set_value_stats(std::map<Xapian::valueno, ValueStats> & value_stats) { LOGCALL_VOID(DB, "ChertValueManager::set_value_stats", value_stats); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; for (i = value_stats.begin(); i != value_stats.end(); ++i) { - string key = make_valuestats_key(i->first); + std::string key = make_valuestats_key(i->first); const ValueStats & stats = i->second; if (stats.freq != 0) { - string new_value; + std::string new_value; pack_uint(new_value, stats.freq); pack_string(new_value, stats.lower_bound); // We don't store or count empty values, so neither of the bounds diff -ur xapian-core-1.4.21/backends/chert/chert_version.cc xapian-core-1.4.21/backends/chert/chert_version.cc --- xapian-core-1.4.21/backends/chert/chert_version.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_version.cc 2022-11-08 16:44:15.404461770 +0100 @@ -69,7 +69,7 @@ int fd = ::open(filename.c_str(), O_WRONLY|O_CREAT|O_TRUNC|O_BINARY|O_CLOEXEC, 0666); if (fd < 0) { - string msg("Failed to create chert version file: "); + std::string msg("Failed to create chert version file: "); msg += filename; throw Xapian::DatabaseOpeningError(msg, errno); } @@ -83,7 +83,7 @@ io_sync(fd); if (close(fd) != 0) { - string msg("Failed to create chert version file: "); + std::string msg("Failed to create chert version file: "); msg += filename; throw Xapian::DatabaseOpeningError(msg, errno); } @@ -95,7 +95,7 @@ int fd = ::open(filename.c_str(), O_RDONLY|O_BINARY|O_CLOEXEC); if (fd < 0) { - string msg = filename; + std::string msg = filename; msg += ": Failed to open chert version file for reading"; if (errno == ENOENT || errno == ENOTDIR) { throw Xapian::DatabaseNotFoundError(msg, errno); @@ -117,7 +117,7 @@ if (size != VERSIONFILE_SIZE) { static_assert(VERSIONFILE_SIZE == VERSIONFILE_SIZE_LITERAL, "VERSIONFILE_SIZE_LITERAL needs updating"); - string msg = filename; + std::string msg = filename; msg += ": Chert version file should be " STRINGIZE(VERSIONFILE_SIZE_LITERAL)" bytes, actually "; msg += str(size); @@ -125,7 +125,7 @@ } if (memcmp(buf, MAGIC_STRING, MAGIC_LEN) != 0) { - string msg = filename; + std::string msg = filename; msg += ": Chert version file doesn't contain the right magic string"; throw Xapian::DatabaseCorruptError(msg); } @@ -134,7 +134,7 @@ v = reinterpret_cast<const unsigned char *>(buf) + MAGIC_LEN; unsigned int version = v[0] | (v[1] << 8) | (v[2] << 16) | (v[3] << 24); if (version != CHERT_VERSION) { - string msg = filename; + std::string msg = filename; msg += ": Chert version file is version "; msg += str(version); msg += " but I only understand " STRINGIZE(CHERT_VERSION); diff -ur xapian-core-1.4.21/backends/chert/chert_version.h xapian-core-1.4.21/backends/chert/chert_version.h --- xapian-core-1.4.21/backends/chert/chert_version.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/chert/chert_version.h 2022-11-08 16:44:00.960513118 +0100 @@ -28,7 +28,7 @@ /** The ChertVersion class manages the "iamchert" file. * - * The "iamchert" file (currently) contains a "magic" string identifying + * The "iamchert" file (currently) contains a "magic" std::string identifying * that this is a chert database and a database format version number. */ class ChertVersion { @@ -57,7 +57,7 @@ return uuid.data(); } - /// Return UUID in the standard 36 character string format. + /// Return UUID in the standard 36 character std::string format. std::string get_uuid_string() const { return uuid.to_string(); } diff -ur xapian-core-1.4.21/backends/contiguousalldocspostlist.cc xapian-core-1.4.21/backends/contiguousalldocspostlist.cc --- xapian-core-1.4.21/backends/contiguousalldocspostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/contiguousalldocspostlist.cc 2022-11-08 16:44:15.328462041 +0100 @@ -123,7 +123,7 @@ string ContiguousAllDocsPostList::get_description() const { - string msg("ContiguousAllDocsPostList(1.."); + std::string msg("ContiguousAllDocsPostList(1.."); msg += str(doccount); msg += ')'; return msg; diff -ur xapian-core-1.4.21/backends/contiguousalldocspostlist.h xapian-core-1.4.21/backends/contiguousalldocspostlist.h --- xapian-core-1.4.21/backends/contiguousalldocspostlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/contiguousalldocspostlist.h 2022-11-08 16:44:00.904513317 +0100 @@ -88,7 +88,7 @@ /// Always return 1 (wdf isn't totally meaningful for us). Xapian::termcount get_wdf_upper_bound() const; - /// Return a string description of this object. + /// Return a std::string description of this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/backends/database.cc xapian-core-1.4.21/backends/database.cc --- xapian-core-1.4.21/backends/database.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/database.cc 2022-11-08 16:44:15.380461857 +0100 @@ -72,7 +72,7 @@ } Xapian::termcount -Database::Internal::get_wdf_upper_bound(const string & term) const +Database::Internal::get_wdf_upper_bound(const std::string & term) const { // Not a very tight bound in general, but this is only a fall-back for // backends which don't store these stats. @@ -173,7 +173,7 @@ } void -Database::Internal::delete_document(const string & unique_term) +Database::Internal::delete_document(const std::string & unique_term) { // Default implementation - overridden for remote databases intrusive_ptr<LeafPostList> pl(open_post_list(unique_term)); @@ -190,7 +190,7 @@ } Xapian::docid -Database::Internal::replace_document(const string & unique_term, +Database::Internal::replace_document(const std::string & unique_term, const Xapian::Document & document) { // Default implementation - overridden for remote databases @@ -214,7 +214,7 @@ } TermList * -Database::Internal::open_spelling_termlist(const string &) const +Database::Internal::open_spelling_termlist(const std::string &) const { // Only implemented for some database backends - others will just not // suggest spelling corrections (or not contribute to them in a multiple @@ -232,7 +232,7 @@ } Xapian::doccount -Database::Internal::get_spelling_frequency(const string &) const +Database::Internal::get_spelling_frequency(const std::string &) const { // Only implemented for some database backends - others will just not // suggest spelling corrections (or not contribute to them in a multiple @@ -241,19 +241,19 @@ } void -Database::Internal::add_spelling(const string &, Xapian::termcount) const +Database::Internal::add_spelling(const std::string &, Xapian::termcount) const { throw Xapian::UnimplementedError("This backend doesn't implement spelling correction"); } void -Database::Internal::remove_spelling(const string &, Xapian::termcount) const +Database::Internal::remove_spelling(const std::string &, Xapian::termcount) const { throw Xapian::UnimplementedError("This backend doesn't implement spelling correction"); } TermList * -Database::Internal::open_synonym_termlist(const string &) const +Database::Internal::open_synonym_termlist(const std::string &) const { // Only implemented for some database backends - others will just not // expand synonyms (or not contribute to them in a multiple database @@ -262,7 +262,7 @@ } TermList * -Database::Internal::open_synonym_keylist(const string &) const +Database::Internal::open_synonym_keylist(const std::string &) const { // Only implemented for some database backends - others will just not // expand synonyms (or not contribute to them in a multiple database @@ -271,31 +271,31 @@ } void -Database::Internal::add_synonym(const string &, const string &) const +Database::Internal::add_synonym(const std::string &, const std::string &) const { throw Xapian::UnimplementedError("This backend doesn't implement synonyms"); } void -Database::Internal::remove_synonym(const string &, const string &) const +Database::Internal::remove_synonym(const std::string &, const std::string &) const { throw Xapian::UnimplementedError("This backend doesn't implement synonyms"); } void -Database::Internal::clear_synonyms(const string &) const +Database::Internal::clear_synonyms(const std::string &) const { throw Xapian::UnimplementedError("This backend doesn't implement synonyms"); } string -Database::Internal::get_metadata(const string &) const +Database::Internal::get_metadata(const std::string &) const { return string(); } TermList * -Database::Internal::open_metadata_keylist(const string &) const +Database::Internal::open_metadata_keylist(const std::string &) const { // Only implemented for some database backends - others will simply report // there being no metadata keys. @@ -303,7 +303,7 @@ } void -Database::Internal::set_metadata(const string &, const string &) +Database::Internal::set_metadata(const std::string &, const std::string &) { throw Xapian::UnimplementedError("This backend doesn't implement metadata"); } @@ -332,7 +332,7 @@ } void -Database::Internal::write_changesets_to_fd(int, const string &, bool, ReplicationInfo *) +Database::Internal::write_changesets_to_fd(int, const std::string &, bool, ReplicationInfo *) { throw Xapian::UnimplementedError("This backend doesn't provide changesets"); } diff -ur xapian-core-1.4.21/backends/database.h xapian-core-1.4.21/backends/database.h --- xapian-core-1.4.21/backends/database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/database.h 2022-11-08 16:44:00.908513303 +0100 @@ -37,7 +37,7 @@ #include <xapian/termiterator.h> #include <xapian/valueiterator.h> -using namespace std; +using std::string; class LeafPostList; class RemoteDatabase; @@ -150,7 +150,7 @@ * @param collfreq_ptr Point to return number of occurrences of @a * term in the database (or NULL not to return) */ - virtual void get_freqs(const string & term, + virtual void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const = 0; @@ -197,7 +197,7 @@ * * @param tname The term whose presence is being checked. */ - virtual bool term_exists(const string & tname) const = 0; + virtual bool term_exists(const std::string & tname) const = 0; /** Check whether this database contains any positional information. */ @@ -221,7 +221,7 @@ * This object must be deleted by the caller after * use. */ - virtual LeafPostList * open_post_list(const string & tname) const = 0; + virtual LeafPostList * open_post_list(const std::string & tname) const = 0; /** Open a value stream. * @@ -255,7 +255,7 @@ * This object must be deleted by the caller after * use. */ - virtual TermList * open_allterms(const string & prefix) const = 0; + virtual TermList * open_allterms(const std::string & prefix) const = 0; /** Open a position list for the given term in the given document. * @@ -269,7 +269,7 @@ * use. */ virtual PositionList * open_position_list(Xapian::docid did, - const string & tname) const = 0; + const std::string & tname) const = 0; /** Open a document. * @@ -295,7 +295,7 @@ * * If there are no trigrams, returns NULL. */ - virtual TermList * open_spelling_termlist(const string & word) const; + virtual TermList * open_spelling_termlist(const std::string & word) const; /** Return a termlist which returns the words which are spelling * correction targets. @@ -305,7 +305,7 @@ virtual TermList * open_spelling_wordlist() const; /** Return the number of times @a word was added as a spelling. */ - virtual Xapian::doccount get_spelling_frequency(const string & word) const; + virtual Xapian::doccount get_spelling_frequency(const std::string & word) const; /** Add a word to the spelling dictionary. * @@ -314,7 +314,7 @@ * @param word The word to add. * @param freqinc How much to increase its frequency by. */ - virtual void add_spelling(const string & word, + virtual void add_spelling(const std::string & word, Xapian::termcount freqinc) const; /** Remove a word from the spelling dictionary. @@ -325,46 +325,46 @@ * @param word The word to remove. * @param freqdec How much to decrease its frequency by. */ - virtual void remove_spelling(const string & word, + virtual void remove_spelling(const std::string & word, Xapian::termcount freqdec) const; /** Open a termlist returning synonyms for a term. * * If @a term has no synonyms, returns NULL. */ - virtual TermList * open_synonym_termlist(const string & term) const; + virtual TermList * open_synonym_termlist(const std::string & term) const; /** Open a termlist returning each term which has synonyms. * * @param prefix If non-empty, only terms with this prefix are * returned. */ - virtual TermList * open_synonym_keylist(const string & prefix) const; + virtual TermList * open_synonym_keylist(const std::string & prefix) const; /** Add a synonym for a term. * * If @a synonym is already a synonym for @a term, then no action is * taken. */ - virtual void add_synonym(const string & term, const string & synonym) const; + virtual void add_synonym(const std::string & term, const std::string & synonym) const; /** Remove a synonym for a term. * * If @a synonym isn't a synonym for @a term, then no action is taken. */ - virtual void remove_synonym(const string & term, const string & synonym) const; + virtual void remove_synonym(const std::string & term, const std::string & synonym) const; /** Clear all synonyms for a term. * * If @a term has no synonyms, no action is taken. */ - virtual void clear_synonyms(const string & term) const; + virtual void clear_synonyms(const std::string & term) const; /** Get the metadata associated with a given key. * * See Database::get_metadata() for more information. */ - virtual string get_metadata(const string & key) const; + virtual std::string get_metadata(const std::string & key) const; /** Open a termlist returning each metadata key. * @@ -380,7 +380,7 @@ * * See WritableDatabase::set_metadata() for more information. */ - virtual void set_metadata(const string & key, const string & value); + virtual void set_metadata(const std::string & key, const std::string & value); /** Reopen the database to the latest available revision. * @@ -440,7 +440,7 @@ * * See WritableDatabase::delete_document() for more information. */ - virtual void delete_document(const string & unique_term); + virtual void delete_document(const std::string & unique_term); /** Replace a given document in the database. * @@ -453,7 +453,7 @@ * * See WritableDatabase::replace_document() for more information. */ - virtual Xapian::docid replace_document(const string & unique_term, + virtual Xapian::docid replace_document(const std::string & unique_term, const Xapian::Document & document); /** Request and later collect a document from the database. @@ -481,8 +481,8 @@ bool need_whole_db, Xapian::ReplicationInfo * info); - /// Get a string describing the current revision of the database. - virtual string get_revision_info() const; + /// Get a std::string describing the current revision of the database. + virtual std::string get_revision_info() const; /** Get a UUID for the database. * @@ -492,9 +492,9 @@ * the database files) will have the same UUID. However, copies (made * with copydatabase, or xapian-compact) will have different UUIDs. * - * If the backend does not support UUIDs the empty string is returned. + * If the backend does not support UUIDs the empty std::string is returned. */ - virtual string get_uuid() const; + virtual std::string get_uuid() const; /** Notify the database that document is no longer valid. * @@ -507,8 +507,8 @@ /** Get backend information about this database. * - * @param path If non-NULL, and set the pointed to string to the file - * path of this database (or if to some string describing + * @param path If non-NULL, and set the pointed to std::string to the file + * path of this database (or if to some std::string describing * the database in a backend-specified format if "path" * isn't a concept which make sense). * diff -ur xapian-core-1.4.21/backends/databasereplicator.cc xapian-core-1.4.21/backends/databasereplicator.cc --- xapian-core-1.4.21/backends/databasereplicator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/databasereplicator.cc 2022-11-08 16:44:15.348461970 +0100 @@ -46,7 +46,7 @@ } DatabaseReplicator * -DatabaseReplicator::open(const string & path) +DatabaseReplicator::open(const std::string & path) { LOGCALL_STATIC(DB, DatabaseReplicator *, "DatabaseReplicator::open", path); diff -ur xapian-core-1.4.21/backends/dbcheck.cc xapian-core-1.4.21/backends/dbcheck.cc --- xapian-core-1.4.21/backends/dbcheck.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/dbcheck.cc 2022-11-08 16:44:15.340461999 +0100 @@ -98,7 +98,7 @@ #endif static size_t -check_db_dir(const string & path, int opts, std::ostream *out) +check_db_dir(const std::string & path, int opts, std::ostream *out) { struct stat sb; if (stat((path + "/iamchert").c_str(), &sb) == 0) { @@ -156,7 +156,7 @@ *out << name << ":\n"; if (strcmp(name, "record") != 0 && strcmp(name, "postlist") != 0) { // Other tables are created lazily, so may not exist. - string table(path); + std::string table(path); table += '/'; table += name; table += ".DB"; @@ -214,7 +214,7 @@ GlassVersion version_file(path); version_file.read(); for (glass_revision_number_t r = version_file.get_revision(); r != 0; --r) { - string changes_file = path; + std::string changes_file = path; changes_file += "/changes"; changes_file += str(r); if (file_exists(changes_file)) @@ -275,9 +275,9 @@ // want. ++p; - string dir(filename, 0, p); + std::string dir(filename, 0, p); - string tablename; + std::string tablename; while (p != filename.size()) { char ch = filename[p++]; if (ch == '.') break; @@ -285,7 +285,7 @@ } #if defined XAPIAN_HAS_CHERT_BACKEND || defined XAPIAN_HAS_GLASS_BACKEND - vector<Xapian::termcount> doclens; + std::vector<Xapian::termcount> doclens; #else (void)opts; (void)out; @@ -419,7 +419,7 @@ } size_t -Database::check_(const string * path_ptr, int fd, int opts, std::ostream *out) +Database::check_(const std::string * path_ptr, int fd, int opts, std::ostream *out) { if (!out) { // If we have nowhere to write output, then disable all the options @@ -431,7 +431,7 @@ return check_db_fd(fd, opts, out, BACKEND_UNKNOWN); } - const string & path = *path_ptr; + const std::string & path = *path_ptr; struct stat sb; if (stat(path.c_str(), &sb) == 0) { if (S_ISDIR(sb.st_mode)) { @@ -464,7 +464,7 @@ // table (perhaps with "." after it), so the user can do xapian-check on // "foo/termlist" or "foo/termlist." (which you would get from filename // completion with older backends). - string filename = path; + std::string filename = path; if (endswith(filename, '.')) { filename.resize(filename.size() - 1); } diff -ur xapian-core-1.4.21/backends/dbfactory.cc xapian-core-1.4.21/backends/dbfactory.cc --- xapian-core-1.4.21/backends/dbfactory.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/dbfactory.cc 2022-11-08 16:44:15.328462041 +0100 @@ -153,7 +153,7 @@ } } -Database::Database(const string &path, int flags) +Database::Database(const std::string &path, int flags) { LOGCALL_CTOR(API, "Database", path|flags); @@ -233,7 +233,7 @@ #endif // Check for "stub directories". - string stub_file = path; + std::string stub_file = path; stub_file += "/XAPIANDB"; if (usual(file_exists(stub_file))) { open_stub(*this, stub_file); @@ -330,7 +330,7 @@ throw FeatureUnavailableError("Flint backend no longer supported"); } else { // Check for "stub directories". - string stub_file = path; + std::string stub_file = path; stub_file += "/XAPIANDB"; if (usual(file_exists(stub_file))) { open_stub(*this, stub_file, flags); diff -ur xapian-core-1.4.21/backends/dbfactory_remote.cc xapian-core-1.4.21/backends/dbfactory_remote.cc --- xapian-core-1.4.21/backends/dbfactory_remote.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/dbfactory_remote.cc 2022-11-08 16:44:15.416461728 +0100 @@ -39,7 +39,7 @@ #endif Database -Remote::open(const string &host, unsigned int port, useconds_t timeout_, +Remote::open(const std::string &host, unsigned int port, useconds_t timeout_, useconds_t connect_timeout) { LOGCALL_STATIC(API, Database, "Remote::open", host | port | timeout_ | connect_timeout); @@ -48,7 +48,7 @@ } WritableDatabase -Remote::open_writable(const string &host, unsigned int port, +Remote::open_writable(const std::string &host, unsigned int port, useconds_t timeout_, useconds_t connect_timeout, int flags) { @@ -59,7 +59,7 @@ } Database -Remote::open(const string &program, const string &args, +Remote::open(const std::string &program, const std::string &args, useconds_t timeout_) { LOGCALL_STATIC(API, Database, "Remote::open", program | args | timeout_); @@ -67,7 +67,7 @@ } WritableDatabase -Remote::open_writable(const string &program, const string &args, +Remote::open_writable(const std::string &program, const std::string &args, useconds_t timeout_, int flags) { LOGCALL_STATIC(API, WritableDatabase, "Remote::open_writable", program | args | timeout_ | flags); diff -ur xapian-core-1.4.21/backends/document.h xapian-core-1.4.21/backends/document.h --- xapian-core-1.4.21/backends/document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/document.h 2022-11-08 16:44:00.912513288 +0100 @@ -32,7 +32,7 @@ #include <map> #include <string> -using namespace std; +using std::string; class DocumentValueList; class ValueStreamDocument; @@ -43,10 +43,10 @@ friend class ::ValueStreamDocument; public: /// Type to store values in. - typedef map<Xapian::valueno, string> document_values; + typedef std::map<Xapian::valueno, string> document_values; /// Type to store terms in. - typedef map<string, OmDocumentTerm> document_terms; + typedef std::map<string, OmDocumentTerm> document_terms; protected: /// The database this document is in. @@ -63,7 +63,7 @@ mutable bool positions_modified; /// The (user defined) data associated with this document. - string data; + std::string data; /// The values associated with this document. mutable document_values values; // FIXME mutable is a hack @@ -89,11 +89,11 @@ private: // Functions for backend to implement - virtual string do_get_value(Xapian::valueno /*valueno*/) const { return string(); } - virtual void do_get_all_values(map<Xapian::valueno, string> & values_) const { + virtual std::string do_get_value(Xapian::valueno /*valueno*/) const { return string(); } + virtual void do_get_all_values(std::map<Xapian::valueno, string> & values_) const { values_.clear(); } - virtual string do_get_data() const { return string(); } + virtual std::string do_get_data() const { return string(); } public: /** Get value by value number. @@ -108,34 +108,34 @@ * * @param slot The value number requested. * - * @return A string containing the specified value. If + * @return A std::string containing the specified value. If * the value is not present in this document, the value's value will * be a zero length string */ - string get_value(Xapian::valueno slot) const; + std::string get_value(Xapian::valueno slot) const; /** Set all the values. * * @param values_ The values to set - passed by non-const reference, and * may be modified by the call. */ - void set_all_values(map<Xapian::valueno, string> & values_) { + void set_all_values(std::map<Xapian::valueno, string> & values_) { // For efficiency we just swap the old and new value maps. swap(values, values_); values_here = true; } Xapian::valueno values_count() const; - void add_value(Xapian::valueno, const string &); + void add_value(Xapian::valueno, const std::string &); void remove_value(Xapian::valueno); void clear_values(); - void add_posting(const string &, Xapian::termpos, Xapian::termcount); - void add_term(const string &, Xapian::termcount); - void remove_posting(const string &, Xapian::termpos, Xapian::termcount); - Xapian::termpos remove_postings(const string &, + void add_posting(const std::string &, Xapian::termpos, Xapian::termcount); + void add_term(const std::string &, Xapian::termcount); + void remove_posting(const std::string &, Xapian::termpos, Xapian::termcount); + Xapian::termpos remove_postings(const std::string &, Xapian::termpos, Xapian::termpos, Xapian::termcount); - void remove_term(const string &); + void remove_term(const std::string &); void clear_terms(); Xapian::termcount termlist_count() const; @@ -150,11 +150,11 @@ * during the match operation (such as in a match decider functor): * use a value instead, if at all possible. * - * @return A string containing the data for this document. + * @return A std::string containing the data for this document. */ - string get_data() const; + std::string get_data() const; - void set_data(const string &); + void set_data(const std::string &); /** Open a term list. * @@ -208,8 +208,8 @@ */ Xapian::docid get_docid() const { return did; } - /// Return a string describing this object. - string get_description() const; + /// Return a std::string describing this object. + std::string get_description() const; /** Constructor. * diff -ur xapian-core-1.4.21/backends/flint_lock.cc xapian-core-1.4.21/backends/flint_lock.cc --- xapian-core-1.4.21/backends/flint_lock.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/flint_lock.cc 2022-11-08 16:44:15.336462012 +0100 @@ -122,7 +122,7 @@ } FlintLock::reason -FlintLock::lock(bool exclusive, bool wait, string & explanation) { +FlintLock::lock(bool exclusive, bool wait, std::string & explanation) { // Currently we only support exclusive locks. (void)exclusive; Assert(exclusive); @@ -497,10 +497,10 @@ void FlintLock::throw_databaselockerror(FlintLock::reason why, - const string & db_dir, - const string & explanation) const + const std::string & db_dir, + const std::string & explanation) const { - string msg("Unable to get write lock on "); + std::string msg("Unable to get write lock on "); msg += db_dir; if (why == FlintLock::INUSE) { msg += ": already locked"; diff -ur xapian-core-1.4.21/backends/flint_lock.h xapian-core-1.4.21/backends/flint_lock.h --- xapian-core-1.4.21/backends/flint_lock.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/flint_lock.h 2022-11-08 16:44:00.944513174 +0100 @@ -93,7 +93,7 @@ /** Attempt to obtain the lock. * - * If the attempt fails with code "UNKNOWN", the string supplied in the + * If the attempt fails with code "UNKNOWN", the std::string supplied in the * explanation parameter will be set to contain any details available of * the reason for the failure. * diff -ur xapian-core-1.4.21/backends/glass/glass_alldocspostlist.cc xapian-core-1.4.21/backends/glass/glass_alldocspostlist.cc --- xapian-core-1.4.21/backends/glass/glass_alldocspostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_alldocspostlist.cc 2022-11-08 16:44:15.376461870 +0100 @@ -80,7 +80,7 @@ string GlassAllDocsPostList::get_description() const { - string desc = "GlassAllDocsPostList(doccount="; + std::string desc = "GlassAllDocsPostList(doccount="; desc += str(doccount); desc += ')'; return desc; diff -ur xapian-core-1.4.21/backends/glass/glass_alltermslist.cc xapian-core-1.4.21/backends/glass/glass_alltermslist.cc --- xapian-core-1.4.21/backends/glass/glass_alltermslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_alltermslist.cc 2022-11-08 16:44:15.372461885 +0100 @@ -83,7 +83,7 @@ if (prefix.empty()) { (void)cursor->find_entry_ge(string("\x00\xff", 2)); } else { - const string & key = pack_glass_postlist_key(prefix); + const std::string & key = pack_glass_postlist_key(prefix); if (cursor->find_entry_ge(key)) { // The exact term we asked for is there, so just copy it rather // than wasting effort unpacking it from the key. @@ -124,7 +124,7 @@ } TermList * -GlassAllTermsList::skip_to(const string &term) +GlassAllTermsList::skip_to(const std::string &term) { LOGCALL(DB, TermList *, "GlassAllTermsList::skip_to", term); Assert(!at_end()); @@ -137,7 +137,7 @@ Assert(cursor); // The postlist table isn't optional. } - string key = pack_glass_postlist_key(term); + std::string key = pack_glass_postlist_key(term); if (cursor->find_entry_ge(key)) { // The exact term we asked for is there, so just copy it rather than // wasting effort unpacking it from the key. diff -ur xapian-core-1.4.21/backends/glass/glass_changes.cc xapian-core-1.4.21/backends/glass/glass_changes.cc --- xapian-core-1.4.21/backends/glass/glass_changes.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_changes.cc 2022-11-08 16:44:15.356461942 +0100 @@ -44,7 +44,7 @@ { if (changes_fd >= 0) { ::close(changes_fd); - string changes_tmp = changes_stem; + std::string changes_tmp = changes_stem; changes_tmp += "tmp"; io_unlink(changes_tmp); } @@ -71,19 +71,19 @@ if (max_changesets == 0) return NULL; - string changes_tmp = changes_stem; + std::string changes_tmp = changes_stem; changes_tmp += "tmp"; changes_fd = posixy_open(changes_tmp.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666); if (changes_fd < 0) { - string message = "Couldn't open changeset "; + std::string message = "Couldn't open changeset "; message += changes_tmp; message += " to write"; throw Xapian::DatabaseError(message, errno); } // Write header for changeset file. - string header = CHANGES_MAGIC_STRING; + std::string header = CHANGES_MAGIC_STRING; header += char(CHANGES_VERSION); pack_uint(header, old_rev); pack_uint(header, rev); @@ -115,7 +115,7 @@ io_write(changes_fd, "\xff", 1); - string changes_tmp = changes_stem; + std::string changes_tmp = changes_stem; changes_tmp += "tmp"; if (!(flags & Xapian::DB_NO_SYNC) && !io_sync(changes_fd)) { @@ -123,7 +123,7 @@ (void)::close(changes_fd); changes_fd = -1; (void)unlink(changes_tmp.c_str()); - string m = changes_tmp; + std::string m = changes_tmp; m += ": Failed to sync"; throw Xapian::DatabaseError(m, saved_errno); } @@ -131,11 +131,11 @@ (void)::close(changes_fd); changes_fd = -1; - string changes_file = changes_stem; + std::string changes_file = changes_stem; changes_file += str(new_rev - 1); // FIXME: ? if (!io_tmp_rename(changes_tmp, changes_file)) { - string m = changes_tmp; + std::string m = changes_tmp; m += ": Failed to rename to "; m += changes_file; throw Xapian::DatabaseError(m, errno); @@ -161,11 +161,11 @@ } void -GlassChanges::check(const string & changes_file) +GlassChanges::check(const std::string & changes_file) { FD fd(posixy_open(changes_file.c_str(), O_RDONLY | O_CLOEXEC, 0666)); if (fd < 0) { - string message = "Couldn't open changeset "; + std::string message = "Couldn't open changeset "; message += changes_file; throw Xapian::DatabaseError(message, errno); } diff -ur xapian-core-1.4.21/backends/glass/glass_check.cc xapian-core-1.4.21/backends/glass/glass_check.cc --- xapian-core-1.4.21/backends/glass/glass_check.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_check.cc 2022-11-08 16:44:15.356461942 +0100 @@ -51,10 +51,10 @@ { if (j == 0) { LeafItem item(p, c); - string key; + std::string key; if (item.key().length() >= 0) item.key().read(&key); - string escaped; + std::string escaped; description_append(escaped, key); *out << escaped; int x = item.component_of(); @@ -64,10 +64,10 @@ } } else { BItem item(p, c); - string key; + std::string key; if (item.key().length() >= 0) item.key().read(&key); - string escaped; + std::string escaped; description_append(escaped, key); *out << escaped; } @@ -77,9 +77,9 @@ { if (j == 0) { LeafItem item(p, c); - string tag; + std::string tag; item.append_chunk(&tag); - string escaped; + std::string escaped; description_append(escaped, tag); *out << ' ' << escaped; } else { @@ -141,7 +141,7 @@ static void failure(const char *msg, uint4 n, int c) { - string e = "Block "; + std::string e = "Block "; e += str(n); if (c) { e += " item "; @@ -260,12 +260,12 @@ } GlassTableCheck * -GlassTableCheck::check(const char * tablename, const string & path, int fd, +GlassTableCheck::check(const char * tablename, const std::string & path, int fd, off_t offset_, const GlassVersion & version_file, int opts, ostream *out) { - string filename(path); + std::string filename(path); filename += '/'; filename += tablename; filename += '.'; @@ -289,7 +289,7 @@ } else if (strcmp(tablename, "synonym") == 0) { tab_type = Glass::SYNONYM; } else { - string e = "Unknown table: "; + std::string e = "Unknown table: "; e += tablename; throw Xapian::DatabaseError(e); } @@ -349,7 +349,7 @@ uint4 count = flcheck.count_set_bits(&first_bad); // Skip this check for a single file DB for now. FIXME if (count && fd < 0) { - string e = str(count); + std::string e = str(count); e += " unused block(s) missing from the free list, first is "; e += str(first_bad); throw Xapian::DatabaseError(e); diff -ur xapian-core-1.4.21/backends/glass/glass_compact.cc xapian-core-1.4.21/backends/glass/glass_compact.cc --- xapian-core-1.4.21/backends/glass/glass_compact.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_compact.cc 2022-11-08 16:44:15.352461955 +0100 @@ -54,25 +54,25 @@ namespace GlassCompact { static inline bool -is_user_metadata_key(const string & key) +is_user_metadata_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xc0'; } static inline bool -is_valuestats_key(const string & key) +is_valuestats_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xd0'; } static inline bool -is_valuechunk_key(const string & key) +is_valuechunk_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xd8'; } static inline bool -is_doclenchunk_key(const string & key) +is_doclenchunk_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xe0'; } @@ -81,7 +81,7 @@ Xapian::docid offset; public: - string key, tag; + std::string key, tag; Xapian::docid firstdid; Xapian::termcount tf, cf; @@ -128,7 +128,7 @@ if (is_doclenchunk_key(key)) { d += 2; } else { - string tname; + std::string tname; if (!unpack_string_preserving_sort(&d, e, tname)) throw Xapian::DatabaseCorruptError("Bad postlist key"); } @@ -173,9 +173,9 @@ static string encode_valuestats(Xapian::doccount freq, - const string & lbound, const string & ubound) + const std::string & lbound, const std::string & ubound) { - string value; + std::string value; pack_uint(value, freq); pack_string(value, lbound); // We don't store or count empty values, so neither of the bounds @@ -187,11 +187,11 @@ static void merge_postlists(Xapian::Compactor * compactor, - GlassTable * out, vector<Xapian::docid>::const_iterator offset, + GlassTable * out, std::vector<Xapian::docid>::const_iterator offset, vector<GlassTable*>::const_iterator b, vector<GlassTable*>::const_iterator e) { - priority_queue<PostlistCursor *, vector<PostlistCursor *>, PostlistCursorGt> pq; + priority_queue<PostlistCursor *, std::vector<PostlistCursor *>, PostlistCursorGt> pq; for ( ; b != e; ++b, ++offset) { GlassTable *in = *b; if (in->empty()) { @@ -202,7 +202,7 @@ pq.push(new PostlistCursor(in, *offset)); } - string last_key; + std::string last_key; { // Merge user metadata. vector<string> tags; @@ -218,7 +218,7 @@ // FIXME: It would be better to merge all duplicates // for a key in one call, but currently we don't in // multipass mode. - const string & resolved_tag = + const std::string & resolved_tag = compactor->resolve_duplicate_metadata(last_key, tags.size(), &tags[0]); @@ -244,7 +244,7 @@ if (!tags.empty()) { if (tags.size() > 1 && compactor) { Assert(!last_key.empty()); - const string & resolved_tag = + const std::string & resolved_tag = compactor->resolve_duplicate_metadata(last_key, tags.size(), &tags[0]); @@ -260,7 +260,7 @@ { // Merge valuestats. Xapian::doccount freq = 0; - string lbound, ubound; + std::string lbound, ubound; while (!pq.empty()) { PostlistCursor * cur = pq.top(); @@ -277,13 +277,13 @@ last_key = key; } - const string & tag = cur->tag; + const std::string & tag = cur->tag; const char * pos = tag.data(); const char * end = pos + tag.size(); Xapian::doccount f; - string l, u; + std::string l, u; if (!unpack_uint(&pos, end, &f)) { if (*pos == 0) throw Xapian::DatabaseCorruptError("Incomplete stats item in value table"); throw Xapian::RangeError("Frequency statistic in value table is too large"); @@ -324,7 +324,7 @@ // Merge valuestream chunks. while (!pq.empty()) { PostlistCursor * cur = pq.top(); - const string & key = cur->key; + const std::string & key = cur->key; if (!is_valuechunk_key(key)) break; Assert(!is_user_metadata_key(key)); out->add(key, cur->tag); @@ -337,7 +337,7 @@ } Xapian::termcount tf = 0, cf = 0; // Initialise to avoid warnings. - vector<pair<Xapian::docid, string>> tags; + std::vector<pair<Xapian::docid, string>> tags; while (true) { PostlistCursor * cur = NULL; if (!pq.empty()) { @@ -347,16 +347,16 @@ Assert(cur == NULL || !is_user_metadata_key(cur->key)); if (cur == NULL || cur->key != last_key) { if (!tags.empty()) { - string first_tag; + std::string first_tag; pack_uint(first_tag, tf); pack_uint(first_tag, cf); pack_uint(first_tag, tags[0].first - 1); - string tag = tags[0].second; + std::string tag = tags[0].second; tag[0] = (tags.size() == 1) ? '1' : '0'; first_tag += tag; out->add(last_key, first_tag); - string term; + std::string term; if (!is_doclenchunk_key(last_key)) { const char * p = last_key.data(); const char * end = p + last_key.size(); @@ -408,7 +408,7 @@ vector<GlassTable*>::const_iterator b, vector<GlassTable*>::const_iterator e) { - priority_queue<MergeCursor *, vector<MergeCursor *>, CursorGt> pq; + priority_queue<MergeCursor *, std::vector<MergeCursor *>, CursorGt> pq; for ( ; b != e; ++b) { GlassTable *in = *b; if (!in->empty()) { @@ -420,7 +420,7 @@ MergeCursor * cur = pq.top(); pq.pop(); - string key = cur->current_key; + std::string key = cur->current_key; if (pq.empty() || pq.top()->current_key > key) { // No need to merge the tags, just copy the (possibly compressed) // tag value. @@ -435,17 +435,17 @@ } // Merge tag values with the same key: - string tag; + std::string tag; if (key[0] != 'W') { // We just want the union of words, so copy over the first instance // and skip any identical ones. priority_queue<PrefixCompressedStringItor *, - vector<PrefixCompressedStringItor *>, + std::vector<PrefixCompressedStringItor *>, PrefixCompressedStringItorGt> pqtag; // Stick all the MergeCursor pointers in a vector because their // current_tag members must remain valid while we're merging their // tags, but we need to call next() on them all afterwards. - vector<MergeCursor *> vec; + std::vector<MergeCursor *> vec; vec.reserve(pq.size()); while (true) { @@ -458,11 +458,11 @@ } PrefixCompressedStringWriter wr(tag); - string lastword; + std::string lastword; while (!pqtag.empty()) { PrefixCompressedStringItor * it = pqtag.top(); pqtag.pop(); - string word = **it; + std::string word = **it; if (word != lastword) { lastword = word; wr.append(lastword); @@ -475,7 +475,7 @@ } } - vector<MergeCursor *>::const_iterator i; + std::vector<MergeCursor *>::const_iterator i; for (i = vec.begin(); i != vec.end(); ++i) { cur = *i; if (cur->next()) { @@ -514,10 +514,10 @@ static void merge_synonyms(GlassTable * out, - vector<GlassTable*>::const_iterator b, - vector<GlassTable*>::const_iterator e) + std::vector<GlassTable*>::const_iterator b, + std::vector<GlassTable*>::const_iterator e) { - priority_queue<MergeCursor *, vector<MergeCursor *>, CursorGt> pq; + priority_queue<MergeCursor *, std::vector<MergeCursor *>, CursorGt> pq; for ( ; b != e; ++b) { GlassTable *in = *b; if (!in->empty()) { @@ -529,7 +529,7 @@ MergeCursor * cur = pq.top(); pq.pop(); - string key = cur->current_key; + std::string key = cur->current_key; if (pq.empty() || pq.top()->current_key > key) { // No need to merge the tags, just copy the (possibly compressed) // tag value. @@ -544,12 +544,12 @@ } // Merge tag values with the same key: - string tag; + std::string tag; // We just want the union of words, so copy over the first instance // and skip any identical ones. priority_queue<ByteLengthPrefixedStringItor *, - vector<ByteLengthPrefixedStringItor *>, + std::vector<ByteLengthPrefixedStringItor *>, ByteLengthPrefixedStringItorGt> pqtag; vector<MergeCursor *> vec; @@ -562,7 +562,7 @@ pq.pop(); } - string lastword; + std::string lastword; while (!pqtag.empty()) { ByteLengthPrefixedStringItor * it = pqtag.top(); pqtag.pop(); @@ -596,8 +596,8 @@ static void multimerge_postlists(Xapian::Compactor * compactor, GlassTable * out, const char * tmpdir, - vector<GlassTable *> tmp, - vector<Xapian::docid> off) + std::vector<GlassTable *> tmp, + std::vector<Xapian::docid> off) { unsigned int c = 0; while (tmp.size() > 3) { @@ -609,7 +609,7 @@ j = i + 2; if (j == tmp.size() - 1) ++j; - string dest = tmpdir; + std::string dest = tmpdir; char buf[64]; sprintf(buf, "/tmp%u_%u.", c, i / 2); dest += buf; @@ -657,7 +657,7 @@ Xapian::docid offset; public: - string key; + std::string key; Xapian::docid firstdid; PositionCursor(GlassTable *in, Xapian::docid offset_) @@ -671,7 +671,7 @@ read_tag(); const char * d = current_key.data(); const char * e = d + current_key.size(); - string term; + std::string term; Xapian::docid did; if (!unpack_string_preserving_sort(&d, e, term) || !unpack_uint_preserving_sort(&d, e, &did) || @@ -685,7 +685,7 @@ return true; } - const string & get_tag() const { + const std::string & get_tag() const { return current_tag; } }; @@ -700,10 +700,10 @@ }; static void -merge_positions(GlassTable *out, const vector<GlassTable*> & inputs, - const vector<Xapian::docid> & offset) +merge_positions(GlassTable *out, const std::vector<GlassTable*> & inputs, + const std::vector<Xapian::docid> & offset) { - priority_queue<PositionCursor *, vector<PositionCursor *>, PositionCursorGt> pq; + priority_queue<PositionCursor *, std::vector<PositionCursor *>, PositionCursorGt> pq; for (size_t i = 0; i < inputs.size(); ++i) { GlassTable *in = inputs[i]; if (in->empty()) { @@ -727,8 +727,8 @@ } static void -merge_docid_keyed(GlassTable *out, const vector<GlassTable*> & inputs, - const vector<Xapian::docid> & offset) +merge_docid_keyed(GlassTable *out, const std::vector<GlassTable*> & inputs, + const std::vector<Xapian::docid> & offset) { for (size_t i = 0; i < inputs.size(); ++i) { Xapian::docid off = offset[i]; @@ -739,7 +739,7 @@ GlassCursor cur(in); cur.find_entry(string()); - string key; + std::string key; while (cur.next()) { // Adjust the key if this isn't the first database. if (off) { @@ -747,7 +747,7 @@ const char * d = cur.current_key.data(); const char * e = d + cur.current_key.size(); if (!unpack_uint_preserving_sort(&d, e, &did)) { - string msg = "Bad key in "; + std::string msg = "Bad key in "; msg += inputs[i]->get_path(); throw Xapian::DatabaseCorruptError(msg); } @@ -776,8 +776,8 @@ GlassDatabase::compact(Xapian::Compactor * compactor, const char * destdir, int fd, - const vector<Xapian::Database::Internal*> & sources, - const vector<Xapian::docid> & offset, + const std::vector<Xapian::Database::Internal*> & sources, + const std::vector<Xapian::docid> & offset, size_t block_size, Xapian::Compactor::compaction_level compaction, unsigned flags, @@ -832,7 +832,7 @@ FlintLock lock(destdir ? destdir : ""); if (!single_file) { - string explanation; + std::string explanation; FlintLock::reason why = lock.lock(true, false, explanation); if (why != FlintLock::SUCCESS) { lock.throw_databaselockerror(why, destdir, explanation); @@ -859,14 +859,14 @@ version_file_out->merge_stats(db->version_file); } - string fl_serialised; + std::string fl_serialised; if (single_file) { GlassFreeList fl; fl.set_first_unused_block(1); // FIXME: Assumption? fl.pack(fl_serialised); } - vector<GlassTable *> tabs; + std::vector<GlassTable *> tabs; tabs.reserve(tables_end - tables); off_t prev_size = block_size; for (const table_list * t = tables; t < tables_end; ++t) { @@ -878,7 +878,7 @@ if (compactor) compactor->set_status(t->name, string()); - string dest; + std::string dest; if (!single_file) { dest = destdir; dest += '/'; @@ -958,7 +958,7 @@ if (t->type == Glass::TERMLIST && inputs_present != sources.size()) { if (inputs_present != 0) { if (compactor) { - string m = str(inputs_present); + std::string m = str(inputs_present); m += " of "; m += str(sources.size()); m += " inputs present, so suppressing output"; @@ -1052,7 +1052,7 @@ if (compactor) compactor->set_status(t->name, "Done (table sizes unknown for single file DB input)"); } else { - string status; + std::string status; if (out_size == in_size) { status = "Size unchanged ("; } else { @@ -1102,7 +1102,7 @@ } } version_file_out->set_last_docid(last_docid); - string tmpfile = version_file_out->write(1, FLAGS); + std::string tmpfile = version_file_out->write(1, FLAGS); for (unsigned j = 0; j != tabs.size(); ++j) { tabs[j]->sync(); } diff -ur xapian-core-1.4.21/backends/glass/glass_cursor.cc xapian-core-1.4.21/backends/glass/glass_cursor.cc --- xapian-core-1.4.21/backends/glass/glass_cursor.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_cursor.cc 2022-11-08 16:44:15.376461870 +0100 @@ -34,10 +34,10 @@ #ifdef XAPIAN_DEBUG_LOG static string -hex_display_encode(const string & input) +hex_display_encode(const std::string & input) { const char * table = "0123456789abcdef"; - string result; + std::string result; for (string::const_iterator i = input.begin(); i != input.end(); ++i) { unsigned char val = *i; result += "\\x"; @@ -141,7 +141,7 @@ } bool -GlassCursor::find_entry(const string &key) +GlassCursor::find_entry(const std::string &key) { LOGCALL(DB, bool, "GlassCursor::find_entry", key); if (B->cursor_version != version) { @@ -187,7 +187,7 @@ } void -GlassCursor::find_entry_lt(const string &key) +GlassCursor::find_entry_lt(const std::string &key) { LOGCALL_VOID(DB, "GlassCursor::find_entry_lt", key); if (!find_entry(key)) { @@ -210,7 +210,7 @@ } bool -GlassCursor::find_exact(const string &key) +GlassCursor::find_exact(const std::string &key) { LOGCALL(DB, bool, "GlassCursor::find_exact", key); is_after_end = false; @@ -235,7 +235,7 @@ } bool -GlassCursor::find_entry_ge(const string &key) +GlassCursor::find_entry_ge(const std::string &key) { LOGCALL(DB, bool, "GlassCursor::find_entry_ge", key); if (B->cursor_version != version) { diff -ur xapian-core-1.4.21/backends/glass/glass_cursor.h xapian-core-1.4.21/backends/glass/glass_cursor.h --- xapian-core-1.4.21/backends/glass/glass_cursor.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_cursor.h 2022-11-08 16:44:00.936513203 +0100 @@ -195,7 +195,7 @@ * e.g. * * GlassCursor BC(&btree); - * string key; + * std::string key; * * // Now do something to each key in the Btree * BC.find_entry(string()); // must give result true @@ -236,12 +236,12 @@ /** Current key pointed to by cursor. */ - string current_key; + std::string current_key; /** Current tag pointed to by cursor. You must call read_tag to * make this value available. */ - string current_tag; + std::string current_tag; /** Read the tag from the table and store it in current_tag. * @@ -295,7 +295,7 @@ * @return true if the exact key was found in the table, false * otherwise. */ - bool find_entry(const string &key); + bool find_entry(const std::string &key); /** Position the cursor exactly on a key. * @@ -305,17 +305,17 @@ * @param key The key to search for. * @return true if the key was found. */ - bool find_exact(const string &key); + bool find_exact(const std::string &key); /// Position the cursor on the highest entry with key < @a key. - void find_entry_lt(const string &key); + void find_entry_lt(const std::string &key); /** Position the cursor on the lowest entry with key >= @a key. * * @return true if the exact key was found in the table, false * otherwise. */ - bool find_entry_ge(const string &key); + bool find_entry_ge(const std::string &key); /** Set the cursor to be off the end of the table. */ diff -ur xapian-core-1.4.21/backends/glass/glass_database.cc xapian-core-1.4.21/backends/glass/glass_database.cc --- xapian-core-1.4.21/backends/glass/glass_database.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_database.cc 2022-11-08 16:44:15.364461914 +0100 @@ -78,7 +78,7 @@ // The maximum safe term length is determined by the postlist. There we // store the term using pack_string_preserving_sort() which takes the -// length of the string plus an extra byte (assuming the string doesn't +// length of the std::string plus an extra byte (assuming the std::string doesn't // contain any zero bytes), followed by the docid with encoded with // pack_uint_preserving_sort() which takes up to 5 bytes (for a 32-bit // docid). @@ -95,7 +95,7 @@ /* This opens the tables, determining the current and next revision numbers, * and stores handles to the tables. */ -GlassDatabase::GlassDatabase(const string &glass_dir, int flags, +GlassDatabase::GlassDatabase(const std::string &glass_dir, int flags, unsigned int block_size) : db_dir(glass_dir), readonly(flags == Xapian::DB_READONLY_), @@ -287,13 +287,13 @@ } void -GlassDatabase::get_changeset_revisions(const string & path, +GlassDatabase::get_changeset_revisions(const std::string & path, glass_revision_number_t * startrev, glass_revision_number_t * endrev) const { FD fd(posixy_open(path.c_str(), O_RDONLY | O_CLOEXEC)); if (fd < 0) { - string message = string("Couldn't open changeset ") + + std::string message = string("Couldn't open changeset ") + path + " to read"; throw Xapian::DatabaseError(message, errno); } @@ -305,7 +305,7 @@ throw Xapian::DatabaseError("Changeset too short at " + path); if (memcmp(start, CHANGES_MAGIC_STRING, CONST_STRLEN(CHANGES_MAGIC_STRING)) != 0) { - string message = string("Changeset at ") + + std::string message = string("Changeset at ") + path + " does not contain valid magic string"; throw Xapian::DatabaseError(message); } @@ -335,7 +335,7 @@ glass_revision_number_t rev = version_file.get_revision(); if (new_revision <= rev && rev != 0) { - string m = "New revision "; + std::string m = "New revision "; m += str(new_revision); m += " <= old revision "; m += str(rev); @@ -358,7 +358,7 @@ spelling_table.commit(new_revision, version_file.root_to_set(Glass::SPELLING)); docdata_table.commit(new_revision, version_file.root_to_set(Glass::DOCDATA)); - const string & tmpfile = version_file.write(new_revision, flags); + const std::string & tmpfile = version_file.write(new_revision, flags); if (!postlist_table.sync() || !position_table.sync() || !termlist_table.sync() || @@ -385,7 +385,7 @@ { Xapian::TermIterator t; for (t = query.get_unique_terms_begin(); t != Xapian::TermIterator(); ++t) { - const string & term = *t; + const std::string & term = *t; if (!postlist_table.readahead_key(GlassPostListTable::make_key(term))) break; } @@ -419,12 +419,12 @@ // FIXME: Handle Xapian::DB_DANGEROUS here, perhaps by having readers // get a lock on the revision they're reading, and then requiring the // writer get an exclusive lock in this case. - string explanation; + std::string explanation; bool retry = flags & Xapian::DB_RETRY_LOCK; FlintLock::reason why = lock.lock(true, retry, explanation); if (why != FlintLock::SUCCESS) { if (why == FlintLock::UNKNOWN && !creating && !database_exists()) { - string msg("No glass database found at path '"); + std::string msg("No glass database found at path '"); msg += db_dir; msg += '\''; throw Xapian::DatabaseNotFoundError(msg); @@ -439,8 +439,8 @@ LOGCALL_VOID(DB, "GlassDatabase::send_whole_database", conn | end_time); #ifdef XAPIAN_HAS_REMOTE_BACKEND // Send the current revision number in the header. - string buf; - string uuid = get_uuid(); + std::string buf; + std::string uuid = get_uuid(); buf += encode_length(uuid.size()); buf += uuid; pack_uint(buf, get_revision_number()); @@ -456,7 +456,7 @@ "position." GLASS_TABLE_EXTENSION "\0" "postlist." GLASS_TABLE_EXTENSION "\0" "iamglass\0"; - string filepath = db_dir; + std::string filepath = db_dir; filepath += '/'; const char * p = filenames; do { @@ -477,7 +477,7 @@ void GlassDatabase::write_changesets_to_fd(int fd, - const string & revision, + const std::string & revision, bool need_whole_db, ReplicationInfo * info) { @@ -485,7 +485,7 @@ #ifdef XAPIAN_HAS_REMOTE_BACKEND int whole_db_copies_left = MAX_DB_COPIES_PER_CONVERSATION; glass_revision_number_t start_rev_num = 0; - string start_uuid = get_uuid(); + std::string start_uuid = get_uuid(); glass_revision_number_t needed_rev_num = 0; @@ -532,7 +532,7 @@ // The update must proceed to that revision number before the // copy is safe to make live. - string buf; + std::string buf; needed_rev_num = get_revision_number(); pack_uint(buf, needed_rev_num); conn.send_message(REPL_REPLY_DB_FOOTER, buf, 0.0); @@ -547,7 +547,7 @@ // because the next message is going to be the start of a new // database transfer. - string buf; + std::string buf; pack_uint(buf, start_rev_num + 1); conn.send_message(REPL_REPLY_DB_FOOTER, buf, 0.0); need_whole_db = true; @@ -566,7 +566,7 @@ } // Look for the changeset for revision start_rev_num. - string changes_name = db_dir + "/changes" + str(start_rev_num); + std::string changes_name = db_dir + "/changes" + str(start_rev_num); FD fd_changes(posixy_open(changes_name.c_str(), O_RDONLY | O_CLOEXEC)); if (fd_changes >= 0) { // Send it, and also update start_rev_num to the new value @@ -752,7 +752,7 @@ } void -GlassDatabase::get_freqs(const string & term, +GlassDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { @@ -795,7 +795,7 @@ } Xapian::termcount -GlassDatabase::get_wdf_upper_bound(const string & term) const +GlassDatabase::get_wdf_upper_bound(const std::string & term) const { Assert(!term.empty()); Xapian::termcount wdfub; @@ -804,7 +804,7 @@ } bool -GlassDatabase::term_exists(const string & term) const +GlassDatabase::term_exists(const std::string & term) const { LOGCALL(DB, bool, "GlassDatabase::term_exists", term); Assert(!term.empty()); @@ -883,7 +883,7 @@ } PositionList * -GlassDatabase::open_position_list(Xapian::docid did, const string & term) const +GlassDatabase::open_position_list(Xapian::docid did, const std::string & term) const { Assert(did != 0); @@ -898,7 +898,7 @@ } TermList * -GlassDatabase::open_allterms(const string & prefix) const +GlassDatabase::open_allterms(const std::string & prefix) const { LOGCALL(DB, TermList *, "GlassDatabase::open_allterms", NO_ARGS); RETURN(new GlassAllTermsList(intrusive_ptr<const GlassDatabase>(this), @@ -906,7 +906,7 @@ } TermList * -GlassDatabase::open_spelling_termlist(const string & word) const +GlassDatabase::open_spelling_termlist(const std::string & word) const { return spelling_table.open_termlist(word); } @@ -921,19 +921,19 @@ } Xapian::doccount -GlassDatabase::get_spelling_frequency(const string & word) const +GlassDatabase::get_spelling_frequency(const std::string & word) const { return spelling_table.get_word_frequency(word); } TermList * -GlassDatabase::open_synonym_termlist(const string & term) const +GlassDatabase::open_synonym_termlist(const std::string & term) const { return synonym_table.open_termlist(term); } TermList * -GlassDatabase::open_synonym_keylist(const string & prefix) const +GlassDatabase::open_synonym_keylist(const std::string & prefix) const { GlassCursor * cursor = synonym_table.cursor_get(); if (!cursor) return NULL; @@ -942,12 +942,12 @@ } string -GlassDatabase::get_metadata(const string & key) const +GlassDatabase::get_metadata(const std::string & key) const { LOGCALL(DB, string, "GlassDatabase::get_metadata", key); - string btree_key("\x00\xc0", 2); + std::string btree_key("\x00\xc0", 2); btree_key += key; - string tag; + std::string tag; (void)postlist_table.get_exact_entry(btree_key, tag); RETURN(tag); } @@ -966,7 +966,7 @@ GlassDatabase::get_revision_info() const { LOGCALL(DB, string, "GlassDatabase::get_revision_info", NO_ARGS); - string buf; + std::string buf; pack_uint(buf, get_revision_number()); RETURN(buf); } @@ -1015,7 +1015,7 @@ /////////////////////////////////////////////////////////////////////////// -GlassWritableDatabase::GlassWritableDatabase(const string &dir, int flags, +GlassWritableDatabase::GlassWritableDatabase(const std::string &dir, int flags, int block_size) : GlassDatabase(dir, flags, block_size), change_count(0), @@ -1128,7 +1128,7 @@ new_doclen += wdf; version_file.check_wdf(wdf); - string tname = *term; + std::string tname = *term; if (tname.size() > MAX_SAFE_TERM_LENGTH) throw Xapian::InvalidArgumentError("Term too long (> " STRINGIZE(MAX_SAFE_TERM_LENGTH) "): " + tname); @@ -1197,7 +1197,7 @@ termlist.next(); while (!termlist.at_end()) { - string tname = termlist.get_termname(); + std::string tname = termlist.get_termname(); inverter.delete_positionlist(did, tname); inverter.remove_posting(did, tname, termlist.get_wdf()); @@ -1289,7 +1289,7 @@ version_file.delete_document(old_doclen); Xapian::termcount new_doclen = old_doclen; - string old_tname, new_tname; + std::string old_tname, new_tname; termlist.next(); while (!termlist.at_end() || term != document.termlist_end()) { @@ -1424,7 +1424,7 @@ } void -GlassWritableDatabase::get_freqs(const string & term, +GlassWritableDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { @@ -1444,7 +1444,7 @@ GlassWritableDatabase::get_value_freq(Xapian::valueno slot) const { LOGCALL(DB, Xapian::doccount, "GlassWritableDatabase::get_value_freq", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.freq); RETURN(GlassDatabase::get_value_freq(slot)); @@ -1454,7 +1454,7 @@ GlassWritableDatabase::get_value_lower_bound(Xapian::valueno slot) const { LOGCALL(DB, std::string, "GlassWritableDatabase::get_value_lower_bound", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.lower_bound); RETURN(GlassDatabase::get_value_lower_bound(slot)); @@ -1464,14 +1464,14 @@ GlassWritableDatabase::get_value_upper_bound(Xapian::valueno slot) const { LOGCALL(DB, std::string, "GlassWritableDatabase::get_value_upper_bound", slot); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; i = value_stats.find(slot); if (i != value_stats.end()) RETURN(i->second.upper_bound); RETURN(GlassDatabase::get_value_upper_bound(slot)); } bool -GlassWritableDatabase::term_exists(const string & tname) const +GlassWritableDatabase::term_exists(const std::string & tname) const { LOGCALL(DB, bool, "GlassWritableDatabase::term_exists", tname); Xapian::doccount tf; @@ -1523,7 +1523,7 @@ const string& term) const { Assert(did != 0); - string data; + std::string data; if (inverter.get_positionlist(did, term, data)) { pos_list->read_data(data); return; @@ -1536,7 +1536,7 @@ const string& term) const { Assert(did != 0); - string data; + std::string data; if (inverter.get_positionlist(did, term, data)) { if (data.empty()) return 0; @@ -1546,13 +1546,13 @@ } PositionList * -GlassWritableDatabase::open_position_list(Xapian::docid did, const string & term) const +GlassWritableDatabase::open_position_list(Xapian::docid did, const std::string & term) const { Assert(did != 0); AutoPtr<GlassPositionList> poslist(new GlassPositionList); - string data; + std::string data; if (inverter.get_positionlist(did, term, data)) { poslist->read_data(data); } else if (!poslist->read_data(&position_table, did, term)) { @@ -1565,7 +1565,7 @@ } TermList * -GlassWritableDatabase::open_allterms(const string & prefix) const +GlassWritableDatabase::open_allterms(const std::string & prefix) const { LOGCALL(DB, TermList *, "GlassWritableDatabase::open_allterms", NO_ARGS); if (change_count) { @@ -1594,14 +1594,14 @@ } void -GlassWritableDatabase::add_spelling(const string & word, +GlassWritableDatabase::add_spelling(const std::string & word, Xapian::termcount freqinc) const { spelling_table.add_word(word, freqinc); } void -GlassWritableDatabase::remove_spelling(const string & word, +GlassWritableDatabase::remove_spelling(const std::string & word, Xapian::termcount freqdec) const { spelling_table.remove_word(word, freqdec); @@ -1615,37 +1615,37 @@ } TermList * -GlassWritableDatabase::open_synonym_keylist(const string & prefix) const +GlassWritableDatabase::open_synonym_keylist(const std::string & prefix) const { synonym_table.merge_changes(); return GlassDatabase::open_synonym_keylist(prefix); } void -GlassWritableDatabase::add_synonym(const string & term, - const string & synonym) const +GlassWritableDatabase::add_synonym(const std::string & term, + const std::string & synonym) const { synonym_table.add_synonym(term, synonym); } void -GlassWritableDatabase::remove_synonym(const string & term, - const string & synonym) const +GlassWritableDatabase::remove_synonym(const std::string & term, + const std::string & synonym) const { synonym_table.remove_synonym(term, synonym); } void -GlassWritableDatabase::clear_synonyms(const string & term) const +GlassWritableDatabase::clear_synonyms(const std::string & term) const { synonym_table.clear_synonyms(term); } void -GlassWritableDatabase::set_metadata(const string & key, const string & value) +GlassWritableDatabase::set_metadata(const std::string & key, const std::string & value) { LOGCALL_VOID(DB, "GlassWritableDatabase::set_metadata", key | value); - string btree_key("\x00\xc0", 2); + std::string btree_key("\x00\xc0", 2); btree_key += key; if (value.empty()) { postlist_table.del(btree_key); diff -ur xapian-core-1.4.21/backends/glass/glass_database.h xapian-core-1.4.21/backends/glass/glass_database.h --- xapian-core-1.4.21/backends/glass/glass_database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_database.h 2022-11-08 16:44:00.920513260 +0100 @@ -175,7 +175,7 @@ /** Called if a modifications fail. * - * @param msg is a string description of the exception that was + * @param msg is a std::string description of the exception that was * raised when the modifications failed. */ void modifications_failed(glass_revision_number_t new_revision, @@ -201,7 +201,7 @@ /** Get the revision stored in a changeset. */ - void get_changeset_revisions(const string & path, + void get_changeset_revisions(const std::string & path, glass_revision_number_t * startrev, glass_revision_number_t * endrev) const; @@ -252,7 +252,7 @@ Xapian::totallength get_total_length() const; Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_unique_terms(Xapian::docid did) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; Xapian::doccount get_value_freq(Xapian::valueno slot) const; @@ -260,11 +260,11 @@ std::string get_value_upper_bound(Xapian::valueno slot) const; Xapian::termcount get_doclength_lower_bound() const; Xapian::termcount get_doclength_upper_bound() const; - Xapian::termcount get_wdf_upper_bound(const string & term) const; - bool term_exists(const string & tname) const; + Xapian::termcount get_wdf_upper_bound(const std::string & term) const; + bool term_exists(const std::string & tname) const; bool has_positions() const; - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; ValueList * open_value_list(Xapian::valueno slot) const; Xapian::Document::Internal* open_document(Xapian::docid did, bool lazy) const; @@ -277,23 +277,23 @@ PositionList* open_position_list(Xapian::docid did, const string& term) const; TermList * open_term_list(Xapian::docid did) const; - TermList * open_allterms(const string & prefix) const; + TermList * open_allterms(const std::string & prefix) const; - TermList * open_spelling_termlist(const string & word) const; + TermList * open_spelling_termlist(const std::string & word) const; TermList * open_spelling_wordlist() const; - Xapian::doccount get_spelling_frequency(const string & word) const; + Xapian::doccount get_spelling_frequency(const std::string & word) const; - TermList * open_synonym_termlist(const string & term) const; - TermList * open_synonym_keylist(const string & prefix) const; + TermList * open_synonym_termlist(const std::string & term) const; + TermList * open_synonym_keylist(const std::string & prefix) const; - string get_metadata(const string & key) const; + std::string get_metadata(const std::string & key) const; TermList * open_metadata_keylist(const std::string &prefix) const; void write_changesets_to_fd(int fd, - const string & start_revision, + const std::string & start_revision, bool need_whole_db, Xapian::ReplicationInfo * info); - string get_revision_info() const; - string get_uuid() const; + std::string get_revision_info() const; + std::string get_uuid() const; void request_document(Xapian::docid /*did*/) const; void readahead_for_query(const Xapian::Query &query); @@ -332,7 +332,7 @@ class GlassWritableDatabase : public GlassDatabase { mutable Inverter inverter; - mutable map<Xapian::valueno, ValueStats> value_stats; + mutable std::map<Xapian::valueno, ValueStats> value_stats; /** The number of documents added, deleted, or replaced since the last * flush. @@ -408,7 +408,7 @@ * * @param dir directory holding glass tables */ - GlassWritableDatabase(const string &dir, int flags, int block_size); + GlassWritableDatabase(const std::string &dir, int flags, int block_size); ~GlassWritableDatabase(); @@ -416,16 +416,16 @@ //@{ Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_unique_terms(Xapian::docid did) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; Xapian::doccount get_value_freq(Xapian::valueno slot) const; std::string get_value_lower_bound(Xapian::valueno slot) const; std::string get_value_upper_bound(Xapian::valueno slot) const; - bool term_exists(const string & tname) const; + bool term_exists(const std::string & tname) const; bool has_positions() const; - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; ValueList * open_value_list(Xapian::valueno slot) const; void read_position_list(GlassPositionList* pos_list, @@ -435,19 +435,19 @@ const string& term) const; PositionList* open_position_list(Xapian::docid did, const string& term) const; - TermList * open_allterms(const string & prefix) const; + TermList * open_allterms(const std::string & prefix) const; - void add_spelling(const string & word, Xapian::termcount freqinc) const; - void remove_spelling(const string & word, + void add_spelling(const std::string & word, Xapian::termcount freqinc) const; + void remove_spelling(const std::string & word, Xapian::termcount freqdec) const; TermList * open_spelling_wordlist() const; - TermList * open_synonym_keylist(const string & prefix) const; - void add_synonym(const string & word, const string & synonym) const; - void remove_synonym(const string & word, const string & synonym) const; - void clear_synonyms(const string & word) const; + TermList * open_synonym_keylist(const std::string & prefix) const; + void add_synonym(const std::string & word, const std::string & synonym) const; + void remove_synonym(const std::string & word, const std::string & synonym) const; + void clear_synonyms(const std::string & word) const; - void set_metadata(const string & key, const string & value); + void set_metadata(const std::string & key, const std::string & value); void invalidate_doc_object(Xapian::Document::Internal * obj) const; //@} diff -ur xapian-core-1.4.21/backends/glass/glass_databasereplicator.cc xapian-core-1.4.21/backends/glass/glass_databasereplicator.cc --- xapian-core-1.4.21/backends/glass/glass_databasereplicator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_databasereplicator.cc 2022-11-08 16:44:15.360461927 +0100 @@ -64,7 +64,7 @@ "/spelling." GLASS_TABLE_EXTENSION "\0" "/synonym." GLASS_TABLE_EXTENSION; -GlassDatabaseReplicator::GlassDatabaseReplicator(const string & db_dir_) +GlassDatabaseReplicator::GlassDatabaseReplicator(const std::string & db_dir_) : db_dir(db_dir_) { std::fill_n(fds, sizeof(fds) / sizeof(fds[0]), -1); @@ -96,8 +96,8 @@ } bool -GlassDatabaseReplicator::check_revision_at_least(const string & rev, - const string & target) const +GlassDatabaseReplicator::check_revision_at_least(const std::string & rev, + const std::string & target) const { LOGCALL(DB, bool, "GlassDatabaseReplicator::check_revision_at_least", rev | target); @@ -107,13 +107,13 @@ const char * ptr = rev.data(); const char * end = ptr + rev.size(); if (!unpack_uint(&ptr, end, &rev_val)) { - throw NetworkError("Invalid revision string supplied to check_revision_at_least"); + throw NetworkError("Invalid revision std::string supplied to check_revision_at_least"); } ptr = target.data(); end = ptr + target.size(); if (!unpack_uint(&ptr, end, &target_val)) { - throw NetworkError("Invalid revision string supplied to check_revision_at_least"); + throw NetworkError("Invalid revision std::string supplied to check_revision_at_least"); } RETURN(rev_val >= target_val); @@ -145,11 +145,11 @@ } // Write size bytes from start of buf to new version file. - string tmpfile = db_dir; + std::string tmpfile = db_dir; tmpfile += "/v.rtmp"; int fd = posixy_open(tmpfile.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666); if (fd == -1) { - string msg = "Failed to open "; + std::string msg = "Failed to open "; msg += tmpfile; throw DatabaseError(msg, errno); } @@ -158,10 +158,10 @@ io_write(fd, buf.data(), size); io_sync(fd); } - string version_file = db_dir; + std::string version_file = db_dir; version_file += "/iamglass"; if (!io_tmp_rename(tmpfile, version_file)) { - string msg("Couldn't create new version file "); + std::string msg("Couldn't create new version file "); msg += version_file; throw DatabaseError(msg, errno); } @@ -172,7 +172,7 @@ void GlassDatabaseReplicator::process_changeset_chunk_blocks(Glass::table_type table, unsigned v, - string & buf, + std::string & buf, RemoteConnection & conn, double end_time) const { @@ -192,11 +192,11 @@ int fd = fds[table]; if (fd == -1) { - string db_path = db_dir; + std::string db_path = db_dir; db_path += dbnames + table * (11 + CONST_STRLEN(GLASS_TABLE_EXTENSION)); fd = posixy_open(db_path.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, 0666); if (fd == -1) { - string msg = "Failed to open "; + std::string msg = "Failed to open "; msg += db_path; throw DatabaseError(msg, errno); } @@ -223,7 +223,7 @@ // Lock the database to perform modifications. FlintLock lock(db_dir); - string explanation; + std::string explanation; FlintLock::reason why = lock.lock(true, false, explanation); if (why != FlintLock::SUCCESS) { lock.throw_databaselockerror(why, db_dir, explanation); @@ -234,7 +234,7 @@ throw_connection_closed_unexpectedly(); AssertEq(type, REPL_REPLY_CHANGESET); - string buf; + std::string buf; // Read enough to be certain that we've got the header part of the // changeset. diff -ur xapian-core-1.4.21/backends/glass/glass_dbcheck.cc xapian-core-1.4.21/backends/glass/glass_dbcheck.cc --- xapian-core-1.4.21/backends/glass/glass_dbcheck.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_dbcheck.cc 2022-11-08 16:44:15.352461955 +0100 @@ -46,7 +46,7 @@ using namespace std; static inline bool -is_user_metadata_key(const string & key) +is_user_metadata_key(const std::string & key) { return key.size() > 1 && key[0] == '\0' && key[1] == '\xc0'; } @@ -58,10 +58,10 @@ }; size_t -check_glass_table(const char * tablename, const string &db_dir, int fd, +check_glass_table(const char * tablename, const std::string &db_dir, int fd, off_t offset_, const GlassVersion & version_file, int opts, - vector<Xapian::termcount> & doclens, ostream * out) + std::vector<Xapian::termcount> & doclens, ostream * out) { Xapian::docid db_last_docid = version_file.get_last_docid(); if (out) @@ -69,7 +69,7 @@ if (fd < 0) { if (strcmp(tablename, "postlist") != 0) { // Other filenames are created lazily, so may not exist. - string filename(db_dir); + std::string filename(db_dir); filename += '/'; filename += tablename; filename += "." GLASS_TABLE_EXTENSION; @@ -102,15 +102,15 @@ if (strcmp(tablename, "postlist") == 0) { // Now check the structure of each postlist in the table. - map<Xapian::valueno, VStats> valuestats; - string current_term; + std::map<Xapian::valueno, VStats> valuestats; + std::string current_term; Xapian::docid lastdid = 0; Xapian::termcount termfreq = 0, collfreq = 0; Xapian::termcount tf = 0, cf = 0; Xapian::doccount num_doclens = 0; for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; if (is_user_metadata_key(key)) { // User metadata can be anything, so we can't do any particular @@ -340,7 +340,7 @@ end = p + cursor->current_tag.size(); while (true) { - string value; + std::string value; if (!unpack_string(&p, end, value)) { if (out) *out << "Failed to unpack value from chunk" << endl; @@ -405,7 +405,7 @@ pos = key.data(); end = pos + key.size(); - string term; + std::string term; Xapian::docid did; if (!unpack_string_preserving_sort(&pos, end, term)) { if (out) @@ -584,7 +584,7 @@ ++errors; } - map<Xapian::valueno, VStats>::const_iterator i; + std::map<Xapian::valueno, VStats>::const_iterator i; for (i = valuestats.begin(); i != valuestats.end(); ++i) { if (i->second.freq != i->second.freq_real) { if (out) @@ -608,7 +608,7 @@ // Now check the contents of the docdata table. for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); @@ -652,7 +652,7 @@ Xapian::doccount num_termlists = 0; Xapian::doccount num_slotsused_entries = 0; for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); @@ -781,7 +781,7 @@ } Xapian::termcount actual_doclen = 0, actual_termlist_size = 0; - string current_tname; + std::string current_tname; bool bad = false; while (pos != end) { @@ -867,13 +867,13 @@ } else if (strcmp(tablename, "position") == 0) { // Now check the contents of the position table. for ( ; !cursor->after_end(); cursor->next()) { - string & key = cursor->current_key; + std::string & key = cursor->current_key; // Get docid from key. const char * pos = key.data(); const char * end = pos + key.size(); - string term; + std::string term; if (!unpack_string_preserving_sort(&pos, end, term)) { if (out) *out << "Error unpacking term from key" << endl; @@ -916,7 +916,7 @@ cursor->read_tag(); - const string & data = cursor->current_tag; + const std::string & data = cursor->current_tag; pos = data.data(); end = pos + data.size(); diff -ur xapian-core-1.4.21/backends/glass/glass_docdata.h xapian-core-1.4.21/backends/glass/glass_docdata.h --- xapian-core-1.4.21/backends/glass/glass_docdata.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_docdata.h 2022-11-08 16:44:00.932513218 +0100 @@ -52,7 +52,7 @@ /** Get the document data for document @a did. * - * If the document doesn't exist, the empty string is returned. + * If the document doesn't exist, the empty std::string is returned. * * @param did The docid to set the document data for. */ diff -ur xapian-core-1.4.21/backends/glass/glass_document.cc xapian-core-1.4.21/backends/glass/glass_document.cc --- xapian-core-1.4.21/backends/glass/glass_document.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_document.cc 2022-11-08 16:44:15.368461899 +0100 @@ -44,7 +44,7 @@ /** Retrieve all value values from the database */ void -GlassDocument::do_get_all_values(map<Xapian::valueno, string> & values_) const +GlassDocument::do_get_all_values(std::map<Xapian::valueno, string> & values_) const { LOGCALL_VOID(DB, "GlassDocument::do_get_all_values", values_); value_manager->get_all_values(values_, did); diff -ur xapian-core-1.4.21/backends/glass/glass_document.h xapian-core-1.4.21/backends/glass/glass_document.h --- xapian-core-1.4.21/backends/glass/glass_document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_document.h 2022-11-08 16:44:00.928513231 +0100 @@ -53,9 +53,9 @@ public: /** Implementation of virtual methods @{ */ - string do_get_value(Xapian::valueno slot) const; - void do_get_all_values(map<Xapian::valueno, string> & values_) const; - string do_get_data() const; + std::string do_get_value(Xapian::valueno slot) const; + void do_get_all_values(std::map<Xapian::valueno, string> & values_) const; + std::string do_get_data() const; /** @} */ }; diff -ur xapian-core-1.4.21/backends/glass/glass_inverter.cc xapian-core-1.4.21/backends/glass/glass_inverter.cc --- xapian-core-1.4.21/backends/glass/glass_inverter.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_inverter.cc 2022-11-08 16:44:15.368461899 +0100 @@ -35,11 +35,11 @@ void Inverter::store_positions(const GlassPositionListTable & position_table, Xapian::docid did, - const string & tname, - const vector<Xapian::termpos> & posvec, + const std::string & tname, + const std::vector<Xapian::termpos> & posvec, bool modifying) { - string s; + std::string s; position_table.pack(s, posvec); if (modifying && has_positions_cache != 0) { // If we add positions we must then have positions, but if we remove @@ -48,7 +48,7 @@ auto i = pos_changes.find(tname); if (i != pos_changes.end()) { - map<Xapian::docid, string> & m = i->second; + std::map<Xapian::docid, string> & m = i->second; auto j = m.find(did); if (j != m.end()) { // Update existing entry. @@ -56,8 +56,8 @@ return; } } - const string & key = position_table.make_key(did, tname); - string old_tag; + const std::string & key = position_table.make_key(did, tname); + std::string old_tag; if (position_table.get_exact_entry(key, old_tag) && s == old_tag) { // Identical to existing entry on disk. return; @@ -72,7 +72,7 @@ void Inverter::set_positionlist(const GlassPositionListTable & position_table, Xapian::docid did, - const string & tname, + const std::string & tname, const Xapian::TermIterator & term, bool modifying) { @@ -86,7 +86,7 @@ } else { Xapian::PositionIterator pos = term.positionlist_begin(); if (pos != term.positionlist_end()) { - vector<Xapian::termpos> posvec(pos, Xapian::PositionIterator()); + std::vector<Xapian::termpos> posvec(pos, Xapian::PositionIterator()); store_positions(position_table, did, tname, posvec, modifying); return; } @@ -98,30 +98,30 @@ void Inverter::set_positionlist(Xapian::docid did, - const string & term, - const string & s) + const std::string & term, + const std::string & s) { has_positions_cache = s.empty() ? -1 : 1; - pos_changes.insert(make_pair(term, map<Xapian::docid, string>())) + pos_changes.insert(make_pair(term, std::map<Xapian::docid, string>())) .first->second[did] = s; } void Inverter::delete_positionlist(Xapian::docid did, - const string & term) + const std::string & term) { set_positionlist(did, term, string()); } bool Inverter::get_positionlist(Xapian::docid did, - const string & term, - string & s) const + const std::string & term, + std::string & s) const { auto i = pos_changes.find(term); if (i == pos_changes.end()) return false; - const map<Xapian::docid, string> & m = i->second; + const std::map<Xapian::docid, string> & m = i->second; auto j = m.find(did); if (j == m.end()) return false; @@ -137,9 +137,9 @@ // efficient? E.g. how many sets and deletes we had in total perhaps. glass_tablesize_t changes = 0; for (const auto& i : pos_changes) { - const map<Xapian::docid, string>& m = i.second; + const std::map<Xapian::docid, string>& m = i.second; for (const auto& j : m) { - const string & s = j.second; + const std::string & s = j.second; if (!s.empty()) return true; ++changes; @@ -160,9 +160,9 @@ } void -Inverter::flush_post_list(GlassPostListTable & table, const string & term) +Inverter::flush_post_list(GlassPostListTable & table, const std::string & term) { - map<string, PostingChanges>::iterator i; + std::map<string, PostingChanges>::iterator i; i = postlist_changes.find(term); if (i == postlist_changes.end()) return; @@ -174,7 +174,7 @@ void Inverter::flush_all_post_lists(GlassPostListTable & table) { - map<string, PostingChanges>::const_iterator i; + std::map<string, PostingChanges>::const_iterator i; for (i = postlist_changes.begin(); i != postlist_changes.end(); ++i) { table.merge_changes(i->first, i->second); } @@ -182,14 +182,14 @@ } void -Inverter::flush_post_lists(GlassPostListTable & table, const string & pfx) +Inverter::flush_post_lists(GlassPostListTable & table, const std::string & pfx) { if (pfx.empty()) return flush_all_post_lists(table); - map<string, PostingChanges>::iterator i, begin, end; + std::map<string, PostingChanges>::iterator i, begin, end; begin = postlist_changes.lower_bound(pfx); - string pfxinc = pfx; + std::string pfxinc = pfx; while (true) { if (pfxinc.back() != '\xff') { ++pfxinc.back(); @@ -223,11 +223,11 @@ Inverter::flush_pos_lists(GlassPositionListTable & table) { for (auto i : pos_changes) { - const string & term = i.first; - const map<Xapian::docid, string> & m = i.second; + const std::string & term = i.first; + const std::map<Xapian::docid, string> & m = i.second; for (auto j : m) { Xapian::docid did = j.first; - const string & s = j.second; + const std::string & s = j.second; if (!s.empty()) table.set_positionlist(did, term, s); else diff -ur xapian-core-1.4.21/backends/glass/glass_metadata.cc xapian-core-1.4.21/backends/glass/glass_metadata.cc --- xapian-core-1.4.21/backends/glass/glass_metadata.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_metadata.cc 2022-11-08 16:44:15.364461914 +0100 @@ -38,7 +38,7 @@ GlassMetadataTermList::GlassMetadataTermList( intrusive_ptr<const Xapian::Database::Internal> database_, GlassCursor * cursor_, - const string &prefix_) + const std::string &prefix_) : database(database_), cursor(cursor_), prefix(string("\x00\xc0", 2) + prefix_) { LOGCALL_CTOR(DB, "GlassMetadataTermList", database_ | cursor_ | prefix_); @@ -85,7 +85,7 @@ } TermList * -GlassMetadataTermList::skip_to(const string &key) +GlassMetadataTermList::skip_to(const std::string &key) { LOGCALL(DB, TermList *, "GlassMetadataTermList::skip_to", key); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/glass/glass_positionlist.cc xapian-core-1.4.21/backends/glass/glass_positionlist.cc --- xapian-core-1.4.21/backends/glass/glass_positionlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_positionlist.cc 2022-11-08 16:44:15.380461857 +0100 @@ -36,7 +36,7 @@ void GlassPositionListTable::pack(string & s, - const vector<Xapian::termpos> & vec) const + const std::vector<Xapian::termpos> & vec) const { LOGCALL_VOID(DB, "GlassPositionListTable::pack", s | vec); Assert(!vec.empty()); @@ -79,11 +79,11 @@ Xapian::termcount GlassPositionListTable::positionlist_count(Xapian::docid did, - const string & term) const + const std::string & term) const { LOGCALL(DB, Xapian::termcount, "GlassPositionListTable::positionlist_count", did | term); - string data; + std::string data; if (!get_exact_entry(make_key(did, term), data)) { RETURN(0); } @@ -94,7 +94,7 @@ /////////////////////////////////////////////////////////////////////////// bool -GlassPositionList::read_data(const string & data) +GlassPositionList::read_data(const std::string & data) { LOGCALL(DB, bool, "GlassPositionList::read_data", data); @@ -133,7 +133,7 @@ bool GlassPositionList::read_data(const GlassTable * table, Xapian::docid did, - const string & tname) + const std::string & tname) { LOGCALL(DB, bool, "GlassPositionList::read_data", table | did | tname); if (!cursor.get()) { diff -ur xapian-core-1.4.21/backends/glass/glass_positionlist.h xapian-core-1.4.21/backends/glass/glass_positionlist.h --- xapian-core-1.4.21/backends/glass/glass_positionlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_positionlist.h 2022-11-08 16:44:00.928513231 +0100 @@ -32,12 +32,12 @@ #include <string> -using namespace std; +using std::string; class GlassPositionListTable : public GlassLazyTable { public: - static string make_key(Xapian::docid did, const string & term) { - string key; + static std::string make_key(Xapian::docid did, const std::string & term) { + std::string key; pack_string_preserving_sort(key, term); pack_uint_preserving_sort(key, did); return key; @@ -51,7 +51,7 @@ * @param dbdir The directory the glass database is stored in. * @param readonly true if we're opening read-only, else false. */ - GlassPositionListTable(const string & dbdir, bool readonly) + GlassPositionListTable(const std::string & dbdir, bool readonly) : GlassLazyTable("position", dbdir + "/position.", readonly) { } GlassPositionListTable(int fd, off_t offset_, bool readonly_) @@ -59,19 +59,19 @@ /** Pack a position list into a string. * - * @param s The string to append the position list data to. + * @param s The std::string to append the position list data to. */ void pack(string & s, const std::vector<Xapian::termpos> & vec) const; /** Set the position list for term tname in document did. */ - void set_positionlist(Xapian::docid did, const string & tname, - const string & s) { + void set_positionlist(Xapian::docid did, const std::string & tname, + const std::string & s) { add(make_key(did, tname), s); } /// Delete the position list for term tname in document did. - void delete_positionlist(Xapian::docid did, const string & tname) { + void delete_positionlist(Xapian::docid did, const std::string & tname) { del(make_key(did, tname)); } @@ -80,7 +80,7 @@ /// Return the number of entries in specified position list. Xapian::termcount positionlist_count(Xapian::docid did, - const string & term) const; + const std::string & term) const; }; /** A position list in a glass database. */ @@ -121,7 +121,7 @@ /// Construct and initialise with data. GlassPositionList(const GlassTable * table, Xapian::docid did, - const string & tname) { + const std::string & tname) { (void)read_data(table, did, tname); } @@ -129,14 +129,14 @@ * * @return true if position data was read. */ - bool read_data(const string & data); + bool read_data(const std::string & data); /** Fill list with data, and move the position to the start. * * @return true if position data was read. */ bool read_data(const GlassTable * table, Xapian::docid did, - const string & tname); + const std::string & tname); /// Returns size of position list. Xapian::termcount get_approx_size() const; diff -ur xapian-core-1.4.21/backends/glass/glass_postlist.cc xapian-core-1.4.21/backends/glass/glass_postlist.cc --- xapian-core-1.4.21/backends/glass/glass_postlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_postlist.cc 2022-11-08 16:44:15.348461970 +0100 @@ -53,15 +53,15 @@ } static inline bool -get_tname_from_key(const char **src, const char *end, string &tname) +get_tname_from_key(const char **src, const char *end, std::string &tname) { return unpack_string_preserving_sort(src, end, tname); } static inline bool -check_tname_in_key_lite(const char **keypos, const char *keyend, const string &tname) +check_tname_in_key_lite(const char **keypos, const char *keyend, const std::string &tname) { - string tname_in_key; + std::string tname_in_key; if (keyend - *keypos >= 2 && (*keypos)[0] == '\0' && (*keypos)[1] == '\xe0') { *keypos += 2; @@ -76,7 +76,7 @@ } static inline bool -check_tname_in_key(const char **keypos, const char *keyend, const string &tname) +check_tname_in_key(const char **keypos, const char *keyend, const std::string &tname) { if (*keypos == keyend) return false; @@ -150,13 +150,13 @@ } void -GlassPostListTable::get_freqs(const string & term, +GlassPostListTable::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr, Xapian::termcount * wdfub_ptr) const { - string key = make_key(term); - string tag; + std::string key = make_key(term); + std::string tag; if (!get_exact_entry(key, tag)) { if (termfreq_ptr) *termfreq_ptr = 0; @@ -187,7 +187,7 @@ Xapian::termcount first_wdf; if (!unpack_uint(&p, e, &first_wdf)) report_read_error(p); - *wdfub_ptr = max(cf - first_wdf, first_wdf); + *wdfub_ptr = std::max(cf - first_wdf, first_wdf); } } } @@ -233,9 +233,9 @@ */ class Glass::PostlistChunkWriter { public: - PostlistChunkWriter(const string &orig_key_, + PostlistChunkWriter(const std::string &orig_key_, bool is_first_chunk_, - const string &tname_, + const std::string &tname_, bool is_last_chunk_); /// Append an entry to this chunk. @@ -244,7 +244,7 @@ /// Append a block of raw entries to this chunk. void raw_append(Xapian::docid first_did_, Xapian::docid current_did_, - const string & s) { + const std::string & s) { Assert(!started); first_did = first_did_; current_did = current_did_; @@ -261,8 +261,8 @@ void flush(GlassTable *table); private: - string orig_key; - string tname; + std::string orig_key; + std::string tname; bool is_first_chunk; bool is_last_chunk; bool started; @@ -270,7 +270,7 @@ Xapian::docid first_did; Xapian::docid current_did; - string chunk; + std::string chunk; }; using Glass::PostlistChunkWriter; @@ -280,7 +280,7 @@ * entries in a postlist. */ class Glass::PostlistChunkReader { - string data; + std::string data; const char *pos; const char *end; @@ -294,9 +294,9 @@ /** Initialise the postlist chunk reader. * * @param first_did First document id in this chunk. - * @param data The tag string with the header removed. + * @param data The tag std::string with the header removed. */ - PostlistChunkReader(Xapian::docid first_did, const string & data_) + PostlistChunkReader(Xapian::docid first_did, const std::string & data_) : data(data_), pos(data.data()), end(pos + data.length()), at_end(data.empty()), did(first_did) { if (!at_end) read_wdf(&pos, end, &wdf); @@ -331,9 +331,9 @@ } } -PostlistChunkWriter::PostlistChunkWriter(const string &orig_key_, +PostlistChunkWriter::PostlistChunkWriter(const std::string &orig_key_, bool is_first_chunk_, - const string &tname_, + const std::string &tname_, bool is_last_chunk_) : orig_key(orig_key_), tname(tname_), is_first_chunk(is_first_chunk_), @@ -377,7 +377,7 @@ Xapian::termcount collectionfreq, Xapian::docid new_did) { - string chunk; + std::string chunk; pack_uint(chunk, entries); pack_uint(chunk, collectionfreq); pack_uint(chunk, new_did - 1); @@ -392,7 +392,7 @@ Xapian::docid new_final_did) { Assert(new_final_did >= new_first_did); - string chunk; + std::string chunk; pack_bool(chunk, new_is_last_chunk); pack_uint(chunk, new_final_did - new_first_did); return chunk; @@ -506,13 +506,13 @@ read_start_of_chunk(&tagpos, tagend, new_first_did, &new_is_last_chunk); - string chunk_data(tagpos, tagend); + std::string chunk_data(tagpos, tagend); // First remove the renamed tag table->del(cursor->current_key); // And now write it as the first chunk - string tag; + std::string tag; tag = make_start_of_first_chunk(num_ent, coll_freq, new_first_did); tag += make_start_of_chunk(new_is_last_chunk, new_first_did, @@ -549,7 +549,7 @@ // Now update the last_chunk cursor->read_tag(); - string tag = cursor->current_tag; + std::string tag = cursor->current_tag; const char *tagpos = tag.data(); const char *tagend = tagpos + tag.size(); @@ -587,7 +587,7 @@ * * The subcases just affect the chunk header. */ - string tag; + std::string tag; /* First write the header, which depends on whether this is the * first chunk. @@ -597,7 +597,7 @@ * and we just have to write this one back to disk. */ LOGLINE(DB, "PostlistChunkWriter::flush(): rewriting the first chunk, which still has items in it"); - string key = GlassPostListTable::make_key(tname); + std::string key = GlassPostListTable::make_key(tname); bool ok = table->get_exact_entry(key, tag); (void)ok; Assert(ok); @@ -641,7 +641,7 @@ if (!unpack_uint_preserving_sort(&keypos, keyend, &initial_did)) { report_read_error(keypos); } - string new_key; + std::string new_key; if (initial_did != first_did) { /* The fiddlier case: * Create a new tag with the correct key, and replace @@ -696,7 +696,7 @@ * standard chunk. */ GlassPostList::GlassPostList(intrusive_ptr<const GlassDatabase> this_db_, - const string & term_, + const std::string & term_, bool keep_reference) : LeafPostList(term_), this_db(keep_reference ? this_db_ : NULL), @@ -709,7 +709,7 @@ } GlassPostList::GlassPostList(intrusive_ptr<const GlassDatabase> this_db_, - const string & term_, + const std::string & term_, GlassCursor * cursor_) : LeafPostList(term_), this_db(this_db_), @@ -724,7 +724,7 @@ void GlassPostList::init() { - string key = GlassPostListTable::make_key(term); + std::string key = GlassPostListTable::make_key(term); int found = cursor->find_entry(key); if (!found) { LOGLINE(DB, "postlist for term not found"); @@ -749,7 +749,7 @@ read_wdf(&pos, end, &wdf); // This works even if there's only one entry (when wdf == collfreq) // or when collfreq is 0 (=> wdf is 0 too). - wdf_upper_bound = max(collfreq - wdf, wdf); + wdf_upper_bound = std::max(collfreq - wdf, wdf); LOGLINE(DB, "Initial docid " << did); } @@ -1040,7 +1040,7 @@ string GlassPostList::get_description() const { - string desc; + std::string desc; description_append(desc, term); desc += ":"; desc += str(number_of_entries); @@ -1049,14 +1049,14 @@ // Returns the last did to allow in this chunk. Xapian::docid -GlassPostListTable::get_chunk(const string &tname, +GlassPostListTable::get_chunk(const std::string &tname, Xapian::docid did, bool adding, PostlistChunkReader ** from, PostlistChunkWriter **to) { LOGCALL(DB, Xapian::docid, "GlassPostListTable::get_chunk", tname | did | adding | from | to); // Get chunk containing entry - string key = make_key(tname, did); + std::string key = make_key(tname, did); // Find the right chunk AutoPtr<GlassCursor> cursor(cursor_get()); @@ -1134,7 +1134,7 @@ } void -GlassPostListTable::merge_doclen_changes(const map<Xapian::docid, Xapian::termcount> & doclens) +GlassPostListTable::merge_doclen_changes(const std::map<Xapian::docid, Xapian::termcount> & doclens) { LOGCALL_VOID(DB, "GlassPostListTable::merge_doclen_changes", doclens); @@ -1145,15 +1145,15 @@ if (doclens.empty()) return; // Ensure there's a first chunk. - string current_key = make_key(string()); + std::string current_key = make_key(string()); if (!key_exists(current_key)) { LOGLINE(DB, "Adding dummy first chunk"); - string newtag = make_start_of_first_chunk(0, 0, 0); + std::string newtag = make_start_of_first_chunk(0, 0, 0); newtag += make_start_of_chunk(true, 0, 0); add(current_key, newtag); } - map<Xapian::docid, Xapian::termcount>::const_iterator j; + std::map<Xapian::docid, Xapian::termcount>::const_iterator j; j = doclens.begin(); Assert(j != doclens.end()); // This case is caught above. @@ -1202,14 +1202,14 @@ } void -GlassPostListTable::merge_changes(const string &term, +GlassPostListTable::merge_changes(const std::string &term, const Inverter::PostingChanges & changes) { { // Rewrite the first chunk of this posting list with the updated // termfreq and collfreq. - string current_key = make_key(term); - string tag; + std::string current_key = make_key(term); + std::string tag; (void)get_exact_entry(current_key, tag); // Read start of first chunk to get termfreq and collfreq. @@ -1255,7 +1255,7 @@ collfreq += changes.get_cfdelta(); // Rewrite start of first chunk to update termfreq and collfreq. - string newhdr = make_start_of_first_chunk(termfreq, collfreq, firstdid); + std::string newhdr = make_start_of_first_chunk(termfreq, collfreq, firstdid); newhdr += make_start_of_chunk(islast, firstdid, lastdid); if (pos == end) { add(current_key, newhdr); @@ -1265,7 +1265,7 @@ add(current_key, tag); } } - map<Xapian::docid, Xapian::termcount>::const_iterator j; + std::map<Xapian::docid, Xapian::termcount>::const_iterator j; j = changes.pl_changes.begin(); Assert(j != changes.pl_changes.end()); // This case is caught above. diff -ur xapian-core-1.4.21/backends/glass/glass_postlist.h xapian-core-1.4.21/backends/glass/glass_postlist.h --- xapian-core-1.4.21/backends/glass/glass_postlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_postlist.h 2022-11-08 16:44:00.924513246 +0100 @@ -37,7 +37,9 @@ #include <map> #include <string> -using namespace std; +using std::string; +using std::map; +using std::pair; class GlassCursor; class GlassDatabase; @@ -69,7 +71,7 @@ * @param readonly_ - whether to open the table for read only * access. */ - GlassPostListTable(const string & path_, bool readonly_) + GlassPostListTable(const std::string & path_, bool readonly_) : GlassTable("postlist", path_ + "/postlist.", readonly_), doclen_pl() { } @@ -90,7 +92,7 @@ const Inverter::PostingChanges& changes); /// Merge document length changes. - void merge_doclen_changes(const map<Xapian::docid, + void merge_doclen_changes(const std::map<Xapian::docid, Xapian::termcount>& doclens); Xapian::docid get_chunk(const string& tname, @@ -99,16 +101,16 @@ Glass::PostlistChunkWriter** to); /// Compose a key from a termname and docid. - static string make_key(const string& term, Xapian::docid did) { + static std::string make_key(const string& term, Xapian::docid did) { return pack_glass_postlist_key(term, did); } /// Compose a key from a termname. - static string make_key(const string & term) { + static std::string make_key(const std::string & term) { return pack_glass_postlist_key(term); } - bool term_exists(const string & term) const { + bool term_exists(const std::string & term) const { return key_exists(make_key(term)); } @@ -240,7 +242,7 @@ bool move_forward_in_chunk_to_at_least(Xapian::docid desired_did); GlassPostList(Xapian::Internal::intrusive_ptr<const GlassDatabase> this_db_, - const string & term, + const std::string & term, GlassCursor * cursor_); void init(); @@ -248,7 +250,7 @@ public: /// Default constructor. GlassPostList(Xapian::Internal::intrusive_ptr<const GlassDatabase> this_db_, - const string & term, + const std::string & term, bool keep_reference); /// Destructor. diff -ur xapian-core-1.4.21/backends/glass/glass_replicate_internal.h xapian-core-1.4.21/backends/glass/glass_replicate_internal.h --- xapian-core-1.4.21/backends/glass/glass_replicate_internal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_replicate_internal.h 2022-11-08 16:44:00.928513231 +0100 @@ -23,7 +23,7 @@ #ifndef XAPIAN_INCLUDED_GLASS_REPLICATE_INTERNAL_H #define XAPIAN_INCLUDED_GLASS_REPLICATE_INTERNAL_H -// Magic string used to recognise a changeset file. +// Magic std::string used to recognise a changeset file. #define CHANGES_MAGIC_STRING "GlassChanges" // The current version of changeset files. diff -ur xapian-core-1.4.21/backends/glass/glass_spelling.cc xapian-core-1.4.21/backends/glass/glass_spelling.cc --- xapian-core-1.4.21/backends/glass/glass_spelling.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_spelling.cc 2022-11-08 16:44:15.364461914 +0100 @@ -51,14 +51,14 @@ auto d = changes.begin(); if (d == changes.end()) continue; - string updated; - string current; + std::string updated; + std::string current; PrefixCompressedStringWriter out(updated); if (get_exact_entry(key, current)) { PrefixCompressedStringItor in(current); updated.reserve(current.size()); // FIXME plus some? while (!in.at_end() && d != changes.end()) { - const string & word = *in; + const std::string & word = *in; Assert(d != changes.end()); int cmp = word.compare(*d); if (cmp < 0) { @@ -92,12 +92,12 @@ } termlist_deltas.clear(); - map<string, Xapian::termcount>::const_iterator j; + std::map<string, Xapian::termcount>::const_iterator j; for (j = wordfreq_changes.begin(); j != wordfreq_changes.end(); ++j) { - string key = "W" + j->first; + std::string key = "W" + j->first; Xapian::termcount wordfreq = j->second; if (wordfreq) { - string tag; + std::string tag; pack_uint_last(tag, wordfreq); add(key, tag); if (wordfreq > wordfreq_upper_bound) @@ -110,7 +110,7 @@ } void -GlassSpellingTable::toggle_fragment(fragment frag, const string & word) +GlassSpellingTable::toggle_fragment(fragment frag, const std::string & word) { auto i = termlist_deltas.find(frag); if (i == termlist_deltas.end()) { @@ -126,11 +126,11 @@ } void -GlassSpellingTable::add_word(const string & word, Xapian::termcount freqinc) +GlassSpellingTable::add_word(const std::string & word, Xapian::termcount freqinc) { if (word.size() <= 1) return; - map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); + std::map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { // Word "word" already exists and has been modified. if (i->second) { @@ -141,8 +141,8 @@ // we need to execute the code below to re-add trigrams for it. i->second = freqinc; } else { - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (get_exact_entry(key, data)) { // Word "word" already exists, so increment its count. Xapian::termcount freq; @@ -161,11 +161,11 @@ } void -GlassSpellingTable::remove_word(const string & word, Xapian::termcount freqdec) +GlassSpellingTable::remove_word(const std::string & word, Xapian::termcount freqdec) { if (word.size() <= 1) return; - map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); + std::map<string, Xapian::termcount>::iterator i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { if (i->second == 0) { // Word has already been deleted. @@ -180,8 +180,8 @@ // Mark word as deleted. i->second = 0; } else { - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (!get_exact_entry(key, data)) { // This word doesn't exist. return; @@ -205,7 +205,7 @@ } void -GlassSpellingTable::toggle_word(const string & word) +GlassSpellingTable::toggle_word(const std::string & word) { fragment buf; // Head: @@ -255,7 +255,7 @@ }; TermList * -GlassSpellingTable::open_termlist(const string & word) +GlassSpellingTable::open_termlist(const std::string & word) { // This should have been handled by Database::get_spelling_suggestion(). AssertRel(word.size(),>,1); @@ -266,9 +266,9 @@ // Build a priority queue of TermList objects which returns those of // greatest approximate size first. - priority_queue<TermList*, vector<TermList*>, TermListGreaterApproxSize> pq; + priority_queue<TermList*, std::vector<TermList*>, TermListGreaterApproxSize> pq; try { - string data; + std::string data; fragment buf; // Head: @@ -371,17 +371,17 @@ } Xapian::doccount -GlassSpellingTable::get_word_frequency(const string & word) const +GlassSpellingTable::get_word_frequency(const std::string & word) const { - map<string, Xapian::termcount>::const_iterator i; + std::map<string, Xapian::termcount>::const_iterator i; i = wordfreq_changes.find(word); if (i != wordfreq_changes.end()) { // Modified frequency for word: return i->second; } - string key = "W" + word; - string data; + std::string key = "W" + word; + std::string data; if (get_exact_entry(key, data)) { // Word "word" already exists. Xapian::termcount freq; @@ -444,7 +444,7 @@ } TermList * -GlassSpellingTermList::skip_to(const string & term) +GlassSpellingTermList::skip_to(const std::string & term) { while (!data.empty() && current_term < term) { (void)GlassSpellingTermList::next(); diff -ur xapian-core-1.4.21/backends/glass/glass_spellingwordslist.cc xapian-core-1.4.21/backends/glass/glass_spellingwordslist.cc --- xapian-core-1.4.21/backends/glass/glass_spellingwordslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_spellingwordslist.cc 2022-11-08 16:44:15.376461870 +0100 @@ -81,7 +81,7 @@ } TermList * -GlassSpellingWordsList::skip_to(const string &tname) +GlassSpellingWordsList::skip_to(const std::string &tname) { LOGCALL(DB, TermList *, "GlassSpellingWordsList::skip_to", tname); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/glass/glass_synonym.cc xapian-core-1.4.21/backends/glass/glass_synonym.cc --- xapian-core-1.4.21/backends/glass/glass_synonym.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_synonym.cc 2022-11-08 16:44:15.352461955 +0100 @@ -47,11 +47,11 @@ if (last_synonyms.empty()) { del(last_term); } else { - string tag; + std::string tag; set<string>::const_iterator i; for (i = last_synonyms.begin(); i != last_synonyms.end(); ++i) { - const string & synonym = *i; + const std::string & synonym = *i; tag += uint8_t(synonym.size() ^ MAGIC_XOR_VALUE); tag += synonym; } @@ -63,13 +63,13 @@ } void -GlassSynonymTable::add_synonym(const string & term, const string & synonym) +GlassSynonymTable::add_synonym(const std::string & term, const std::string & synonym) { if (last_term != term) { merge_changes(); last_term = term; - string tag; + std::string tag; if (get_exact_entry(term, tag)) { const char * p = tag.data(); const char * end = p + tag.size(); @@ -89,13 +89,13 @@ } void -GlassSynonymTable::remove_synonym(const string & term, const string & synonym) +GlassSynonymTable::remove_synonym(const std::string & term, const std::string & synonym) { if (last_term != term) { merge_changes(); last_term = term; - string tag; + std::string tag; if (get_exact_entry(term, tag)) { const char * p = tag.data(); const char * end = p + tag.size(); @@ -115,7 +115,7 @@ } void -GlassSynonymTable::clear_synonyms(const string & term) +GlassSynonymTable::clear_synonyms(const std::string & term) { // We don't actually ever need to merge_changes() here, but it's quite // likely that someone might clear_synonyms() and then add_synonym() for @@ -131,9 +131,9 @@ } TermList * -GlassSynonymTable::open_termlist(const string & term) +GlassSynonymTable::open_termlist(const std::string & term) { - vector<string> synonyms; + std::vector<string> synonyms; if (last_term == term) { if (last_synonyms.empty()) return NULL; @@ -144,7 +144,7 @@ synonyms.push_back(*i); } } else { - string tag; + std::string tag; if (!get_exact_entry(term, tag)) return NULL; const char * p = tag.data(); @@ -203,7 +203,7 @@ } TermList * -GlassSynonymTermList::skip_to(const string &tname) +GlassSynonymTermList::skip_to(const std::string &tname) { LOGCALL(DB, TermList *, "GlassSynonymTermList::skip_to", tname); Assert(!at_end()); diff -ur xapian-core-1.4.21/backends/glass/glass_synonym.h xapian-core-1.4.21/backends/glass/glass_synonym.h --- xapian-core-1.4.21/backends/glass/glass_synonym.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_synonym.h 2022-11-08 16:44:00.924513246 +0100 @@ -133,12 +133,12 @@ GlassCursor * cursor; /// The prefix to restrict the terms to. - string prefix; + std::string prefix; public: GlassSynonymTermList(Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> database_, GlassCursor * cursor_, - const string & prefix_) + const std::string & prefix_) : database(database_), cursor(cursor_), prefix(prefix_) { // Position the cursor on the highest key before the first key we want, @@ -160,7 +160,7 @@ * Either next() or skip_to() must have been called before this * method can be called. */ - string get_termname() const; + std::string get_termname() const; /// Return the term frequency for the term at the current position. Xapian::doccount get_termfreq() const; @@ -169,7 +169,7 @@ TermList * next(); /// Advance to the first term which is >= tname. - TermList * skip_to(const string &tname); + TermList * skip_to(const std::string &tname); /// True if we're off the end of the list bool at_end() const; diff -ur xapian-core-1.4.21/backends/glass/glass_table.cc xapian-core-1.4.21/backends/glass/glass_table.cc --- xapian-core-1.4.21/backends/glass/glass_table.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_table.cc 2022-11-08 16:44:15.372461885 +0100 @@ -170,7 +170,7 @@ if (GET_LEVEL(p) != LEVEL_FREELIST) { int dir_end = DIR_END(p); if (rare(dir_end < DIR_START || unsigned(dir_end) > block_size)) { - string msg("dir_end invalid in block "); + std::string msg("dir_end invalid in block "); msg += str(n); throw Xapian::DatabaseCorruptError(msg); } @@ -256,7 +256,7 @@ return; // FIXME } - string buf; + std::string buf; buf += char(v); // Write the block number to the file pack_uint(buf, n); @@ -339,7 +339,7 @@ } if (rare(j != GET_LEVEL(p))) { - string msg = "Expected block "; + std::string msg = "Expected block "; msg += str(n); msg += " to be level "; msg += str(j); @@ -1244,7 +1244,7 @@ K set accordingly. c is set to 1. */ -void GlassTable::form_key(const string & key) const +void GlassTable::form_key(const std::string & key) const { LOGCALL_VOID(DB, "GlassTable::form_key", key); kt.form_key(key); @@ -1274,7 +1274,7 @@ */ void -GlassTable::add(const string &key, string tag, bool already_compressed) +GlassTable::add(const std::string &key, std::string tag, bool already_compressed) { LOGCALL_VOID(DB, "GlassTable::add", key | tag | already_compressed); Assert(writable); @@ -1389,7 +1389,7 @@ */ bool -GlassTable::del(const string &key) +GlassTable::del(const std::string &key) { LOGCALL(DB, bool, "GlassTable::del", key); Assert(writable); @@ -1425,7 +1425,7 @@ } bool -GlassTable::readahead_key(const string &key) const +GlassTable::readahead_key(const std::string &key) const { LOGCALL(DB, bool, "GlassTable::readahead_key", key); Assert(!key.empty()); @@ -1468,7 +1468,7 @@ } bool -GlassTable::get_exact_entry(const string &key, string & tag) const +GlassTable::get_exact_entry(const std::string &key, std::string & tag) const { LOGCALL(DB, bool, "GlassTable::get_exact_entry", key | tag); Assert(!key.empty()); @@ -1491,7 +1491,7 @@ } bool -GlassTable::key_exists(const string &key) const +GlassTable::key_exists(const std::string &key) const { LOGCALL(DB, bool, "GlassTable::key_exists", key); Assert(!key.empty()); @@ -1504,7 +1504,7 @@ } bool -GlassTable::read_tag(Glass::Cursor * C_, string *tag, bool keep_compressed) const +GlassTable::read_tag(Glass::Cursor * C_, std::string *tag, bool keep_compressed) const { LOGCALL(DB, bool, "GlassTable::read_tag", Literal("C_") | tag | keep_compressed); @@ -1581,7 +1581,7 @@ item_count = root_info->get_num_entries(); faked_root_block = root_info->get_root_is_fake(); sequential = root_info->get_sequential(); - const string & fl_serialised = root_info->get_free_list(); + const std::string & fl_serialised = root_info->get_free_list(); if (!fl_serialised.empty()) { if (!free_list.unpack(fl_serialised)) throw Xapian::DatabaseCorruptError("Bad freelist metadata"); @@ -1674,7 +1674,7 @@ revision_number = rev; return; } - string message((rev == 0) ? "Couldn't create " : "Couldn't open "); + std::string message((rev == 0) ? "Couldn't create " : "Couldn't open "); message += name; message += GLASS_TABLE_EXTENSION" read/write"; throw Xapian::DatabaseOpeningError(message, errno); @@ -1693,7 +1693,7 @@ seq_count = SEQ_START_POINT; } -GlassTable::GlassTable(const char * tablename_, const string & path_, +GlassTable::GlassTable(const char * tablename_, const std::string & path_, bool readonly_, bool lazy_) : tablename(tablename_), revision_number(0), @@ -1904,7 +1904,7 @@ free_list.commit(this, block_size); // Save the freelist details into the root_info. - string serialised; + std::string serialised; free_list.pack(serialised); root_info->set_free_list(serialised); @@ -1946,7 +1946,7 @@ item_count = root_info.get_num_entries(); faked_root_block = root_info.get_root_is_fake(); sequential = root_info.get_sequential(); - const string & fl_serialised = root_info.get_free_list(); + const std::string & fl_serialised = root_info.get_free_list(); if (!fl_serialised.empty()) { if (!free_list.unpack(fl_serialised)) throw Xapian::DatabaseCorruptError("Bad freelist metadata"); @@ -1992,7 +1992,7 @@ revision_number = rev; return; } - string message("Couldn't open "); + std::string message("Couldn't open "); message += name; message += GLASS_TABLE_EXTENSION" to read"; throw Xapian::DatabaseOpeningError(message, errno); diff -ur xapian-core-1.4.21/backends/glass/glass_table.h xapian-core-1.4.21/backends/glass/glass_table.h --- xapian-core-1.4.21/backends/glass/glass_table.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_table.h 2022-11-08 16:44:00.936513203 +0100 @@ -484,7 +484,7 @@ */ void close(bool permanent = false); - bool readahead_key(const string &key) const; + bool readahead_key(const std::string &key) const; /** Determine whether the btree exists on disk. */ @@ -730,7 +730,7 @@ /// Throw an exception indicating that the database is closed. XAPIAN_NORETURN(static void throw_database_closed()); - string get_path() const { + std::string get_path() const { return name + GLASS_TABLE_EXTENSION; } @@ -926,8 +926,8 @@ when they are preordered by their keys. This is therefore the piece of code that needs to be followed to arrange for the preordering. - Note that keys have two parts - a string value and a "component_of" count. - If the string values are equal, the comparison is made based on + Note that keys have two parts - a std::string value and a "component_of" count. + If the std::string values are equal, the comparison is made based on "component_of". */ diff -ur xapian-core-1.4.21/backends/glass/glass_termlist.cc xapian-core-1.4.21/backends/glass/glass_termlist.cc --- xapian-core-1.4.21/backends/glass/glass_termlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_termlist.cc 2022-11-08 16:44:15.368461899 +0100 @@ -187,7 +187,7 @@ } TermList * -GlassTermList::skip_to(const string & term) +GlassTermList::skip_to(const std::string & term) { LOGCALL(API, TermList *, "GlassTermList::skip_to", term); while (pos != NULL && current_term < term) { diff -ur xapian-core-1.4.21/backends/glass/glass_termlisttable.cc xapian-core-1.4.21/backends/glass/glass_termlisttable.cc --- xapian-core-1.4.21/backends/glass/glass_termlisttable.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_termlisttable.cc 2022-11-08 16:44:15.368461899 +0100 @@ -51,13 +51,13 @@ return; } - string tag; + std::string tag; pack_uint(tag, doclen); Xapian::TermIterator t = doc.termlist_begin(); if (t != doc.termlist_end()) { pack_uint(tag, termlist_size); - string prev_term = *t; + std::string prev_term = *t; tag += char(prev_term.size()); tag += prev_term; @@ -65,7 +65,7 @@ --termlist_size; while (++t != doc.termlist_end()) { - const string & term = *t; + const std::string & term = *t; // If there's a shared prefix with the previous term, we don't // store it explicitly, but just store the length of the shared // prefix. In general, this is a big win. diff -ur xapian-core-1.4.21/backends/glass/glass_valuelist.cc xapian-core-1.4.21/backends/glass/glass_valuelist.cc --- xapian-core-1.4.21/backends/glass/glass_valuelist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_valuelist.cc 2022-11-08 16:44:15.376461870 +0100 @@ -37,7 +37,7 @@ if (!first_did) return false; cursor->read_tag(); - const string & tag = cursor->current_tag; + const std::string & tag = cursor->current_tag; reader.assign(tag.data(), tag.size(), first_did); return true; } @@ -165,7 +165,7 @@ string GlassValueList::get_description() const { - string desc("GlassValueList(slot="); + std::string desc("GlassValueList(slot="); desc += str(slot); desc += ')'; return desc; diff -ur xapian-core-1.4.21/backends/glass/glass_values.cc xapian-core-1.4.21/backends/glass/glass_values.cc --- xapian-core-1.4.21/backends/glass/glass_values.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_values.cc 2022-11-08 16:44:15.360461927 +0100 @@ -52,7 +52,7 @@ // Add an extra character so that it can't clash with a termlist entry key // and will sort just after the corresponding termlist entry key. // FIXME: should we store this in the *same entry* as the list of terms? - string key; + std::string key; pack_uint_preserving_sort(key, did); key += '\0'; RETURN(key); @@ -63,7 +63,7 @@ make_valuestats_key(Xapian::valueno slot) { LOGCALL_STATIC(DB, string, "make_valuestats_key", slot); - string key("\0\xd0", 2); + std::string key("\0\xd0", 2); pack_uint_last(key, slot); RETURN(key); } @@ -131,11 +131,11 @@ void GlassValueManager::add_value(Xapian::docid did, Xapian::valueno slot, - const string & val) + const std::string & val) { auto i = changes.find(slot); if (i == changes.end()) { - i = changes.insert(make_pair(slot, map<Xapian::docid, string>())).first; + i = changes.insert(make_pair(slot, std::map<Xapian::docid, string>())).first; } i->second[did] = val; } @@ -145,7 +145,7 @@ { auto i = changes.find(slot); if (i == changes.end()) { - i = changes.insert(make_pair(slot, map<Xapian::docid, string>())).first; + i = changes.insert(make_pair(slot, std::map<Xapian::docid, string>())).first; } i->second[did] = string(); } @@ -153,7 +153,7 @@ Xapian::docid GlassValueManager::get_chunk_containing_did(Xapian::valueno slot, Xapian::docid did, - string &chunk) const + std::string &chunk) const { LOGCALL(DB, Xapian::docid, "GlassValueManager::get_chunk_containing_did", slot | did | chunk); if (!cursor.get()) @@ -198,11 +198,11 @@ Xapian::valueno slot; - string ctag; + std::string ctag; ValueChunkReader reader; - string tag; + std::string tag; Xapian::docid prev_did; @@ -212,7 +212,7 @@ Xapian::docid last_allowed_did; - void append_to_stream(Xapian::docid did, const string & value) { + void append_to_stream(Xapian::docid did, const std::string & value) { Assert(did); if (tag.empty()) { new_first_did = did; @@ -250,13 +250,13 @@ write_tag(); } - void update(Xapian::docid did, const string & value) { + void update(Xapian::docid did, const std::string & value) { if (last_allowed_did && did > last_allowed_did) { // The next change needs to go in a later existing chunk than the // one we're currently updating, so we copy over the rest of the // entries from the current chunk, write out the updated chunk and // drop through to the case below will read in that later chunk. - // FIXME: use some string splicing magic instead of this loop. + // FIXME: use some std::string splicing magic instead of this loop. while (!reader.at_end()) { // last_allowed_did should be an upper bound for this chunk. AssertRel(reader.get_docid(),<=,last_allowed_did); @@ -295,7 +295,7 @@ reader.assign(ctag.data(), ctag.size(), first_did); } if (cursor->next()) { - const string & key = cursor->current_key; + const std::string & key = cursor->current_key; Xapian::docid next_first_did = docid_from_key(slot, key); if (next_first_did) last_allowed_did = next_first_did - 1; Assert(last_allowed_did); @@ -325,7 +325,7 @@ { if (termlist_table->is_open()) { for (auto i : slots) { - string key = make_slot_key(i.first); + std::string key = make_slot_key(i.first); const string& enc = i.second; if (!enc.empty()) { termlist_table->add(key, enc); @@ -339,7 +339,7 @@ for (auto i : changes) { Xapian::valueno slot = i.first; Glass::ValueUpdater updater(postlist_table, slot); - const map<Xapian::docid, string>& slot_changes = i.second; + const std::map<Xapian::docid, string>& slot_changes = i.second; for (auto j : slot_changes) { updater.update(j.first, j.second); } @@ -349,16 +349,16 @@ void GlassValueManager::add_document(Xapian::docid did, const Xapian::Document &doc, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { // FIXME: Use BitWriter and interpolative coding? Or is it not worthwhile // for this? - string slots_used; + std::string slots_used; Xapian::valueno prev_slot = static_cast<Xapian::valueno>(-1); Xapian::ValueIterator it = doc.values_begin(); while (it != doc.values_end()) { Xapian::valueno slot = it.get_valueno(); - string value = *it; + std::string value = *it; Assert(!value.empty()); // Update the statistics. @@ -401,11 +401,11 @@ void GlassValueManager::delete_document(Xapian::docid did, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { Assert(termlist_table->is_open()); - map<Xapian::docid, string>::iterator it = slots.find(did); - string s; + std::map<Xapian::docid, string>::iterator it = slots.find(did); + std::string s; if (it != slots.end()) { swap(s, it->second); } else { @@ -446,7 +446,7 @@ void GlassValueManager::replace_document(Xapian::docid did, const Xapian::Document &doc, - map<Xapian::valueno, ValueStats> & value_stats) + std::map<Xapian::valueno, ValueStats> & value_stats) { if (doc.get_docid() == did) { // If we're replacing a document with itself, but the optimisation for @@ -478,7 +478,7 @@ } // Read it from the table. - string chunk; + std::string chunk; Xapian::docid first_did; first_did = get_chunk_containing_did(slot, did, chunk); if (first_did == 0) return string(); @@ -490,7 +490,7 @@ } void -GlassValueManager::get_all_values(map<Xapian::valueno, string> & values, +GlassValueManager::get_all_values(std::map<Xapian::valueno, string> & values, Xapian::docid did) const { Assert(values.empty()); @@ -502,8 +502,8 @@ GlassTable::throw_database_closed(); throw Xapian::FeatureUnavailableError("Database has no termlist"); } - map<Xapian::docid, string>::const_iterator i = slots.find(did); - string s; + std::map<Xapian::docid, string>::const_iterator i = slots.find(did); + std::string s; if (i != slots.end()) { s = i->second; } else { @@ -539,7 +539,7 @@ { LOGCALL_VOID(DB, "GlassValueManager::get_value_stats", slot | Literal("[stats]")); - string tag; + std::string tag; if (postlist_table->get_exact_entry(make_valuestats_key(slot), tag)) { const char * pos = tag.data(); const char * end = pos + tag.size(); @@ -571,15 +571,15 @@ } void -GlassValueManager::set_value_stats(map<Xapian::valueno, ValueStats> & value_stats) +GlassValueManager::set_value_stats(std::map<Xapian::valueno, ValueStats> & value_stats) { LOGCALL_VOID(DB, "GlassValueManager::set_value_stats", value_stats); - map<Xapian::valueno, ValueStats>::const_iterator i; + std::map<Xapian::valueno, ValueStats>::const_iterator i; for (i = value_stats.begin(); i != value_stats.end(); ++i) { - string key = make_valuestats_key(i->first); + std::string key = make_valuestats_key(i->first); const ValueStats & stats = i->second; if (stats.freq != 0) { - string new_value; + std::string new_value; pack_uint(new_value, stats.freq); pack_string(new_value, stats.lower_bound); // We don't store or count empty values, so neither of the bounds diff -ur xapian-core-1.4.21/backends/glass/glass_version.cc xapian-core-1.4.21/backends/glass/glass_version.cc --- xapian-core-1.4.21/backends/glass/glass_version.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_version.cc 2022-11-08 16:44:15.356461942 +0100 @@ -78,7 +78,7 @@ { offset = lseek(fd, 0, SEEK_CUR); if (rare(offset < 0)) { - string msg = "lseek failed on file descriptor "; + std::string msg = "lseek failed on file descriptor "; msg += str(fd); throw Xapian::DatabaseOpeningError(msg, errno); } @@ -100,17 +100,17 @@ int fd_in; if (single_file()) { if (rare(lseek(fd, offset, SEEK_SET) < 0)) { - string msg = "Failed to rewind file descriptor "; + std::string msg = "Failed to rewind file descriptor "; msg += str(fd); throw Xapian::DatabaseOpeningError(msg, errno); } fd_in = fd; } else { - string filename = db_dir; + std::string filename = db_dir; filename += "/iamglass"; fd_in = posixy_open(filename.c_str(), O_RDONLY|O_BINARY); if (rare(fd_in < 0)) { - string msg = filename; + std::string msg = filename; msg += ": Failed to open glass revision file for reading"; if (errno == ENOENT || errno == ENOTDIR) { throw Xapian::DatabaseNotFoundError(msg, errno); @@ -133,7 +133,7 @@ version <<= 8; version |= static_cast<unsigned char>(buf[GLASS_VERSION_MAGIC_LEN + 1]); if (version != GLASS_FORMAT_VERSION) { - string msg; + std::string msg; if (!single_file()) { msg = db_dir; msg += ": "; @@ -272,7 +272,7 @@ { LOGCALL(DB, const string, "GlassVersion::write", new_rev|flags); - string s(GLASS_VERSION_MAGIC, GLASS_VERSION_MAGIC_AND_VERSION_LEN); + std::string s(GLASS_VERSION_MAGIC, GLASS_VERSION_MAGIC_AND_VERSION_LEN); s.append(uuid.data(), uuid.BINARY_SIZE); pack_uint(s, new_rev); @@ -285,7 +285,7 @@ serialise_stats(); s += serialised_stats; - string tmpfile; + std::string tmpfile; if (!single_file()) { tmpfile = db_dir; // In dangerous mode, just write the new version file in place. @@ -312,7 +312,7 @@ } if (changes) { - string changes_buf; + std::string changes_buf; changes_buf += '\xfe'; pack_uint(changes_buf, new_rev); pack_uint(changes_buf, s.size()); @@ -324,7 +324,7 @@ } bool -GlassVersion::sync(const string & tmpfile, +GlassVersion::sync(const std::string & tmpfile, glass_revision_number_t new_rev, int flags) { Assert(new_rev > rev || rev == 0); diff -ur xapian-core-1.4.21/backends/glass/glass_version.h xapian-core-1.4.21/backends/glass/glass_version.h --- xapian-core-1.4.21/backends/glass/glass_version.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/glass/glass_version.h 2022-11-08 16:44:00.924513246 +0100 @@ -86,7 +86,7 @@ /** The GlassVersion class manages the revision files. * - * The "iamglass" file (currently) contains a "magic" string identifying + * The "iamglass" file (currently) contains a "magic" std::string identifying * that this is a glass database, a database format version number, the UUID * of the database, the revision of the database, and the root block info for * each table. @@ -199,7 +199,7 @@ return uuid.data(); } - /// Return UUID in the standard 36 character string format. + /// Return UUID in the standard 36 character std::string format. std::string get_uuid_string() const { return uuid.to_string(); } diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.cc xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.cc --- xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.cc 2022-11-08 16:44:15.332462027 +0100 @@ -45,10 +45,10 @@ } TermList * -InMemoryAllTermsList::skip_to(const string &tname_) +InMemoryAllTermsList::skip_to(const std::string &tname_) { if (database->is_closed()) InMemoryDatabase::throw_database_closed(); - string tname(tname_); + std::string tname(tname_); Assert(it != tmap->end()); if (!it->first.empty()) { // Don't skip backwards. diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.h xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.h --- xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_alltermslist.h 2022-11-08 16:44:00.908513303 +0100 @@ -42,7 +42,7 @@ Xapian::Internal::intrusive_ptr<const InMemoryDatabase> database; - string prefix; + std::string prefix; public: /// Constructor. @@ -55,12 +55,12 @@ } // Gets current termname - string get_termname() const; + std::string get_termname() const; // Get num of docs indexed by term Xapian::doccount get_termfreq() const; - TermList * skip_to(const string &tname); + TermList * skip_to(const std::string &tname); /** next() causes the AllTermsList to move to the next term in the list. */ diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_database.cc xapian-core-1.4.21/backends/inmemory/inmemory_database.cc --- xapian-core-1.4.21/backends/inmemory/inmemory_database.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_database.cc 2022-11-08 16:44:15.332462027 +0100 @@ -49,7 +49,7 @@ InMemoryTerm::add_posting(const InMemoryPosting & post) { // Add document to right place in list - vector<InMemoryPosting>::iterator p; + std::vector<InMemoryPosting>::iterator p; p = lower_bound(docs.begin(), docs.end(), post, InMemoryPostingLessThan()); if (p == docs.end() || InMemoryPostingLessThan()(post, *p)) { @@ -65,7 +65,7 @@ InMemoryDoc::add_posting(const InMemoryTermEntry & post) { // Add document to right place in list - vector<InMemoryTermEntry>::iterator p; + std::vector<InMemoryTermEntry>::iterator p; p = lower_bound(terms.begin(), terms.end(), post, InMemoryTermEntryLessThan()); if (p == terms.end() || InMemoryTermEntryLessThan()(post, *p)) { @@ -93,7 +93,7 @@ while (pos != end && !pos->valid) ++pos; if (pos != end) { auto first_wdf = (*pos).wdf; - wdf_upper_bound = max(first_wdf, imterm.collection_freq - first_wdf); + wdf_upper_bound = std::max(first_wdf, imterm.collection_freq - first_wdf); } } @@ -279,7 +279,7 @@ } TermList * -InMemoryTermList::skip_to(const string & term) +InMemoryTermList::skip_to(const std::string & term) { if (rare(db->is_closed())) InMemoryDatabase::throw_database_closed(); @@ -457,13 +457,13 @@ } LeafPostList * -InMemoryDatabase::open_post_list(const string & tname) const +InMemoryDatabase::open_post_list(const std::string & tname) const { if (closed) InMemoryDatabase::throw_database_closed(); if (tname.empty()) { return new InMemoryAllDocsPostList(this); } - map<string, InMemoryTerm>::const_iterator i = postlists.find(tname); + std::map<string, InMemoryTerm>::const_iterator i = postlists.find(tname); if (i == postlists.end() || i->second.term_freq == 0) { i = postlists.begin(); // Check that our dummy entry for string() is present. @@ -480,12 +480,12 @@ } void -InMemoryDatabase::get_freqs(const string & term, +InMemoryDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { if (closed) InMemoryDatabase::throw_database_closed(); - map<string, InMemoryTerm>::const_iterator i = postlists.find(term); + std::map<string, InMemoryTerm>::const_iterator i = postlists.find(term); if (i != postlists.end()) { if (termfreq_ptr) *termfreq_ptr = i->second.term_freq; @@ -503,7 +503,7 @@ InMemoryDatabase::get_value_freq(Xapian::valueno slot) const { if (closed) InMemoryDatabase::throw_database_closed(); - map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); + std::map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); if (i == valuestats.end()) return 0; return i->second.freq; } @@ -512,7 +512,7 @@ InMemoryDatabase::get_value_lower_bound(Xapian::valueno slot) const { if (closed) InMemoryDatabase::throw_database_closed(); - map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); + std::map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); if (i == valuestats.end()) return string(); return i->second.lower_bound; } @@ -521,7 +521,7 @@ InMemoryDatabase::get_value_upper_bound(Xapian::valueno slot) const { if (closed) InMemoryDatabase::throw_database_closed(); - map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); + std::map<Xapian::valueno, ValueStats>::const_iterator i = valuestats.find(slot); if (i == valuestats.end()) return string(); return i->second.upper_bound; } @@ -602,14 +602,14 @@ InMemoryDatabase::get_metadata(const std::string & key) const { if (closed) InMemoryDatabase::throw_database_closed(); - map<string, string>::const_iterator i = metadata.find(key); + std::map<string, string>::const_iterator i = metadata.find(key); if (i == metadata.end()) return string(); return i->second; } TermList * -InMemoryDatabase::open_metadata_keylist(const string &) const +InMemoryDatabase::open_metadata_keylist(const std::string &) const { if (closed) InMemoryDatabase::throw_database_closed(); if (metadata.empty()) return NULL; @@ -631,7 +631,7 @@ Xapian::termcount InMemoryDatabase::positionlist_count(Xapian::docid did, - const string & tname) const + const std::string & tname) const { if (closed) InMemoryDatabase::throw_database_closed(); if (!doc_exists(did)) { @@ -651,7 +651,7 @@ PositionList * InMemoryDatabase::open_position_list(Xapian::docid did, - const string & tname) const + const std::string & tname) const { if (closed) InMemoryDatabase::throw_database_closed(); if (usual(doc_exists(did))) { @@ -670,7 +670,7 @@ void InMemoryDatabase::add_values(Xapian::docid did, - const map<Xapian::valueno, string> &values_) + const std::map<Xapian::valueno, string> &values_) { if (closed) InMemoryDatabase::throw_database_closed(); if (did > valuelists.size()) { @@ -679,10 +679,10 @@ valuelists[did - 1] = values_; // Update the statistics. - map<Xapian::valueno, string>::const_iterator j; + std::map<Xapian::valueno, string>::const_iterator j; for (j = values_.begin(); j != values_.end(); ++j) { - std::pair<map<Xapian::valueno, ValueStats>::iterator, bool> i; - i = valuestats.insert(make_pair(j->first, ValueStats())); + std::pair<std::map<Xapian::valueno, ValueStats>::iterator, bool> i; + i = valuestats.insert(std::make_pair(j->first, ValueStats())); // Now, modify the stored statistics. if ((i.first->second.freq)++ == 0) { @@ -724,9 +724,9 @@ } termlists[did - 1].is_valid = false; doclists[did - 1] = string(); - map<Xapian::valueno, string>::const_iterator j; + std::map<Xapian::valueno, string>::const_iterator j; for (j = valuelists[did - 1].begin(); j != valuelists[did - 1].end(); ++j) { - map<Xapian::valueno, ValueStats>::iterator i; + std::map<Xapian::valueno, ValueStats>::iterator i; i = valuestats.find(j->first); if (--(i->second.freq) == 0) { i->second.lower_bound.resize(0); @@ -742,11 +742,11 @@ // InMemory structure without being very inefficient. if (totdocs == 0) positions_present = false; - vector<InMemoryTermEntry>::const_iterator i; + std::vector<InMemoryTermEntry>::const_iterator i; for (i = termlists[did - 1].terms.begin(); i != termlists[did - 1].terms.end(); ++i) { - map<string, InMemoryTerm>::iterator t = postlists.find(i->tname); + std::map<string, InMemoryTerm>::iterator t = postlists.find(i->tname); Assert(t != postlists.end()); t->second.collection_freq -= i->wdf; --t->second.term_freq; @@ -774,9 +774,9 @@ if (closed) InMemoryDatabase::throw_database_closed(); if (doc_exists(did)) { - map<Xapian::valueno, string>::const_iterator j; + std::map<Xapian::valueno, string>::const_iterator j; for (j = valuelists[did - 1].begin(); j != valuelists[did - 1].end(); ++j) { - map<Xapian::valueno, ValueStats>::iterator i; + std::map<Xapian::valueno, ValueStats>::iterator i; i = valuestats.find(j->first); if (--(i->second.freq) == 0) { i->second.lower_bound.resize(0); @@ -796,11 +796,11 @@ termlists[did - 1].is_valid = true; } - vector<InMemoryTermEntry>::const_iterator i; + std::vector<InMemoryTermEntry>::const_iterator i; for (i = termlists[did - 1].terms.begin(); i != termlists[did - 1].terms.end(); ++i) { - map<string, InMemoryTerm>::iterator t = postlists.find(i->tname); + std::map<string, InMemoryTerm>::iterator t = postlists.find(i->tname); Assert(t != postlists.end()); t->second.collection_freq -= i->wdf; --t->second.term_freq; @@ -840,7 +840,7 @@ InMemoryDatabase::finish_add_doc(Xapian::docid did, const Xapian::Document &document) { { - map<Xapian::valueno, string> values; + std::map<Xapian::valueno, string> values; Xapian::ValueIterator k = document.values_begin(); for ( ; k != document.values_end(); ++k) { values.insert(make_pair(k.get_valueno(), *k)); @@ -873,19 +873,19 @@ postlists[*i].collection_freq += i.get_wdf(); ++postlists[*i].term_freq; } - swap(termlists[did - 1], doc); + std::swap(termlists[did - 1], doc); totdocs++; } void -InMemoryDatabase::make_term(const string & tname) +InMemoryDatabase::make_term(const std::string & tname) { postlists[tname]; // Initialise, if not already there. } Xapian::docid -InMemoryDatabase::make_doc(const string & docdata) +InMemoryDatabase::make_doc(const std::string & docdata) { termlists.push_back(InMemoryDoc(true)); doclengths.push_back(0); @@ -897,7 +897,7 @@ } void InMemoryDatabase::make_posting(InMemoryDoc * doc, - const string & tname, + const std::string & tname, Xapian::docid did, Xapian::termpos position, Xapian::termcount wdf, @@ -934,11 +934,11 @@ } bool -InMemoryDatabase::term_exists(const string & tname) const +InMemoryDatabase::term_exists(const std::string & tname) const { if (closed) InMemoryDatabase::throw_database_closed(); Assert(!tname.empty()); - map<string, InMemoryTerm>::const_iterator i = postlists.find(tname); + std::map<string, InMemoryTerm>::const_iterator i = postlists.find(tname); if (i == postlists.end()) return false; return (i->second.term_freq != 0); } @@ -951,7 +951,7 @@ } TermList * -InMemoryDatabase::open_allterms(const string & prefix) const +InMemoryDatabase::open_allterms(const std::string & prefix) const { if (closed) InMemoryDatabase::throw_database_closed(); return new InMemoryAllTermsList(&postlists, diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_database.h xapian-core-1.4.21/backends/inmemory/inmemory_database.h --- xapian-core-1.4.21/backends/inmemory/inmemory_database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_database.h 2022-11-08 16:44:00.904513317 +0100 @@ -39,7 +39,7 @@ #include "omassert.h" #include "noreturn.h" -using namespace std; +using std::string; // Class representing a posting (a term/doc pair, and // all the relevant positional information, is a single posting) @@ -47,7 +47,7 @@ public: Xapian::docid did; bool valid; - vector<Xapian::termpos> positions; // Sorted vector of positions + std::vector<Xapian::termpos> positions; // Sorted vector of positions Xapian::termcount wdf; // Merge two postings (same term/doc pair, new positional info) @@ -57,15 +57,15 @@ positions.insert(positions.end(), post.positions.begin(), post.positions.end()); - // FIXME - inefficient - use merge (and list<>)? + // FIXME - inefficient - use merge (and std::list<>)? sort(positions.begin(), positions.end()); } }; class InMemoryTermEntry { public: - string tname; - vector<Xapian::termpos> positions; // Sorted vector of positions + std::string tname; + std::vector<Xapian::termpos> positions; // Sorted vector of positions Xapian::termcount wdf; // Merge two postings (same term/doc pair, new positional info) @@ -75,7 +75,7 @@ positions.insert(positions.end(), post.positions.begin(), post.positions.end()); - // FIXME - inefficient - use merge (and list<>)? + // FIXME - inefficient - use merge (and std::list<>)? sort(positions.begin(), positions.end()); } }; @@ -104,7 +104,7 @@ class InMemoryTerm { public: // Sorted list of documents indexing this term. - vector<InMemoryPosting> docs; + std::vector<InMemoryPosting> docs; Xapian::termcount term_freq; Xapian::termcount collection_freq; @@ -119,7 +119,7 @@ public: bool is_valid; // Sorted list of terms indexing this document. - vector<InMemoryTermEntry> terms; + std::vector<InMemoryTermEntry> terms; /* Initialise invalid by default, so that resizing the termlist array * doesn't create valid documents. */ @@ -139,8 +139,8 @@ friend class InMemoryDatabase; private: - vector<InMemoryPosting>::const_iterator pos; - vector<InMemoryPosting>::const_iterator end; + std::vector<InMemoryPosting>::const_iterator pos; + std::vector<InMemoryPosting>::const_iterator end; Xapian::doccount termfreq; bool started; @@ -175,7 +175,7 @@ Xapian::termcount get_wdf_upper_bound() const; - string get_description() const; + std::string get_description() const; }; /** A PostList over all docs in an inmemory database. @@ -211,7 +211,7 @@ Xapian::termcount get_wdf_upper_bound() const; - string get_description() const; + std::string get_description() const; }; // Term List @@ -219,8 +219,8 @@ friend class InMemoryDatabase; private: - vector<InMemoryTermEntry>::const_iterator pos; - vector<InMemoryTermEntry>::const_iterator end; + std::vector<InMemoryTermEntry>::const_iterator pos; + std::vector<InMemoryTermEntry>::const_iterator end; Xapian::termcount terms; bool started; @@ -239,7 +239,7 @@ /// Collate weighting information for the current term. void accumulate_stats(Xapian::Internal::ExpandStats & stats) const; - string get_termname() const; + std::string get_termname() const; // Number of occurrences of term in current doc Xapian::termcount get_wdf() const; Xapian::doccount get_termfreq() const; // Number of docs indexed by term @@ -260,13 +260,13 @@ friend class InMemoryAllDocsPostList; friend class InMemoryDocument; - map<string, InMemoryTerm> postlists; - vector<InMemoryDoc> termlists; - vector<std::string> doclists; - vector<std::map<Xapian::valueno, string>> valuelists; + std::map<string, InMemoryTerm> postlists; + std::vector<InMemoryDoc> termlists; + std::vector<std::string> doclists; + std::vector<std::map<Xapian::valueno, string>> valuelists; std::map<Xapian::valueno, ValueStats> valuestats; - vector<Xapian::termcount> doclengths; + std::vector<Xapian::termcount> doclengths; std::map<string, string> metadata; @@ -283,18 +283,18 @@ InMemoryDatabase& operator=(const InMemoryDatabase &); InMemoryDatabase(const InMemoryDatabase &); - void make_term(const string & tname); + void make_term(const std::string & tname); bool doc_exists(Xapian::docid did) const; - Xapian::docid make_doc(const string & docdata); + Xapian::docid make_doc(const std::string & docdata); /* The common parts of add_doc and replace_doc */ void finish_add_doc(Xapian::docid did, const Xapian::Document& document); void add_values(Xapian::docid did, - const map<Xapian::valueno, string>& values_); + const std::map<Xapian::valueno, string>& values_); void make_posting(InMemoryDoc * doc, - const string & tname, + const std::string & tname, Xapian::docid did, Xapian::termpos position, Xapian::termcount wdf, @@ -339,16 +339,16 @@ Xapian::termcount get_doclength(Xapian::docid did) const; Xapian::termcount get_unique_terms(Xapian::docid did) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; Xapian::doccount get_value_freq(Xapian::valueno slot) const; std::string get_value_lower_bound(Xapian::valueno slot) const; std::string get_value_upper_bound(Xapian::valueno slot) const; - bool term_exists(const string & tname) const; + bool term_exists(const std::string & tname) const; bool has_positions() const; - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; TermList * open_term_list(Xapian::docid did) const; Xapian::Document::Internal* open_document(Xapian::docid did, bool lazy) const; @@ -358,10 +358,10 @@ void set_metadata(const std::string & key, const std::string & value); Xapian::termcount positionlist_count(Xapian::docid did, - const string & tname) const; + const std::string & tname) const; PositionList * open_position_list(Xapian::docid did, - const string & tname) const; - TermList * open_allterms(const string & prefix) const; + const std::string & tname) const; + TermList * open_allterms(const std::string & prefix) const; XAPIAN_NORETURN(static void throw_database_closed()); diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_document.cc xapian-core-1.4.21/backends/inmemory/inmemory_document.cc --- xapian-core-1.4.21/backends/inmemory/inmemory_document.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_document.cc 2022-11-08 16:44:15.332462027 +0100 @@ -34,8 +34,8 @@ db = static_cast<const InMemoryDatabase*>(database.get()); if (rare(did > db->valuelists.size())) RETURN(string()); - map<Xapian::valueno, string> values_ = db->valuelists[did - 1]; - map<Xapian::valueno, string>::const_iterator i; + std::map<Xapian::valueno, string> values_ = db->valuelists[did - 1]; + std::map<Xapian::valueno, string>::const_iterator i; i = values_.find(slot); if (i == values_.end()) RETURN(string()); @@ -43,7 +43,7 @@ } void -InMemoryDocument::do_get_all_values(map<Xapian::valueno, string> &values_) const +InMemoryDocument::do_get_all_values(std::map<Xapian::valueno, string> &values_) const { LOGCALL_VOID(DB, "InMemoryDocument::do_get_all_values", values_); const InMemoryDatabase * db; diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_document.h xapian-core-1.4.21/backends/inmemory/inmemory_document.h --- xapian-core-1.4.21/backends/inmemory/inmemory_document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_document.h 2022-11-08 16:44:00.904513317 +0100 @@ -41,9 +41,9 @@ public: /** Implementation of virtual methods @{ */ - string do_get_value(Xapian::valueno slot) const; - void do_get_all_values(map<Xapian::valueno, string> & values_) const; - string do_get_data() const; + std::string do_get_value(Xapian::valueno slot) const; + void do_get_all_values(std::map<Xapian::valueno, string> & values_) const; + std::string do_get_data() const; /** @} */ }; diff -ur xapian-core-1.4.21/backends/inmemory/inmemory_positionlist.h xapian-core-1.4.21/backends/inmemory/inmemory_positionlist.h --- xapian-core-1.4.21/backends/inmemory/inmemory_positionlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/inmemory/inmemory_positionlist.h 2022-11-08 16:44:00.904513317 +0100 @@ -30,17 +30,17 @@ #include "backends/positionlist.h" #include "api/documentterm.h" -using namespace std; +using std::string; /** A position list in a inmemory database. */ class InMemoryPositionList : public PositionList { private: /// The list of positions. - vector<Xapian::termpos> positions; + std::vector<Xapian::termpos> positions; /// Position of iteration through positions - vector<Xapian::termpos>::const_iterator mypos; + std::vector<Xapian::termpos>::const_iterator mypos; /// True if we have started iterating bool iterating_in_progress; diff -ur xapian-core-1.4.21/backends/multi/multi_alltermslist.cc xapian-core-1.4.21/backends/multi/multi_alltermslist.cc --- xapian-core-1.4.21/backends/multi/multi_alltermslist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/multi/multi_alltermslist.cc 2022-11-08 16:44:15.336462012 +0100 @@ -43,8 +43,8 @@ void operator()(CLASS *p) const { delete p; } }; -MultiAllTermsList::MultiAllTermsList(const vector<intrusive_ptr<Xapian::Database::Internal> > & dbs, - const string & prefix) +MultiAllTermsList::MultiAllTermsList(const std::vector<intrusive_ptr<Xapian::Database::Internal> > & dbs, + const std::string & prefix) { // The 0 and 1 cases should be handled by our caller. AssertRel(dbs.size(), >=, 2); @@ -75,7 +75,7 @@ MultiAllTermsList::get_termfreq() const { if (termlists.empty()) return 0; - vector<TermList *>::const_iterator i = termlists.begin(); + std::vector<TermList *>::const_iterator i = termlists.begin(); Xapian::doccount total_tf = (*i)->get_termfreq(); while (++i != termlists.end()) { if ((*i)->get_termname() == current_term) @@ -138,7 +138,7 @@ // Assume the skip is likely to be a long distance, and rebuild the heap // from scratch. FIXME: It would be useful to profile this against an // approach more like that next() uses if this ever gets heavy use. - vector<TermList*>::iterator i = termlists.begin(); + std::vector<TermList*>::iterator i = termlists.begin(); while (i != termlists.end()) { (*i)->skip_to(term); if ((*i)->at_end()) { diff -ur xapian-core-1.4.21/backends/multi/multi_termlist.cc xapian-core-1.4.21/backends/multi/multi_termlist.cc --- xapian-core-1.4.21/backends/multi/multi_termlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/multi/multi_termlist.cc 2022-11-08 16:44:15.340461999 +0100 @@ -73,7 +73,7 @@ return tl->next(); } -TermList * MultiTermList::skip_to(const string & term) +TermList * MultiTermList::skip_to(const std::string & term) { return tl->skip_to(term); } diff -ur xapian-core-1.4.21/backends/multi/multi_termlist.h xapian-core-1.4.21/backends/multi/multi_termlist.h --- xapian-core-1.4.21/backends/multi/multi_termlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/multi/multi_termlist.h 2022-11-08 16:44:00.912513288 +0100 @@ -42,7 +42,7 @@ /// Collate weighting information for the current term. void accumulate_stats(Xapian::Internal::ExpandStats & stats) const; - string get_termname() const; + std::string get_termname() const; Xapian::termcount get_wdf() const; // Number of occurrences of term in current doc Xapian::doccount get_termfreq() const; // Number of docs indexed by term TermList * next(); diff -ur xapian-core-1.4.21/backends/multi/multi_valuelist.cc xapian-core-1.4.21/backends/multi/multi_valuelist.cc --- xapian-core-1.4.21/backends/multi/multi_valuelist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/multi/multi_valuelist.cc 2022-11-08 16:44:15.336462012 +0100 @@ -81,7 +81,7 @@ void operator()(CLASS *p) const { delete p; } }; -MultiValueList::MultiValueList(const vector<intrusive_ptr<Xapian::Database::Internal> > & dbs, +MultiValueList::MultiValueList(const std::vector<intrusive_ptr<Xapian::Database::Internal> > & dbs, Xapian::valueno slot_) : current_docid(0), slot(slot_), multiplier(dbs.size()) { @@ -180,7 +180,7 @@ // Assume the skip is likely to be a long distance, and rebuild the heap // from scratch. FIXME: It would be useful to profile this against an // approach more like that next() uses if this ever gets heavy use. - vector<SubValueList*>::iterator i = valuelists.begin(); + std::vector<SubValueList*>::iterator i = valuelists.begin(); while (i != valuelists.end()) { (*i)->skip_to(did, multiplier); if ((*i)->at_end()) { diff -ur xapian-core-1.4.21/backends/multivaluelist.h xapian-core-1.4.21/backends/multivaluelist.h --- xapian-core-1.4.21/backends/multivaluelist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/multivaluelist.h 2022-11-08 16:44:00.912513288 +0100 @@ -104,7 +104,7 @@ */ bool check(Xapian::docid did); - /// Return a string description of this object. + /// Return a std::string description of this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/backends/prefix_compressed_strings.h xapian-core-1.4.21/backends/prefix_compressed_strings.h --- xapian-core-1.4.21/backends/prefix_compressed_strings.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/prefix_compressed_strings.h 2022-11-08 16:44:00.912513288 +0100 @@ -116,7 +116,7 @@ }; struct PrefixCompressedStringItorGt { - /// Return true if and only if a's string is strictly greater than b's. + /// Return true if and only if a's std::string is strictly greater than b's. bool operator()(const PrefixCompressedStringItor *a, const PrefixCompressedStringItor *b) const { return (**a > **b); diff -ur xapian-core-1.4.21/backends/remote/net_postlist.cc xapian-core-1.4.21/backends/remote/net_postlist.cc --- xapian-core-1.4.21/backends/remote/net_postlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/net_postlist.cc 2022-11-08 16:44:15.344461984 +0100 @@ -117,7 +117,7 @@ string NetworkPostList::get_description() const { - string desc = "NetworkPostList("; + std::string desc = "NetworkPostList("; description_append(desc, term); desc += ')'; return desc; diff -ur xapian-core-1.4.21/backends/remote/net_postlist.h xapian-core-1.4.21/backends/remote/net_postlist.h --- xapian-core-1.4.21/backends/remote/net_postlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/net_postlist.h 2022-11-08 16:44:00.916513275 +0100 @@ -29,7 +29,7 @@ #include "omassert.h" #include "remote-database.h" -using namespace std; +using std::string; /** A postlist in a remote database. */ @@ -38,7 +38,7 @@ Xapian::Internal::intrusive_ptr<const RemoteDatabase> db; - string postings; + std::string postings; bool started; const char * pos; const char * pos_end; @@ -49,7 +49,7 @@ Xapian::doccount termfreq; /// Append a posting to the end of the postlist. - void append_posting(const string & serialised) { + void append_posting(const std::string & serialised) { Assert(pos == NULL); Assert(!started); postings.append(serialised); @@ -58,7 +58,7 @@ public: /// Constructor. NetworkPostList(Xapian::Internal::intrusive_ptr<const RemoteDatabase> db_, - const string & term_) + const std::string & term_) : LeafPostList(term_), db(db_), started(false), pos(NULL), pos_end(NULL), lastdocid(0), lastwdf(0), termfreq(0) @@ -99,7 +99,7 @@ Xapian::termcount get_wdf_upper_bound() const; /// Get a description of the postlist. - string get_description() const; + std::string get_description() const; }; #endif /* XAPIAN_INCLUDED_NET_POSTLIST_H */ diff -ur xapian-core-1.4.21/backends/remote/net_termlist.cc xapian-core-1.4.21/backends/remote/net_termlist.cc --- xapian-core-1.4.21/backends/remote/net_termlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/net_termlist.cc 2022-11-08 16:44:15.344461984 +0100 @@ -99,7 +99,7 @@ } TermList * -NetworkTermList::skip_to(const string & term) +NetworkTermList::skip_to(const std::string & term) { while (current_position != items.end() && current_position->tname < term) { ++current_position; diff -ur xapian-core-1.4.21/backends/remote/net_termlist.h xapian-core-1.4.21/backends/remote/net_termlist.h --- xapian-core-1.4.21/backends/remote/net_termlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/net_termlist.h 2022-11-08 16:44:00.916513275 +0100 @@ -31,7 +31,7 @@ #include "expand/expandweight.h" #include "remote-database.h" -using namespace std; +using std::string; /** An item in a NetworkTermList. */ @@ -39,7 +39,7 @@ public: /** The "name" of this term. */ - string tname; + std::string tname; /** The term frequency. * This is the number of documents (in the network database) @@ -64,11 +64,11 @@ private: /** The list of items comprising the termlist. */ - vector<NetworkTermListItem> items; + std::vector<NetworkTermListItem> items; /** The current position in the list. */ - vector<NetworkTermListItem>::const_iterator current_position; + std::vector<NetworkTermListItem>::const_iterator current_position; /** Whether we have yet started iterating through the list. */ @@ -114,7 +114,7 @@ // Collate weighting information for the current term. void accumulate_stats(Xapian::Internal::ExpandStats &stats) const; - string get_termname() const; + std::string get_termname() const; Xapian::termcount get_wdf() const; Xapian::doccount get_termfreq() const; TermList * next(); diff -ur xapian-core-1.4.21/backends/remote/remote-database.cc xapian-core-1.4.21/backends/remote/remote-database.cc --- xapian-core-1.4.21/backends/remote/remote-database.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/remote-database.cc 2022-11-08 16:44:15.344461984 +0100 @@ -67,9 +67,9 @@ (msg_code == MSG_TERMLIST && reply_code == REPLY_DOCLENGTH); } -XAPIAN_NORETURN(static void throw_handshake_failed(const string & context)); +XAPIAN_NORETURN(static void throw_handshake_failed(const std::string & context)); static void -throw_handshake_failed(const string & context) +throw_handshake_failed(const std::string & context) { throw Xapian::NetworkError("Handshake failed - is this a Xapian server?", context); @@ -83,7 +83,7 @@ } RemoteDatabase::RemoteDatabase(int fd, double timeout_, - const string & context_, bool writable, + const std::string & context_, bool writable, int flags) : link(fd, fd, context_), context(context_), @@ -113,7 +113,7 @@ if (writable) { if (flags & Xapian::DB_RETRY_LOCK) { - const string & body = encode_length(flags & Xapian::DB_RETRY_LOCK); + const std::string & body = encode_length(flags & Xapian::DB_RETRY_LOCK); update_stats(MSG_WRITEACCESS, body); } else { update_stats(MSG_WRITEACCESS); @@ -125,7 +125,7 @@ RemoteDatabase::keep_alive() { send_message(MSG_KEEPALIVE, string()); - string message; + std::string message; get_message(message, REPLY_DONE); } @@ -137,14 +137,14 @@ send_message(MSG_METADATAKEYLIST, prefix); - string message; + std::string message; AutoPtr<NetworkTermList> tlist( new NetworkTermList(0, doccount, intrusive_ptr<const RemoteDatabase>(this), 0)); - vector<NetworkTermListItem> & items = tlist->items; + std::vector<NetworkTermListItem> & items = tlist->items; - string term = prefix; + std::string term = prefix; while (get_message_or_done(message, REPLY_METADATAKEYLIST)) { NetworkTermListItem item; term.resize(size_t(static_cast<unsigned char>(message[0]))); @@ -167,7 +167,7 @@ send_message(MSG_TERMLIST, encode_length(did)); - string message; + std::string message; get_message(message, REPLY_DOCLENGTH); const char * p = message.c_str(); const char * p_end = p + message.size(); @@ -181,9 +181,9 @@ new NetworkTermList(doclen, doccount, intrusive_ptr<const RemoteDatabase>(this), did)); - vector<NetworkTermListItem> & items = tlist->items; + std::vector<NetworkTermListItem> & items = tlist->items; - string term; + std::string term; while (get_message_or_done(message, REPLY_TERMLIST)) { NetworkTermListItem item; p = message.data(); @@ -201,7 +201,7 @@ } TermList * -RemoteDatabase::open_allterms(const string & prefix) const { +RemoteDatabase::open_allterms(const std::string & prefix) const { // Ensure that total_length and doccount are up-to-date. if (!cached_stats_valid) update_stats(); @@ -211,10 +211,10 @@ new NetworkTermList(0, doccount, intrusive_ptr<const RemoteDatabase>(this), 0)); - vector<NetworkTermListItem> & items = tlist->items; + std::vector<NetworkTermListItem> & items = tlist->items; - string term = prefix; - string message; + std::string term = prefix; + std::string message; while (get_message_or_done(message, REPLY_ALLTERMS)) { NetworkTermListItem item; const char * p = message.data(); @@ -231,17 +231,17 @@ } LeafPostList * -RemoteDatabase::open_post_list(const string &term) const +RemoteDatabase::open_post_list(const std::string &term) const { return new NetworkPostList(intrusive_ptr<const RemoteDatabase>(this), term); } Xapian::doccount -RemoteDatabase::read_post_list(const string &term, NetworkPostList & pl) const +RemoteDatabase::read_post_list(const std::string &term, NetworkPostList & pl) const { send_message(MSG_POSTLIST, term); - string message; + std::string message; get_message(message, REPLY_POSTLISTSTART); const char * p = message.data(); @@ -257,13 +257,13 @@ } PositionList * -RemoteDatabase::open_position_list(Xapian::docid did, const string &term) const +RemoteDatabase::open_position_list(Xapian::docid did, const std::string &term) const { send_message(MSG_POSITIONLIST, encode_length(did) + term); - vector<Xapian::termpos> positions; + std::vector<Xapian::termpos> positions; - string message; + std::string message; Xapian::termpos lastpos = static_cast<Xapian::termpos>(-1); while (get_message_or_done(message, REPLY_POSITIONLIST)) { const char * p = message.data(); @@ -325,11 +325,11 @@ Assert(did); send_message(MSG_DOCUMENT, encode_length(did)); - string doc_data; - map<Xapian::valueno, string> values; + std::string doc_data; + std::map<Xapian::valueno, string> values; get_message(doc_data, REPLY_DOCDATA); - string message; + std::string message; while (get_message_or_done(message, REPLY_VALUE)) { const char * p = message.data(); const char * p_end = p + message.size(); @@ -342,14 +342,14 @@ } bool -RemoteDatabase::update_stats(message_type msg_code, const string & body) const +RemoteDatabase::update_stats(message_type msg_code, const std::string & body) const { // MSG_MAX signals that we're handling the opening greeting, which isn't in // response to an explicit message. if (msg_code != MSG_MAX) send_message(msg_code, body); - string message; + std::string message; if (!get_message_or_done(message, REPLY_UPDATE)) { // The database was already open at the latest revision. return false; @@ -367,7 +367,7 @@ int protocol_minor = static_cast<unsigned char>(*p++); if (protocol_major != XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION || protocol_minor < XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION) { - string errmsg("Server supports protocol version"); + std::string errmsg("Server supports protocol version"); if (protocol_minor) { errmsg += "s "; errmsg += str(protocol_major); @@ -424,11 +424,11 @@ } bool -RemoteDatabase::term_exists(const string & tname) const +RemoteDatabase::term_exists(const std::string & tname) const { Assert(!tname.empty()); send_message(MSG_TERMEXISTS, tname); - string message; + std::string message; reply_type type = get_message(message, REPLY_TERMEXISTS, REPLY_TERMDOESNTEXIST); @@ -436,12 +436,12 @@ } void -RemoteDatabase::get_freqs(const string & term, +RemoteDatabase::get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const { Assert(!term.empty()); - string message; + std::string message; const char * p; const char * p_end; if (termfreq_ptr) { @@ -471,7 +471,7 @@ { if (mru_slot != slot) { send_message(MSG_VALUESTATS, encode_length(slot)); - string message; + std::string message; get_message(message, REPLY_VALUESTATS); const char * p = message.data(); const char * p_end = p + message.size(); @@ -524,7 +524,7 @@ } Xapian::termcount -RemoteDatabase::get_wdf_upper_bound(const string &) const +RemoteDatabase::get_wdf_upper_bound(const std::string &) const { // The default implementation returns get_collection_freq(), but we // don't want the overhead of a remote message and reply per query @@ -538,7 +538,7 @@ { Assert(did != 0); send_message(MSG_DOCLENGTH, encode_length(did)); - string message; + std::string message; get_message(message, REPLY_DOCLENGTH); const char * p = message.c_str(); const char * p_end = p + message.size(); @@ -555,7 +555,7 @@ { Assert(did != 0); send_message(MSG_UNIQUETERMS, encode_length(did)); - string message; + std::string message; get_message(message, REPLY_UNIQUETERMS); const char * p = message.c_str(); const char * p_end = p + message.size(); @@ -582,7 +582,7 @@ if (rare(type) >= REPLY_MAX) { if (required_type == REPLY_UPDATE) throw_handshake_failed(context); - string errmsg("Invalid reply type "); + std::string errmsg("Invalid reply type "); errmsg += str(type); throw Xapian::NetworkError(errmsg); } @@ -590,7 +590,7 @@ unserialise_error(result, "REMOTE:", context); } if (type != required_type && type != required_type2) { - string errmsg("Expecting reply type "); + std::string errmsg("Expecting reply type "); errmsg += str(int(required_type)); if (required_type2 != required_type) { errmsg += " or "; @@ -605,11 +605,11 @@ } void -RemoteDatabase::send_message(message_type type, const string &message) const +RemoteDatabase::send_message(message_type type, const std::string &message) const { double end_time = RealTime::end_time(timeout); while (pending_reply >= 0) { - string dummy; + std::string dummy; int reply_code = link.get_message(dummy, end_time); if (reply_code < 0) throw_connection_closed_unexpectedly(); @@ -673,10 +673,10 @@ int percent_cutoff, double weight_cutoff, const Xapian::Weight *wtscheme, const Xapian::RSet &omrset, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies) + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies) { - string tmp = query.serialise(); - string message = encode_length(tmp.size()); + std::string tmp = query.serialise(); + std::string message = encode_length(tmp.size()); message += tmp; // Serialise assorted Enquire settings. @@ -724,7 +724,7 @@ { if (nowait && !link.ready_to_read()) return false; - string message; + std::string message; get_message(message, REPLY_STATS); const char* p = message.data(); unserialise_stats(p, p + message.size(), out); @@ -738,7 +738,7 @@ Xapian::doccount check_at_least, const Xapian::Weight::Internal &stats) { - string message = encode_length(first); + std::string message = encode_length(first); message += encode_length(maxitems); message += encode_length(check_at_least); message += serialise_stats(stats); @@ -747,9 +747,9 @@ void RemoteDatabase::get_mset(Xapian::MSet &mset, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies) + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies) { - string message; + std::string message; get_message(message, REPLY_RESULTS); const char * p = message.data(); const char * p_end = p + message.size(); @@ -759,7 +759,7 @@ throw Xapian::NetworkError("Expected serialised matchspy"); size_t len; decode_length_and_check(&p, p_end, len); - string spyresults(p, len); + std::string spyresults(p, len); p += len; i->merge_results(spyresults); } @@ -774,7 +774,7 @@ send_message(MSG_COMMIT, string()); // We need to wait for a response to ensure documents have been committed. - string message; + std::string message; get_message(message, REPLY_DONE); uncommitted_changes = false; @@ -789,7 +789,7 @@ mru_slot = Xapian::BAD_VALUENO; send_message(MSG_CANCEL, string()); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); uncommitted_changes = false; @@ -804,7 +804,7 @@ send_message(MSG_ADDDOCUMENT, serialise_document(doc)); - string message; + std::string message; get_message(message, REPLY_ADDDOCUMENT); const char * p = message.data(); @@ -822,7 +822,7 @@ uncommitted_changes = true; send_message(MSG_DELETEDOCUMENT, encode_length(did)); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); } @@ -834,7 +834,7 @@ uncommitted_changes = true; send_message(MSG_DELETEDOCUMENTTERM, unique_term); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); } @@ -846,11 +846,11 @@ mru_slot = Xapian::BAD_VALUENO; uncommitted_changes = true; - string message = encode_length(did); + std::string message = encode_length(did); message += serialise_document(doc); send_message(MSG_REPLACEDOCUMENT, message); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); } @@ -862,7 +862,7 @@ mru_slot = Xapian::BAD_VALUENO; uncommitted_changes = true; - string message = encode_length(unique_term.size()); + std::string message = encode_length(unique_term.size()); message += unique_term; message += serialise_document(doc); @@ -884,47 +884,47 @@ } string -RemoteDatabase::get_metadata(const string & key) const +RemoteDatabase::get_metadata(const std::string & key) const { send_message(MSG_GETMETADATA, key); - string metadata; + std::string metadata; get_message(metadata, REPLY_METADATA); return metadata; } void -RemoteDatabase::set_metadata(const string & key, const string & value) +RemoteDatabase::set_metadata(const std::string & key, const std::string & value) { uncommitted_changes = true; - string data = encode_length(key.size()); + std::string data = encode_length(key.size()); data += key; data += value; send_message(MSG_SETMETADATA, data); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); } void -RemoteDatabase::add_spelling(const string & word, +RemoteDatabase::add_spelling(const std::string & word, Xapian::termcount freqinc) const { uncommitted_changes = true; - string data = encode_length(freqinc); + std::string data = encode_length(freqinc); data += word; send_message(MSG_ADDSPELLING, data); - string dummy; + std::string dummy; get_message(dummy, REPLY_DONE); } void -RemoteDatabase::remove_spelling(const string & word, +RemoteDatabase::remove_spelling(const std::string & word, Xapian::termcount freqdec) const { uncommitted_changes = true; - string data = encode_length(freqdec); + std::string data = encode_length(freqdec); data += word; send_message(MSG_REMOVESPELLING, data); } diff -ur xapian-core-1.4.21/backends/remote/remote-database.h xapian-core-1.4.21/backends/remote/remote-database.h --- xapian-core-1.4.21/backends/remote/remote-database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/remote-database.h 2022-11-08 16:44:00.916513275 +0100 @@ -87,10 +87,10 @@ mutable int pending_reply = -1; /// The UUID of the remote database. - mutable string uuid; + mutable std::string uuid; /// The context to return with any error messages - string context; + std::string context; mutable bool cached_stats_valid; @@ -129,7 +129,7 @@ * @param writable Is this a WritableDatabase? * @param flags Xapian::DB_RETRY_LOCK or 0. */ - RemoteDatabase(int fd, double timeout_, const string & context_, + RemoteDatabase(int fd, double timeout_, const std::string & context_, bool writable, int flags); /// Receive a message from the server. @@ -148,12 +148,12 @@ } /// Send a message to the server. - void send_message(message_type type, const string & data) const; + void send_message(message_type type, const std::string & data) const; /// Close the socket void do_close(); - bool get_posting(Xapian::docid &did, double &w, string &value); + bool get_posting(Xapian::docid &did, double &w, std::string &value); /// The timeout value used in network communications, in seconds. double timeout; @@ -194,7 +194,7 @@ int percent_cutoff, double weight_cutoff, const Xapian::Weight *wtscheme, const Xapian::RSet &omrset, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); /** Get the stats from the remote server. * @@ -210,7 +210,7 @@ /// Get the MSet from the remote server. void get_mset(Xapian::MSet &mset, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); /// Get remote metadata key list. TermList * open_metadata_keylist(const std::string & prefix) const; @@ -219,7 +219,7 @@ TermList * open_term_list(Xapian::docid did) const; /// Iterate all terms. - TermList * open_allterms(const string & prefix) const; + TermList * open_allterms(const std::string & prefix) const; bool has_positions() const; @@ -227,12 +227,12 @@ void close(); - LeafPostList * open_post_list(const string & tname) const; + LeafPostList * open_post_list(const std::string & tname) const; - Xapian::doccount read_post_list(const string &term, NetworkPostList & pl) const; + Xapian::doccount read_post_list(const std::string &term, NetworkPostList & pl) const; PositionList * open_position_list(Xapian::docid did, - const string & tname) const; + const std::string & tname) const; /// Get a remote document. Xapian::Document::Internal * open_document(Xapian::docid did, bool lazy) const; @@ -249,9 +249,9 @@ Xapian::termcount get_unique_terms(Xapian::docid did) const; /// Check if term exists. - bool term_exists(const string & tname) const; + bool term_exists(const std::string & tname) const; - void get_freqs(const string & term, + void get_freqs(const std::string & term, Xapian::doccount * termfreq_ptr, Xapian::termcount * collfreq_ptr) const; @@ -263,7 +263,7 @@ Xapian::termcount get_doclength_lower_bound() const; Xapian::termcount get_doclength_upper_bound() const; - Xapian::termcount get_wdf_upper_bound(const string & term) const; + Xapian::termcount get_wdf_upper_bound(const std::string & term) const; void commit(); @@ -280,9 +280,9 @@ std::string get_uuid() const; - string get_metadata(const string & key) const; + std::string get_metadata(const std::string & key) const; - void set_metadata(const string & key, const string & value); + void set_metadata(const std::string & key, const std::string & value); void add_spelling(const std::string&, Xapian::termcount) const; diff -ur xapian-core-1.4.21/backends/remote/remote-document.cc xapian-core-1.4.21/backends/remote/remote-document.cc --- xapian-core-1.4.21/backends/remote/remote-document.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/remote-document.cc 2022-11-08 16:44:15.340461999 +0100 @@ -35,7 +35,7 @@ } void -RemoteDocument::do_get_all_values(map<Xapian::valueno, string> &) const +RemoteDocument::do_get_all_values(std::map<Xapian::valueno, string> &) const { LOGCALL_VOID(DB, "RemoteDocument::do_get_all_values", Literal("[&values_]")); // Our ctor sets the values, so we should never get here. diff -ur xapian-core-1.4.21/backends/remote/remote-document.h xapian-core-1.4.21/backends/remote/remote-document.h --- xapian-core-1.4.21/backends/remote/remote-document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/remote/remote-document.h 2022-11-08 16:44:00.916513275 +0100 @@ -41,8 +41,8 @@ * may be modified by the call. */ RemoteDocument(const Xapian::Database::Internal *db, Xapian::docid did_, - const string & data_, - map<Xapian::valueno, string> &values_) + const std::string & data_, + std::map<Xapian::valueno, string> &values_) : Xapian::Document::Internal(db, did_) { set_data(data_); @@ -51,9 +51,9 @@ public: /** Implementation of virtual methods @{ */ - string do_get_value(Xapian::valueno slot) const; - void do_get_all_values(map<Xapian::valueno, string> & values_) const; - string do_get_data() const; + std::string do_get_value(Xapian::valueno slot) const; + void do_get_all_values(std::map<Xapian::valueno, string> & values_) const; + std::string do_get_data() const; /** @} */ }; diff -ur xapian-core-1.4.21/backends/slowvaluelist.cc xapian-core-1.4.21/backends/slowvaluelist.cc --- xapian-core-1.4.21/backends/slowvaluelist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/slowvaluelist.cc 2022-11-08 16:44:15.340461999 +0100 @@ -71,7 +71,7 @@ continue; AutoPtr<Xapian::Document::Internal> doc(static_cast<Xapian::Document::Internal*>(d)); - string value = doc->get_value(slot); + std::string value = doc->get_value(slot); if (!value.empty()) { swap(current_value, value); return; @@ -123,7 +123,7 @@ string SlowValueList::get_description() const { - string desc = "SlowValueList(slot="; + std::string desc = "SlowValueList(slot="; desc += str(slot); if (last_docid != 0) { desc += ", docid="; diff -ur xapian-core-1.4.21/backends/uuids.cc xapian-core-1.4.21/backends/uuids.cc --- xapian-core-1.4.21/backends/uuids.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/uuids.cc 2022-11-08 16:44:15.416461728 +0100 @@ -56,7 +56,7 @@ using namespace std; -/// Bit-mask to determine where to put hyphens in the string representation. +/// Bit-mask to determine where to put hyphens in the std::string representation. static constexpr unsigned UUID_GAP_MASK = 0x2a8; void @@ -119,7 +119,7 @@ string Uuid::to_string() const { - string result; + std::string result; result.reserve(STRING_SIZE); for (unsigned i = 0; i != BINARY_SIZE; ++i) { unsigned char ch = uuid_data[i]; diff -ur xapian-core-1.4.21/backends/uuids.h xapian-core-1.4.21/backends/uuids.h --- xapian-core-1.4.21/backends/uuids.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/uuids.h 2022-11-08 16:44:00.940513189 +0100 @@ -30,7 +30,7 @@ /// The size of a UUID in bytes. static constexpr unsigned BINARY_SIZE = 16; - /// The size of a UUID string in bytes (not including trailing '\0'). + /// The size of a UUID std::string in bytes (not including trailing '\0'). static constexpr unsigned STRING_SIZE = 36; Uuid() {} diff -ur xapian-core-1.4.21/backends/valuelist.h xapian-core-1.4.21/backends/valuelist.h --- xapian-core-1.4.21/backends/valuelist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/backends/valuelist.h 2022-11-08 16:44:00.944513174 +0100 @@ -92,7 +92,7 @@ */ virtual bool check(Xapian::docid did); - /// Return a string description of this object. + /// Return a std::string description of this object. virtual std::string get_description() const = 0; }; diff -ur xapian-core-1.4.21/bin/xapian-compact.cc xapian-core-1.4.21/bin/xapian-compact.cc --- xapian-core-1.4.21/bin/xapian-compact.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-compact.cc 2022-11-08 16:44:15.564461202 +0100 @@ -67,16 +67,16 @@ void set_quiet(bool quiet_) { quiet = quiet_; } - void set_status(const string & table, const string & status); + void set_status(const std::string & table, const std::string & status); string - resolve_duplicate_metadata(const string & key, + resolve_duplicate_metadata(const std::string & key, size_t n, - const string tags[]); + const std::string tags[]); }; void -MyCompactor::set_status(const string & table, const string & status) +MyCompactor::set_status(const std::string & table, const std::string & status) { if (quiet) return; @@ -87,9 +87,9 @@ } string -MyCompactor::resolve_duplicate_metadata(const string & key, +MyCompactor::resolve_duplicate_metadata(const std::string & key, size_t n, - const string tags[]) + const std::string tags[]) { (void)key; while (--n) { @@ -179,7 +179,7 @@ } // Path to the database to create. - string destdir = argv[argc - 1]; + std::string destdir = argv[argc - 1]; try { Xapian::Database src; diff -ur xapian-core-1.4.21/bin/xapian-delve.cc xapian-core-1.4.21/bin/xapian-delve.cc --- xapian-core-1.4.21/bin/xapian-delve.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-delve.cc 2022-11-08 16:44:15.564461202 +0100 @@ -160,7 +160,7 @@ { switch (value_decode) { case VALUE_ESCAPE: { - string esc; + std::string esc; description_append(esc, value); cout << esc; break; @@ -196,8 +196,8 @@ static void show_values(Database &db, - vector<docid>::const_iterator i, - vector<docid>::const_iterator end) + std::vector<docid>::const_iterator i, + std::vector<docid>::const_iterator end) { while (i != end) { cout << "Values for record #" << *i << ':'; @@ -209,8 +209,8 @@ static void show_value(Database &db, - vector<docid>::const_iterator i, - vector<docid>::const_iterator end, + std::vector<docid>::const_iterator i, + std::vector<docid>::const_iterator end, Xapian::valueno slot) { while (i != end) { @@ -230,8 +230,8 @@ static void show_docdata(Database &db, - vector<docid>::const_iterator i, - vector<docid>::const_iterator end) + std::vector<docid>::const_iterator i, + std::vector<docid>::const_iterator end) { while (i != end) { cout << "Data for record #" << *i << ':' << endl; @@ -268,7 +268,7 @@ cout << ':'; while (t != tend) { - const string & term = *t; + const std::string & term = *t; cout << separator << term; if (verbose) { if (did != 0) @@ -286,8 +286,8 @@ static void show_termlists(Database &db, - vector<docid>::const_iterator i, - vector<docid>::const_iterator end) + std::vector<docid>::const_iterator i, + std::vector<docid>::const_iterator end) { // Display termlists while (i != end) { @@ -311,9 +311,9 @@ } const char * all_terms = NULL; - vector<docid> recnos; - vector<string> terms; - vector<string> dbs; + std::vector<docid> recnos; + std::vector<string> terms; + std::vector<string> dbs; Stem stemmer; valueno slot = 0; // Avoid "may be used uninitialised" warnings. @@ -474,9 +474,9 @@ return 0; } - vector<string>::const_iterator i; + std::vector<string>::const_iterator i; for (i = terms.begin(); i != terms.end(); ++i) { - string term = stemmer(*i); + std::string term = stemmer(*i); PostingIterator p = db.postlist_begin(term); PostingIterator pend = db.postlist_end(term); if (p == pend) { @@ -501,7 +501,7 @@ cout << endl; } else { // Display position lists - vector<docid>::const_iterator j; + std::vector<docid>::const_iterator j; for (j = recnos.begin(); j != recnos.end(); ++j) { p.skip_to(*j); if (p == pend || *p != *j) { diff -ur xapian-core-1.4.21/bin/xapian-inspect.cc xapian-core-1.4.21/bin/xapian-inspect.cc --- xapian-core-1.4.21/bin/xapian-inspect.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-inspect.cc 2022-11-08 16:44:15.564461202 +0100 @@ -84,7 +84,7 @@ auto bslash = s.find('\\'); if (bslash == string::npos) return s; - string r(s, 0, bslash); + std::string r(s, 0, bslash); for (auto i = s.begin() + bslash; i != s.end(); ++i) { char ch = *i; if (ch == '\\') { @@ -224,7 +224,7 @@ {NULL, 0, 0, 0} }; - string table_name; + std::string table_name; int c; while ((c = gnu_getopt_long(argc, argv, "t:", long_opts, 0)) != -1) { @@ -251,7 +251,7 @@ } // Path to the DB to inspect (possibly with a table name appended). - string db_path(argv[optind]); + std::string db_path(argv[optind]); bool arg_is_directory = dir_exists(db_path); if (arg_is_directory && table_name.empty()) { cerr << argv[0] @@ -324,7 +324,7 @@ GlassTable* table_ptr; if (single_file_fd < 0) { - string table_path = db_path; + std::string table_path = db_path; table_path += '/'; table_path += table_name; table_path += '.'; @@ -351,7 +351,7 @@ wait_for_input: cout << "? " << flush; - string input; + std::string input; getline(cin, input); if (cin.eof()) break; diff -ur xapian-core-1.4.21/bin/xapian-progsrv.cc xapian-core-1.4.21/bin/xapian-progsrv.cc --- xapian-core-1.4.21/bin/xapian-progsrv.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-progsrv.cc 2022-11-08 16:44:15.564461202 +0100 @@ -97,7 +97,7 @@ * to open the database(s) to check they work - if they can't be opened the * client will get an exception right away anyway. */ - vector<string> dbnames(argv + optind, argv + argc); + std::vector<string> dbnames(argv + optind, argv + argc); try { // We communicate with the client via stdin (fd 0) and stdout (fd 1). diff -ur xapian-core-1.4.21/bin/xapian-replicate.cc xapian-core-1.4.21/bin/xapian-replicate.cc --- xapian-core-1.4.21/bin/xapian-replicate.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-replicate.cc 2022-11-08 16:44:15.560461217 +0100 @@ -89,9 +89,9 @@ {NULL, 0, 0, 0} }; - string host; + std::string host; int port = 0; - string masterdb; + std::string masterdb; int interval = DEFAULT_INTERVAL; bool one_shot = false; enum { NORMAL, VERBOSE, QUIET } verbosity = NORMAL; @@ -163,7 +163,7 @@ } // Path to the database to create/update. - string dbpath(argv[optind]); + std::string dbpath(argv[optind]); if (masterdb.empty()) masterdb = dbpath; diff -ur xapian-core-1.4.21/bin/xapian-replicate-server.cc xapian-core-1.4.21/bin/xapian-replicate-server.cc --- xapian-core-1.4.21/bin/xapian-replicate-server.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-replicate-server.cc 2022-11-08 16:44:15.564461202 +0100 @@ -61,7 +61,7 @@ {NULL, 0, 0, 0} }; - string host; + std::string host; int port = 0; bool one_shot = false; @@ -97,7 +97,7 @@ } // Path to the database to create/update. - string dbpath(argv[optind]); + std::string dbpath(argv[optind]); try { ReplicateTcpServer server(host, port, dbpath); diff -ur xapian-core-1.4.21/bin/xapian-tcpsrv.cc xapian-core-1.4.21/bin/xapian-tcpsrv.cc --- xapian-core-1.4.21/bin/xapian-tcpsrv.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/bin/xapian-tcpsrv.cc 2022-11-08 16:44:15.560461217 +0100 @@ -87,7 +87,7 @@ } int main(int argc, char **argv) { - string host; + std::string host; int port = 0; double active_timeout = MSECS_ACTIVE_TIMEOUT_DEFAULT * 1e-3; double idle_timeout = MSECS_IDLE_TIMEOUT_DEFAULT * 1e-3; diff -ur xapian-core-1.4.21/common/append_filename_arg.h xapian-core-1.4.21/common/append_filename_arg.h --- xapian-core-1.4.21/common/append_filename_arg.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/append_filename_arg.h 2022-11-08 16:44:00.880513402 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Append filename argument to a command string with suitable escaping + * @brief Append filename argument to a command std::string with suitable escaping */ /* Copyright (C) 2003,2004,2007,2012,2019 Olly Betts * @@ -54,7 +54,7 @@ cmd += '"'; #else // Allow for the typical case of a filename without single quote characters - // in - this reserving is just an optimisation, and the string will grow + // in - this reserving is just an optimisation, and the std::string will grow // larger if necessary. cmd.reserve(cmd.size() + arg.size() + 5); diff -ur xapian-core-1.4.21/common/bitstream.cc xapian-core-1.4.21/common/bitstream.cc --- xapian-core-1.4.21/common/bitstream.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/bitstream.cc 2022-11-08 16:44:15.308462113 +0100 @@ -152,7 +152,7 @@ } void -BitWriter::encode_interpolative(const vector<Xapian::termpos>& pos, int j, int k) +BitWriter::encode_interpolative(const std::vector<Xapian::termpos>& pos, int j, int k) { // "Interpolative code" - for an algorithm description, see "Managing // Gigabytes" - pages 126-127 in the second edition. You can probably diff -ur xapian-core-1.4.21/common/compression_stream.cc xapian-core-1.4.21/common/compression_stream.cc --- xapian-core-1.4.21/common/compression_stream.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/compression_stream.cc 2022-11-08 16:44:15.316462084 +0100 @@ -98,7 +98,7 @@ int err = inflate(inflate_zstream, Z_SYNC_FLUSH); if (err != Z_OK && err != Z_STREAM_END) { if (err == Z_MEM_ERROR) throw std::bad_alloc(); - string msg = "inflate failed"; + std::string msg = "inflate failed"; if (inflate_zstream->msg) { msg += " ("; msg += inflate_zstream->msg; @@ -138,7 +138,7 @@ deflate_zstream = 0; throw std::bad_alloc(); } - string msg = "deflateInit2 failed ("; + std::string msg = "deflateInit2 failed ("; if (deflate_zstream->msg) { msg += deflate_zstream->msg; } else { @@ -174,7 +174,7 @@ inflate_zstream = 0; throw std::bad_alloc(); } - string msg = "inflateInit2 failed ("; + std::string msg = "inflateInit2 failed ("; if (inflate_zstream->msg) { msg += inflate_zstream->msg; } else { diff -ur xapian-core-1.4.21/common/debuglog.cc xapian-core-1.4.21/common/debuglog.cc --- xapian-core-1.4.21/common/debuglog.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/debuglog.cc 2022-11-08 16:44:15.312462098 +0100 @@ -56,7 +56,7 @@ // Filename "-" means "log to stderr". fd = 2; } else { - string fnm, pid; + std::string fnm, pid; while (*f) { if (*f == '%') { if (f[1] == 'p') { @@ -124,7 +124,7 @@ // which expects errno not to change. int saved_errno = errno; - string line; + std::string line; line.reserve(9 + indent_level + msg.size()); line = char(category) + '@'; line += ' '; diff -ur xapian-core-1.4.21/common/errno_to_string.cc xapian-core-1.4.21/common/errno_to_string.cc --- xapian-core-1.4.21/common/errno_to_string.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/errno_to_string.cc 2022-11-08 16:44:15.308462113 +0100 @@ -42,7 +42,7 @@ void errno_to_string(int e, string& s) { - // Use a thread-safe way to convert an errno value to a string if possible. + // Use a thread-safe way to convert an errno value to a std::string if possible. #ifdef HAVE_STRERRORDESC_NP // GNU-specific replacement for sys_errlist and sys_nerr, added in glibc // 2.32. @@ -95,7 +95,7 @@ // actual longest on Linux in English is EILSEQ which needs 50 bytes. char buf[1024]; # ifdef STRERROR_R_CHAR_P - // Returns char* pointing to string describing error. + // Returns char* pointing to std::string describing error. s += strerror_r(e, buf, sizeof(buf)); # else // XSI-compliant strerror_r returns int: 0 means success; a positive error diff -ur xapian-core-1.4.21/common/fileutils.cc xapian-core-1.4.21/common/fileutils.cc --- xapian-core-1.4.21/common/fileutils.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/fileutils.cc 2022-11-08 16:44:15.304462126 +0100 @@ -47,7 +47,7 @@ }; void -removedir(const string &dirname) +removedir(const std::string &dirname) { DIR * dir; @@ -67,7 +67,7 @@ break; throw Xapian::DatabaseError("Cannot read entry from directory at '" + dirname + "'", errno); } - string name(entry->d_name); + std::string name(entry->d_name); if (name == "." || name == "..") continue; if (unlink((dirname + "/" + name).c_str())) { @@ -83,14 +83,14 @@ #ifdef __WIN32__ /// Return true iff a path starts with a drive letter. static bool -has_drive(const string &path) +has_drive(const std::string &path) { return (path.size() >= 2 && path[1] == ':'); } /// Return true iff path is a UNCW path. static bool -uncw_path(const string & path) +uncw_path(const std::string & path) { return (path.size() >= 4 && memcmp(path.data(), "\\\\?\\", 4) == 0); } @@ -102,7 +102,7 @@ #endif void -resolve_relative_path(string & path, const string & base) +resolve_relative_path(string & path, const std::string & base) { #ifndef __WIN32__ if (path.empty() || path[0] != '/') { diff -ur xapian-core-1.4.21/common/getopt.cc xapian-core-1.4.21/common/getopt.cc --- xapian-core-1.4.21/common/getopt.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/getopt.cc 2022-11-08 16:44:15.304462126 +0100 @@ -297,7 +297,7 @@ that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) - OPTSTRING is a string containing the legitimate option characters. + OPTSTRING is a std::string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. diff -ur xapian-core-1.4.21/common/msvc_dirent.cc xapian-core-1.4.21/common/msvc_dirent.cc --- xapian-core-1.4.21/common/msvc_dirent.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/msvc_dirent.cc 2022-11-08 16:44:15.308462113 +0100 @@ -45,7 +45,7 @@ intptr_t handle; /* -1 for failed rewind */ struct _finddata_t info; struct dirent result; /* d_name null iff first time */ - char name[1];/* null-terminated char string */ + char name[1];/* null-terminated char std::string */ }; DIR *opendir(const char *name) diff -ur xapian-core-1.4.21/common/pack.h xapian-core-1.4.21/common/pack.h --- xapian-core-1.4.21/common/pack.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/pack.h 2022-11-08 16:44:00.872513430 +0100 @@ -50,7 +50,7 @@ /** Append an encoded bool to a string. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The bool to encode. */ inline void @@ -80,12 +80,12 @@ return true; } -/** Append an encoded unsigned integer to a string as the last item. +/** Append an encoded unsigned integer to a std::string as the last item. * * This encoding is only suitable when this is the last thing encoded as * the encoding used doesn't contain its own length. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The unsigned integer to encode. */ template<class U> @@ -134,14 +134,14 @@ * * [Chert variant] * - * The appended string data will sort in the same order as the unsigned + * The appended std::string data will sort in the same order as the unsigned * integer being encoded. * * Note that the first byte of the encoding will never be \xff, so it is * safe to store the result of this function immediately after the result of * pack_string_preserving_sort(). * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The unsigned integer to encode. */ template<class U> @@ -254,14 +254,14 @@ * * [Glass and newer variant] * - * The appended string data will sort in the same order as the unsigned + * The appended std::string data will sort in the same order as the unsigned * integer being encoded. * * Note that the first byte of the encoding will never be \xff, so it is * safe to store the result of this function immediately after the result of * pack_string_preserving_sort(). * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The unsigned integer to encode. */ template<class U> @@ -374,7 +374,7 @@ /** Append an encoded unsigned integer to a string. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The unsigned integer to encode. */ template<class U> @@ -392,7 +392,7 @@ /** Append an encoded unsigned integer (bool type) to a string. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The unsigned integer to encode. */ template<> @@ -470,7 +470,7 @@ /** Append an encoded std::string to a string. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The std::string to encode. */ inline void @@ -480,10 +480,10 @@ s += value; } -/** Append an encoded C-style string to a string. +/** Append an encoded C-style std::string to a string. * - * @param s The string to append to. - * @param ptr The C-style string to encode. + * @param s The std::string to append to. + * @param ptr The C-style std::string to encode. */ inline void pack_string(std::string & s, const char * ptr) @@ -526,10 +526,10 @@ * ensure this. Note that pack_uint_preserving_sort() can never produce * \xff as its first byte so is safe to use immediately afterwards. * - * @param s The string to append to. + * @param s The std::string to append to. * @param value The std::string to encode. * @param last If true, this is the last thing to be encoded in this - * string - see note below (default: false) + * std::string - see note below (default: false) * * It doesn't make sense to use pack_string_preserving_sort() if nothing can * ever follow, but if optional items can, you can set last=true in cases diff -ur xapian-core-1.4.21/common/parseint.h xapian-core-1.4.21/common/parseint.h --- xapian-core-1.4.21/common/parseint.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/parseint.h 2022-11-08 16:44:00.896513345 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Parse signed and unsigned type from string and check for trailing characters. + * @brief Parse signed and unsigned type from std::string and check for trailing characters. */ /* Copyright (C) 2019 Olly Betts * Copyright (C) 2019 Vaibhav Kansagara diff -ur xapian-core-1.4.21/common/replicate_utils.cc xapian-core-1.4.21/common/replicate_utils.cc --- xapian-core-1.4.21/common/replicate_utils.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/replicate_utils.cc 2022-11-08 16:44:15.320462069 +0100 @@ -40,16 +40,16 @@ using namespace std; int -create_changeset_file(const string & changeset_dir, - const string & filename, - string & changes_name) +create_changeset_file(const std::string & changeset_dir, + const std::string & filename, + std::string & changes_name) { changes_name = changeset_dir; changes_name += '/'; changes_name += filename; int changes_fd = posixy_open(changes_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666); if (changes_fd < 0) { - string message("Couldn't open changeset to write: "); + std::string message("Couldn't open changeset to write: "); message += changes_name; throw Xapian::DatabaseError(message, errno); } @@ -57,7 +57,7 @@ } void -write_and_clear_changes(int changes_fd, string & buf, size_t bytes) +write_and_clear_changes(int changes_fd, std::string & buf, size_t bytes) { if (changes_fd != -1) { io_write(changes_fd, buf.data(), bytes); diff -ur xapian-core-1.4.21/common/replicate_utils.h xapian-core-1.4.21/common/replicate_utils.h --- xapian-core-1.4.21/common/replicate_utils.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/replicate_utils.h 2022-11-08 16:44:00.864513459 +0100 @@ -32,7 +32,7 @@ * * @param changeset_dir The directory for the changesets. * @param filename The name of the changeset file. - * @param changes_name A string which will be set to the path of the changeset + * @param changes_name A std::string which will be set to the path of the changeset * file. * * @return The open file descriptor. diff -ur xapian-core-1.4.21/common/serialise-double.cc xapian-core-1.4.21/common/serialise-double.cc --- xapian-core-1.4.21/common/serialise-double.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/serialise-double.cc 2022-11-08 16:44:15.312462098 +0100 @@ -100,7 +100,7 @@ int exp = base256ify_double(v); - string result; + std::string result; if (exp <= 6 && exp >= -7) { unsigned char b = static_cast<unsigned char>(exp + 7); diff -ur xapian-core-1.4.21/common/stringutils.h xapian-core-1.4.21/common/stringutils.h --- xapian-core-1.4.21/common/stringutils.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/common/stringutils.h 2022-11-08 16:44:00.876513417 +0100 @@ -32,13 +32,13 @@ */ #define STRINGIZE_(X) #X -/// The STRINGIZE macro converts its parameter into a string constant. +/// The STRINGIZE macro converts its parameter into a std::string constant. #define STRINGIZE(X) STRINGIZE_(X) -/** Returns the length of a string constant. +/** Returns the length of a std::string constant. * - * We rely on concatenation of string literals to produce an error if this - * macro is applied to something other than a string literal. + * We rely on concatenation of std::string literals to produce an error if this + * macro is applied to something other than a std::string literal. */ #define CONST_STRLEN(S) (sizeof(S"") - 1) diff -ur xapian-core-1.4.21/examples/copydatabase.cc xapian-core-1.4.21/examples/copydatabase.cc --- xapian-core-1.4.21/examples/copydatabase.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/copydatabase.cc 2022-11-08 16:44:15.444461628 +0100 @@ -83,7 +83,7 @@ Xapian::WritableDatabase db_out(dest, Xapian::DB_CREATE); for (int i = 1; i < argc - 1; ++i) { - string src = argv[i]; + std::string src = argv[i]; if (!src.empty()) { // Remove any trailing directory separator. char ch = src.back(); @@ -150,7 +150,7 @@ cout << "Copying synonym data..." << flush; Xapian::TermIterator synkey = db_in.synonym_keys_begin(); while (synkey != db_in.synonym_keys_end()) { - string key = *synkey; + std::string key = *synkey; Xapian::TermIterator syn = db_in.synonyms_begin(key); while (syn != db_in.synonyms_end(key)) { db_out.add_synonym(key, *syn); @@ -163,7 +163,7 @@ cout << "Copying user metadata..." << flush; Xapian::TermIterator metakey = db_in.metadata_keys_begin(); while (metakey != db_in.metadata_keys_end()) { - string key = *metakey; + std::string key = *metakey; db_out.set_metadata(key, db_in.get_metadata(key)); ++metakey; } diff -ur xapian-core-1.4.21/examples/quest.cc xapian-core-1.4.21/examples/quest.cc --- xapian-core-1.4.21/examples/quest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/quest.cc 2022-11-08 16:44:15.444461628 +0100 @@ -49,7 +49,7 @@ "was", "what", "when", "where", "which", "who", "why", "will", "with" }; -/** Common string to integer map entry for option decoding. */ +/** Common std::string to integer map entry for option decoding. */ struct tab_entry { const char* s; @@ -60,10 +60,10 @@ } }; -/** Decode a string to an integer. +/** Decode a std::string to an integer. * - * @param table Array of tab_entry in ascending string order. - * @param s The string to decode. + * @param table Array of tab_entry in ascending std::string order. + * @param s The std::string to decode. */ template<typename T, std::size_t N> static int @@ -146,9 +146,9 @@ #define INDENT \ " " -/** Print string from a string to integer mapping table. +/** Print std::string from a std::string to integer mapping table. * - * @param table Array of tab_entry in ascending string order. + * @param table Array of tab_entry in ascending std::string order. */ template<typename T> static char @@ -275,8 +275,8 @@ cerr << argv[0] << ": need ':' when setting prefix\n"; exit(1); } - string prefix(optarg, colon - optarg); - string termprefix(colon + 1); + std::string prefix(optarg, colon - optarg); + std::string termprefix(colon + 1); if (c == 'b') { parser.add_boolean_prefix(prefix, termprefix); } else { @@ -347,7 +347,7 @@ flags = Xapian::QueryParser::FLAG_DEFAULT; } Xapian::Query query = parser.parse_query(argv[optind], flags); - const string & correction = parser.get_corrected_query_string(); + const std::string & correction = parser.get_corrected_query_string(); if (!correction.empty()) cout << "Did you mean: " << correction << "\n\n"; @@ -433,7 +433,7 @@ cout << "MSet:\n"; for (Xapian::MSetIterator i = mset.begin(); i != mset.end(); ++i) { Xapian::Document doc = i.get_document(); - string data = doc.get_data(); + std::string data = doc.get_data(); cout << *i << ": [" << i.get_weight() << "]\n" << data << "\n"; } cout << flush; diff -ur xapian-core-1.4.21/examples/simpleexpand.cc xapian-core-1.4.21/examples/simpleexpand.cc --- xapian-core-1.4.21/examples/simpleexpand.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/simpleexpand.cc 2022-11-08 16:44:15.444461628 +0100 @@ -60,7 +60,7 @@ // Combine command line arguments up to "--" with spaces between // them, so that simple queries don't have to be quoted at the shell // level. - string query_string(argv[2]); + std::string query_string(argv[2]); argv += 3; while (*argv && strcmp(*argv, "--") != 0) { query_string += ' '; @@ -75,7 +75,7 @@ } } - // Parse the query string to produce a Xapian::Query object. + // Parse the query std::string to produce a Xapian::Query object. Xapian::QueryParser qp; Xapian::Stem stemmer("english"); qp.set_stemmer(stemmer); diff -ur xapian-core-1.4.21/examples/simpleindex.cc xapian-core-1.4.21/examples/simpleindex.cc --- xapian-core-1.4.21/examples/simpleindex.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/simpleindex.cc 2022-11-08 16:44:15.444461628 +0100 @@ -59,9 +59,9 @@ indexer.set_stemmer(stemmer); indexer.set_stemming_strategy(indexer.STEM_SOME_FULL_POS); - string para; + std::string para; while (true) { - string line; + std::string line; if (cin.eof()) { if (para.empty()) break; } else { diff -ur xapian-core-1.4.21/examples/simplesearch.cc xapian-core-1.4.21/examples/simplesearch.cc --- xapian-core-1.4.21/examples/simplesearch.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/simplesearch.cc 2022-11-08 16:44:15.448461615 +0100 @@ -62,14 +62,14 @@ // Combine the rest of the command line arguments with spaces between // them, so that simple queries don't have to be quoted at the shell // level. - string query_string(argv[2]); + std::string query_string(argv[2]); argv += 3; while (*argv) { query_string += ' '; query_string += *argv++; } - // Parse the query string to produce a Xapian::Query object. + // Parse the query std::string to produce a Xapian::Query object. Xapian::QueryParser qp; Xapian::Stem stemmer("english"); qp.set_stemmer(stemmer); diff -ur xapian-core-1.4.21/examples/xapian-metadata.cc xapian-core-1.4.21/examples/xapian-metadata.cc --- xapian-core-1.4.21/examples/xapian-metadata.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/xapian-metadata.cc 2022-11-08 16:44:15.448461615 +0100 @@ -68,7 +68,7 @@ } else if (strcmp(command, "list") == 0) { if (argc != 3 && argc != 4) goto syntax_error; Xapian::Database db(argv[2]); - string prefix; + std::string prefix; if (argc == 4) prefix = argv[3]; for (Xapian::TermIterator t = db.metadata_keys_begin(prefix); t != db.metadata_keys_end(prefix); diff -ur xapian-core-1.4.21/examples/xapian-pos.cc xapian-core-1.4.21/examples/xapian-pos.cc --- xapian-core-1.4.21/examples/xapian-pos.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/examples/xapian-pos.cc 2022-11-08 16:44:15.444461628 +0100 @@ -59,7 +59,7 @@ Xapian::PositionIterator p; - string term; + std::string term; public: Pos(const string& term_, const Xapian::PositionIterator& p_) @@ -172,7 +172,7 @@ exit(1); } - vector<Pos*> heap; + std::vector<Pos*> heap; Xapian::Database db(argv[optind]); diff -ur xapian-core-1.4.21/expand/esetinternal.cc xapian-core-1.4.21/expand/esetinternal.cc --- xapian-core-1.4.21/expand/esetinternal.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/expand/esetinternal.cc 2022-11-08 16:44:15.588461116 +0100 @@ -47,7 +47,7 @@ string Internal::ExpandTerm::get_description() const { - string desc("ExpandTerm("); + std::string desc("ExpandTerm("); desc += str(wt); desc += ", "; description_append(desc, term); @@ -75,7 +75,7 @@ const set<Xapian::docid> & docids = rset.internal->get_items(); - vector<TermList*> termlists; + std::vector<TermList*> termlists; termlists.reserve(docids.size()); try { @@ -167,7 +167,7 @@ if (tree->at_end()) break; - string term = tree->get_termname(); + std::string term = tree->get_termname(); // If there's an ExpandDecider, see if it accepts the term. if (edecider && !(*edecider)(term)) continue; @@ -212,10 +212,10 @@ string ESet::Internal::get_description() const { - string desc("ESet::Internal(ebound="); + std::string desc("ESet::Internal(ebound="); desc += str(ebound); - vector<Xapian::Internal::ExpandTerm>::const_iterator i; + std::vector<Xapian::Internal::ExpandTerm>::const_iterator i; for (i = items.begin(); i != items.end(); ++i) { desc += ", "; desc += i->get_description(); @@ -260,7 +260,7 @@ std::string ESet::get_description() const { - string desc = "ESet("; + std::string desc = "ESet("; if (internal.get()) desc += internal->get_description(); desc += ')'; @@ -283,7 +283,7 @@ std::string ESetIterator::get_description() const { - string desc = "ESetIterator("; + std::string desc = "ESetIterator("; if (eset.internal.get()) desc += str(eset.internal->items.size() - off_from_end); desc += ')'; diff -ur xapian-core-1.4.21/expand/esetinternal.h xapian-core-1.4.21/expand/esetinternal.h --- xapian-core-1.4.21/expand/esetinternal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/expand/esetinternal.h 2022-11-08 16:44:01.092512649 +0100 @@ -67,7 +67,7 @@ return term > o.term; } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -106,7 +106,7 @@ Xapian::Internal::ExpandWeight & eweight, double min_wt); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/expand/ortermlist.cc xapian-core-1.4.21/expand/ortermlist.cc --- xapian-core-1.4.21/expand/ortermlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/expand/ortermlist.cc 2022-11-08 16:44:15.592461103 +0100 @@ -148,7 +148,7 @@ } TermList * -OrTermList::skip_to(const string & term) +OrTermList::skip_to(const std::string & term) { LOGCALL(EXPAND, TermList *, "OrTermList::skip_to", term); handle_prune(left, left->skip_to(term)); diff -ur xapian-core-1.4.21/expand/ortermlist.h xapian-core-1.4.21/expand/ortermlist.h --- xapian-core-1.4.21/expand/ortermlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/expand/ortermlist.h 2022-11-08 16:44:01.092512649 +0100 @@ -37,7 +37,7 @@ /** The current term for left and right respectively. * * Until next() is first called, these will be empty strings. Once next() - * has been called, they won't be empty (since the empty string isn't a + * has been called, they won't be empty (since the empty std::string isn't a * valid term). */ std::string left_current, right_current; diff -ur xapian-core-1.4.21/geospatial/geoencode.cc xapian-core-1.4.21/geospatial/geoencode.cc --- xapian-core-1.4.21/geospatial/geoencode.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/geospatial/geoencode.cc 2022-11-08 16:44:15.324462056 +0100 @@ -70,7 +70,7 @@ }; bool -GeoEncode::encode(double lat, double lon, string & result) +GeoEncode::encode(double lat, double lon, std::string & result) { // Check range of latitude. if (rare(lat < -90.0 || lat > 90.0)) { diff -ur xapian-core-1.4.21/geospatial/geoencode.h xapian-core-1.4.21/geospatial/geoencode.h --- xapian-core-1.4.21/geospatial/geoencode.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/geospatial/geoencode.h 2022-11-08 16:44:00.904513317 +0100 @@ -36,11 +36,11 @@ * @param lon The longitude coordinate in degrees (any range is valid - * longitudes will be wrapped). Note that decoding will return * longitudes in the range 0 <= value < 360. - * @param result The string to append the result to. + * @param result The std::string to append the result to. * * @returns true if the encoding was successful, false if there was an error. * If there was an error, the result value will be unmodified. The only cause - * of error is out-of-range latitudes. If there was no error, the string will + * of error is out-of-range latitudes. If there was no error, the std::string will * have been extended by 6 bytes. */ extern bool @@ -65,7 +65,7 @@ /** Decode a coordinate from a string. * - * @param value The string to decode. This must be at least 2 bytes long (this + * @param value The std::string to decode. This must be at least 2 bytes long (this * constraint is not checked). * @param lat_ref A reference to a value to return the latitude in. * @param lon_ref A reference to a value to return the longitude in. diff -ur xapian-core-1.4.21/geospatial/latlongcoord.cc xapian-core-1.4.21/geospatial/latlongcoord.cc --- xapian-core-1.4.21/geospatial/latlongcoord.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/geospatial/latlongcoord.cc 2022-11-08 16:44:15.320462069 +0100 @@ -44,7 +44,7 @@ } void -LatLongCoord::unserialise(const string & serialised) +LatLongCoord::unserialise(const std::string & serialised) { const char * ptr = serialised.data(); const char * end = ptr + serialised.size(); @@ -74,7 +74,7 @@ string LatLongCoord::serialise() const { - string result; + std::string result; GeoEncode::encode(latitude, longitude, result); return result; } @@ -82,7 +82,7 @@ string LatLongCoord::get_description() const { - string res("Xapian::LatLongCoord("); + std::string res("Xapian::LatLongCoord("); res += str(latitude); res += ", "; res += str(longitude); @@ -91,7 +91,7 @@ } void -LatLongCoords::unserialise(const string & serialised) +LatLongCoords::unserialise(const std::string & serialised) { const char * ptr = serialised.data(); const char * end_ptr = ptr + serialised.size(); @@ -105,8 +105,8 @@ string LatLongCoords::serialise() const { - string result; - vector<LatLongCoord>::const_iterator coord; + std::string result; + std::vector<LatLongCoord>::const_iterator coord; for (coord = coords.begin(); coord != coords.end(); ++coord) { GeoEncode::encode(coord->latitude, coord->longitude, result); @@ -117,8 +117,8 @@ string LatLongCoords::get_description() const { - string res("Xapian::LatLongCoords("); - vector<LatLongCoord>::const_iterator coord; + std::string res("Xapian::LatLongCoords("); + std::vector<LatLongCoord>::const_iterator coord; for (coord = coords.begin(); coord != coords.end(); ++coord) { if (coord != coords.begin()) { res += ", "; diff -ur xapian-core-1.4.21/geospatial/latlong_distance_keymaker.cc xapian-core-1.4.21/geospatial/latlong_distance_keymaker.cc --- xapian-core-1.4.21/geospatial/latlong_distance_keymaker.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/geospatial/latlong_distance_keymaker.cc 2022-11-08 16:44:15.324462056 +0100 @@ -33,7 +33,7 @@ string LatLongDistanceKeyMaker::operator()(const Document &doc) const { - string val(doc.get_value(slot)); + std::string val(doc.get_value(slot)); if (val.empty()) { return defkey; } diff -ur xapian-core-1.4.21/geospatial/latlong_posting_source.cc xapian-core-1.4.21/geospatial/latlong_posting_source.cc --- xapian-core-1.4.21/geospatial/latlong_posting_source.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/geospatial/latlong_posting_source.cc 2022-11-08 16:44:15.324462056 +0100 @@ -53,13 +53,13 @@ static void validate_postingsource_params(double k1, double k2) { if (k1 <= 0) { - string msg("k1 parameter to LatLongDistancePostingSource must be " + std::string msg("k1 parameter to LatLongDistancePostingSource must be " "greater than 0; was "); msg += str(k1); throw InvalidArgumentError(msg); } if (k2 <= 0) { - string msg("k2 parameter to LatLongDistancePostingSource must be " + std::string msg("k2 parameter to LatLongDistancePostingSource must be " "greater than 0; was "); msg += str(k2); throw InvalidArgumentError(msg); @@ -194,11 +194,11 @@ string LatLongDistancePostingSource::serialise() const { - string serialised_centre = centre.serialise(); - string metric_name = metric->name(); - string serialised_metric = metric->serialise(); + std::string serialised_centre = centre.serialise(); + std::string metric_name = metric->name(); + std::string serialised_metric = metric->serialise(); - string result = encode_length(get_slot()); + std::string result = encode_length(get_slot()); result += encode_length(serialised_centre.size()); result += serialised_centre; result += encode_length(metric_name.size()); @@ -212,7 +212,7 @@ } LatLongDistancePostingSource * -LatLongDistancePostingSource::unserialise_with_registry(const string &s, +LatLongDistancePostingSource::unserialise_with_registry(const std::string &s, const Registry & registry) const { const char * p = s.data(); @@ -222,13 +222,13 @@ decode_length(&p, end, new_slot); size_t len; decode_length_and_check(&p, end, len); - string new_serialised_centre(p, len); + std::string new_serialised_centre(p, len); p += len; decode_length_and_check(&p, end, len); - string new_metric_name(p, len); + std::string new_metric_name(p, len); p += len; decode_length_and_check(&p, end, len); - string new_serialised_metric(p, len); + std::string new_serialised_metric(p, len); p += len; double new_max_range = unserialise_double(&p, end); double new_k1 = unserialise_double(&p, end); @@ -243,7 +243,7 @@ const Xapian::LatLongMetric * metric_type = registry.get_lat_long_metric(new_metric_name); if (metric_type == NULL) { - string msg("LatLongMetric "); + std::string msg("LatLongMetric "); msg += new_metric_name; msg += " not registered"; throw InvalidArgumentError(msg); @@ -272,7 +272,7 @@ string LatLongDistancePostingSource::get_description() const { - string result("Xapian::LatLongDistancePostingSource(slot="); + std::string result("Xapian::LatLongDistancePostingSource(slot="); result += str(get_slot()); result += ")"; return result; diff -ur xapian-core-1.4.21/include/xapian/compactor.h xapian-core-1.4.21/include/xapian/compactor.h --- xapian-core-1.4.21/include/xapian/compactor.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/compactor.h 2022-11-08 16:44:00.980513047 +0100 @@ -170,7 +170,7 @@ * may change in the future. * * Since 1.4.6, an implementation of this method can return an empty - * string to indicate that the appropriate result is to not set a value + * std::string to indicate that the appropriate result is to not set a value * for this user metadata key in the output database. In older versions, * you should not return an empty string. * diff -ur xapian-core-1.4.21/include/xapian/constants.h xapian-core-1.4.21/include/xapian/constants.h --- xapian-core-1.4.21/include/xapian/constants.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/constants.h 2022-11-08 16:44:00.984513032 +0100 @@ -181,7 +181,7 @@ /** Use the "in memory" backend. * * The filename is currently ignored when this flag is used, but an empty - * string should be passed to allow for future expansion. + * std::string should be passed to allow for future expansion. * * A new empty database is created, so when creating a Database object this * creates an empty read-only database - sometimes useful to avoid special diff -ur xapian-core-1.4.21/include/xapian/database.h xapian-core-1.4.21/include/xapian/database.h --- xapian-core-1.4.21/include/xapian/database.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/database.h 2022-11-08 16:44:00.976513061 +0100 @@ -205,7 +205,7 @@ */ virtual void close(); - /// Return a string describing this object. + /// Return a std::string describing this object. virtual std::string get_description() const; /** An iterator pointing to the start of the postlist @@ -467,7 +467,7 @@ * but this behaviour may change in the future. * * If there is no piece of metadata associated with the specified - * key, an empty string is returned (this applies even for backends + * key, an empty std::string is returned (this applies even for backends * which don't support metadata). * * Empty keys are not valid, and specifying one will cause an @@ -518,7 +518,7 @@ * If the backend does not support UUIDs or this database has no * subdatabases, the UUID will be empty. * - * If this database has multiple sub-databases, the UUID string will + * If this database has multiple sub-databases, the UUID std::string will * contain the UUIDs of all the sub-databases. */ std::string get_uuid() const; @@ -1273,7 +1273,7 @@ */ void set_metadata(const std::string & key, const std::string & metadata); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/document.h xapian-core-1.4.21/include/xapian/document.h --- xapian-core-1.4.21/include/xapian/document.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/document.h 2022-11-08 16:44:00.984513032 +0100 @@ -100,7 +100,7 @@ /** Get value by number. * - * Returns an empty string if no value with the given number is present + * Returns an empty std::string if no value with the given number is present * in the document. * * @param slot The number of the value. @@ -294,11 +294,11 @@ */ std::string serialise() const; - /** Unserialise a document from a string produced by serialise(). + /** Unserialise a document from a std::string produced by serialise(). */ static Document unserialise(const std::string &serialised); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/enquire.h xapian-core-1.4.21/include/xapian/enquire.h --- xapian-core-1.4.21/include/xapian/enquire.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/enquire.h 2022-11-08 16:44:00.988513019 +0100 @@ -109,7 +109,7 @@ /// Test if a given document in the relevance set. bool contains(const Xapian::MSetIterator & i) const { return contains(*i); } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -270,7 +270,7 @@ * * get_expansion_scheme("trad"); * - * @param eweightname_ A string in lowercase specifying the name of + * @param eweightname_ A std::string in lowercase specifying the name of * the scheme to be used. The following schemes * are currently available: * "bo1" : The Bo1 scheme for query expansion. @@ -383,7 +383,7 @@ /** Set the sorting to be by value only. * - * Note that sorting by values uses a string comparison, so to use + * Note that sorting by values uses a std::string comparison, so to use * this to sort by a numeric value you'll need to store the numeric * values in a manner which sorts appropriately. For example, you * could use Xapian::sortable_serialise() (which works for floating @@ -407,7 +407,7 @@ /** Set the sorting to be by value, then by relevance for documents * with the same value. * - * Note that sorting by values uses a string comparison, so to use + * Note that sorting by values uses a std::string comparison, so to use * this to sort by a numeric value you'll need to store the numeric * values in a manner which sorts appropriately. For example, you * could use Xapian::sortable_serialise() (which works for floating @@ -433,7 +433,7 @@ /** Set the sorting to be by relevance then value. * - * Note that sorting by values uses a string comparison, so to use + * Note that sorting by values uses a std::string comparison, so to use * this to sort by a numeric value you'll need to store the numeric * values in a manner which sorts appropriately. For example, you * could use Xapian::sortable_serialise() (which works for floating @@ -743,7 +743,7 @@ return TermIterator(); } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/error.h xapian-core-1.4.21/include/xapian/error.h --- xapian-core-1.4.21/include/xapian/error.h 2022-09-22 07:29:21.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/error.h 2022-11-08 16:44:01.004512962 +0100 @@ -56,9 +56,9 @@ */ std::string context; - /** The error string derived from my_errno. + /** The error std::string derived from my_errno. * - * This string is generated from my_errno lazily. + * This std::string is generated from my_errno lazily. */ mutable std::string error_string; @@ -134,15 +134,15 @@ return context; } - /** Returns any system error string associated with this exception. + /** Returns any system error std::string associated with this exception. * - * The system error string may come from errno, h_errno (on UNIX), or + * The system error std::string may come from errno, h_errno (on UNIX), or * GetLastError() (on MS Windows). If there is no associated system * error string, NULL is returned. */ const char * get_error_string() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -201,7 +201,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ AssertionError(const std::string &msg_, const std::string &context_, const char * error_string_) : LogicError(msg_, context_, "\000AssertionError", error_string_) {} @@ -243,7 +243,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ InvalidArgumentError(const std::string &msg_, const std::string &context_, const char * error_string_) : LogicError(msg_, context_, "\001InvalidArgumentError", error_string_) {} @@ -285,7 +285,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ InvalidOperationError(const std::string &msg_, const std::string &context_, const char * error_string_) : LogicError(msg_, context_, "\002InvalidOperationError", error_string_) {} @@ -327,7 +327,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ UnimplementedError(const std::string &msg_, const std::string &context_, const char * error_string_) : LogicError(msg_, context_, "\003UnimplementedError", error_string_) {} @@ -369,7 +369,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\004DatabaseError", error_string_) {} @@ -411,7 +411,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseCorruptError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\005DatabaseCorruptError", error_string_) {} @@ -453,7 +453,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseCreateError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\006DatabaseCreateError", error_string_) {} @@ -495,7 +495,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseLockError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\007DatabaseLockError", error_string_) {} @@ -541,7 +541,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseModifiedError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\010DatabaseModifiedError", error_string_) {} @@ -583,7 +583,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseOpeningError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\011DatabaseOpeningError", error_string_) {} @@ -634,7 +634,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseVersionError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseOpeningError(msg_, context_, "\012DatabaseVersionError", error_string_) {} @@ -676,7 +676,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DocNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\013DocNotFoundError", error_string_) {} @@ -721,7 +721,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ FeatureUnavailableError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\014FeatureUnavailableError", error_string_) {} @@ -763,7 +763,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ InternalError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\015InternalError", error_string_) {} @@ -805,7 +805,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ NetworkError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\016NetworkError", error_string_) {} @@ -847,7 +847,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ NetworkTimeoutError(const std::string &msg_, const std::string &context_, const char * error_string_) : NetworkError(msg_, context_, "\017NetworkTimeoutError", error_string_) {} @@ -882,14 +882,14 @@ : NetworkError(msg_, context_, type_, errno_) {} }; -/** Indicates a query string can't be parsed. +/** Indicates a query std::string can't be parsed. */ class XAPIAN_VISIBILITY_DEFAULT QueryParserError : public RuntimeError { public: /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ QueryParserError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\020QueryParserError", error_string_) {} @@ -931,7 +931,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ SerialisationError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\021SerialisationError", error_string_) {} @@ -973,7 +973,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ RangeError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\022RangeError", error_string_) {} @@ -1015,7 +1015,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ WildcardError(const std::string &msg_, const std::string &context_, const char * error_string_) : RuntimeError(msg_, context_, "\023WildcardError", error_string_) {} @@ -1057,7 +1057,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseNotFoundError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseOpeningError(msg_, context_, "\024DatabaseNotFoundError", error_string_) {} @@ -1099,7 +1099,7 @@ /** @private @internal * @brief Private constructor for use by remote backend. * - * @param error_string_ Optional string describing error. May be NULL. + * @param error_string_ Optional std::string describing error. May be NULL. */ DatabaseClosedError(const std::string &msg_, const std::string &context_, const char * error_string_) : DatabaseError(msg_, context_, "\025DatabaseClosedError", error_string_) {} diff -ur xapian-core-1.4.21/include/xapian/eset.h xapian-core-1.4.21/include/xapian/eset.h --- xapian-core-1.4.21/include/xapian/eset.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/eset.h 2022-11-08 16:44:00.972513076 +0100 @@ -106,7 +106,7 @@ /** Return iterator pointing to the last object in this ESet. */ ESetIterator back() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal ESet is what the C++ STL calls a container. @@ -265,7 +265,7 @@ /** Get the weight for the current position. */ double get_weight() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/geospatial.h xapian-core-1.4.21/include/xapian/geospatial.h --- xapian-core-1.4.21/include/xapian/geospatial.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/geospatial.h 2022-11-08 16:44:00.992513004 +0100 @@ -115,11 +115,11 @@ */ LatLongCoord(double latitude_, double longitude_); - /** Unserialise a string and set this object to its coordinate. + /** Unserialise a std::string and set this object to its coordinate. * - * @param serialised the string to unserialise the coordinate from. + * @param serialised the std::string to unserialise the coordinate from. * - * @exception Xapian::SerialisationError if the string does not contain + * @exception Xapian::SerialisationError if the std::string does not contain * a valid serialised latitude-longitude pair, or contains extra data at * the end of it. */ @@ -133,7 +133,7 @@ * to point to the end of the data representing the coordinate. * @param end A pointer to the end of the string. * - * @exception Xapian::SerialisationError if the string does not start with + * @exception Xapian::SerialisationError if the std::string does not start with * a valid serialised latitude-longitude pair. */ void unserialise(const char ** ptr, const char * end); @@ -154,7 +154,7 @@ return (longitude < other.longitude); } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -271,11 +271,11 @@ coords.push_back(coord); } - /** Unserialise a string and set this object to the coordinates in it. + /** Unserialise a std::string and set this object to the coordinates in it. * - * @param serialised the string to unserialise the coordinates from. + * @param serialised the std::string to unserialise the coordinates from. * - * @exception Xapian::SerialisationError if the string does not contain + * @exception Xapian::SerialisationError if the std::string does not contain * a valid serialised latitude-longitude pair, or contains junk at the end * of it. */ @@ -285,7 +285,7 @@ */ std::string serialise() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -379,7 +379,7 @@ */ virtual std::string serialise() const = 0; - /** Create object given string serialisation returned by serialise(). + /** Create object given std::string serialisation returned by serialise(). * * @param serialised A serialised instance of this LatLongMetric subclass. */ diff -ur xapian-core-1.4.21/include/xapian/keymaker.h xapian-core-1.4.21/include/xapian/keymaker.h --- xapian-core-1.4.21/include/xapian/keymaker.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/keymaker.h 2022-11-08 16:44:00.972513076 +0100 @@ -50,7 +50,7 @@ /// Default constructor. KeyMaker() { } - /** Build a key string for a Document. + /** Build a key std::string for a Document. * * These keys can be used for sorting or collapsing matching documents. * diff -ur xapian-core-1.4.21/include/xapian/matchspy.h xapian-core-1.4.21/include/xapian/matchspy.h --- xapian-core-1.4.21/include/xapian/matchspy.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/matchspy.h 2022-11-08 16:44:01.000512975 +0100 @@ -135,7 +135,7 @@ * method in your subclass as shown here: * https://trac.xapian.org/ticket/554#comment:1 * - * @param serialised A string containing the serialised results. + * @param serialised A std::string containing the serialised results. * @param context Registry object to use for unserialisation to permit * MatchSpy subclasses with sub-MatchSpy objects to be * implemented. @@ -161,11 +161,11 @@ * can use the default implementation which simply throws * Xapian::UnimplementedError. * - * @param serialised A string containing the serialised results. + * @param serialised A std::string containing the serialised results. */ virtual void merge_results(const std::string & serialised); - /** Return a string describing this object. + /** Return a std::string describing this object. * * This default implementation returns a generic answer, to avoid forcing * those deriving their own MatchSpy subclasses from having to implement diff -ur xapian-core-1.4.21/include/xapian/mset.h xapian-core-1.4.21/include/xapian/mset.h --- xapian-core-1.4.21/include/xapian/mset.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/mset.h 2022-11-08 16:44:00.988513019 +0100 @@ -177,9 +177,9 @@ * the time taken to generate a snippet. */ SNIPPET_EXHAUSTIVE = 2, - /** Return the empty string if no term got matched. + /** Return the empty std::string if no term got matched. * - * If enabled, snippet() returns an empty string if not a single match + * If enabled, snippet() returns an empty std::string if not a single match * was found in text. If not enabled, snippet() returns a (sub)string * of text without any highlighted terms. */ @@ -297,7 +297,7 @@ /** Return iterator pointing to the last object in this MSet. */ MSetIterator back() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal MSet is what the C++ STL calls a container. @@ -469,7 +469,7 @@ /** Return the collapse key for the current position. * - * If collapsing isn't in use, an empty string will be returned. + * If collapsing isn't in use, an empty std::string will be returned. */ std::string get_collapse_key() const; @@ -494,7 +494,7 @@ /** Return the sort key for the current position. * - * If sorting didn't use a key then an empty string will be returned. + * If sorting didn't use a key then an empty std::string will be returned. * * @since Added in Xapian 1.4.6. */ @@ -515,7 +515,7 @@ return mset.convert_to_percent(get_weight()); } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/positioniterator.h xapian-core-1.4.21/include/xapian/positioniterator.h --- xapian-core-1.4.21/include/xapian/positioniterator.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/positioniterator.h 2022-11-08 16:44:01.000512975 +0100 @@ -107,7 +107,7 @@ */ void skip_to(Xapian::termpos termpos); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal PositionIterator is what the C++ STL calls an diff -ur xapian-core-1.4.21/include/xapian/postingiterator.h xapian-core-1.4.21/include/xapian/postingiterator.h --- xapian-core-1.4.21/include/xapian/postingiterator.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/postingiterator.h 2022-11-08 16:44:00.984513032 +0100 @@ -128,7 +128,7 @@ */ void skip_to(Xapian::docid did); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal PostingIterator is what the C++ STL calls an diff -ur xapian-core-1.4.21/include/xapian/postingsource.h xapian-core-1.4.21/include/xapian/postingsource.h --- xapian-core-1.4.21/include/xapian/postingsource.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/postingsource.h 2022-11-08 16:44:01.000512975 +0100 @@ -295,7 +295,7 @@ */ virtual std::string serialise() const; - /** Create object given string serialisation returned by serialise(). + /** Create object given std::string serialisation returned by serialise(). * * Note that the returned object will be deallocated by Xapian after use * with "delete". If you want to handle the deletion in a special way @@ -311,7 +311,7 @@ */ virtual PostingSource * unserialise(const std::string &serialised) const; - /** Create object given string serialisation returned by serialise(). + /** Create object given std::string serialisation returned by serialise(). * * Note that the returned object will be deallocated by Xapian after use * with "delete". If you want to handle the deletion in a special way @@ -353,7 +353,7 @@ */ virtual void init(const Database & db) = 0; - /** Return a string describing this object. + /** Return a std::string describing this object. * * This default implementation returns a generic answer. This default * it provided to avoid forcing those deriving their own PostingSource diff -ur xapian-core-1.4.21/include/xapian/query.h xapian-core-1.4.21/include/xapian/query.h --- xapian-core-1.4.21/include/xapian/query.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/query.h 2022-11-08 16:44:00.996512990 +0100 @@ -299,7 +299,7 @@ * * If OP_WILDCARD would expand to more than its expansion limit, the * most frequent terms are taken. This approach works well for cases - * such as expanding a partial term at the end of a query string which + * such as expanding a partial term at the end of a query std::string which * the user hasn't finished typing yet - as well as being less expense * to evaluate than the full expansion, using only the most frequent * terms tends to give better results too. @@ -343,7 +343,7 @@ /** Construct a Query object for a term. * - * @param term The term. An empty string constructs a query matching + * @param term The term. An empty std::string constructs a query matching * all documents (@a MatchAll is a static instance of this). * @param wqf The within-query frequency. (default: 1) * @param pos The query position. Currently this is mainly used to @@ -528,9 +528,9 @@ /** Serialise this object into a string. */ std::string serialise() const; - /** Unserialise a string and return a Query object. + /** Unserialise a std::string and return a Query object. * - * @param serialised the string to unserialise. + * @param serialised the std::string to unserialise. * @param reg Xapian::Registry object to use to unserialise * user-subclasses of Xapian::PostingSource * (default: standard registry). @@ -551,7 +551,7 @@ */ const Query get_subquery(size_t n) const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** Combine with another Xapian::Query object using OP_AND. diff -ur xapian-core-1.4.21/include/xapian/queryparser.h xapian-core-1.4.21/include/xapian/queryparser.h --- xapian-core-1.4.21/include/xapian/queryparser.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/queryparser.h 2022-11-08 16:44:00.996512990 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief parsing a user query string to build a Xapian::Query object + * @brief parsing a user query std::string to build a Xapian::Query object */ /* Copyright (C) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2021 Olly Betts * Copyright (C) 2010 Adam Sjøgren @@ -68,7 +68,7 @@ /// Class has virtual methods, so provide a virtual destructor. virtual ~Stopper() { } - /// Return a string describing this object. + /// Return a std::string describing this object. virtual std::string get_description() const; /** Start reference counting this object. @@ -152,7 +152,7 @@ */ Xapian::valueno slot; - /** The prefix (or suffix with RP_SUFFIX) string to look for. */ + /** The prefix (or suffix with RP_SUFFIX) std::string to look for. */ std::string str; /** Flags. @@ -175,7 +175,7 @@ /** Constructor. * * @param slot_ Which value slot to generate ranges over. - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this range (as a prefix by default, or as a suffix * if flags Xapian::RP_SUFFIX is specified). * @param flags_ Zero or more of the following flags, combined with @@ -210,7 +210,7 @@ * @param begin The start of the range as specified in the query string * by the user. * @param end The end of the range as specified in the query string - * by the user (empty string for no upper limit). + * by the user (empty std::string for no upper limit). * * @return An OP_VALUE_RANGE Query object (or if end.empty(), an * OP_VALUE_GE Query object). Or if the range isn't one @@ -277,7 +277,7 @@ * * @param slot_ The value slot number to query. * - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this date range. * * @param flags_ Zero or more of the following flags, combined with @@ -296,7 +296,7 @@ * years (default: 1970, so 1/1/69 is 2069 while * 1/1/70 is 1970). * - * The string supplied in str_ is used by @a operator() to decide whether + * The std::string supplied in str_ is used by @a operator() to decide whether * the pair of strings supplied to it constitute a valid range. If * prefix_ is true, the first value in a range must begin with str_ (and * the second value may optionally begin with str_); @@ -346,7 +346,7 @@ * * @param slot_ The value slot number to query. * - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this numeric range. * * @param flags_ Zero or more of the following flags, combined with @@ -359,7 +359,7 @@ * the start (e.g. date:1/1/1980..31/12/1989), and a * suffix only on the end (e.g. 2..12kg). * - * The string supplied in str_ is used by @a operator() to decide whether + * The std::string supplied in str_ is used by @a operator() to decide whether * the pair of strings supplied to it constitute a valid range. If * prefix_ is true, the first value in a range must begin with str_ (and * the second value may optionally begin with str_); @@ -419,7 +419,7 @@ /** Check for a valid range of this type. * * @param[in,out] begin The start of the range as specified in the query - * string by the user. This parameter is a + * std::string by the user. This parameter is a * non-const reference so the ValueRangeProcessor * can modify it to return the value to start the * range with. @@ -457,7 +457,7 @@ } }; -/** Handle a string range. +/** Handle a std::string range. * * The end points can be any strings. * @@ -471,7 +471,7 @@ /** Whether to look for @a str as a prefix or suffix. */ bool prefix; - /** The prefix (or suffix if prefix==false) string to look for. */ + /** The prefix (or suffix if prefix==false) std::string to look for. */ std::string str; public: @@ -485,7 +485,7 @@ /** Constructor. * * @param slot_ The value number to return from operator(). - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this range. * @param prefix_ Flag specifying whether to check for str_ as a prefix * or a suffix. @@ -494,10 +494,10 @@ bool prefix_ = true) : valno(slot_), prefix(prefix_), str(str_) { } - /** Check for a valid string range. + /** Check for a valid std::string range. * * @param[in,out] begin The start of the range as specified in the - * query string by the user. This parameter is a + * query std::string by the user. This parameter is a * non-const reference so the ValueRangeProcessor * can modify it to return the value to start the * range with. @@ -541,12 +541,12 @@ * * @param slot_ The value number to return from operator(). * - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this date range. * - * @param prefix_ Whether to look for the string at the start or end of - * the values. If true, the string is a prefix; if - * false, the string is a suffix (default: true). + * @param prefix_ Whether to look for the std::string at the start or end of + * the values. If true, the std::string is a prefix; if + * false, the std::string is a suffix (default: true). * * @param prefer_mdy_ Should ambiguous dates be interpreted as * month/day/year rather than day/month/year? @@ -556,7 +556,7 @@ * years (default: 1970, so 1/1/69 is 2069 while * 1/1/70 is 1970). * - * The string supplied in str_ is used by @a operator() to decide whether + * The std::string supplied in str_ is used by @a operator() to decide whether * the pair of strings supplied to it constitute a valid range. If * prefix_ is true, the first value in a range must begin with str_ (and * the second value may optionally begin with str_); @@ -592,12 +592,12 @@ * * @param slot_ The value number to return from operator(). * - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this date range. * - * @param prefix_ Whether to look for the string at the start or end of - * the values. If true, the string is a prefix; if - * false, the string is a suffix (default: true). + * @param prefix_ Whether to look for the std::string at the start or end of + * the values. If true, the std::string is a prefix; if + * false, the std::string is a suffix (default: true). * * @param prefer_mdy_ Should ambiguous dates be interpreted as * month/day/year rather than day/month/year? @@ -607,7 +607,7 @@ * years (default: 1970, so 1/1/69 is 2069 while * 1/1/70 is 1970). * - * The string supplied in str_ is used by @a operator() to decide whether + * The std::string supplied in str_ is used by @a operator() to decide whether * the pair of strings supplied to it constitute a valid range. If * prefix_ is true, the first value in a range must begin with str_ (and * the second value may optionally begin with str_); @@ -635,7 +635,7 @@ /** Check for a valid date range. * * @param[in,out] begin The start of the range as specified in the - * query string by the user. This parameter is a + * query std::string by the user. This parameter is a * non-const reference so the ValueRangeProcessor * can modify it to return the value to start the * range with. @@ -672,14 +672,14 @@ * * @param slot_ The value number to return from operator(). * - * @param str_ A string to look for to recognise values as belonging + * @param str_ A std::string to look for to recognise values as belonging * to this numeric range. * - * @param prefix_ Whether to look for the string at the start or end of - * the values. If true, the string is a prefix; if - * false, the string is a suffix (default: true). + * @param prefix_ Whether to look for the std::string at the start or end of + * the values. If true, the std::string is a prefix; if + * false, the std::string is a suffix (default: true). * - * The string supplied in str_ is used by @a operator() to decide whether + * The std::string supplied in str_ is used by @a operator() to decide whether * the pair of strings supplied to it constitute a valid range. If * prefix_ is true, the first value in a range must begin with str_ (and * the second value may optionally begin with str_); @@ -707,7 +707,7 @@ /** Check for a valid numeric range. * * @param[in,out] begin The start of the range as specified in the - * query string by the user. This parameter is a + * query std::string by the user. This parameter is a * non-const reference so the ValueRangeProcessor * can modify it to return the value to start the * range with. @@ -741,9 +741,9 @@ /// Destructor. virtual ~FieldProcessor(); - /** Convert a field-prefixed string to a Query object. + /** Convert a field-prefixed std::string to a Query object. * - * @param str The string to convert. + * @param str The std::string to convert. * * @return Query object corresponding to @a str. */ @@ -843,7 +843,7 @@ * a suggestion is returned, a corrected version of the query string * will be built up which can be read using * QueryParser::get_corrected_query_string(). The query returned is - * based on the uncorrected query string however - if you want a + * based on the uncorrected query std::string however - if you want a * parsed query based on the corrected query string, you must call * QueryParser::parse_query() again. * @@ -1072,7 +1072,7 @@ * @param default_prefix The default term prefix to use (default none). * For example, you can pass "A" when parsing an "Author" field. * - * @exception If the query string can't be parsed, then + * @exception If the query std::string can't be parsed, then * Xapian::QueryParserError is thrown. You can get an English * error message to report to the user by catching it and * calling get_msg() on the caught exception. The current @@ -1110,7 +1110,7 @@ * combined with @c Xapian::Query::OP_OR. * * If any prefixes are specified for the empty field name (i.e. you - * call this method with an empty string as the first parameter) + * call this method with an empty std::string as the first parameter) * these prefixes will be used for terms without a field specifier. * If you do this and also specify the @c default_prefix parameter to @c * parse_query(), then the @c default_prefix parameter will override. @@ -1167,7 +1167,7 @@ * prefixes. Multiple terms being generated for such a field, and * combined with @c Xapian::Query::OP_OR. * - * Calling this method with an empty string for @a field will cause + * Calling this method with an empty std::string for @a field will cause * a @c Xapian::InvalidArgumentError. * * If you call @c add_prefix() and @c add_boolean_prefix() for the @@ -1298,11 +1298,11 @@ * This will only be set if FLAG_SPELLING_CORRECTION is specified when * QueryParser::parse_query() was last called. * - * If there were no corrections, an empty string is returned. + * If there were no corrections, an empty std::string is returned. */ std::string get_corrected_query_string() const; - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; @@ -1329,7 +1329,7 @@ * The conversion attempts to ensure that, for any pair of values supplied * to the conversion algorithm, the result of comparing the original * values (with a numeric comparison operator) will be the same as the - * result of comparing the resulting values (with a string comparison + * result of comparing the resulting values (with a std::string comparison * operator). On platforms which represent doubles with the precisions * specified by IEEE_754, this will be the case: if the representation of * doubles is more precise, it is possible that two very close doubles @@ -1349,19 +1349,19 @@ return std::string(buf, sortable_serialise_(value, buf)); } -/** Convert a string encoded using @a sortable_serialise back to a floating +/** Convert a std::string encoded using @a sortable_serialise back to a floating * point number. * - * This expects the input to be a string produced by @a sortable_serialise(). + * This expects the input to be a std::string produced by @a sortable_serialise(). * If the input is not such a string, the value returned is undefined (but * no error will be thrown). * * The result of the conversion will be exactly the value which was - * supplied to @a sortable_serialise() when making the string on platforms + * supplied to @a sortable_serialise() when making the std::string on platforms * which represent doubles with the precisions specified by IEEE_754, but * may be a different (nearby) value on other platforms. * - * @param serialised The serialised string to decode. + * @param serialised The serialised std::string to decode. */ XAPIAN_VISIBILITY_DEFAULT double XAPIAN_NOTHROW(sortable_unserialise(const std::string & serialised)); diff -ur xapian-core-1.4.21/include/xapian/stem.h xapian-core-1.4.21/include/xapian/stem.h --- xapian-core-1.4.21/include/xapian/stem.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/stem.h 2022-11-08 16:44:00.980513047 +0100 @@ -54,7 +54,7 @@ /// Stem the specified word. virtual std::string operator()(const std::string & word) = 0; - /// Return a string describing this object. + /// Return a std::string describing this object. virtual std::string get_description() const = 0; }; @@ -165,7 +165,7 @@ /// Return true if this is a no-op stemmer. bool is_none() const { return !internal.get(); } - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** Return a list of available languages. diff -ur xapian-core-1.4.21/include/xapian/termgenerator.h xapian-core-1.4.21/include/xapian/termgenerator.h --- xapian-core-1.4.21/include/xapian/termgenerator.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/termgenerator.h 2022-11-08 16:44:00.972513076 +0100 @@ -268,7 +268,7 @@ */ void set_termpos(Xapian::termpos termpos); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; }; diff -ur xapian-core-1.4.21/include/xapian/termiterator.h xapian-core-1.4.21/include/xapian/termiterator.h --- xapian-core-1.4.21/include/xapian/termiterator.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/termiterator.h 2022-11-08 16:44:01.004512962 +0100 @@ -126,7 +126,7 @@ */ void skip_to(const std::string &term); - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal TermIterator is what the C++ STL calls an diff -ur xapian-core-1.4.21/include/xapian/unicode.h xapian-core-1.4.21/include/xapian/unicode.h --- xapian-core-1.4.21/include/xapian/unicode.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/unicode.h 2022-11-08 16:44:00.992513004 +0100 @@ -58,16 +58,16 @@ /** Return the number of bytes left in the iterator's buffer. */ size_t left() const { return p ? end - p : 0; } - /** Assign a new string to the iterator. + /** Assign a new std::string to the iterator. * - * The iterator will forget the string it was iterating through, and - * return characters from the start of the new string when next called. - * The string is not copied into the iterator, so it must remain valid + * The iterator will forget the std::string it was iterating through, and + * return characters from the start of the new std::string when next called. + * The std::string is not copied into the iterator, so it must remain valid * while the iteration is in progress. * - * @param p_ A pointer to the start of the string to read. + * @param p_ A pointer to the start of the std::string to read. * - * @param len The length of the string to read. + * @param len The length of the std::string to read. */ void assign(const char* p_, size_t len) { if (len) { @@ -79,47 +79,47 @@ } } - /** Assign a new string to the iterator. + /** Assign a new std::string to the iterator. * - * The iterator will forget the string it was iterating through, and - * return characters from the start of the new string when next called. - * The string is not copied into the iterator, so it must remain valid + * The iterator will forget the std::string it was iterating through, and + * return characters from the start of the new std::string when next called. + * The std::string is not copied into the iterator, so it must remain valid * while the iteration is in progress. * - * @param s The string to read. Must not be modified while the iteration + * @param s The std::string to read. Must not be modified while the iteration * is in progress. */ void assign(const std::string& s) { assign(s.data(), s.size()); } /** Create an iterator given a pointer to a null terminated string. * - * The iterator will return characters from the start of the string when - * next called. The string is not copied into the iterator, so it must + * The iterator will return characters from the start of the std::string when + * next called. The std::string is not copied into the iterator, so it must * remain valid while the iteration is in progress. * - * @param p_ A pointer to the start of the null terminated string to read. + * @param p_ A pointer to the start of the null terminated std::string to read. */ explicit Utf8Iterator(const char* p_); /** Create an iterator given a pointer and a length. * - * The iterator will return characters from the start of the string when - * next called. The string is not copied into the iterator, so it must + * The iterator will return characters from the start of the std::string when + * next called. The std::string is not copied into the iterator, so it must * remain valid while the iteration is in progress. * - * @param p_ A pointer to the start of the string to read. + * @param p_ A pointer to the start of the std::string to read. * - * @param len The length of the string to read. + * @param len The length of the std::string to read. */ Utf8Iterator(const char* p_, size_t len) { assign(p_, len); } /** Create an iterator given a string. * - * The iterator will return characters from the start of the string when - * next called. The string is not copied into the iterator, so it must + * The iterator will return characters from the start of the std::string when + * next called. The std::string is not copied into the iterator, so it must * remain valid while the iteration is in progress. * - * @param s The string to read. Must not be modified while the iteration + * @param s The std::string to read. Must not be modified while the iteration * is in progress. */ Utf8Iterator(const std::string& s) { assign(s.data(), s.size()); } diff -ur xapian-core-1.4.21/include/xapian/valueiterator.h xapian-core-1.4.21/include/xapian/valueiterator.h --- xapian-core-1.4.21/include/xapian/valueiterator.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/valueiterator.h 2022-11-08 16:44:00.980513047 +0100 @@ -173,7 +173,7 @@ bool (check)(Xapian::docid docid); #endif - /// Return a string describing this object. + /// Return a std::string describing this object. std::string get_description() const; /** @private @internal ValueIterator is what the C++ STL calls an diff -ur xapian-core-1.4.21/include/xapian/version_h.cc xapian-core-1.4.21/include/xapian/version_h.cc --- xapian-core-1.4.21/include/xapian/version_h.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/version_h.cc 2022-11-08 16:44:15.416461728 +0100 @@ -101,7 +101,7 @@ "#define XAPIAN_ENABLE_VISIBILITY", "", #endif -"/// The version of Xapian as a C string literal.", +"/// The version of Xapian as a C std::string literal.", "#define XAPIAN_VERSION ", STRING_VERSION, "", "/** The major component of the Xapian version.", diff -ur xapian-core-1.4.21/include/xapian/weight.h xapian-core-1.4.21/include/xapian/weight.h --- xapian-core-1.4.21/include/xapian/weight.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian/weight.h 2022-11-08 16:44:00.984513032 +0100 @@ -212,7 +212,7 @@ * method in your subclass as shown here: * https://trac.xapian.org/ticket/554#comment:1 * - * @param serialised A string containing the serialised parameters. + * @param serialised A std::string containing the serialised parameters. */ virtual Weight * unserialise(const std::string & serialised) const; @@ -445,7 +445,7 @@ /// Xapian::Weight subclass implementing the tf-idf weighting scheme. class XAPIAN_VISIBILITY_DEFAULT TfIdfWeight : public Weight { - /* Three character string indicating the normalizations for tf(wdf), idf and + /* Three character std::string indicating the normalizations for tf(wdf), idf and tfidf weight. */ std::string normalizations; @@ -465,11 +465,11 @@ public: /** Construct a TfIdfWeight * - * @param normalizations A three character string indicating the + * @param normalizations A three character std::string indicating the * normalizations to be used for the tf(wdf), idf * and document weight. (default: "ntn") * - * The @a normalizations string works like so: + * The @a normalizations std::string works like so: * * @li The first character specifies the normalization for the wdf. The * following normalizations are currently supported: diff -ur xapian-core-1.4.21/include/xapian.h xapian-core-1.4.21/include/xapian.h --- xapian-core-1.4.21/include/xapian.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/include/xapian.h 2022-11-08 16:44:00.968513089 +0100 @@ -107,7 +107,7 @@ // Functions returning library version: -/** Report the version string of the library which the program is linked with. +/** Report the version std::string of the library which the program is linked with. * * This may be different to the version compiled against (given by * XAPIAN_VERSION) if shared libraries are being used. diff -ur xapian-core-1.4.21/languages/compiler/header.h xapian-core-1.4.21/languages/compiler/header.h --- xapian-core-1.4.21/languages/compiler/header.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/languages/compiler/header.h 2022-11-08 16:44:01.120512549 +0100 @@ -178,7 +178,7 @@ struct amongvec { - symbol * b; /* the string giving the case */ + symbol * b; /* the std::string giving the case */ int size; /* - and its size */ struct node * action; /* the corresponding action */ int i; /* the amongvec index of the longest substring of b */ diff -ur xapian-core-1.4.21/languages/sbl-dispatch.h xapian-core-1.4.21/languages/sbl-dispatch.h --- xapian-core-1.4.21/languages/sbl-dispatch.h 2022-09-22 07:29:21.000000000 +0200 +++ xapian-core-1.4.21/languages/sbl-dispatch.h 2022-11-08 16:44:01.132512507 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Map string to language code + * @brief Map std::string to language code */ /* Warning: This file is generated by ./languages/collate-sbl - do not modify directly! */ /* Copyright (C) 2007,2012,2013,2015 Olly Betts diff -ur xapian-core-1.4.21/languages/stem.cc xapian-core-1.4.21/languages/stem.cc --- xapian-core-1.4.21/languages/stem.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/languages/stem.cc 2022-11-08 16:44:15.648460904 +0100 @@ -146,7 +146,7 @@ string Stem::get_description() const { - string desc = "Xapian::Stem("; + std::string desc = "Xapian::Stem("; if (internal.get()) { desc += internal->get_description(); desc += ')'; diff -ur xapian-core-1.4.21/languages/steminternal.cc xapian-core-1.4.21/languages/steminternal.cc --- xapian-core-1.4.21/languages/steminternal.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/languages/steminternal.cc 2022-11-08 16:44:15.648460904 +0100 @@ -145,7 +145,7 @@ } string -SnowballStemImplementation::operator()(const string & word) +SnowballStemImplementation::operator()(const std::string & word) { const symbol * s = reinterpret_cast<const symbol *>(word.data()); replace_s(0, l, word.size(), s); diff -ur xapian-core-1.4.21/languages/steminternal.h xapian-core-1.4.21/languages/steminternal.h --- xapian-core-1.4.21/languages/steminternal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/languages/steminternal.h 2022-11-08 16:44:01.116512564 +0100 @@ -36,8 +36,8 @@ typedef int (*among_function)(Xapian::StemImplementation *); struct among { - int s_size; /* length of search string (in symbols) */ - unsigned s; /* offset in pool to search string */ + int s_size; /* length of search std::string (in symbols) */ + unsigned s; /* offset in pool to search std::string */ int substring_i; /* index to longest matching substring */ int result; /* result of the lookup */ }; diff -ur xapian-core-1.4.21/matcher/collapser.cc xapian-core-1.4.21/matcher/collapser.cc --- xapian-core-1.4.21/matcher/collapser.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/collapser.cc 2022-11-08 16:44:15.588461116 +0100 @@ -74,7 +74,7 @@ { ++docs_considered; // The postlist will supply the collapse key for a remote match. - const string * key_ptr = postlist->get_collapse_key(); + const std::string * key_ptr = postlist->get_collapse_key(); if (key_ptr) { item.collapse_key = *key_ptr; } else { @@ -108,7 +108,7 @@ } Xapian::doccount -Collapser::get_collapse_count(const string & collapse_key, int percent_cutoff, +Collapser::get_collapse_count(const std::string & collapse_key, int percent_cutoff, double min_weight) const { auto key = table.find(collapse_key); diff -ur xapian-core-1.4.21/matcher/exactphrasepostlist.cc xapian-core-1.4.21/matcher/exactphrasepostlist.cc --- xapian-core-1.4.21/matcher/exactphrasepostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/exactphrasepostlist.cc 2022-11-08 16:44:15.580461145 +0100 @@ -32,8 +32,8 @@ using namespace std; ExactPhrasePostList::ExactPhrasePostList(PostList *source_, - const vector<PostList*>::const_iterator &terms_begin, - const vector<PostList*>::const_iterator &terms_end) + const std::vector<PostList*>::const_iterator &terms_begin, + const std::vector<PostList*>::const_iterator &terms_end) : SelectPostList(source_), terms(terms_begin, terms_end) { size_t n = terms.size(); @@ -61,7 +61,7 @@ } class TermCompare { - vector<PostList *> & terms; + std::vector<PostList *> & terms; public: explicit TermCompare(vector<PostList *> & terms_) : terms(terms_) { } @@ -136,7 +136,7 @@ // // We use the minimum wdf of a sub-postlist as our estimate. See the // comment in NearPostList::get_wdf() for justification of this estimate. - vector<PostList *>::const_iterator i = terms.begin(); + std::vector<PostList *>::const_iterator i = terms.begin(); Xapian::termcount wdf = (*i)->get_wdf(); while (++i != terms.end()) { wdf = min(wdf, (*i)->get_wdf()); diff -ur xapian-core-1.4.21/matcher/externalpostlist.cc xapian-core-1.4.21/matcher/externalpostlist.cc --- xapian-core-1.4.21/matcher/externalpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/externalpostlist.cc 2022-11-08 16:44:15.576461160 +0100 @@ -196,7 +196,7 @@ string ExternalPostList::get_description() const { - string desc = "ExternalPostList("; + std::string desc = "ExternalPostList("; if (source.get()) desc += source->get_description(); desc += ")"; return desc; diff -ur xapian-core-1.4.21/matcher/localsubmatch.cc xapian-core-1.4.21/matcher/localsubmatch.cc --- xapian-core-1.4.21/matcher/localsubmatch.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/localsubmatch.cc 2022-11-08 16:44:15.572461173 +0100 @@ -111,7 +111,7 @@ string LazyWeight::name() const { - string desc = "LazyWeight("; + std::string desc = "LazyWeight("; desc += real_wt->name(); desc += ")"; return desc; @@ -124,7 +124,7 @@ } LazyWeight * -LazyWeight::unserialise(const string &) const +LazyWeight::unserialise(const std::string &) const { throw Xapian::InvalidOperationError("LazyWeight::unserialise()"); } diff -ur xapian-core-1.4.21/matcher/maxpostlist.cc xapian-core-1.4.21/matcher/maxpostlist.cc --- xapian-core-1.4.21/matcher/maxpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/maxpostlist.cc 2022-11-08 16:44:15.572461173 +0100 @@ -247,7 +247,7 @@ string MaxPostList::get_description() const { - string desc("("); + std::string desc("("); desc += plist[0]->get_description(); for (size_t i = 1; i < n_kids; ++i) { desc += " MAX "; diff -ur xapian-core-1.4.21/matcher/mergepostlist.cc xapian-core-1.4.21/matcher/mergepostlist.cc --- xapian-core-1.4.21/matcher/mergepostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/mergepostlist.cc 2022-11-08 16:44:15.588461116 +0100 @@ -88,7 +88,7 @@ LOGCALL(MATCH, Xapian::doccount, "MergePostList::get_termfreq_max", NO_ARGS); // sum of termfreqs for all children Xapian::doccount total = 0; - vector<PostList *>::const_iterator i; + std::vector<PostList *>::const_iterator i; for (i = plists.begin(); i != plists.end(); ++i) { total += (*i)->get_termfreq_max(); } @@ -101,7 +101,7 @@ LOGCALL(MATCH, Xapian::doccount, "MergePostList::get_termfreq_min", NO_ARGS); // sum of termfreqs for all children Xapian::doccount total = 0; - vector<PostList *>::const_iterator i; + std::vector<PostList *>::const_iterator i; for (i = plists.begin(); i != plists.end(); ++i) { total += (*i)->get_termfreq_min(); } @@ -114,7 +114,7 @@ LOGCALL(MATCH, Xapian::doccount, "MergePostList::get_termfreq_est", NO_ARGS); // sum of termfreqs for all children Xapian::doccount total = 0; - vector<PostList *>::const_iterator i; + std::vector<PostList *>::const_iterator i; for (i = plists.begin(); i != plists.end(); ++i) { total += (*i)->get_termfreq_est(); } @@ -139,18 +139,18 @@ RETURN(plists[current]->get_weight()); } -const string * +const std::string * MergePostList::get_sort_key() const { - LOGCALL(MATCH, const string *, "MergePostList::get_sort_key", NO_ARGS); + LOGCALL(MATCH, const std::string *, "MergePostList::get_sort_key", NO_ARGS); Assert(current != -1); RETURN(plists[current]->get_sort_key()); } -const string * +const std::string * MergePostList::get_collapse_key() const { - LOGCALL(MATCH, const string *, "MergePostList::get_collapse_key", NO_ARGS); + LOGCALL(MATCH, const std::string *, "MergePostList::get_collapse_key", NO_ARGS); Assert(current != -1); RETURN(plists[current]->get_collapse_key()); } @@ -167,7 +167,7 @@ { LOGCALL(MATCH, double, "MergePostList::recalc_maxweight", NO_ARGS); w_max = 0; - vector<PostList *>::iterator i; + std::vector<PostList *>::iterator i; for (i = plists.begin(); i != plists.end(); ++i) { double w = (*i)->recalc_maxweight(); if (w > w_max) w_max = w; @@ -186,8 +186,8 @@ string MergePostList::get_description() const { - string desc = "( Merge "; - vector<PostList *>::const_iterator i; + std::string desc = "( Merge "; + std::vector<PostList *>::const_iterator i; for (i = plists.begin(); i != plists.end(); ++i) { desc += (*i)->get_description() + " "; } diff -ur xapian-core-1.4.21/matcher/mergepostlist.h xapian-core-1.4.21/matcher/mergepostlist.h --- xapian-core-1.4.21/matcher/mergepostlist.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/mergepostlist.h 2022-11-08 16:44:01.080512691 +0100 @@ -40,7 +40,7 @@ double w_max; - vector<PostList *> plists; + std::vector<PostList *> plists; int current; @@ -67,8 +67,8 @@ Xapian::docid get_docid() const; double get_weight() const; - const string * get_sort_key() const; - const string * get_collapse_key() const; + const std::string * get_sort_key() const; + const std::string * get_collapse_key() const; double get_maxweight() const; @@ -78,7 +78,7 @@ PostList *skip_to(Xapian::docid did, double w_min); bool at_end() const; - string get_description() const; + std::string get_description() const; /** Return the document length of the document the current term * comes from. diff -ur xapian-core-1.4.21/matcher/msetpostlist.cc xapian-core-1.4.21/matcher/msetpostlist.cc --- xapian-core-1.4.21/matcher/msetpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/msetpostlist.cc 2022-11-08 16:44:15.568461188 +0100 @@ -86,18 +86,18 @@ RETURN(mset_internal->items[cursor].wt); } -const string * +const std::string * MSetPostList::get_sort_key() const { - LOGCALL(MATCH, const string *, "MSetPostList::get_sort_key", NO_ARGS); + LOGCALL(MATCH, const std::string *, "MSetPostList::get_sort_key", NO_ARGS); Assert(cursor != -1); RETURN(&mset_internal->items[cursor].sort_key); } -const string * +const std::string * MSetPostList::get_collapse_key() const { - LOGCALL(MATCH, const string *, "MSetPostList::get_collapse_key", NO_ARGS); + LOGCALL(MATCH, const std::string *, "MSetPostList::get_collapse_key", NO_ARGS); Assert(cursor != -1); RETURN(&mset_internal->items[cursor].collapse_key); } @@ -161,7 +161,7 @@ string MSetPostList::get_description() const { - string desc("(MSet "); + std::string desc("(MSet "); desc += mset_internal->get_description(); desc += ')'; return desc; diff -ur xapian-core-1.4.21/matcher/multiandpostlist.cc xapian-core-1.4.21/matcher/multiandpostlist.cc --- xapian-core-1.4.21/matcher/multiandpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/multiandpostlist.cc 2022-11-08 16:44:15.588461116 +0100 @@ -251,7 +251,7 @@ std::string MultiAndPostList::get_description() const { - string desc("("); + std::string desc("("); desc += plist[0]->get_description(); for (size_t i = 1; i < n_kids; ++i) { desc += " AND "; diff -ur xapian-core-1.4.21/matcher/multimatch.cc xapian-core-1.4.21/matcher/multimatch.cc --- xapian-core-1.4.21/matcher/multimatch.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/multimatch.cc 2022-11-08 16:44:15.584461131 +0100 @@ -172,7 +172,7 @@ static void split_rset_by_db(const Xapian::RSet * rset, Xapian::doccount number_of_subdbs, - vector<Xapian::RSet> & subrsets) + std::vector<Xapian::RSet> & subrsets) { LOGCALL_STATIC_VOID(MATCH, "split_rset_by_db", rset | number_of_subdbs | subrsets); if (rset && !rset->empty()) { @@ -225,8 +225,8 @@ Xapian::Weight::Internal & stats) { LOGCALL_STATIC_VOID(MATCH, "prepare_sub_matches", leaves | stats); - // We use a vector<bool> to track which SubMatches we're already prepared. - vector<bool> prepared; + // We use a std::vector<bool> to track which SubMatches we're already prepared. + std::vector<bool> prepared; prepared.resize(leaves.size(), false); size_t unprepared = leaves.size(); bool nowait = true; @@ -288,7 +288,7 @@ double time_limit_, Xapian::Weight::Internal & stats, const Xapian::Weight * weight_, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_, + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_, bool have_sorter, bool have_mdecider) : db(db_), query(query_), collapse_max(collapse_max_), collapse_key(collapse_key_), @@ -306,7 +306,7 @@ if (query.empty()) return; Xapian::doccount number_of_subdbs = db.internal.size(); - vector<Xapian::RSet> subrsets; + std::vector<Xapian::RSet> subrsets; split_rset_by_db(omrset, number_of_subdbs, subrsets); for (size_t i = 0; i != number_of_subdbs; ++i) { @@ -434,7 +434,7 @@ } // Get postlists and term info - vector<PostList *> postlists; + std::vector<PostList *> postlists; Xapian::termcount total_subqs = 0; // Keep a count of matches which we know exist, but we won't see. This // occurs when a submatch is remote, and returns a lower bound on the @@ -502,7 +502,7 @@ #ifdef XAPIAN_HAS_REMOTE_BACKEND unsigned greatest_wt_subqs_db_num = UINT_MAX; #endif - vector<Xapian::Internal::MSetItem> items; + std::vector<Xapian::Internal::MSetItem> items; // maximum weight a document could possibly have const double max_possible = pl->recalc_maxweight(); @@ -660,7 +660,7 @@ } if (sort_by != REL) { - const string * ptr = pl->get_sort_key(); + const std::string * ptr = pl->get_sort_key(); if (ptr) { new_item.sort_key = *ptr; } else if (sorter) { @@ -763,7 +763,7 @@ // Scan through (unsorted) MSet looking for entry. // FIXME: more efficient way than just scanning? Xapian::docid olddid = old_item.did; - vector<Xapian::Internal::MSetItem>::iterator i; + std::vector<Xapian::Internal::MSetItem>::iterator i; for (i = items.begin(); i != items.end(); ++i) { if (i->did == olddid) { LOGLINE(MATCH, "collapse: removing " << @@ -886,7 +886,7 @@ items.pop_back(); } #ifdef XAPIAN_ASSERTIONS_PARANOID - vector<Xapian::Internal::MSetItem>::const_iterator i; + std::vector<Xapian::Internal::MSetItem>::const_iterator i; for (i = items.begin(); i != items.end(); ++i) { Assert(i->wt >= min_weight); } @@ -932,7 +932,7 @@ items.pop_back(); } #ifdef XAPIAN_ASSERTIONS_PARANOID - vector<Xapian::Internal::MSetItem>::const_iterator j; + std::vector<Xapian::Internal::MSetItem>::const_iterator j; for (j = items.begin(); j != items.end(); ++j) { Assert(j->wt >= min_wt); } @@ -1145,7 +1145,7 @@ // unwanted elements end up at the end of items, which means // that the call to erase() to remove them doesn't have to copy // any elements. - vector<Xapian::Internal::MSetItem>::reverse_iterator nth; + std::vector<Xapian::Internal::MSetItem>::reverse_iterator nth; nth = items.rbegin() + first; nth_element(items.rbegin(), nth, items.rend(), mcmp); // Erase the trailing "first" elements diff -ur xapian-core-1.4.21/matcher/multimatch.h xapian-core-1.4.21/matcher/multimatch.h --- xapian-core-1.4.21/matcher/multimatch.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/multimatch.h 2022-11-08 16:44:01.080512691 +0100 @@ -68,10 +68,10 @@ bool recalculate_w_max; /** Is each sub-database remote? */ - vector<bool> is_remote; + std::vector<bool> is_remote; /// The matchspies to use. - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies; + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies; /** get the maxweight that the postlist pl may return, calling * recalc_maxweight if recalculate_w_max is set, and unsetting it. @@ -115,7 +115,7 @@ double time_limit_, Xapian::Weight::Internal & stats, const Xapian::Weight *wtscheme, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_, + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_, bool have_sorter, bool have_mdecider); /** Run the match and generate an MSet object. diff -ur xapian-core-1.4.21/matcher/multixorpostlist.cc xapian-core-1.4.21/matcher/multixorpostlist.cc --- xapian-core-1.4.21/matcher/multixorpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/multixorpostlist.cc 2022-11-08 16:44:15.568461188 +0100 @@ -371,7 +371,7 @@ string MultiXorPostList::get_description() const { - string desc("("); + std::string desc("("); desc += plist[0]->get_description(); for (size_t i = 1; i < n_kids; ++i) { desc += " XOR "; diff -ur xapian-core-1.4.21/matcher/nearpostlist.cc xapian-core-1.4.21/matcher/nearpostlist.cc --- xapian-core-1.4.21/matcher/nearpostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/nearpostlist.cc 2022-11-08 16:44:15.572461173 +0100 @@ -35,8 +35,8 @@ NearPostList::NearPostList(PostList *source_, Xapian::termpos window_, - const vector<PostList*>::const_iterator &terms_begin, - const vector<PostList*>::const_iterator &terms_end) + const std::vector<PostList*>::const_iterator &terms_begin, + const std::vector<PostList*>::const_iterator &terms_end) : SelectPostList(source_), window(window_), terms(terms_begin, terms_end) { size_t n = terms.size(); @@ -189,7 +189,7 @@ // // If this estimate proves to give bad results, we can revisit this and try // a better approximation. - vector<PostList *>::const_iterator i = terms.begin(); + std::vector<PostList *>::const_iterator i = terms.begin(); Xapian::termcount wdf = (*i)->get_wdf(); while (++i != terms.end()) { wdf = min(wdf, (*i)->get_wdf()); @@ -223,7 +223,7 @@ string NearPostList::get_description() const { - string m = "(Near "; + std::string m = "(Near "; m += str(window); m += ' '; m += source->get_description(); diff -ur xapian-core-1.4.21/matcher/orpospostlist.cc xapian-core-1.4.21/matcher/orpospostlist.cc --- xapian-core-1.4.21/matcher/orpospostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/orpospostlist.cc 2022-11-08 16:44:15.568461188 +0100 @@ -124,7 +124,7 @@ std::string OrPosPostList::get_description() const { - string desc = "OrPosPostList("; + std::string desc = "OrPosPostList("; desc += pl->get_description(); desc += ')'; return desc; diff -ur xapian-core-1.4.21/matcher/phrasepostlist.cc xapian-core-1.4.21/matcher/phrasepostlist.cc --- xapian-core-1.4.21/matcher/phrasepostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/phrasepostlist.cc 2022-11-08 16:44:15.580461145 +0100 @@ -34,8 +34,8 @@ PhrasePostList::PhrasePostList(PostList *source_, Xapian::termpos window_, - const vector<PostList*>::const_iterator &terms_begin, - const vector<PostList*>::const_iterator &terms_end) + const std::vector<PostList*>::const_iterator &terms_begin, + const std::vector<PostList*>::const_iterator &terms_end) : SelectPostList(source_), window(window_), terms(terms_begin, terms_end) { size_t n = terms.size(); @@ -93,7 +93,7 @@ // // We use the minimum wdf of a sub-postlist as our estimate. See the // comment in NearPostList::get_wdf() for justification of this estimate. - vector<PostList *>::const_iterator i = terms.begin(); + std::vector<PostList *>::const_iterator i = terms.begin(); Xapian::termcount wdf = (*i)->get_wdf(); while (++i != terms.end()) { wdf = min(wdf, (*i)->get_wdf()); @@ -127,7 +127,7 @@ string PhrasePostList::get_description() const { - string m = "(Phrase "; + std::string m = "(Phrase "; m += str(window); m += ' '; m += source->get_description(); diff -ur xapian-core-1.4.21/matcher/remotesubmatch.cc xapian-core-1.4.21/matcher/remotesubmatch.cc --- xapian-core-1.4.21/matcher/remotesubmatch.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/remotesubmatch.cc 2022-11-08 16:44:15.576461160 +0100 @@ -30,7 +30,7 @@ RemoteSubMatch::RemoteSubMatch(RemoteDatabase *db_, bool decreasing_relevance_, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_) + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies_) : db(db_), decreasing_relevance(decreasing_relevance_), matchspies(matchspies_) diff -ur xapian-core-1.4.21/matcher/remotesubmatch.h xapian-core-1.4.21/matcher/remotesubmatch.h --- xapian-core-1.4.21/matcher/remotesubmatch.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/remotesubmatch.h 2022-11-08 16:44:01.092512649 +0100 @@ -54,13 +54,13 @@ double percent_factor; /// The matchspies to use. - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies; + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies; public: /// Constructor. RemoteSubMatch(RemoteDatabase *db_, bool decreasing_relevance_, - const vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); + const std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> & matchspies); /// Fetch and collate statistics. bool prepare_match(bool nowait, Xapian::Weight::Internal & total_stats); diff -ur xapian-core-1.4.21/matcher/valuegepostlist.cc xapian-core-1.4.21/matcher/valuegepostlist.cc --- xapian-core-1.4.21/matcher/valuegepostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/valuegepostlist.cc 2022-11-08 16:44:15.576461160 +0100 @@ -37,7 +37,7 @@ if (!valuelist) valuelist = db->open_value_list(slot); valuelist->next(); while (!valuelist->at_end()) { - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); if (v >= begin) return NULL; valuelist->next(); } @@ -52,7 +52,7 @@ if (!valuelist) valuelist = db->open_value_list(slot); valuelist->skip_to(did); while (!valuelist->at_end()) { - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); if (v >= begin) return NULL; valuelist->next(); } @@ -70,7 +70,7 @@ if (!valid) { return NULL; } - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); valid = (v >= begin); return NULL; } @@ -78,7 +78,7 @@ string ValueGePostList::get_description() const { - string desc = "ValueGePostList("; + std::string desc = "ValueGePostList("; desc += str(slot); desc += ", "; description_append(desc, begin); diff -ur xapian-core-1.4.21/matcher/valuerangepostlist.cc xapian-core-1.4.21/matcher/valuerangepostlist.cc --- xapian-core-1.4.21/matcher/valuerangepostlist.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/valuerangepostlist.cc 2022-11-08 16:44:15.572461173 +0100 @@ -54,7 +54,7 @@ } static double -string_frac(const string &s, size_t prefix) +string_frac(const std::string &s, size_t prefix) { double r = 0; double f = 1.0; @@ -203,7 +203,7 @@ if (!valuelist) valuelist = db->open_value_list(slot); valuelist->next(); while (!valuelist->at_end()) { - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); if (v >= begin && v <= end) { return NULL; } @@ -220,7 +220,7 @@ if (!valuelist) valuelist = db->open_value_list(slot); valuelist->skip_to(did); while (!valuelist->at_end()) { - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); if (v >= begin && v <= end) { return NULL; } @@ -240,7 +240,7 @@ if (!valid) { return NULL; } - const string & v = valuelist->get_value(); + const std::string & v = valuelist->get_value(); valid = (v >= begin && v <= end); return NULL; } @@ -260,7 +260,7 @@ string ValueRangePostList::get_description() const { - string desc = "ValueRangePostList("; + std::string desc = "ValueRangePostList("; desc += str(slot); desc += ", "; description_append(desc, begin); diff -ur xapian-core-1.4.21/matcher/valuestreamdocument.cc xapian-core-1.4.21/matcher/valuestreamdocument.cc --- xapian-core-1.4.21/matcher/valuestreamdocument.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/matcher/valuestreamdocument.cc 2022-11-08 16:44:15.584461131 +0100 @@ -26,9 +26,9 @@ using namespace std; static void -clear_valuelists(map<Xapian::valueno, ValueList *> & valuelists) +clear_valuelists(std::map<Xapian::valueno, ValueList *> & valuelists) { - map<Xapian::valueno, ValueList *>::const_iterator i; + std::map<Xapian::valueno, ValueList *>::const_iterator i; for (i = valuelists.begin(); i != valuelists.end(); ++i) { delete i->second; } @@ -60,7 +60,7 @@ } #endif - pair<map<Xapian::valueno, ValueList *>::iterator, bool> ret; + std::pair<map<Xapian::valueno, ValueList *>::iterator, bool> ret; ret = valuelists.insert(make_pair(slot, static_cast<ValueList*>(NULL))); ValueList * vl; if (ret.second) { @@ -81,7 +81,7 @@ ret.first->second = NULL; } else if (vl->get_docid() == did) { Assert(vl); - string v = vl->get_value(); + std::string v = vl->get_value(); AssertEq(v, doc->get_value(slot)); return v; } @@ -91,7 +91,7 @@ } void -ValueStreamDocument::do_get_all_values(map<Xapian::valueno, string> & v) const +ValueStreamDocument::do_get_all_values(std::map<Xapian::valueno, string> & v) const { if (!doc) { doc = database->open_document(did, true); diff -ur xapian-core-1.4.21/net/progclient.cc xapian-core-1.4.21/net/progclient.cc --- xapian-core-1.4.21/net/progclient.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/progclient.cc 2022-11-08 16:44:15.600461075 +0100 @@ -46,11 +46,11 @@ using namespace std; #ifndef __WIN32__ -/** Split a string into a vector of strings, using a given separator +/** Split a std::string into a vector of strings, using a given separator * character (default space) */ static void -split_words(const string &text, vector<string> &words, char ws = ' ') +split_words(const std::string &text, std::vector<string> &words, char ws = ' ') { size_t i = 0; if (i < text.length() && text[0] == ws) { @@ -64,7 +64,7 @@ } #endif -ProgClient::ProgClient(const string &progname, const string &args, +ProgClient::ProgClient(const std::string &progname, const std::string &args, double timeout_, bool writable, int flags) : RemoteDatabase(run_program(progname, args, child), timeout_, get_progcontext(progname, args), writable, @@ -74,14 +74,14 @@ } string -ProgClient::get_progcontext(const string &progname, const string &args) +ProgClient::get_progcontext(const std::string &progname, const std::string &args) { LOGCALL_STATIC(DB, string, "ProgClient::get_progcontext", progname | args); RETURN("remote:prog(" + progname + " " + args + ")"); } int -ProgClient::run_program(const string &progname, const string &args, +ProgClient::run_program(const std::string &progname, const std::string &args, #ifndef __WIN32__ pid_t& child #else @@ -154,7 +154,7 @@ ::close(stderrfd); } - vector<string> argvec; + std::vector<string> argvec; split_words(args, argvec); // We never explicitly free this memory, but that's OK as we're about @@ -227,7 +227,7 @@ startupinfo.dwFlags |= STARTF_USESTDHANDLES; // For some reason Windows wants a modifiable command line! - string cmdline = progname + ' ' + args; + std::string cmdline = progname + ' ' + args; BOOL ok = CreateProcess(0, &cmdline[0], 0, 0, TRUE, 0, 0, 0, &startupinfo, &procinfo); if (!ok) { diff -ur xapian-core-1.4.21/net/progclient.h xapian-core-1.4.21/net/progclient.h --- xapian-core-1.4.21/net/progclient.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/progclient.h 2022-11-08 16:44:01.104512606 +0100 @@ -68,7 +68,7 @@ #endif ); - /** Generate context string for Xapian::Error exception objects. + /** Generate context std::string for Xapian::Error exception objects. * * @param progname The program used to create the connection. * @param args Any arguments to the program. diff -ur xapian-core-1.4.21/net/remoteconnection.cc xapian-core-1.4.21/net/remoteconnection.cc --- xapian-core-1.4.21/net/remoteconnection.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/remoteconnection.cc 2022-11-08 16:44:15.600461075 +0100 @@ -88,7 +88,7 @@ #endif RemoteConnection::RemoteConnection(int fdin_, int fdout_, - const string & context_) + const std::string & context_) : fdin(fdin_), fdout(fdout_), context(context_) { #ifdef __WIN32__ @@ -268,20 +268,20 @@ } void -RemoteConnection::send_message(char type, const string &message, +RemoteConnection::send_message(char type, const std::string &message, double end_time) { LOGCALL_VOID(REMOTE, "RemoteConnection::send_message", type | message | end_time); if (fdout == -1) throw_database_closed(); - string header; + std::string header; header += type; header += encode_length(message.size()); #ifdef __WIN32__ HANDLE hout = fd_to_handle(fdout); - const string * str = &header; + const std::string * str = &header; size_t count = 0; while (true) { @@ -322,7 +322,7 @@ context, errno); } - const string * str = &header; + const std::string * str = &header; size_t count = 0; while (true) { @@ -411,7 +411,7 @@ buf[0] = type; size_t c = 1; { - string enc_size = encode_length(size); + std::string enc_size = encode_length(size); c += enc_size.size(); // An encoded length should be just a few bytes. AssertRel(c, <=, sizeof(buf)); @@ -696,7 +696,7 @@ } int -RemoteConnection::receive_file(const string &file, double end_time) +RemoteConnection::receive_file(const std::string &file, double end_time) { LOGCALL(REMOTE, int, "RemoteConnection::receive_file", file | end_time); if (fdin == -1) diff -ur xapian-core-1.4.21/net/remoteserver.cc xapian-core-1.4.21/net/remoteserver.cc --- xapian-core-1.4.21/net/remoteserver.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/remoteserver.cc 2022-11-08 16:44:15.600461075 +0100 @@ -78,7 +78,7 @@ context = dbpaths[0]; if (!writable) { - vector<std::string>::const_iterator i(dbpaths.begin()); + std::vector<std::string>::const_iterator i(dbpaths.begin()); for (++i; i != dbpaths.end(); ++i) { db->add_database(Xapian::Database(*i)); context += ' '; @@ -112,7 +112,7 @@ } message_type -RemoteServer::get_message(double timeout, string & result, +RemoteServer::get_message(double timeout, std::string & result, message_type required_type) { double end_time = RealTime::end_time(timeout); @@ -126,12 +126,12 @@ if (type < 0) throw Xapian::NetworkError("Connection closed unexpectedly"); if (type >= MSG_MAX) { - string errmsg("Invalid message type "); + std::string errmsg("Invalid message type "); errmsg += str(type); throw Xapian::NetworkError(errmsg); } if (required_type != MSG_MAX && type != int(required_type)) { - string errmsg("Expecting message type "); + std::string errmsg("Expecting message type "); errmsg += str(int(required_type)); errmsg += ", got "; errmsg += str(type); @@ -141,14 +141,14 @@ } void -RemoteServer::send_message(reply_type type, const string &message) +RemoteServer::send_message(reply_type type, const std::string &message) { double end_time = RealTime::end_time(active_timeout); unsigned char type_as_char = static_cast<unsigned char>(type); RemoteConnection::send_message(type_as_char, message, end_time); } -typedef void (RemoteServer::* dispatch_func)(const string &); +typedef void (RemoteServer::* dispatch_func)(const std::string &); void RemoteServer::run() @@ -199,10 +199,10 @@ &RemoteServer::msg_addspelling, }; - string message; + std::string message; size_t type = get_message(idle_timeout, message); if (type >= sizeof(dispatch) / sizeof(dispatch[0]) || !dispatch[type]) { - string errmsg("Unexpected message type "); + std::string errmsg("Unexpected message type "); errmsg += str(type); throw Xapian::InvalidArgumentError(errmsg); } @@ -242,17 +242,17 @@ } void -RemoteServer::msg_allterms(const string &message) +RemoteServer::msg_allterms(const std::string &message) { - string prev = message; - string reply; + std::string prev = message; + std::string reply; - const string & prefix = message; + const std::string & prefix = message; const Xapian::TermIterator end = db->allterms_end(prefix); for (Xapian::TermIterator t = db->allterms_begin(prefix); t != end; ++t) { if (rare(prev.size() > 255)) prev.resize(255); - const string & v = *t; + const std::string & v = *t; size_t reuse = common_prefix_length(prev, v); reply = encode_length(t.get_termfreq()); reply.append(1, char(reuse)); @@ -265,7 +265,7 @@ } void -RemoteServer::msg_termlist(const string &message) +RemoteServer::msg_termlist(const std::string &message) { const char *p = message.data(); const char *p_end = p + message.size(); @@ -273,14 +273,14 @@ decode_length(&p, p_end, did); send_message(REPLY_DOCLENGTH, encode_length(db->get_doclength(did))); - string prev; + std::string prev; const Xapian::TermIterator end = db->termlist_end(did); for (Xapian::TermIterator t = db->termlist_begin(did); t != end; ++t) { if (rare(prev.size() > 255)) prev.resize(255); - const string & v = *t; + const std::string & v = *t; size_t reuse = common_prefix_length(prev, v); - string reply = encode_length(t.get_wdf()); + std::string reply = encode_length(t.get_wdf()); reply += encode_length(t.get_termfreq()); reply.append(1, char(reuse)); reply.append(v, reuse, string::npos); @@ -292,13 +292,13 @@ } void -RemoteServer::msg_positionlist(const string &message) +RemoteServer::msg_positionlist(const std::string &message) { const char *p = message.data(); const char *p_end = p + message.size(); Xapian::docid did; decode_length(&p, p_end, did); - string term(p, p_end - p); + std::string term(p, p_end - p); Xapian::termpos lastpos = static_cast<Xapian::termpos>(-1); const Xapian::PositionIterator end = db->positionlist_end(did, term); @@ -313,9 +313,9 @@ } void -RemoteServer::msg_postlist(const string &message) +RemoteServer::msg_postlist(const std::string &message) { - const string & term = message; + const std::string & term = message; Xapian::doccount termfreq = db->get_termfreq(term); Xapian::termcount collfreq = db->get_collection_freq(term); @@ -327,7 +327,7 @@ i != end; ++i) { Xapian::docid newdocid = *i; - string reply = encode_length(newdocid - lastdocid - 1); + std::string reply = encode_length(newdocid - lastdocid - 1); reply += encode_length(i.get_wdf()); send_message(REPLY_POSTLISTITEM, reply); @@ -338,7 +338,7 @@ } void -RemoteServer::msg_writeaccess(const string & msg) +RemoteServer::msg_writeaccess(const std::string & msg) { if (!writable) throw_read_only(); @@ -362,7 +362,7 @@ } void -RemoteServer::msg_reopen(const string & msg) +RemoteServer::msg_reopen(const std::string & msg) { if (!db->reopen()) { send_message(REPLY_DONE, string()); @@ -372,13 +372,13 @@ } void -RemoteServer::msg_update(const string &) +RemoteServer::msg_update(const std::string &) { static const char protocol[2] = { char(XAPIAN_REMOTE_PROTOCOL_MAJOR_VERSION), char(XAPIAN_REMOTE_PROTOCOL_MINOR_VERSION) }; - string message(protocol, 2); + std::string message(protocol, 2); Xapian::doccount num_docs = db->get_doccount(); message += encode_length(num_docs); message += encode_length(db->get_lastdocid() - num_docs); @@ -387,13 +387,13 @@ message += encode_length(db->get_doclength_upper_bound() - doclen_lb); message += (db->has_positions() ? '1' : '0'); message += encode_length(db->get_total_length()); - string uuid = db->get_uuid(); + std::string uuid = db->get_uuid(); message += uuid; send_message(REPLY_UPDATE, message); } void -RemoteServer::msg_query(const string &message_in) +RemoteServer::msg_query(const std::string &message_in) { const char *p = message_in.c_str(); const char *p_end = p + message_in.size(); @@ -449,7 +449,7 @@ // Unserialise the Weight object. decode_length_and_check(&p, p_end, len); - string wtname(p, len); + std::string wtname(p, len); p += len; const Xapian::Weight * wttype = reg.get_weighting_scheme(wtname); @@ -471,10 +471,10 @@ p += len; // Unserialise any MatchSpy objects. - vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> matchspies; + std::vector<Xapian::Internal::opt_intrusive_ptr<Xapian::MatchSpy>> matchspies; while (p != p_end) { decode_length_and_check(&p, p_end, len); - string spytype(p, len); + std::string spytype(p, len); const Xapian::MatchSpy * spyclass = reg.get_match_spy(spytype); if (spyclass == NULL) { throw Xapian::InvalidArgumentError("Match spy " + spytype + @@ -495,7 +495,7 @@ send_message(REPLY_STATS, serialise_stats(local_stats)); - string message; + std::string message; get_message(active_timeout, message, MSG_GETMSET); p = message.c_str(); p_end = p + message.size(); @@ -518,7 +518,7 @@ message.resize(0); for (auto i : matchspies) { - string spy_results = i->serialise_results(); + std::string spy_results = i->serialise_results(); message += encode_length(spy_results.size()); message += spy_results; } @@ -527,7 +527,7 @@ } void -RemoteServer::msg_document(const string &message) +RemoteServer::msg_document(const std::string &message) { const char *p = message.data(); const char *p_end = p + message.size(); @@ -540,7 +540,7 @@ Xapian::ValueIterator i; for (i = doc.values_begin(); i != doc.values_end(); ++i) { - string item = encode_length(i.get_valueno()); + std::string item = encode_length(i.get_valueno()); item += *i; send_message(REPLY_VALUE, item); } @@ -548,7 +548,7 @@ } void -RemoteServer::msg_keepalive(const string &) +RemoteServer::msg_keepalive(const std::string &) { // Ensure *our* database stays alive, as it may contain remote databases! db->keep_alive(); @@ -556,42 +556,42 @@ } void -RemoteServer::msg_termexists(const string &term) +RemoteServer::msg_termexists(const std::string &term) { send_message((db->term_exists(term) ? REPLY_TERMEXISTS : REPLY_TERMDOESNTEXIST), string()); } void -RemoteServer::msg_collfreq(const string &term) +RemoteServer::msg_collfreq(const std::string &term) { send_message(REPLY_COLLFREQ, encode_length(db->get_collection_freq(term))); } void -RemoteServer::msg_termfreq(const string &term) +RemoteServer::msg_termfreq(const std::string &term) { send_message(REPLY_TERMFREQ, encode_length(db->get_termfreq(term))); } void -RemoteServer::msg_freqs(const string &term) +RemoteServer::msg_freqs(const std::string &term) { - string msg = encode_length(db->get_termfreq(term)); + std::string msg = encode_length(db->get_termfreq(term)); msg += encode_length(db->get_collection_freq(term)); send_message(REPLY_FREQS, msg); } void -RemoteServer::msg_valuestats(const string & message) +RemoteServer::msg_valuestats(const std::string & message) { const char *p = message.data(); const char *p_end = p + message.size(); while (p != p_end) { Xapian::valueno slot; decode_length(&p, p_end, slot); - string message_out; + std::string message_out; message_out += encode_length(db->get_value_freq(slot)); - string bound = db->get_value_lower_bound(slot); + std::string bound = db->get_value_lower_bound(slot); message_out += encode_length(bound.size()); message_out += bound; bound = db->get_value_upper_bound(slot); @@ -603,7 +603,7 @@ } void -RemoteServer::msg_doclength(const string &message) +RemoteServer::msg_doclength(const std::string &message) { const char *p = message.data(); const char *p_end = p + message.size(); @@ -613,7 +613,7 @@ } void -RemoteServer::msg_uniqueterms(const string &message) +RemoteServer::msg_uniqueterms(const std::string &message) { const char *p = message.data(); const char *p_end = p + message.size(); @@ -623,7 +623,7 @@ } void -RemoteServer::msg_commit(const string &) +RemoteServer::msg_commit(const std::string &) { if (!wdb) throw_read_only(); @@ -634,14 +634,14 @@ } void -RemoteServer::msg_cancel(const string &message) +RemoteServer::msg_cancel(const std::string &message) { msg_cancel_(message); send_message(REPLY_DONE, string()); } void -RemoteServer::msg_cancel_(const string &) +RemoteServer::msg_cancel_(const std::string &) { if (!wdb) throw_read_only(); @@ -653,7 +653,7 @@ } void -RemoteServer::msg_adddocument(const string & message) +RemoteServer::msg_adddocument(const std::string & message) { if (!wdb) throw_read_only(); @@ -664,7 +664,7 @@ } void -RemoteServer::msg_deletedocument(const string & message) +RemoteServer::msg_deletedocument(const std::string & message) { if (!wdb) throw_read_only(); @@ -680,14 +680,14 @@ } void -RemoteServer::msg_deletedocumentterm(const string & message) +RemoteServer::msg_deletedocumentterm(const std::string & message) { msg_deletedocumentterm_(message); send_message(REPLY_DONE, string()); } void -RemoteServer::msg_deletedocumentterm_(const string & message) +RemoteServer::msg_deletedocumentterm_(const std::string & message) { if (!wdb) throw_read_only(); @@ -696,14 +696,14 @@ } void -RemoteServer::msg_replacedocument(const string & message) +RemoteServer::msg_replacedocument(const std::string & message) { msg_replacedocument_(message); send_message(REPLY_DONE, string()); } void -RemoteServer::msg_replacedocument_(const string & message) +RemoteServer::msg_replacedocument_(const std::string & message) { if (!wdb) throw_read_only(); @@ -717,7 +717,7 @@ } void -RemoteServer::msg_replacedocumentterm(const string & message) +RemoteServer::msg_replacedocumentterm(const std::string & message) { if (!wdb) throw_read_only(); @@ -726,7 +726,7 @@ const char *p_end = p + message.size(); size_t len; decode_length_and_check(&p, p_end, len); - string unique_term(p, len); + std::string unique_term(p, len); p += len; Xapian::docid did = wdb->replace_document(unique_term, unserialise_document(string(p, p_end))); @@ -735,24 +735,24 @@ } void -RemoteServer::msg_getmetadata(const string & message) +RemoteServer::msg_getmetadata(const std::string & message) { send_message(REPLY_METADATA, db->get_metadata(message)); } void -RemoteServer::msg_openmetadatakeylist(const string & message) +RemoteServer::msg_openmetadatakeylist(const std::string & message) { - string prev = message; - string reply; + std::string prev = message; + std::string reply; - const string & prefix = message; + const std::string & prefix = message; const Xapian::TermIterator end = db->metadata_keys_end(prefix); Xapian::TermIterator t = db->metadata_keys_begin(prefix); for (; t != end; ++t) { if (rare(prev.size() > 255)) prev.resize(255); - const string & v = *t; + const std::string & v = *t; size_t reuse = common_prefix_length(prev, v); reply.assign(1, char(reuse)); reply.append(v, reuse, string::npos); @@ -763,14 +763,14 @@ } void -RemoteServer::msg_setmetadata(const string & message) +RemoteServer::msg_setmetadata(const std::string & message) { msg_setmetadata_(message); send_message(REPLY_DONE, string()); } void -RemoteServer::msg_setmetadata_(const string & message) +RemoteServer::msg_setmetadata_(const std::string & message) { if (!wdb) throw_read_only(); @@ -778,21 +778,21 @@ const char *p_end = p + message.size(); size_t keylen; decode_length_and_check(&p, p_end, keylen); - string key(p, keylen); + std::string key(p, keylen); p += keylen; - string val(p, p_end - p); + std::string val(p, p_end - p); wdb->set_metadata(key, val); } void -RemoteServer::msg_addspelling(const string & message) +RemoteServer::msg_addspelling(const std::string & message) { msg_addspelling_(message); send_message(REPLY_DONE, string()); } void -RemoteServer::msg_addspelling_(const string & message) +RemoteServer::msg_addspelling_(const std::string & message) { if (!wdb) throw_read_only(); @@ -804,7 +804,7 @@ } void -RemoteServer::msg_removespelling(const string & message) +RemoteServer::msg_removespelling(const std::string & message) { if (!wdb) throw_read_only(); diff -ur xapian-core-1.4.21/net/remotetcpclient.cc xapian-core-1.4.21/net/remotetcpclient.cc --- xapian-core-1.4.21/net/remotetcpclient.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/remotetcpclient.cc 2022-11-08 16:44:15.596461088 +0100 @@ -30,7 +30,7 @@ using namespace std; int -RemoteTcpClient::open_socket(const string & hostname, int port, +RemoteTcpClient::open_socket(const std::string & hostname, int port, double timeout_connect) { // If TcpClient::open_socket() throws, fill in the context. @@ -46,9 +46,9 @@ } string -RemoteTcpClient::get_tcpcontext(const string & hostname, int port) +RemoteTcpClient::get_tcpcontext(const std::string & hostname, int port) { - string result("remote:tcp("); + std::string result("remote:tcp("); result += hostname; result += ':'; result += str(port); diff -ur xapian-core-1.4.21/net/remotetcpclient.h xapian-core-1.4.21/net/remotetcpclient.h --- xapian-core-1.4.21/net/remotetcpclient.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/remotetcpclient.h 2022-11-08 16:44:01.100512621 +0100 @@ -53,7 +53,7 @@ static int open_socket(const std::string & hostname, int port, double timeout_connect); - /** Get a context string for use when constructing Xapian::NetworkError. + /** Get a context std::string for use when constructing Xapian::NetworkError. * * Note: this method is used from constructors so has been made static to * avoid problems with trying to use uninitialised member variables. In diff -ur xapian-core-1.4.21/net/remotetcpserver.cc xapian-core-1.4.21/net/remotetcpserver.cc --- xapian-core-1.4.21/net/remotetcpserver.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/remotetcpserver.cc 2022-11-08 16:44:15.604461060 +0100 @@ -34,7 +34,7 @@ using namespace std; /// The RemoteTcpServer constructor, taking a database and a listening port. -RemoteTcpServer::RemoteTcpServer(const vector<std::string> &dbpaths_, +RemoteTcpServer::RemoteTcpServer(const std::vector<std::string> &dbpaths_, const std::string & host, int port, double active_timeout_, double idle_timeout_, bool writable_, bool verbose_) diff -ur xapian-core-1.4.21/net/replicatetcpclient.cc xapian-core-1.4.21/net/replicatetcpclient.cc --- xapian-core-1.4.21/net/replicatetcpclient.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/replicatetcpclient.cc 2022-11-08 16:44:15.596461088 +0100 @@ -29,7 +29,7 @@ using namespace std; -ReplicateTcpClient::ReplicateTcpClient(const string & hostname, int port, +ReplicateTcpClient::ReplicateTcpClient(const std::string & hostname, int port, double timeout_connect, double socket_timeout) : socket(open_socket(hostname, port, timeout_connect)), @@ -39,7 +39,7 @@ } int -ReplicateTcpClient::open_socket(const string & hostname, int port, +ReplicateTcpClient::open_socket(const std::string & hostname, int port, double timeout_connect) { return TcpClient::open_socket(hostname, port, timeout_connect, false); diff -ur xapian-core-1.4.21/net/replicatetcpserver.cc xapian-core-1.4.21/net/replicatetcpserver.cc --- xapian-core-1.4.21/net/replicatetcpserver.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/replicatetcpserver.cc 2022-11-08 16:44:15.600461075 +0100 @@ -28,8 +28,8 @@ using namespace std; -ReplicateTcpServer::ReplicateTcpServer(const string & host, int port, - const string & path_) +ReplicateTcpServer::ReplicateTcpServer(const std::string & host, int port, + const std::string & path_) : TcpServer(host, port, false, false), path(path_) { } @@ -43,13 +43,13 @@ RemoteConnection client(socket, -1); try { // Read start_revision from the client. - string start_revision; + std::string start_revision; if (client.get_message(start_revision, 0.0) != 'R') { throw Xapian::NetworkError("Bad replication client message"); } // Read dbname from the client. - string dbname; + std::string dbname; if (client.get_message(dbname, 0.0) != 'D') { throw Xapian::NetworkError("Bad replication client message (2)"); } @@ -57,7 +57,7 @@ throw Xapian::NetworkError("dbname contained '..'"); } - string dbpath(path); + std::string dbpath(path); dbpath += '/'; dbpath += dbname; Xapian::DatabaseMaster master(dbpath); diff -ur xapian-core-1.4.21/net/resolver.h xapian-core-1.4.21/net/resolver.h --- xapian-core-1.4.21/net/resolver.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/resolver.h 2022-11-08 16:44:01.096512634 +0100 @@ -27,7 +27,7 @@ #include "str.h" #include "xapian/error.h" -using namespace std; +using std::string; class Resolver { struct addrinfo* result = NULL; diff -ur xapian-core-1.4.21/net/serialise.cc xapian-core-1.4.21/net/serialise.cc --- xapian-core-1.4.21/net/serialise.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/serialise.cc 2022-11-08 16:44:15.596461088 +0100 @@ -41,7 +41,7 @@ string serialise_stats(const Xapian::Weight::Internal &stats) { - string result; + std::string result; result += encode_length(stats.total_length); result += encode_length(stats.collection_size); @@ -52,7 +52,7 @@ result += static_cast<char>(stats.have_max_part); result += encode_length(stats.termfreqs.size()); - map<string, TermFreqs>::const_iterator i; + std::map<string, TermFreqs>::const_iterator i; for (i = stats.termfreqs.begin(); i != stats.termfreqs.end(); ++i) { result += encode_length(i->first.size()); result += i->first; @@ -86,7 +86,7 @@ while (n--) { size_t len; decode_length_and_check(&p, p_end, len); - string term(p, len); + std::string term(p, len); p += len; Xapian::doccount termfreq; decode_length(&p, p_end, termfreq); @@ -112,7 +112,7 @@ string serialise_mset(const Xapian::MSet &mset) { - string result; + std::string result; result += encode_length(mset.get_firstitem()); // Send back the raw matches_* values. MSet::get_matches_estimated() @@ -172,7 +172,7 @@ double percent_factor = unserialise_double(&p, p_end); - vector<Xapian::Internal::MSetItem> items; + std::vector<Xapian::Internal::MSetItem> items; size_t msize; decode_length(&p, p_end, msize); while (msize-- > 0) { @@ -181,10 +181,10 @@ decode_length(&p, p_end, did); size_t len; decode_length_and_check(&p, p_end, len); - string sort_key(p, len); + std::string sort_key(p, len); p += len; decode_length_and_check(&p, p_end, len); - string key(p, len); + std::string key(p, len); p += len; Xapian::doccount collapse_cnt; decode_length(&p, p_end, collapse_cnt); @@ -216,7 +216,7 @@ string serialise_rset(const Xapian::RSet &rset) { - string result; + std::string result; const set<Xapian::docid> & items = rset.internal->get_items(); set<Xapian::docid>::const_iterator i; Xapian::docid lastdid = 0; @@ -229,7 +229,7 @@ } Xapian::RSet -unserialise_rset(const string &s) +unserialise_rset(const std::string &s) { Xapian::RSet rset; @@ -250,7 +250,7 @@ string serialise_document(const Xapian::Document &doc) { - string result; + std::string result; size_t n = doc.values_count(); result += encode_length(n); @@ -277,7 +277,7 @@ Xapian::termpos oldpos = 0; for (pos = term.positionlist_begin(); pos != term.positionlist_end(); ++pos) { Xapian::termpos diff = *pos - oldpos; - string delta = encode_length(diff); + std::string delta = encode_length(diff); result += delta; oldpos = *pos; --x; @@ -292,7 +292,7 @@ } Xapian::Document -unserialise_document(const string &s) +unserialise_document(const std::string &s) { Xapian::Document doc; const char * p = s.data(); @@ -314,7 +314,7 @@ while (n_terms--) { size_t len; decode_length_and_check(&p, p_end, len); - string term(p, len); + std::string term(p, len); p += len; // Set all the wdf using add_term, then pass wdf_inc 0 to add_posting. diff -ur xapian-core-1.4.21/net/serialise-error.cc xapian-core-1.4.21/net/serialise-error.cc --- xapian-core-1.4.21/net/serialise-error.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/serialise-error.cc 2022-11-08 16:44:15.604461060 +0100 @@ -33,7 +33,7 @@ serialise_error(const Xapian::Error &e) { // The byte before the type name is the type code. - string result(1, (e.get_type())[-1]); + std::string result(1, (e.get_type())[-1]); result += encode_length(e.get_context().length()); result += e.get_context(); result += encode_length(e.get_msg().length()); @@ -45,10 +45,10 @@ } void -unserialise_error(const string &serialised_error, const string &prefix, - const string &new_context) +unserialise_error(const std::string &serialised_error, const std::string &prefix, + const std::string &new_context) { - // Use c_str() so last string is nul-terminated. + // Use c_str() so last std::string is nul-terminated. const char * p = serialised_error.c_str(); const char * end = p + serialised_error.size(); if (p != end) { @@ -56,11 +56,11 @@ size_t len; decode_length_and_check(&p, end, len); - string context(p, len); + std::string context(p, len); p += len; decode_length_and_check(&p, end, len); - string msg(prefix); + std::string msg(prefix); msg.append(p, len); p += len; diff -ur xapian-core-1.4.21/net/serialise-error.h xapian-core-1.4.21/net/serialise-error.h --- xapian-core-1.4.21/net/serialise-error.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/serialise-error.h 2022-11-08 16:44:01.100512621 +0100 @@ -42,7 +42,7 @@ * * Note: does not return! * - * @param error_string The string to unserialise. + * @param error_string The std::string to unserialise. * @param prefix Optional prefix to prepend to the unserialised * Error's @a msg field. * @param new_context Optional context to replace the context in diff -ur xapian-core-1.4.21/net/serialise.h xapian-core-1.4.21/net/serialise.h --- xapian-core-1.4.21/net/serialise.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/serialise.h 2022-11-08 16:44:01.096512634 +0100 @@ -59,8 +59,8 @@ /** Unserialise a serialised Xapian::MSet object. * - * @param p Pointer to the start of the string to unserialise. - * @param p_end Pointer to the end of the string to unserialise. + * @param p Pointer to the start of the std::string to unserialise. + * @param p_end Pointer to the end of the std::string to unserialise. * * @return The unserialised Xapian::MSet object. */ diff -ur xapian-core-1.4.21/net/tcpserver.cc xapian-core-1.4.21/net/tcpserver.cc --- xapian-core-1.4.21/net/tcpserver.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/tcpserver.cc 2022-11-08 16:44:15.596461088 +0100 @@ -126,7 +126,7 @@ // the same port, so we guard against that by using a named win32 mutex // object (and we create it in the 'Global namespace' so that this // still works in a Terminal Services environment). - string name = "Global\\xapian-tcpserver-listening-" + str(port); + std::string name = "Global\\xapian-tcpserver-listening-" + str(port); if ((mutex = CreateMutex(NULL, TRUE, name.c_str())) == NULL) { // We failed to create the mutex, probably the error is // ERROR_ACCESS_DENIED, which simply means that TcpServer is diff -ur xapian-core-1.4.21/net/tcpserver.h xapian-core-1.4.21/net/tcpserver.h --- xapian-core-1.4.21/net/tcpserver.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/net/tcpserver.h 2022-11-08 16:44:01.100512621 +0100 @@ -57,7 +57,7 @@ /** Create a listening socket ready to accept connections. * - * @param host hostname or address to listen on or an empty string to + * @param host hostname or address to listen on or an empty std::string to * accept connections on any interface. * @param port TCP port to listen on. * @param tcp_nodelay If true, enable TCP_NODELAY option. diff -ur xapian-core-1.4.21/queryparser/queryparser.cc xapian-core-1.4.21/queryparser/queryparser.cc --- xapian-core-1.4.21/queryparser/queryparser.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/queryparser/queryparser.cc 2022-11-08 16:44:15.436461657 +0100 @@ -46,7 +46,7 @@ string SimpleStopper::get_description() const { - string desc("Xapian::SimpleStopper("); + std::string desc("Xapian::SimpleStopper("); set<string>::const_iterator i; for (i = stop_words.begin(); i != stop_words.end(); ++i) { if (i != stop_words.begin()) desc += ' '; @@ -158,8 +158,8 @@ } Query -QueryParser::parse_query(const string &query_string, unsigned flags, - const string &default_prefix) +QueryParser::parse_query(const std::string &query_string, unsigned flags, + const std::string &default_prefix) { if (!(flags & FLAG_ACCUMULATE)) { internal->stoplist.clear(); @@ -180,21 +180,21 @@ } void -QueryParser::add_prefix(const string &field, const string &prefix) +QueryParser::add_prefix(const std::string &field, const std::string &prefix) { Assert(internal.get()); internal->add_prefix(field, prefix); } void -QueryParser::add_prefix(const string &field, Xapian::FieldProcessor * proc) +QueryParser::add_prefix(const std::string &field, Xapian::FieldProcessor * proc) { Assert(internal.get()); internal->add_prefix(field, proc); } void -QueryParser::add_boolean_prefix(const string &field, const string &prefix, +QueryParser::add_boolean_prefix(const std::string &field, const std::string &prefix, const string* grouping) { Assert(internal.get()); @@ -202,7 +202,7 @@ } void -QueryParser::add_boolean_prefix(const string &field, +QueryParser::add_boolean_prefix(const std::string &field, Xapian::FieldProcessor * proc, const string* grouping) { @@ -213,17 +213,17 @@ TermIterator QueryParser::stoplist_begin() const { - const list<string> & sl = internal->stoplist; + const std::list<string> & sl = internal->stoplist; return TermIterator(new VectorTermList(sl.begin(), sl.end())); } TermIterator -QueryParser::unstem_begin(const string &term) const +QueryParser::unstem_begin(const std::string &term) const { struct range_adaptor : public multimap<string, string>::iterator { range_adaptor(multimap<string, string>::iterator i) : multimap<string, string>::iterator(i) {} - const string & operator*() const { return (*this)->second; } + const std::string & operator*() const { return (*this)->second; } }; auto range = internal->unstem.equal_range(term); return TermIterator(new VectorTermList(range_adaptor(range.first), diff -ur xapian-core-1.4.21/queryparser/queryparser_internal.cc xapian-core-1.4.21/queryparser/queryparser_internal.cc --- xapian-core-1.4.21/queryparser/queryparser_internal.cc 2022-09-22 07:29:21.000000000 +0200 +++ xapian-core-1.4.21/queryparser/queryparser_internal.cc 2022-11-08 16:44:15.440461643 +0100 @@ -134,7 +134,7 @@ } inline bool -prefix_needs_colon(const string & prefix, unsigned ch) +prefix_needs_colon(const std::string & prefix, unsigned ch) { if (!U_isupper(ch) && ch != ':') return false; string::size_type len = prefix.length(); @@ -161,32 +161,32 @@ State * state; public: - string name; + std::string name; const FieldInfo * field_info; - string unstemmed; + std::string unstemmed; QueryParser::stem_strategy stem; termpos pos; Query query; - Term(const string &name_, termpos pos_) + Term(const std::string &name_, termpos pos_) : name(name_), stem(QueryParser::STEM_NONE), pos(pos_) { } - explicit Term(const string &name_) + explicit Term(const std::string &name_) : name(name_), stem(QueryParser::STEM_NONE), pos(0) { } - Term(const string &name_, const FieldInfo * field_info_) + Term(const std::string &name_, const FieldInfo * field_info_) : name(name_), field_info(field_info_), stem(QueryParser::STEM_NONE), pos(0) { } explicit Term(termpos pos_) : stem(QueryParser::STEM_NONE), pos(pos_) { } - Term(State * state_, const string &name_, const FieldInfo * field_info_, - const string &unstemmed_, + Term(State * state_, const std::string &name_, const FieldInfo * field_info_, + const std::string &unstemmed_, QueryParser::stem_strategy stem_ = QueryParser::STEM_NONE, termpos pos_ = 0) : state(state_), name(name_), field_info(field_info_), unstemmed(unstemmed_), stem(stem_), pos(pos_) { } // For RANGE tokens. - Term(const Xapian::Query & q, const string & grouping) + Term(const Xapian::Query & q, const std::string & grouping) : name(grouping), query(q) { } - string make_term(const string & prefix) const; + std::string make_term(const std::string & prefix) const; void need_positions() { if (stem == QueryParser::STEM_SOME) stem = QueryParser::STEM_NONE; @@ -194,13 +194,13 @@ termpos get_termpos() const { return pos; } - string get_grouping() const { + std::string get_grouping() const { return field_info->grouping; } Query * as_wildcarded_query(State * state) const; - /** Build a query for a term at the very end of the query string when + /** Build a query for a term at the very end of the query std::string when * FLAG_PARTIAL is in use. * * This query should match documents containing any terms which start with @@ -210,10 +210,10 @@ */ Query * as_partial_query(State * state_) const; - /** Build a query for a string of CJK characters. */ + /** Build a query for a std::string of CJK characters. */ Query * as_cjk_query() const; - /** Handle a CJK character string in a positional context. */ + /** Handle a CJK character std::string in a positional context. */ void as_positional_cjk_term(Terms * terms) const; /// Range query. @@ -246,7 +246,7 @@ } } - string stem_term(const string &term) { + std::string stem_term(const std::string &term) { return qpi->stemmer(term); } @@ -254,11 +254,11 @@ qpi->stoplist.push_back(term->name); } - void add_to_unstem(const string & term, const string & unstemmed) { + void add_to_unstem(const std::string & term, const std::string & unstemmed) { qpi->unstem.insert(make_pair(term, unstemmed)); } - Term * range(const string &a, const string &b) { + Term * range(const std::string &a, const std::string &b) { for (auto i : qpi->rangeprocs) { Xapian::Query range_query = (i.proc)->check_range(a, b); Xapian::Query::op op = range_query.get_type(); @@ -327,9 +327,9 @@ }; string -Term::make_term(const string & prefix) const +Term::make_term(const std::string & prefix) const { - string term; + std::string term; if (stem != QueryParser::STEM_NONE && stem != QueryParser::STEM_ALL) term += 'Z'; if (!prefix.empty()) { @@ -403,7 +403,7 @@ for (auto&& prefix : prefixes) { // First try the unstemmed term: - string term; + std::string term; if (!prefix.empty()) { term += prefix; if (prefix_needs_colon(prefix, name[0])) term += ':'; @@ -499,7 +499,7 @@ const auto& prefixes = field_info->prefixes; Xapian::termcount max = state_->get_max_wildcard_expansion(); int max_type = state_->get_max_wildcard_type(); - vector<Query> subqs; + std::vector<Query> subqs; subqs.reserve(prefixes.size()); for (string root : prefixes) { root += name; @@ -517,11 +517,11 @@ { Xapian::termcount max = state_->get_max_partial_expansion(); int max_type = state_->get_max_partial_type(); - vector<Query> subqs_partial; // A synonym of all the partial terms. - vector<Query> subqs_full; // A synonym of all the full terms. + std::vector<Query> subqs_partial; // A synonym of all the partial terms. + std::vector<Query> subqs_full; // A synonym of all the full terms. for (const string& prefix : field_info->prefixes) { - string root = prefix; + std::string root = prefix; root += name; // Combine with OP_OR, and apply OP_SYNONYM afterwards. subqs_partial.push_back(Query(Query::OP_WILDCARD, root, max, max_type, @@ -541,8 +541,8 @@ Query * Term::as_cjk_query() const { - vector<Query> prefix_subqs; - vector<Query> cjk_subqs; + std::vector<Query> prefix_subqs; + std::vector<Query> cjk_subqs; const auto& prefixes = field_info->prefixes; for (const string& prefix : prefixes) { for (CJKTokenIterator tk(name); tk != CJKTokenIterator(); ++tk) { @@ -582,7 +582,7 @@ } inline bool -should_stem(const string & term) +should_stem(const std::string & term) { const unsigned int SHOULD_STEM_MASK = (1 << Unicode::LOWERCASE_LETTER) | @@ -644,9 +644,9 @@ static void yy_parse_failed(yyParser *); void -QueryParser::Internal::add_prefix(const string &field, const string &prefix) +QueryParser::Internal::add_prefix(const std::string &field, const std::string &prefix) { - map<string, FieldInfo>::iterator p = field_map.find(field); + std::map<string, FieldInfo>::iterator p = field_map.find(field); if (p == field_map.end()) { field_map.insert(make_pair(field, FieldInfo(NON_BOOLEAN, prefix))); } else { @@ -655,15 +655,15 @@ throw Xapian::InvalidOperationError("Can't use add_prefix() and add_boolean_prefix() on the same field name, or add_boolean_prefix() with different values of the 'exclusive' parameter"); } if (p->second.proc.get()) - throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and string prefixes currently not supported"); + throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and std::string prefixes currently not supported"); p->second.prefixes.push_back(prefix); } } void -QueryParser::Internal::add_prefix(const string &field, FieldProcessor *proc) +QueryParser::Internal::add_prefix(const std::string &field, FieldProcessor *proc) { - map<string, FieldInfo>::iterator p = field_map.find(field); + std::map<string, FieldInfo>::iterator p = field_map.find(field); if (p == field_map.end()) { field_map.insert(make_pair(field, FieldInfo(NON_BOOLEAN, proc))); } else { @@ -672,14 +672,14 @@ throw Xapian::InvalidOperationError("Can't use add_prefix() and add_boolean_prefix() on the same field name, or add_boolean_prefix() with different values of the 'exclusive' parameter"); } if (!p->second.prefixes.empty()) - throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and string prefixes currently not supported"); + throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and std::string prefixes currently not supported"); throw Xapian::FeatureUnavailableError("Multiple FieldProcessor objects for the same prefix currently not supported"); } } void -QueryParser::Internal::add_boolean_prefix(const string &field, - const string &prefix, +QueryParser::Internal::add_boolean_prefix(const std::string &field, + const std::string &prefix, const string* grouping) { // Don't allow the empty prefix to be set as boolean as it doesn't @@ -688,7 +688,7 @@ throw Xapian::UnimplementedError("Can't set the empty prefix to be a boolean filter"); if (!grouping) grouping = &field; filter_type type = grouping->empty() ? BOOLEAN : BOOLEAN_EXCLUSIVE; - map<string, FieldInfo>::iterator p = field_map.find(field); + std::map<string, FieldInfo>::iterator p = field_map.find(field); if (p == field_map.end()) { field_map.insert(make_pair(field, FieldInfo(type, prefix, *grouping))); } else { @@ -697,13 +697,13 @@ throw Xapian::InvalidOperationError("Can't use add_prefix() and add_boolean_prefix() on the same field name, or add_boolean_prefix() with different values of the 'exclusive' parameter"); // FIXME } if (p->second.proc.get()) - throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and string prefixes currently not supported"); + throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and std::string prefixes currently not supported"); p->second.prefixes.push_back(prefix); // FIXME grouping } } void -QueryParser::Internal::add_boolean_prefix(const string &field, +QueryParser::Internal::add_boolean_prefix(const std::string &field, FieldProcessor *proc, const string* grouping) { @@ -713,7 +713,7 @@ throw Xapian::UnimplementedError("Can't set the empty prefix to be a boolean filter"); if (!grouping) grouping = &field; filter_type type = grouping->empty() ? BOOLEAN : BOOLEAN_EXCLUSIVE; - map<string, FieldInfo>::iterator p = field_map.find(field); + std::map<string, FieldInfo>::iterator p = field_map.find(field); if (p == field_map.end()) { field_map.insert(make_pair(field, FieldInfo(type, proc, *grouping))); } else { @@ -722,7 +722,7 @@ throw Xapian::InvalidOperationError("Can't use add_prefix() and add_boolean_prefix() on the same field name, or add_boolean_prefix() with different values of the 'exclusive' parameter"); // FIXME } if (!p->second.prefixes.empty()) - throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and string prefixes currently not supported"); + throw Xapian::FeatureUnavailableError("Mixing FieldProcessor objects and std::string prefixes currently not supported"); throw Xapian::FeatureUnavailableError("Multiple FieldProcessor objects for the same prefix currently not supported"); } } @@ -732,11 +732,11 @@ bool cjk_ngram, bool & is_cjk_term, bool &was_acronym) { - string term; + std::string term; // Look for initials separated by '.' (e.g. P.T.O., U.N.C.L.E). // Don't worry if there's a trailing '.' or not. if (U_isupper(*it)) { - string t; + std::string t; Utf8Iterator p = it; do { Unicode::append_utf8(t, *p++); @@ -789,7 +789,7 @@ prevch = ch; } if (it != end && is_suffix(*it)) { - string suff_term = term; + std::string suff_term = term; Utf8Iterator p = it; // Keep trailing + (e.g. C++, Na+) or # (e.g. C#). do { @@ -805,7 +805,7 @@ // the case when QueryParser::set_database() hasn't // been called. bool use_suff_term = false; - string lc = Unicode::tolower(suff_term); + std::string lc = Unicode::tolower(suff_term); if (db.term_exists(lc)) { use_suff_term = true; } else { @@ -832,7 +832,7 @@ // filter is a map from prefix to a query for that prefix. Queries with // the same prefix are combined with OR, and the results of this are // combined with AND to get the full filter. - map<string, Query> filter; + std::map<string, Query> filter; ProbQuery() {} @@ -888,7 +888,7 @@ /// A group of terms separated only by whitespace. class TermGroup { - vector<Term *> terms; + std::vector<Term *> terms; /** Controls how to handle a group where all terms are stopwords. * @@ -934,20 +934,20 @@ bool default_op_is_positional = is_positional(state->default_op()); reprocess: Query::op default_op = state->default_op(); - vector<Query> subqs; + std::vector<Query> subqs; subqs.reserve(terms.size()); if (state->flags & QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS) { // Check for multi-word synonyms. Database db = state->get_database(); - string key; + std::string key; vector<Term*>::size_type begin = 0; vector<Term*>::size_type i = begin; while (terms.size() - i > 0) { size_t longest_match = 0; // This value is never used, but GCC 4.8 warns with // -Wmaybe-uninitialized (GCC 5.4 doesn't). - vector<Term*>::size_type longest_match_end = 0; + std::vector<Term*>::size_type longest_match_end = 0; if (terms.size() - i >= 2) { // Greedily try to match as many consecutive words as possible. key = terms[i]->name; @@ -989,7 +989,7 @@ i = longest_match_end; key.resize(longest_match); - vector<Query> subqs2; + std::vector<Query> subqs2; for (auto j = begin; j != i; ++j) { if (stopper && (*stopper)(terms[j]->name)) { state->add_to_stoplist(terms[j]); @@ -1056,7 +1056,7 @@ /// Some terms which form a positional sub-query. class Terms { - vector<Term *> terms; + std::vector<Term *> terms; /** Window size. * @@ -1079,10 +1079,10 @@ /** The list of prefixes of the terms added. * This will be NULL if the terms have different prefixes. */ - const vector<string>* prefixes; + const std::vector<string>* prefixes; Query opwindow_subq(Query::op op, - const vector<Query>& v, + const std::vector<Query>& v, Xapian::termcount w) const { if (op == Query::OP_AND) { return Query(op, v.begin(), v.end()); @@ -1099,7 +1099,7 @@ if (uniform_prefixes) { if (prefixes) { for (auto&& prefix : *prefixes) { - vector<Query> subqs; + std::vector<Query> subqs; subqs.reserve(n_terms); for (Term* t : terms) { subqs.push_back(Query(t->make_term(prefix), 1, t->pos)); @@ -1108,7 +1108,7 @@ } } } else { - vector<Query> subqs; + std::vector<Query> subqs; subqs.reserve(n_terms); for (Term* t : terms) { subqs.push_back(t->get_query()); @@ -1186,7 +1186,7 @@ Term::as_positional_cjk_term(Terms * terms) const { // Add each individual CJK character to the phrase. - string t; + std::string t; for (Utf8Iterator it(name); it != Utf8Iterator(); ++it) { Unicode::append_utf8(t, *it); Term * c = new Term(state, t, field_info, unstemmed, stem, pos); @@ -1527,7 +1527,7 @@ int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ - vector<yyStackEntry> yystack; /* The parser's stack */ + std::vector<yyStackEntry> yystack; /* The parser's stack */ yyParser() { ParseInit(this); } @@ -2233,7 +2233,7 @@ case 1: /* query ::= */ #line 1868 "queryparser/queryparser.lemony" { - // Handle a query string with no terms in. + // Handle a query std::string with no terms in. state->query = Query(); } #line 2240 "queryparser/queryparser_internal.cc" @@ -2359,7 +2359,7 @@ case 10: /* prob ::= RANGE */ #line 1987 "queryparser/queryparser.lemony" { - string grouping = yymsp[0].minor.yy0->name; + std::string grouping = yymsp[0].minor.yy0->name; const Query & range = yymsp[0].minor.yy0->as_range_query(); yymsp[0].minor.yy40 = new ProbQuery; /*P-overwrites-R*/ yymsp[0].minor.yy40->add_filter_range(grouping, range); @@ -2369,7 +2369,7 @@ case 11: /* prob ::= stop_prob RANGE */ #line 1994 "queryparser/queryparser.lemony" { - string grouping = yymsp[0].minor.yy0->name; + std::string grouping = yymsp[0].minor.yy0->name; const Query & range = yymsp[0].minor.yy0->as_range_query(); yymsp[-1].minor.yy40->append_filter_range(grouping, range); } @@ -2970,8 +2970,8 @@ Query -QueryParser::Internal::parse_query(const string &qs, unsigned flags, - const string &default_prefix) +QueryParser::Internal::parse_query(const std::string &qs, unsigned flags, + const std::string &default_prefix) { bool cjk_ngram = (flags & FLAG_CJK_NGRAM) || CJK::is_cjk_enabled(); @@ -2989,7 +2989,7 @@ corrected_query.resize(0); // Stack of prefixes, used for phrases and subexpressions. - list<const FieldInfo *> prefix_stack; + std::list<const FieldInfo *> prefix_stack; // If default_prefix is specified, use it. Otherwise, use any list // that has been set for the empty prefix. @@ -3048,7 +3048,7 @@ unsigned ch = 0; while (p != end) { if (ch == '.' && *p == '.') { - string a; + std::string a; while (it != p) { Unicode::append_utf8(a, *it++); } @@ -3058,7 +3058,7 @@ // Either end of the range can be empty (for an open-ended // range) but both can't be empty. if (!a.empty() || (p != end && *p > ' ' && *p != ')')) { - string b; + std::string b; // Allow any character except whitespace and ')' in the // upper bound. while (p != end && *p > ' ' && *p != ')') { @@ -3231,11 +3231,11 @@ // Check for a fieldname prefix (e.g. title:historical). Utf8Iterator p = find_if(it, end, is_not_wordchar); if (p != end && *p == ':' && ++p != end && *p > ' ' && *p != ')') { - string field; + std::string field; p = it; while (*p != ':') Unicode::append_utf8(field, *p++); - map<string, FieldInfo>::const_iterator f; + std::map<string, FieldInfo>::const_iterator f; f = field_map.find(field); if (f != field_map.end()) { // Special handling for prefixed fields, depending on the @@ -3248,7 +3248,7 @@ if (mode == IN_GROUP || mode == IN_GROUP2) mode = DEFAULT; it = p; - string name; + std::string name; if (it != end && is_double_quote(*it)) { // Quoted boolean term (can contain any character). bool fancy = (*it != '"'); @@ -3333,7 +3333,7 @@ phrased_term: bool was_acronym; bool is_cjk_term = false; - string term = parse_term(it, end, cjk_ngram, is_cjk_term, was_acronym); + std::string term = parse_term(it, end, cjk_ngram, is_cjk_term, was_acronym); if ((mode == DEFAULT || mode == IN_GROUP || mode == IN_GROUP2) && (flags & FLAG_BOOLEAN) && @@ -3342,7 +3342,7 @@ !field_info && term.size() >= 2 && term.size() <= 4 && U_isalpha(term[0])) { // Boolean operators. - string op = term; + std::string op = term; if (flags & FLAG_BOOLEAN_ANY_CASE) { for (string::iterator i = op.begin(); i != op.end(); ++i) { *i = C_toupper(*i); @@ -3410,7 +3410,7 @@ Assert(field_info->type == NON_BOOLEAN); { - string unstemmed_term(term); + std::string unstemmed_term(term); term = Unicode::tolower(term); // Reuse stem_strategy - STEM_SOME here means "stem terms except @@ -3482,7 +3482,7 @@ for (const string& prefix : prefixes) { if (!prefix.empty()) continue; - const string & suggest = db.get_spelling_suggestion(term); + const std::string & suggest = db.get_spelling_suggestion(term); if (!suggest.empty()) { if (corrected_query.empty()) corrected_query = qs; size_t term_end_index = it.raw() - qs.data(); diff -ur xapian-core-1.4.21/queryparser/queryparser_internal.h xapian-core-1.4.21/queryparser/queryparser_internal.h --- xapian-core-1.4.21/queryparser/queryparser_internal.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/queryparser/queryparser_internal.h 2022-11-08 16:48:12.763618017 +0100 @@ -32,7 +32,7 @@ #include <list> #include <map> -using namespace std; +using std::string; class State; @@ -43,10 +43,10 @@ /// The type of this field. filter_type type; - string grouping; + std::string grouping; /// Field prefix strings. - vector<string> prefixes; + std::vector<string> prefixes; /// Field processor. Currently only one is supported. Xapian::Internal::opt_intrusive_ptr<Xapian::FieldProcessor> proc; @@ -89,16 +89,16 @@ Query::op default_op; const char * errmsg; Database db; - list<string> stoplist; - multimap<string, string> unstem; + std::list<string> stoplist; + std::multimap<string, string> unstem; // Map "from" -> "A" ; "subject" -> "C" ; "newsgroups" -> "G" ; // "foobar" -> "XFOO". FIXME: it does more than this now! - map<string, FieldInfo> field_map; + std::map<string, FieldInfo> field_map; - list<RangeProc> rangeprocs; + std::list<RangeProc> rangeprocs; - string corrected_query; + std::string corrected_query; Xapian::termcount max_wildcard_expansion; @@ -108,14 +108,14 @@ int max_partial_type; - void add_prefix(const string &field, const string &prefix); + void add_prefix(const std::string &field, const std::string &prefix); - void add_prefix(const string &field, Xapian::FieldProcessor *proc); + void add_prefix(const std::string &field, Xapian::FieldProcessor *proc); - void add_boolean_prefix(const string &field, const string &prefix, + void add_boolean_prefix(const std::string &field, const std::string &prefix, const string* grouping); - void add_boolean_prefix(const string &field, Xapian::FieldProcessor *proc, + void add_boolean_prefix(const std::string &field, Xapian::FieldProcessor *proc, const string* grouping); std::string parse_term(Utf8Iterator &it, const Utf8Iterator &end, @@ -129,7 +129,7 @@ max_wildcard_type(Xapian::Query::WILDCARD_LIMIT_ERROR), max_partial_type(Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT) { } - Query parse_query(const string & query_string, unsigned int flags, const string & default_prefix); + Query parse_query(const std::string & query_string, unsigned int flags, const std::string & default_prefix); }; } diff -ur xapian-core-1.4.21/queryparser/termgenerator.cc xapian-core-1.4.21/queryparser/termgenerator.cc --- xapian-core-1.4.21/queryparser/termgenerator.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/queryparser/termgenerator.cc 2022-11-08 16:44:15.436461657 +0100 @@ -108,7 +108,7 @@ void TermGenerator::index_text(const Xapian::Utf8Iterator & itor, Xapian::termcount weight, - const string & prefix) + const std::string & prefix) { internal->index_text(itor, weight, prefix, true); } @@ -116,7 +116,7 @@ void TermGenerator::index_text_without_positions(const Xapian::Utf8Iterator & itor, Xapian::termcount weight, - const string & prefix) + const std::string & prefix) { internal->index_text(itor, weight, prefix, false); } @@ -142,7 +142,7 @@ string TermGenerator::get_description() const { - string s("Xapian::TermGenerator(stem="); + std::string s("Xapian::TermGenerator(stem="); s += internal->stemmer.get_description(); if (internal->stopper.get()) { s += ", stopper set"; diff -ur xapian-core-1.4.21/queryparser/termgenerator_internal.cc xapian-core-1.4.21/queryparser/termgenerator_internal.cc --- xapian-core-1.4.21/queryparser/termgenerator_internal.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/queryparser/termgenerator_internal.cc 2022-11-08 16:44:15.432461672 +0100 @@ -151,7 +151,7 @@ ++itor; } - string term; + std::string term; // Look for initials separated by '.' (e.g. P.T.O., U.N.C.L.E). // Don't worry if there's a trailing '.' or not. if (U_isupper(*itor)) { @@ -248,7 +248,7 @@ void TermGenerator::Internal::index_text(Utf8Iterator itor, termcount wdf_inc, - const string & prefix, bool with_positions) + const std::string & prefix, bool with_positions) { bool cjk_ngram = (flags & FLAG_CJK_NGRAM) || CJK::is_cjk_enabled(); @@ -266,7 +266,7 @@ // don't allow `this` here. , this #endif - ](const string & term, bool positional, const Utf8Iterator &) { + ](const std::string & term, bool positional, const Utf8Iterator &) { if (term.size() > max_word_length) return true; if (current_stop_mode == TermGenerator::STOP_ALL && @@ -306,7 +306,7 @@ // Add stemmed form without positional information. const string& stem = stemmer(term); if (rare(stem.empty())) return true; - string stemmed_term; + std::string stemmed_term; if (strategy != TermGenerator::STEM_ALL) { stemmed_term += "Z"; } @@ -363,11 +363,11 @@ void done(); - bool drain(const string & input, - const string & hi_start, - const string & hi_end, - const string & omit, - string & output); + bool drain(const std::string & input, + const std::string & hi_start, + const std::string & hi_end, + const std::string & omit, + std::string & output); }; #define DECAY 2.0 @@ -540,11 +540,11 @@ } inline bool -SnipPipe::drain(const string & input, - const string & hi_start, - const string & hi_end, - const string & omit, - string & output) +SnipPipe::drain(const std::string & input, + const std::string & hi_start, + const std::string & hi_end, + const std::string & omit, + std::string & output) { if (best_pipe.empty() && !pipe.empty()) { swap(best_pipe, pipe); @@ -681,9 +681,9 @@ static void check_query(const Xapian::Query & query, - list<vector<string>> & exact_phrases, + std::list<vector<string>> & exact_phrases, unordered_map<string, double> & loose_terms, - list<string> & wildcards, + std::list<string> & wildcards, size_t & longest_phrase) { // FIXME: OP_NEAR, non-tight OP_PHRASE, OP_PHRASE with non-term subqueries @@ -709,7 +709,7 @@ // Tight phrase of terms. exact_phrases.push_back(vector<string>()); - vector<string> & terms = exact_phrases.back(); + std::vector<string> & terms = exact_phrases.back(); terms.reserve(n_subqs); for (size_t i = 0; i != n_subqs; ++i) { Xapian::Query q = query.get_subquery(i); @@ -730,7 +730,7 @@ static double* check_term(unordered_map<string, double> & loose_terms, const Xapian::Weight::Internal * stats, - const string & term, + const std::string & term, double max_tw) { auto it = loose_terms.find(term); @@ -750,13 +750,13 @@ } string -MSet::Internal::snippet(const string & text, +MSet::Internal::snippet(const std::string & text, size_t length, const Xapian::Stem & stemmer, unsigned flags, - const string & hi_start, - const string & hi_end, - const string & omit) const + const std::string & hi_start, + const std::string & hi_end, + const std::string & omit) const { if (hi_start.empty() && hi_end.empty() && text.size() <= length) { // Too easy! @@ -787,21 +787,21 @@ } SnipPipe snip(length); - list<vector<string>> exact_phrases; + std::list<vector<string>> exact_phrases; unordered_map<string, double> loose_terms; - list<string> wildcards; + std::list<string> wildcards; size_t longest_phrase = 0; check_query(query, exact_phrases, loose_terms, wildcards, longest_phrase); - vector<double> exact_phrases_relevance; + std::vector<double> exact_phrases_relevance; exact_phrases_relevance.reserve(exact_phrases.size()); for (auto&& terms : exact_phrases) { // FIXME: What relevance to use? exact_phrases_relevance.push_back(max_tw * terms.size()); } - vector<double> wildcards_relevance; + std::vector<double> wildcards_relevance; wildcards_relevance.reserve(exact_phrases.size()); for (auto&& pattern : wildcards) { // FIXME: What relevance to use? @@ -813,12 +813,12 @@ // between calls to MSet::snippet() on the same object. unordered_map<string, double>& background = snippet_bg_relevance; - vector<string> phrase; + std::vector<string> phrase; if (longest_phrase) phrase.resize(longest_phrase - 1); size_t phrase_next = 0; bool matchfound = false; parse_terms(Utf8Iterator(text), cjk_ngram, true, - [&](const string & term, bool positional, const Utf8Iterator & it) { + [&](const std::string & term, bool positional, const Utf8Iterator & it) { // FIXME: Don't hardcode this here. const size_t max_word_length = 64; @@ -861,7 +861,7 @@ goto relevance_done; } - string stem = "Z"; + std::string stem = "Z"; stem += stemmer(term); relevance = check_term(loose_terms, stats, stem, max_tw); if (relevance) { @@ -923,7 +923,7 @@ if (queryterms.find(term) != queryterms.end()) { relevance = term.size() * 3; } else { - string stem = "Z"; + std::string stem = "Z"; stem += stemmer(term); if (queryterms.find(stem) != queryterms.end()) { relevance = term.size() * 2; @@ -970,7 +970,7 @@ snip.done(); // Put together the snippet. - string result; + std::string result; if (matchfound || (flags & SNIPPET_EMPTY_WITHOUT_MATCH) == 0) { while (snip.drain(text, hi_start, hi_end, omit, result)) { } } diff -ur xapian-core-1.4.21/tests/api_anydb.cc xapian-core-1.4.21/tests/api_anydb.cc --- xapian-core-1.4.21/tests/api_anydb.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_anydb.cc 2022-11-08 16:44:15.544461274 +0100 @@ -61,13 +61,13 @@ static Xapian::Query query(Xapian::Query::op op, - const string & t1 = string(), const string & t2 = string(), - const string & t3 = string(), const string & t4 = string(), - const string & t5 = string(), const string & t6 = string(), - const string & t7 = string(), const string & t8 = string(), - const string & t9 = string(), const string & t10 = string()) + const std::string & t1 = string(), const std::string & t2 = string(), + const std::string & t3 = string(), const std::string & t4 = string(), + const std::string & t5 = string(), const std::string & t6 = string(), + const std::string & t7 = string(), const std::string & t8 = string(), + const std::string & t9 = string(), const std::string & t10 = string()) { - vector<string> v; + std::vector<string> v; Xapian::Stem stemmer("english"); if (!t1.empty()) v.push_back(stemmer(t1)); if (!t2.empty()) v.push_back(stemmer(t2)); @@ -84,13 +84,13 @@ static Xapian::Query query(Xapian::Query::op op, Xapian::termcount parameter, - const string & t1 = string(), const string & t2 = string(), - const string & t3 = string(), const string & t4 = string(), - const string & t5 = string(), const string & t6 = string(), - const string & t7 = string(), const string & t8 = string(), - const string & t9 = string(), const string & t10 = string()) + const std::string & t1 = string(), const std::string & t2 = string(), + const std::string & t3 = string(), const std::string & t4 = string(), + const std::string & t5 = string(), const std::string & t6 = string(), + const std::string & t7 = string(), const std::string & t8 = string(), + const std::string & t9 = string(), const std::string & t10 = string()) { - vector<string> v; + std::vector<string> v; Xapian::Stem stemmer("english"); if (!t1.empty()) v.push_back(stemmer(t1)); if (!t2.empty()) v.push_back(stemmer(t2)); @@ -106,7 +106,7 @@ } static Xapian::Query -query(const string &t) +query(const std::string &t) { return Xapian::Query(Xapian::Stem("english")(t)); } @@ -151,7 +151,7 @@ TEST_EQUAL(mymset.get_uncollapsed_matches_upper_bound(), 0); TEST_EQUAL(mymset.get_uncollapsed_matches_estimated(), 0); - vector<Xapian::Query> v; + std::vector<Xapian::Query> v; enquire.set_query(Xapian::Query(Xapian::Query::OP_AND, v.begin(), v.end())); mymset = enquire.get_mset(0, 10); TEST_MSET_SIZE(mymset, 0); @@ -566,7 +566,7 @@ class EvenParityExpandFunctor : public Xapian::ExpandDecider { public: - bool operator()(const string & tname) const { + bool operator()(const std::string & tname) const { unsigned long sum = 0; for (unsigned ch : tname) { sum += ch; @@ -656,7 +656,7 @@ // Choose the first char in the first term as prefix. Xapian::ESetIterator j = myeset_orig.begin(); TEST(myeset_orig.size() >= 1); - string prefix(*j, 0, 1); + std::string prefix(*j, 0, 1); Xapian::ExpandDeciderFilterPrefix myfunctor(prefix); for ( ; j != myeset_orig.end(); ++j) { @@ -851,7 +851,7 @@ // tests the allow query terms expand option DEFINE_TESTCASE(allowqterms1, backend) { Xapian::Enquire enquire(get_database("apitest_simpledata")); - string term = "paragraph"; + std::string term = "paragraph"; enquire.set_query(Xapian::Query(term)); Xapian::MSet mymset = enquire.get_mset(0, 10); @@ -983,7 +983,7 @@ // tests that get_matching_terms() returns the terms in the right order DEFINE_TESTCASE(getmterms1, backend) { - list<string> answers_list; + std::list<string> answers_list; answers_list.push_back("one"); answers_list.push_back("two"); answers_list.push_back("three"); @@ -1005,14 +1005,14 @@ Xapian::MSet mymset = enquire.get_mset(0, 10); TEST_MSET_SIZE(mymset, 1); - list<string> list(enquire.get_matching_terms_begin(mymset.begin()), + std::list<string> list(enquire.get_matching_terms_begin(mymset.begin()), enquire.get_matching_terms_end(mymset.begin())); TEST(list == answers_list); } // tests that get_matching_terms() returns the terms only once DEFINE_TESTCASE(getmterms2, backend) { - list<string> answers_list; + std::list<string> answers_list; answers_list.push_back("one"); answers_list.push_back("two"); answers_list.push_back("three"); @@ -1033,7 +1033,7 @@ Xapian::MSet mymset = enquire.get_mset(0, 10); TEST_MSET_SIZE(mymset, 1); - list<string> list(enquire.get_matching_terms_begin(mymset.begin()), + std::list<string> list(enquire.get_matching_terms_begin(mymset.begin()), enquire.get_matching_terms_end(mymset.begin())); TEST(list == answers_list); } @@ -1093,7 +1093,7 @@ // as absentterm1, but setting query from a vector of terms DEFINE_TESTCASE(absentterm2, backend) { Xapian::Enquire enquire(get_database("apitest_simpledata")); - vector<string> terms; + std::vector<string> terms; terms.push_back("frink"); Xapian::Query query(Xapian::Query::OP_OR, terms.begin(), terms.end()); @@ -1239,7 +1239,7 @@ Xapian::Query myquery1 = query(Xapian::Query::OP_AND, "word", "search"); - vector<Xapian::Query> qs; + std::vector<Xapian::Query> qs; qs.push_back(query("this")); qs.push_back(query(Xapian::Query::OP_AND, "word", "search")); Xapian::Query myquery2(Xapian::Query::OP_ELITE_SET, @@ -1261,7 +1261,7 @@ Xapian::Query myquery1 = query(Xapian::Query::OP_AND, "word", "search"); - vector<Xapian::Query> qs; + std::vector<Xapian::Query> qs; qs.push_back(query("this")); qs.push_back(query(Xapian::Query::OP_AND, "word", "search")); Xapian::Query myquery2(Xapian::Query::OP_ELITE_SET, @@ -1301,11 +1301,11 @@ // make a query Xapian::Stem stemmer("english"); - string term1 = stemmer("word"); - string term2 = stemmer("rubbish"); - string term3 = stemmer("banana"); + std::string term1 = stemmer("word"); + std::string term2 = stemmer("rubbish"); + std::string term3 = stemmer("banana"); - vector<string> terms; + std::vector<string> terms; terms.push_back(term1); terms.push_back(term2); terms.push_back(term3); @@ -1392,7 +1392,7 @@ Xapian::Database mydb1(get_database("apitest_simpledata")); Xapian::Enquire enquire1(mydb1); - vector<string> v; + std::vector<string> v; for (int i = 0; i != 3; ++i) { v.push_back("simpl"); v.push_back("queri"); @@ -1433,7 +1433,7 @@ Xapian::ESet eset2 = enquire.get_eset(1000, rset2); // search for weight of term 'another' - string theterm = stemmer("another"); + std::string theterm = stemmer("another"); double wt1 = 0; double wt2 = 0; @@ -1473,9 +1473,9 @@ // make a query Xapian::Stem stemmer("english"); - string term1 = stemmer("word"); - string term2 = stemmer("inmemory"); - string term3 = stemmer("flibble"); + std::string term1 = stemmer("word"); + std::string term2 = stemmer("inmemory"); + std::string term3 = stemmer("flibble"); Xapian::Query myquery(Xapian::Query::OP_OR, Xapian::Query(term1), @@ -1522,8 +1522,8 @@ // make a query Xapian::Stem stemmer("english"); - string term1 = stemmer("paragraph"); - string term2 = stemmer("another"); + std::string term1 = stemmer("paragraph"); + std::string term2 = stemmer("another"); enquire.set_query(Xapian::Query(term1)); Xapian::MSet mset0 = enquire.get_mset(0, 10); @@ -1733,11 +1733,11 @@ Xapian::TermIterator t_clone(t); TEST_EQUAL(t, t_clone); - vector<string> v(t, tend); + std::vector<string> v(t, tend); t = db.termlist_begin(1); tend = db.termlist_end(1); - vector<string>::const_iterator i; + std::vector<string>::const_iterator i; for (i = v.begin(); i != v.end(); ++i) { TEST_NOT_EQUAL(t, tend); TEST_EQUAL(*i, *t); @@ -1821,7 +1821,7 @@ TEST_EQUAL(count, 1); for (Xapian::valueno value_no = 0; value_no < 7; ++value_no) { - string value = mymset.begin().get_document().get_value(value_no); + std::string value = mymset.begin().get_document().get_value(value_no); TEST_NOT_EQUAL(value, ""); if (value_no == 0) { TEST(value.size() > 262); @@ -1842,7 +1842,7 @@ Xapian::Enquire enquire(get_database("apitest_simpledata")); Xapian::Stem stemmer("english"); - vector<string> terms; + std::vector<string> terms; terms.push_back(stemmer("this")); terms.push_back(stemmer("word")); terms.push_back(stemmer("of")); @@ -1867,7 +1867,7 @@ Xapian::Enquire enquire(get_database("apitest_simpledata")); Xapian::Stem stemmer("english"); - vector<string> terms; + std::vector<string> terms; terms.push_back(stemmer("this")); terms.push_back(stemmer("word")); terms.push_back(stemmer("of")); @@ -1906,7 +1906,7 @@ // test whether operators with no elements work as a null query DEFINE_TESTCASE(emptyop1, backend) { Xapian::Enquire enquire(get_database("apitest_simpledata")); - vector<Xapian::Query> nullvec; + std::vector<Xapian::Query> nullvec; Xapian::Query query1(Xapian::Query::OP_XOR, nullvec.begin(), nullvec.end()); @@ -2251,9 +2251,9 @@ // First, build a vector of docids matching the first part of the query, // and append the non-duplicate docids matching the second part of the // query. - vector<Xapian::docid> ids1; + std::vector<Xapian::docid> ids1; set<Xapian::docid> idsin1; - vector<Xapian::docid> ids3; + std::vector<Xapian::docid> ids3; enq.set_query(query1); Xapian::MSet mset1 = enq.get_mset(0, 20); @@ -2274,7 +2274,7 @@ ids1.insert(ids1.end(), ids3.begin(), ids3.end()); // Now, run the combined query and build a vector of the matching docids. - vector<Xapian::docid> ids5; + std::vector<Xapian::docid> ids5; enq.set_query(query5); Xapian::MSet mset5 = enq.get_mset(0, 20); for (i = mset5.begin(); i != mset5.end(); ++i) { @@ -2342,7 +2342,7 @@ DEFINE_TESTCASE(uuid1, backend && !multi) { SKIP_TEST_FOR_BACKEND("inmemory"); Xapian::Database db = get_database("apitest_simpledata"); - string uuid1 = db.get_uuid(); + std::string uuid1 = db.get_uuid(); TEST_EQUAL(uuid1.size(), 36); // A database with no sub-databases has an empty UUID. diff -ur xapian-core-1.4.21/tests/api_backend.cc xapian-core-1.4.21/tests/api_backend.cc --- xapian-core-1.4.21/tests/api_backend.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_backend.cc 2022-11-08 16:44:15.528461330 +0100 @@ -60,7 +60,7 @@ try { Xapian::WritableDatabase db = get_named_writable_database("lockfileumask1"); - string path = get_named_writable_database_path("lockfileumask1"); + std::string path = get_named_writable_database_path("lockfileumask1"); path += "/flintlock"; struct stat statbuf; @@ -308,7 +308,7 @@ DEFINE_TESTCASE(lockfilealreadyopen1, chert || glass) { // Ensure database has been created. (void)get_named_writable_database("lockfilealreadyopen1"); - string path = get_named_writable_database_path("lockfilealreadyopen1"); + std::string path = get_named_writable_database_path("lockfilealreadyopen1"); int fd = ::open((path + "/flintlock").c_str(), O_RDONLY); TEST(fd != -1); try { @@ -576,7 +576,7 @@ } static void -make_msize1_db(Xapian::WritableDatabase &db, const string &) +make_msize1_db(Xapian::WritableDatabase &db, const std::string &) { const char * value0 = "ABBCDEFGHIJKLMMNOPQQRSTTUUVVWXYZZaabcdefghhijjkllmnopqrsttuvwxyz"; @@ -626,7 +626,7 @@ } static void -make_msize2_db(Xapian::WritableDatabase &db, const string &) +make_msize2_db(Xapian::WritableDatabase &db, const std::string &) { const char * value0 = "AAABCDEEFGHIIJJKLLMNNOOPPQQRSTTUVWXYZ"; const char * value1 = "MLEMNMLMLMEDEDEMLEMLMLMLPOAHGF"; @@ -674,7 +674,7 @@ } static void -make_xordecay1_db(Xapian::WritableDatabase &db, const string &) +make_xordecay1_db(Xapian::WritableDatabase &db, const std::string &) { for (int n = 1; n != 50; ++n) { Xapian::Document doc; @@ -702,7 +702,7 @@ } static void -make_ordecay_db(Xapian::WritableDatabase &db, const string &) +make_ordecay_db(Xapian::WritableDatabase &db, const std::string &) { const char * p = "VJ=QC]LUNTaARLI;715RR^];A4O=P4ZG<2CS4EM^^VS[A6QENR"; for (int d = 0; p[d]; ++d) { @@ -757,7 +757,7 @@ } static void -make_orcheck_db(Xapian::WritableDatabase &db, const string &) +make_orcheck_db(Xapian::WritableDatabase &db, const std::string &) { static const unsigned t1[] = {2, 4, 6, 8, 10}; static const unsigned t2[] = {6, 7, 8, 11, 12, 13, 14, 15, 16, 17}; @@ -1095,7 +1095,7 @@ // but the uncorrected size was passed to the base file. Also, abort() was // called on 0. DEFINE_TESTCASE(blocksize1, chert || glass) { - string db_dir = "." + get_dbtype(); + std::string db_dir = "." + get_dbtype(); mkdir(db_dir.c_str(), 0755); db_dir += "/db__blocksize1"; int flags; @@ -1121,7 +1121,7 @@ /// Feature test for Xapian::DB_NO_TERMLIST. DEFINE_TESTCASE(notermlist1, glass) { - string db_dir = "." + get_dbtype(); + std::string db_dir = "." + get_dbtype(); mkdir(db_dir.c_str(), 0755); db_dir += "/db__notermlist1"; int flags = Xapian::DB_CREATE|Xapian::DB_NO_TERMLIST; @@ -1168,7 +1168,7 @@ */ DEFINE_TESTCASE(readonlyparentdir1, chert || glass) { #if !defined __WIN32__ && !defined __CYGWIN__ && !defined __OS2__ - string path = get_named_writable_database_path("readonlyparentdir1"); + std::string path = get_named_writable_database_path("readonlyparentdir1"); // Fix permissions if the previous test was killed. (void)chmod(path.c_str(), 0700); mkdir(path.c_str(), 0777); @@ -1192,7 +1192,7 @@ } static void -make_phrasebug1_db(Xapian::WritableDatabase &db, const string &) +make_phrasebug1_db(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_posting("hurricane", 199881); @@ -1247,7 +1247,7 @@ } catch (const Xapian::DatabaseLockError &) { if (write(fds[0], "l", 1)) { } } catch (const Xapian::Error &e) { - const string & m = e.get_description(); + const std::string & m = e.get_description(); if (write(fds[0], m.data(), m.size())) { } } catch (...) { if (write(fds[0], "o", 1)) { } @@ -1423,8 +1423,8 @@ for (int i = free_id; i <= free_id + ITEMS; ++i) { Xapian::Document doc; - const string & id = str(i); - string qterm = "Q" + id; + const std::string & id = str(i); + std::string qterm = "Q" + id; doc.add_value(0, id); doc.add_boolean_term(qterm); wdb.replace_document(qterm, doc); @@ -1450,9 +1450,9 @@ // Check all results are in key order - the bug was that they were sorted // by docid instead with multiple remote databases. - string old_key; + std::string old_key; for (Xapian::MSetIterator i = mset.begin(); i != mset.end(); ++i) { - string key = db.get_document(*i).get_value(0); + std::string key = db.get_document(*i).get_value(0); TEST(old_key <= key); swap(old_key, key); } @@ -1471,8 +1471,8 @@ off_t offset = 1234; Xapian::Database db = get_database("apitest_simpledata"); - const string & db_path = get_database_path("apitest_simpledata"); - const string & tmp_path = db_path + "-embedded"; + const std::string & db_path = get_database_path("apitest_simpledata"); + const std::string & tmp_path = db_path + "-embedded"; ofstream out(tmp_path, fstream::trunc|fstream::binary); out.seekp(offset); out << ifstream(db_path, fstream::binary).rdbuf(); @@ -1731,7 +1731,7 @@ DEFINE_TESTCASE(allterms7, backend) { Xapian::Database db = get_database("etext"); for (auto i = db.allterms_begin(); i != db.allterms_end(); ++i) { - string term = *i; + std::string term = *i; TEST(db.get_termfreq(term) > 0); TEST(db.postlist_begin(term) != db.postlist_end(term)); } @@ -1747,7 +1747,7 @@ Xapian::Enquire enquire{db}; // Test up to a length longer than any backend supports. const unsigned MAX_LEN = 300; - string term; + std::string term; term.reserve(MAX_LEN); while (term.size() < MAX_LEN) { term += 'x'; diff -ur xapian-core-1.4.21/tests/api_closedb.cc xapian-core-1.4.21/tests/api_closedb.cc --- xapian-core-1.4.21/tests/api_closedb.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_closedb.cc 2022-11-08 16:44:15.552461245 +0100 @@ -221,7 +221,7 @@ // Dup stdout to the fds which the database was using, to try to catch // issues with lingering references to closed fds (regression test for // early development versions of honey). - vector<int> fds; + std::vector<int> fds; for (int i = 0; i != 6; ++i) { fds.push_back(dup(1)); } @@ -262,7 +262,7 @@ /// Check API methods which might either work or throw an exception. DEFINE_TESTCASE(closedb3, backend) { Xapian::Database db(get_database("etext")); - const string & uuid = db.get_uuid(); + const std::string & uuid = db.get_uuid(); db.close(); try { TEST_EQUAL(db.get_uuid(), uuid); diff -ur xapian-core-1.4.21/tests/api_collapse.cc xapian-core-1.4.21/tests/api_collapse.cc --- xapian-core-1.4.21/tests/api_collapse.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_collapse.cc 2022-11-08 16:44:15.504461416 +0100 @@ -39,7 +39,7 @@ Xapian::MSet full_mset = enquire.get_mset(0, db.get_doccount()); for (Xapian::valueno slot = 0; slot < 10; ++slot) { - map<string, Xapian::doccount> tally; + std::map<string, Xapian::doccount> tally; for (Xapian::docid did = 1; did <= db.get_doccount(); ++did) { ++tally[db.get_document(did).get_value(slot)]; } @@ -51,7 +51,7 @@ // Check the collapse MSet size is as expected. Xapian::doccount expect_size = 0; - map<string, Xapian::doccount>::const_iterator i; + std::map<string, Xapian::doccount>::const_iterator i; for (i = tally.begin(); i != tally.end(); ++i) { if (i->first.empty() || i->second <= cmax) { expect_size += i->second; @@ -63,9 +63,9 @@ // Check that the right number of documents with each collapse key // value are left after collapsing. - map<string, Xapian::doccount> seen; + std::map<string, Xapian::doccount> seen; for (Xapian::MSetIterator j = mset.begin(); j != mset.end(); ++j) { - const string & key = j.get_collapse_key(); + const std::string & key = j.get_collapse_key(); TEST(tally.find(key) != tally.end()); ++seen[key]; } diff -ur xapian-core-1.4.21/tests/api_compact.cc xapian-core-1.4.21/tests/api_compact.cc --- xapian-core-1.4.21/tests/api_compact.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_compact.cc 2022-11-08 16:44:15.532461315 +0100 @@ -48,7 +48,7 @@ using namespace std; static void -make_sparse_db(Xapian::WritableDatabase &db, const string & s) +make_sparse_db(Xapian::WritableDatabase &db, const std::string & s) { // Need non-const pointer for strtoul(), but data isn't modified. char * p = const_cast<char *>(s.c_str()); @@ -74,7 +74,7 @@ db.delete_document(first); } else { Xapian::Document doc; - string id = str(first); + std::string id = str(first); doc.set_data(id); doc.add_term("Q" + str(first)); doc.add_term(string(first % 7 + 1, char((first % 26) + 'a'))); @@ -90,7 +90,7 @@ } static void -check_sparse_uid_terms(const string & path) +check_sparse_uid_terms(const std::string & path) { Xapian::Database db(path); Xapian::TermIterator t; @@ -103,21 +103,21 @@ // With multi the docids in the shards change the behaviour. DEFINE_TESTCASE(compactnorenumber1, compact && generated && !multi) { - string a = get_database_path("compactnorenumber1a", make_sparse_db, + std::string a = get_database_path("compactnorenumber1a", make_sparse_db, "5-7 24 76 987 1023-1027 9999 !9999"); - string a_uuid; + std::string a_uuid; { Xapian::Database db(a); a_uuid = db.get_uuid(); } - string b = get_database_path("compactnorenumber1b", make_sparse_db, + std::string b = get_database_path("compactnorenumber1b", make_sparse_db, "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, + std::string c = get_database_path("compactnorenumber1c", make_sparse_db, "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, + std::string d = get_database_path("compactnorenumber1d", make_sparse_db, "3000 999999 !999999"); - string out = get_compaction_output_path("compactnorenumber1out"); + std::string out = get_compaction_output_path("compactnorenumber1out"); rm_rf(out); { @@ -132,7 +132,7 @@ Xapian::Database db(out); // xapian-compact should change the UUID of the database, but didn't // prior to 1.0.18/1.1.4. - string out_uuid = db.get_uuid(); + std::string out_uuid = db.get_uuid(); TEST_NOT_EQUAL(a_uuid, out_uuid); TEST_EQUAL(out_uuid.size(), 36); TEST_NOT_EQUAL(out_uuid, "00000000-0000-0000-0000-000000000000"); @@ -238,8 +238,8 @@ // Test use of compact to merge two databases. DEFINE_TESTCASE(compactmerge1, compact) { - string indbpath = get_database_path("apitest_simpledata"); - string outdbpath = get_compaction_output_path("compactmerge1out"); + std::string indbpath = get_database_path("apitest_simpledata"); + std::string outdbpath = get_compaction_output_path("compactmerge1out"); rm_rf(outdbpath); const string& dbtype = get_dbtype(); @@ -275,7 +275,7 @@ "", "/postlist", "/termlist.", nullptr }; for (auto s : suffixes) { - string suffix; + std::string suffix; if (s) { suffix = s; } else { @@ -287,7 +287,7 @@ } tout.str(string()); tout << "Trying suffix '" << suffix << "'" << endl; - string arg = outdbpath; + std::string arg = outdbpath; arg += suffix; TEST_EQUAL(Xapian::Database::check(arg, 0, &tout), 0); } @@ -295,7 +295,7 @@ } static void -make_multichunk_db(Xapian::WritableDatabase &db, const string &) +make_multichunk_db(Xapian::WritableDatabase &db, const std::string &) { int count = 10000; @@ -312,9 +312,9 @@ // Test use of compact on a database which has multiple chunks for a term. // This is a regression test for ticket #427 DEFINE_TESTCASE(compactmultichunks1, compact && generated) { - string indbpath = get_database_path("compactmultichunks1in", + std::string indbpath = get_database_path("compactmultichunks1in", make_multichunk_db, ""); - string outdbpath = get_compaction_output_path("compactmultichunks1out"); + std::string outdbpath = get_compaction_output_path("compactmultichunks1out"); rm_rf(outdbpath); { @@ -341,7 +341,7 @@ stub << "auto ../../" << get_database_path("apitest_simpledata2") << endl; stub.close(); - string outdbpath = get_compaction_output_path("compactstub1out"); + std::string outdbpath = get_compaction_output_path("compactstub1out"); rm_rf(outdbpath); { @@ -366,7 +366,7 @@ stub << "auto ../" << get_database_path("apitest_simpledata2") << endl; stub.close(); - string outdbpath = get_compaction_output_path("compactstub2out"); + std::string outdbpath = get_compaction_output_path("compactstub2out"); rm_rf(outdbpath); { @@ -430,7 +430,7 @@ } static void -make_all_tables(Xapian::WritableDatabase &db, const string &) +make_all_tables(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("foo"); @@ -443,7 +443,7 @@ } static void -make_missing_tables(Xapian::WritableDatabase &db, const string &) +make_missing_tables(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("foo"); @@ -453,12 +453,12 @@ } DEFINE_TESTCASE(compactmissingtables1, compact && generated) { - string a = get_database_path("compactmissingtables1a", + std::string a = get_database_path("compactmissingtables1a", make_all_tables); - string b = get_database_path("compactmissingtables1b", + std::string b = get_database_path("compactmissingtables1b", make_missing_tables); - string out = get_compaction_output_path("compactmissingtables1out"); + std::string out = get_compaction_output_path("compactmissingtables1out"); rm_rf(out); { @@ -478,7 +478,7 @@ } static void -make_all_tables2(Xapian::WritableDatabase &db, const string &) +make_all_tables2(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("bar"); @@ -493,12 +493,12 @@ /// Adds coverage for merging synonym table. DEFINE_TESTCASE(compactmergesynonym1, compact && generated) { - string a = get_database_path("compactmergesynonym1a", + std::string a = get_database_path("compactmergesynonym1a", make_all_tables); - string b = get_database_path("compactmergesynonym1b", + std::string b = get_database_path("compactmergesynonym1b", make_all_tables2); - string out = get_compaction_output_path("compactmergesynonym1out"); + std::string out = get_compaction_output_path("compactmergesynonym1out"); rm_rf(out); { @@ -538,8 +538,8 @@ } DEFINE_TESTCASE(compactempty1, compact) { - string empty_dbpath = get_database_path(string()); - string outdbpath = get_compaction_output_path("compactempty1out"); + std::string empty_dbpath = get_database_path(string()); + std::string outdbpath = get_compaction_output_path("compactempty1out"); rm_rf(outdbpath); { @@ -567,16 +567,16 @@ } DEFINE_TESTCASE(compactmultipass1, compact && generated) { - string outdbpath = get_compaction_output_path("compactmultipass1"); + std::string outdbpath = get_compaction_output_path("compactmultipass1"); rm_rf(outdbpath); - string a = get_database_path("compactnorenumber1a", make_sparse_db, + std::string a = get_database_path("compactnorenumber1a", make_sparse_db, "5-7 24 76 987 1023-1027 9999 !9999"); - string b = get_database_path("compactnorenumber1b", make_sparse_db, + std::string b = get_database_path("compactnorenumber1b", make_sparse_db, "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, + std::string c = get_database_path("compactnorenumber1c", make_sparse_db, "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, + std::string d = get_database_path("compactnorenumber1d", make_sparse_db, "3000 999999 !999999"); { @@ -596,7 +596,7 @@ // Chert doesn't support single file databases. DEFINE_TESTCASE(compacttofd1, compact && !chert) { Xapian::Database indb(get_database("apitest_simpledata")); - string outdbpath = get_compaction_output_path("compacttofd1out"); + std::string outdbpath = get_compaction_output_path("compacttofd1out"); rm_rf(outdbpath); int fd = open(outdbpath.c_str(), O_CREAT|O_RDWR|O_BINARY, 0666); @@ -623,7 +623,7 @@ // Chert doesn't support single file databases. DEFINE_TESTCASE(compacttofd2, compact && !chert) { Xapian::Database indb(get_database("apitest_simpledata")); - string outdbpath = get_compaction_output_path("compacttofd2out"); + std::string outdbpath = get_compaction_output_path("compacttofd2out"); rm_rf(outdbpath); int fd = open(outdbpath.c_str(), O_CREAT|O_RDWR|O_BINARY, 0666); @@ -683,7 +683,7 @@ // Also test a completely empty document. db.add_document(Xapian::Document()); - string output = get_compaction_output_path("compactsingle1-out"); + std::string output = get_compaction_output_path("compactsingle1-out"); // In 1.3.4, we would hang if the output file already existed, so check // that works. touch(output); @@ -721,7 +721,7 @@ // Also test a completely empty document. db.add_document(Xapian::Document()); - string output = get_compaction_output_path("compact1-out"); + std::string output = get_compaction_output_path("compact1-out"); rm_rf(output); TEST_EXCEPTION(Xapian::InvalidOperationError, diff -ur xapian-core-1.4.21/tests/api_compactold.cc xapian-core-1.4.21/tests/api_compactold.cc --- xapian-core-1.4.21/tests/api_compactold.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_compactold.cc 2022-11-08 16:44:15.540461287 +0100 @@ -42,7 +42,7 @@ using namespace std; static void -make_sparse_db(Xapian::WritableDatabase &db, const string & s) +make_sparse_db(Xapian::WritableDatabase &db, const std::string & s) { // Need non-const pointer for strtoul(), but data isn't modified. char * p = const_cast<char *>(s.c_str()); @@ -68,7 +68,7 @@ db.delete_document(first); } else { Xapian::Document doc; - string id = str(first); + std::string id = str(first); doc.set_data(id); doc.add_term("Q" + str(first)); doc.add_term(string(first % 7 + 1, char((first % 26) + 'a'))); @@ -84,7 +84,7 @@ } static void -check_sparse_uid_terms(const string & path) +check_sparse_uid_terms(const std::string & path) { Xapian::Database db(path); Xapian::TermIterator t; @@ -97,21 +97,21 @@ // With multi the docids in the shards change the behaviour. DEFINE_TESTCASE(compactoldnorenumber1, compact && generated && !multi) { - string a = get_database_path("compactnorenumber1a", make_sparse_db, + std::string a = get_database_path("compactnorenumber1a", make_sparse_db, "5-7 24 76 987 1023-1027 9999 !9999"); - string a_uuid; + std::string a_uuid; { Xapian::Database db(a); a_uuid = db.get_uuid(); } - string b = get_database_path("compactnorenumber1b", make_sparse_db, + std::string b = get_database_path("compactnorenumber1b", make_sparse_db, "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, + std::string c = get_database_path("compactnorenumber1c", make_sparse_db, "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, + std::string d = get_database_path("compactnorenumber1d", make_sparse_db, "3000 999999 !999999"); - string out = get_compaction_output_path("compactnorenumber1out"); + std::string out = get_compaction_output_path("compactnorenumber1out"); rm_rf(out); { @@ -129,7 +129,7 @@ Xapian::Database db(out); // xapian-compact should change the UUID of the database, but didn't // prior to 1.0.18/1.1.4. - string out_uuid = db.get_uuid(); + std::string out_uuid = db.get_uuid(); TEST_NOT_EQUAL(a_uuid, out_uuid); TEST_EQUAL(out_uuid.size(), 36); TEST_NOT_EQUAL(out_uuid, "00000000-0000-0000-0000-000000000000"); @@ -241,8 +241,8 @@ // Test use of compact to merge two databases. DEFINE_TESTCASE(compactoldmerge1, compact) { - string indbpath = get_database_path("apitest_simpledata"); - string outdbpath = get_compaction_output_path("compactmerge1out"); + std::string indbpath = get_database_path("apitest_simpledata"); + std::string outdbpath = get_compaction_output_path("compactmerge1out"); rm_rf(outdbpath); Xapian::Compactor compact; @@ -259,7 +259,7 @@ } static void -make_multichunk_db(Xapian::WritableDatabase &db, const string &) +make_multichunk_db(Xapian::WritableDatabase &db, const std::string &) { int count = 10000; @@ -276,9 +276,9 @@ // Test use of compact on a database which has multiple chunks for a term. // This is a regression test for ticket #427 DEFINE_TESTCASE(compactoldmultichunks1, compact && generated) { - string indbpath = get_database_path("compactmultichunks1in", + std::string indbpath = get_database_path("compactmultichunks1in", make_multichunk_db, ""); - string outdbpath = get_compaction_output_path("compactmultichunks1out"); + std::string outdbpath = get_compaction_output_path("compactmultichunks1out"); rm_rf(outdbpath); Xapian::Compactor compact; @@ -305,7 +305,7 @@ stub << "auto ../../" << get_database_path("apitest_simpledata2") << endl; stub.close(); - string outdbpath = get_compaction_output_path("compactstub1out"); + std::string outdbpath = get_compaction_output_path("compactstub1out"); rm_rf(outdbpath); Xapian::Compactor compact; @@ -330,7 +330,7 @@ stub << "auto ../" << get_database_path("apitest_simpledata2") << endl; stub.close(); - string outdbpath = get_compaction_output_path("compactstub2out"); + std::string outdbpath = get_compaction_output_path("compactstub2out"); rm_rf(outdbpath); Xapian::Compactor compact; @@ -402,7 +402,7 @@ } static void -make_all_tables(Xapian::WritableDatabase &db, const string &) +make_all_tables(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("foo"); @@ -415,7 +415,7 @@ } static void -make_missing_tables(Xapian::WritableDatabase &db, const string &) +make_missing_tables(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("foo"); @@ -425,12 +425,12 @@ } DEFINE_TESTCASE(compactoldmissingtables1, compact && generated) { - string a = get_database_path("compactmissingtables1a", + std::string a = get_database_path("compactmissingtables1a", make_all_tables); - string b = get_database_path("compactmissingtables1b", + std::string b = get_database_path("compactmissingtables1b", make_missing_tables); - string out = get_compaction_output_path("compactmissingtables1out"); + std::string out = get_compaction_output_path("compactmissingtables1out"); rm_rf(out); Xapian::Compactor compact; @@ -449,7 +449,7 @@ } static void -make_all_tables2(Xapian::WritableDatabase &db, const string &) +make_all_tables2(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_term("bar"); @@ -464,12 +464,12 @@ /// Adds coverage for merging synonym table. DEFINE_TESTCASE(compactoldmergesynonym1, compact && generated) { - string a = get_database_path("compactmergesynonym1a", + std::string a = get_database_path("compactmergesynonym1a", make_all_tables); - string b = get_database_path("compactmergesynonym1b", + std::string b = get_database_path("compactmergesynonym1b", make_all_tables2); - string out = get_compaction_output_path("compactmergesynonym1out"); + std::string out = get_compaction_output_path("compactmergesynonym1out"); rm_rf(out); Xapian::Compactor compact; @@ -508,8 +508,8 @@ } DEFINE_TESTCASE(compactoldempty1, compact) { - string empty_dbpath = get_database_path(string()); - string outdbpath = get_compaction_output_path("compactempty1out"); + std::string empty_dbpath = get_database_path(string()); + std::string outdbpath = get_compaction_output_path("compactempty1out"); rm_rf(outdbpath); { @@ -539,16 +539,16 @@ } DEFINE_TESTCASE(compactoldmultipass1, compact && generated) { - string outdbpath = get_compaction_output_path("compactmultipass1"); + std::string outdbpath = get_compaction_output_path("compactmultipass1"); rm_rf(outdbpath); - string a = get_database_path("compactnorenumber1a", make_sparse_db, + std::string a = get_database_path("compactnorenumber1a", make_sparse_db, "5-7 24 76 987 1023-1027 9999 !9999"); - string b = get_database_path("compactnorenumber1b", make_sparse_db, + std::string b = get_database_path("compactnorenumber1b", make_sparse_db, "1027-1030"); - string c = get_database_path("compactnorenumber1c", make_sparse_db, + std::string c = get_database_path("compactnorenumber1c", make_sparse_db, "1028-1040"); - string d = get_database_path("compactnorenumber1d", make_sparse_db, + std::string d = get_database_path("compactnorenumber1d", make_sparse_db, "3000 999999 !999999"); Xapian::Compactor compact; diff -ur xapian-core-1.4.21/tests/api_db.cc xapian-core-1.4.21/tests/api_db.cc --- xapian-core-1.4.21/tests/api_db.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_db.cc 2022-11-08 16:44:15.500461429 +0100 @@ -47,7 +47,7 @@ using namespace std; static Xapian::Query -query(const string &t) +query(const std::string &t) { return Xapian::Query(Xapian::Stem("english")(t)); } @@ -191,7 +191,7 @@ // NetworkError: Couldn't resolve host ::1 (context: remote:tcp(::1:65535)) (nodename nor servname provided, or not known) // or on macOS (EAI_NONAME): // NetworkError: Couldn't resolve host ::1 (context: remote:tcp(::1:65535)) (Address family for hostname not supported) - // So we test the message instead of the error string for portability. + // So we test the message instead of the error std::string for portability. // // But NetBSD seems to resolve ::1 to an IPv4 address and then tries // to connect to it (which hopefully fails), so just test the message @@ -495,7 +495,7 @@ #endif class GrepMatchDecider : public Xapian::MatchDecider { - string needle; + std::string needle; public: explicit GrepMatchDecider(const string& needle_) : needle(needle_) {} @@ -516,7 +516,7 @@ Xapian::MSet mymset = enquire.get_mset(0, 100, 0, &myfunctor); - vector<bool> docid_checked(db.get_lastdocid()); + std::vector<bool> docid_checked(db.get_lastdocid()); // Check that we get the expected number of matches, and that they // satisfy the condition. @@ -643,7 +643,7 @@ Xapian::MSet mymset = enquire.get_mset(0, 100, 0, NULL, &myfunctor); - vector<bool> docid_checked(db.get_lastdocid()); + std::vector<bool> docid_checked(db.get_lastdocid()); // Check that we get the expected number of matches, and that they // satisfy the condition. @@ -867,10 +867,10 @@ TEST_AND_EXPLAIN(mymsize1 > mymset.size(), "Had no fewer items when performing collapse: don't know whether it worked."); - map<string, Xapian::docid> values; + std::map<string, Xapian::docid> values; Xapian::MSetIterator i = mymset.begin(); for ( ; i != mymset.end(); ++i) { - string value = i.get_document().get_value(value_no); + std::string value = i.get_document().get_value(value_no); TEST(values[value] == 0 || value.empty()); values[value] = *i; } @@ -918,10 +918,10 @@ TEST_AND_EXPLAIN(mymset1.get_matches_upper_bound() > mymset.get_matches_upper_bound(), "Upper bound was not lower when performing collapse: don't know whether it worked."); - map<string, Xapian::docid> values; + std::map<string, Xapian::docid> values; Xapian::MSetIterator i = mymset.begin(); for ( ; i != mymset.end(); ++i) { - string value = i.get_document().get_value(value_no); + std::string value = i.get_document().get_value(value_no); TEST(values[value] == 0 || value.empty()); values[value] = *i; } @@ -940,10 +940,10 @@ TEST(mymset.get_matches_lower_bound() <= mymset1.get_matches_lower_bound()); TEST_EQUAL(mymset.get_matches_upper_bound(), mymset1.get_matches_upper_bound()); - map<string, Xapian::docid> values; + std::map<string, Xapian::docid> values; Xapian::MSetIterator i = mymset.begin(); for ( ; i != mymset.end(); ++i) { - string value = i.get_document().get_value(value_no); + std::string value = i.get_document().get_value(value_no); TEST(values[value] == 0 || value.empty()); values[value] = *i; } @@ -967,10 +967,10 @@ TEST_AND_EXPLAIN(mymset1.get_matches_upper_bound() == mymset.get_matches_upper_bound(), "Upper bound was changed when performing collapse but not asking for any results."); - map<string, Xapian::docid> values; + std::map<string, Xapian::docid> values; Xapian::MSetIterator i = mymset.begin(); for ( ; i != mymset.end(); ++i) { - string value = i.get_document().get_value(value_no); + std::string value = i.get_document().get_value(value_no); TEST(values[value] == 0 || value.empty()); values[value] = *i; } @@ -1182,7 +1182,7 @@ TEST_EQUAL(count, 1); for (Xapian::valueno value_no = 0; value_no < 7; ++value_no) { - string value = mymset.begin().get_document().get_value(value_no); + std::string value = mymset.begin().get_document().get_value(value_no); TEST_NOT_EQUAL(value, ""); if (value_no == 0) { TEST(value.size() > 263); @@ -1324,7 +1324,7 @@ TEST_EQUAL(db.postlist_begin("rosebud"), db.postlist_end("rosebud")); - string s = "let_us_see_if_we_can_break_it_with_a_really_really_long_term."; + std::string s = "let_us_see_if_we_can_break_it_with_a_really_really_long_term."; for (int i = 0; i < 8; ++i) { s += s; TEST_EQUAL(db.postlist_begin(s), db.postlist_end(s)); @@ -1355,11 +1355,11 @@ TEST(p_clone.get_description() != "PostingIterator()"); - vector<Xapian::docid> v(p, pend); + std::vector<Xapian::docid> v(p, pend); p = db.postlist_begin("this"); pend = db.postlist_end("this"); - vector<Xapian::docid>::const_iterator i; + std::vector<Xapian::docid>::const_iterator i; for (i = v.begin(); i != v.end(); ++i) { TEST_NOT_EQUAL(p, pend); TEST_EQUAL(*i, *p); @@ -1618,7 +1618,7 @@ TEST_EXCEPTION(Xapian::DatabaseNotFoundError, Xapian::WritableDatabase("no/such/directory", Xapian::DB_OPEN)); - string empty_dir = "emptydirectory"; + std::string empty_dir = "emptydirectory"; mkdir(empty_dir.c_str(), 0700); TEST_EXCEPTION(Xapian::DatabaseNotFoundError, Xapian::Database{empty_dir}); @@ -1627,7 +1627,7 @@ /// Test opening of a chert database DEFINE_TESTCASE(chertdatabaseopen1, chert) { #ifdef XAPIAN_HAS_CHERT_BACKEND - const string dbdir = ".chert/test_chertdatabaseopen1"; + const std::string dbdir = ".chert/test_chertdatabaseopen1"; mkdir(".chert", 0755); { @@ -1881,7 +1881,7 @@ TEST_EQUAL(mset.get_max_attained(), 1.445962071042388164); TEST_EQUAL(mset.size(), 7); - static const pair<Xapian::docid, double> to_compare[] = { + static const std::pair<Xapian::docid, double> to_compare[] = { {7, 1.445962071042388164}, {3, 1.4140112748017070743}, {1, 1.3747698831232337824}, @@ -1909,8 +1909,8 @@ MyWeight() { } ~MyWeight() { } std::string name() const { return "MyWeight"; } - string serialise() const { return string(); } - MyWeight * unserialise(const string &) const { return new MyWeight; } + std::string serialise() const { return string(); } + MyWeight * unserialise(const std::string &) const { return new MyWeight; } double get_sumpart(Xapian::termcount, Xapian::termcount, Xapian::termcount) const { return scale_factor; } diff -ur xapian-core-1.4.21/tests/api_geospatial.cc xapian-core-1.4.21/tests/api_geospatial.cc --- xapian-core-1.4.21/tests/api_geospatial.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_geospatial.cc 2022-11-08 16:44:15.552461245 +0100 @@ -36,7 +36,7 @@ // # Tests start here static void -builddb_coords1(Xapian::WritableDatabase &db, const string &) +builddb_coords1(Xapian::WritableDatabase &db, const std::string &) { Xapian::LatLongCoord coord1(10, 10); Xapian::LatLongCoord coord2(20, 10); @@ -370,8 +370,8 @@ LatLongCoord c2(1, 0); LatLongCoords cl1(c1); LatLongCoords cl2(c2); - string c2_str = c2.serialise(); - string cl2_str = cl2.serialise(); + std::string c2_str = c2.serialise(); + std::string cl2_str = cl2.serialise(); TEST_EQUAL(c2_str, cl2_str); LatLongCoord c2_check(5, 5); diff -ur xapian-core-1.4.21/tests/api_matchspy.cc xapian-core-1.4.21/tests/api_matchspy.cc --- xapian-core-1.4.21/tests/api_matchspy.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_matchspy.cc 2022-11-08 16:44:15.504461416 +0100 @@ -70,7 +70,7 @@ // Check that the match estimates aren't affected by the matchspy. TEST_EQUAL(nospymset, spymset); - vector<bool> docid_checked(db.get_lastdocid()); + std::vector<bool> docid_checked(db.get_lastdocid()); // Check that we get the expected number of matches, and that the stored // document contents are right. @@ -96,8 +96,8 @@ } } -static string values_to_repr(const Xapian::ValueCountMatchSpy & spy) { - string resultrepr("|"); +static std::string values_to_repr(const Xapian::ValueCountMatchSpy & spy) { + std::string resultrepr("|"); for (Xapian::TermIterator i = spy.values_begin(); i != spy.values_end(); ++i) { @@ -110,7 +110,7 @@ } static void -make_matchspy2_db(Xapian::WritableDatabase &db, const string &) +make_matchspy2_db(Xapian::WritableDatabase &db, const std::string &) { for (int c = 1; c <= 25; ++c) { Xapian::Document doc; @@ -244,7 +244,7 @@ for (Xapian::valueno v = 0; results[v]; ++v) { tout << "value " << v << endl; Xapian::ValueCountMatchSpy * spy = spies[v]; - string allvals_str("|"); + std::string allvals_str("|"); if (spy != NULL) { size_t allvals_size = 0; for (Xapian::TermIterator i = spy->top_values_begin(100); @@ -337,7 +337,7 @@ DEFINE_TESTCASE(matchspy7, !backend) { Xapian::ValueCountMatchSpy myspy(1); - string s = myspy.serialise_results(); + std::string s = myspy.serialise_results(); s += 'x'; // This merge_results() call used to enter an infinite loop. TEST_EXCEPTION(Xapian::NetworkError, myspy.merge_results(s)); diff -ur xapian-core-1.4.21/tests/api_metadata.cc xapian-core-1.4.21/tests/api_metadata.cc --- xapian-core-1.4.21/tests/api_metadata.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_metadata.cc 2022-11-08 16:44:15.504461416 +0100 @@ -261,9 +261,9 @@ DEFINE_TESTCASE(writeread1, writable && metadata) { Xapian::WritableDatabase db_w = get_writable_database(); db_w.set_metadata("1", "2"); - string longitem(20000, 'j'); + std::string longitem(20000, 'j'); db_w.set_metadata("2", longitem); - string readitem = db_w.get_metadata("2"); + std::string readitem = db_w.get_metadata("2"); TEST_EQUAL(readitem, longitem); } diff -ur xapian-core-1.4.21/tests/api_nodb.cc xapian-core-1.4.21/tests/api_nodb.cc --- xapian-core-1.4.21/tests/api_nodb.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_nodb.cc 2022-11-08 16:44:15.532461315 +0100 @@ -45,7 +45,7 @@ // tests that get_query_terms() returns the terms in the right order DEFINE_TESTCASE(getqterms1, !backend) { - list<string> answers_list; + std::list<string> answers_list; answers_list.push_back("one"); answers_list.push_back("two"); answers_list.push_back("three"); @@ -59,14 +59,14 @@ Xapian::Query("four", 1, 4), Xapian::Query("two", 1, 2))); - list<string> list1; + std::list<string> list1; { Xapian::TermIterator t; for (t = myquery.get_terms_begin(); t != myquery.get_terms_end(); ++t) list1.push_back(*t); } TEST(list1 == answers_list); - list<string> list2(myquery.get_terms_begin(), myquery.get_terms_end()); + std::list<string> list2(myquery.get_terms_begin(), myquery.get_terms_end()); TEST(list2 == answers_list); } @@ -85,7 +85,7 @@ TEST(Xapian::Query().empty()); // test that an empty query has length 0 TEST(Xapian::Query().get_length() == 0); - vector<Xapian::Query> v; + std::vector<Xapian::Query> v; TEST(Xapian::Query(Xapian::Query::OP_OR, v.begin(), v.end()).empty()); TEST(Xapian::Query(Xapian::Query::OP_OR, v.begin(), v.end()).get_length() == 0); } @@ -133,7 +133,7 @@ // tests that query lengths are calculated correctly DEFINE_TESTCASE(querylen2, !backend) { // test with an even bigger and strange query - string terms[3] = { + std::string terms[3] = { "foo", "bar", "baz" @@ -145,9 +145,9 @@ }; Xapian::Query myquery; - vector<string> v1(terms, terms + 3); - vector<Xapian::Query> v2(queries, queries + 3); - vector<Xapian::Query *> v3; + std::vector<string> v1(terms, terms + 3); + std::vector<Xapian::Query> v2(queries, queries + 3); + std::vector<Xapian::Query *> v3; Xapian::Query query1(Xapian::Query::OP_AND, string("ball"), string("club")); Xapian::Query query2("ring"); v3.push_back(&query1); @@ -199,12 +199,12 @@ Xapian::Query("wobble") }; - vector<Xapian::Query> vec1(queries1, queries1 + 3); + std::vector<Xapian::Query> vec1(queries1, queries1 + 3); Xapian::Query myquery1(Xapian::Query::OP_OR, vec1.begin(), vec1.end()); TEST_EQUAL(myquery1.get_description(), "Query((wibble OR wobble OR (jelly OR belly)))"); - vector<Xapian::Query> vec2(queries2, queries2 + 3); + std::vector<Xapian::Query> vec2(queries2, queries2 + 3); Xapian::Query myquery2(Xapian::Query::OP_AND, vec2.begin(), vec2.end()); TEST_EQUAL(myquery2.get_description(), "Query(((jelly AND belly) AND wibble AND wobble))"); @@ -212,7 +212,7 @@ // test behaviour when creating a query from an empty vector DEFINE_TESTCASE(emptyquerypart1, !backend) { - vector<string> emptyterms; + std::vector<string> emptyterms; Xapian::Query query(Xapian::Query::OP_OR, emptyterms.begin(), emptyterms.end()); TEST(Xapian::Query(Xapian::Query::OP_AND, query, Xapian::Query("x")).empty()); TEST(Xapian::Query(Xapian::Query::OP_AND, query, Xapian::Query("x")).get_length() == 0); @@ -221,7 +221,7 @@ } DEFINE_TESTCASE(stemlangs1, !backend) { - string langs = Xapian::Stem::get_available_languages(); + std::string langs = Xapian::Stem::get_available_languages(); tout << "available languages '" << langs << "'" << endl; TEST(!langs.empty()); @@ -238,12 +238,12 @@ // Try making a stemmer for this language. We should be able to create // it without an exception being thrown. - string language(langs, i, spc - i); + std::string language(langs, i, spc - i); tout << "checking language code '" << language << "' works" << endl; Xapian::Stem stemmer(language); TEST(!stemmer.is_none()); if (language.size() > 2) { - string expected("Xapian::Stem("); + std::string expected("Xapian::Stem("); expected += language; expected += ')'; TEST_EQUAL(stemmer.get_description(), expected); @@ -545,7 +545,7 @@ } DEFINE_TESTCASE(expanddeciderfilterprefix1, !backend) { - string prefix = "tw"; + std::string prefix = "tw"; Xapian::ExpandDeciderFilterPrefix decider(prefix); TEST(!decider("one")); TEST(!decider("t")); diff -ur xapian-core-1.4.21/tests/api_none.cc xapian-core-1.4.21/tests/api_none.cc --- xapian-core-1.4.21/tests/api_none.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_none.cc 2022-11-08 16:44:15.504461416 +0100 @@ -36,7 +36,7 @@ // Check the version functions give consistent results. DEFINE_TESTCASE(version1, !backend) { - string version = str(Xapian::major_version()); + std::string version = str(Xapian::major_version()); version += '.'; version += str(Xapian::minor_version()); version += '.'; @@ -348,7 +348,7 @@ public: TestFieldProcessor(bool & destroyed_) : destroyed(destroyed_) { } - Xapian::Query operator()(const string &str) { + Xapian::Query operator()(const std::string &str) { return Xapian::Query(str); } }; @@ -625,7 +625,7 @@ public: TestKeyMaker(bool & destroyed_) : destroyed(destroyed_) { } - string operator()(const Xapian::Document&) const { return string(); } + std::string operator()(const Xapian::Document&) const { return string(); } }; /// Check reference counting of KeyMaker. diff -ur xapian-core-1.4.21/tests/api_opsynonym.cc xapian-core-1.4.21/tests/api_opsynonym.cc --- xapian-core-1.4.21/tests/api_opsynonym.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_opsynonym.cc 2022-11-08 16:44:15.524461344 +0100 @@ -256,8 +256,8 @@ TEST_NOT_EQUAL(synmset.size(), 0); // Check that the queries return the same number of results. TEST_EQUAL(synmset.size(), ormset.size()); - map<Xapian::docid, double> values_or; - map<Xapian::docid, double> values_synonym; + std::map<Xapian::docid, double> values_or; + std::map<Xapian::docid, double> values_synonym; for (Xapian::doccount i = 0; i < synmset.size(); ++i) { values_or[*ormset[i]] = ormset[i].get_weight(); values_synonym[*synmset[i]] = synmset[i].get_weight(); @@ -268,7 +268,7 @@ * different from those in the "synonym" mset. */ int same_weight = 0; int different_weight = 0; - for (map<Xapian::docid, double>::const_iterator + for (std::map<Xapian::docid, double>::const_iterator j = values_or.begin(); j != values_or.end(); ++j) { Xapian::docid did = j->first; // Check that all the results in the or tree make it to the synonym @@ -296,7 +296,7 @@ // Regression test - test a synonym search with a MultiAndPostlist. DEFINE_TESTCASE(synonym2, backend) { Xapian::Query query; - vector<Xapian::Query> subqueries; + std::vector<Xapian::Query> subqueries; subqueries.push_back(Xapian::Query("file")); subqueries.push_back(Xapian::Query("the")); subqueries.push_back(Xapian::Query("next")); @@ -441,13 +441,13 @@ // Check that the weights in msetmax are the maximum of the weights in // mset1 and mset2 for each docid. - map<Xapian::docid, double> expected_weights; + std::map<Xapian::docid, double> expected_weights; Xapian::MSetIterator i; for (i = mset1.begin(); i != mset1.end(); ++i) { expected_weights[*i] = i.get_weight(); } for (i = mset2.begin(); i != mset2.end(); ++i) { - map<Xapian::docid, double>::iterator j; + std::map<Xapian::docid, double>::iterator j; j = expected_weights.find(*i); if (j != expected_weights.end()) { j->second = max(j->second, i.get_weight()); @@ -457,7 +457,7 @@ } for (i = msetmax.begin(); i != msetmax.end(); ++i) { - map<Xapian::docid, double>::iterator j; + std::map<Xapian::docid, double>::iterator j; j = expected_weights.find(*i); TEST(j != expected_weights.end()); TEST_EQUAL_DOUBLE(j->second, i.get_weight()); diff -ur xapian-core-1.4.21/tests/api_opvalue.cc xapian-core-1.4.21/tests/api_opvalue.cc --- xapian-core-1.4.21/tests/api_opvalue.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_opvalue.cc 2022-11-08 16:44:15.484461486 +0100 @@ -52,14 +52,14 @@ Xapian::MSetIterator i; for (i = mset.begin(); i != mset.end(); ++i) { matched.insert(*i); - string value = db.get_document(*i).get_value(1); + std::string value = db.get_document(*i).get_value(1); TEST_REL(value,>=,start); TEST_REL(value,<=,end); } // Check that documents not in the MSet don't match the value range filter. for (Xapian::docid j = db.get_lastdocid(); j != 0; --j) { if (matched.find(j) == matched.end()) { - string value = db.get_document(j).get_value(1); + std::string value = db.get_document(j).get_value(1); tout << value << " < '" << start << "' or > '" << end << "'" << endl; TEST(value < start || value > end); } @@ -87,7 +87,7 @@ } static void -make_valuerange5(Xapian::WritableDatabase &db, const string &) +make_valuerange5(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; doc.add_value(0, "BOOK"); @@ -119,7 +119,7 @@ } static void -make_singularvalue_db(Xapian::WritableDatabase &db, const string &) +make_singularvalue_db(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; db.add_document(doc); @@ -238,7 +238,7 @@ } static void -make_valprefixbounds_db(Xapian::WritableDatabase &db, const string &) +make_valprefixbounds_db(Xapian::WritableDatabase &db, const std::string &) { Xapian::Document doc; db.add_document(doc); @@ -296,7 +296,7 @@ Xapian::MSetIterator i; for (i = mset.begin(); i != mset.end(); ++i) { matched.insert(*i); - string value = db.get_document(*i).get_value(1); + std::string value = db.get_document(*i).get_value(1); tout << "'" << start << "' <= '" << value << "'" << endl; TEST_REL(value,>=,start); } @@ -304,7 +304,7 @@ // filter. for (Xapian::docid j = db.get_lastdocid(); j != 0; --j) { if (matched.find(j) == matched.end()) { - string value = db.get_document(j).get_value(1); + std::string value = db.get_document(j).get_value(1); tout << value << " < '" << start << "'" << endl; TEST_REL(value,<,start); } @@ -340,14 +340,14 @@ Xapian::MSetIterator i; for (i = mset.begin(); i != mset.end(); ++i) { matched.insert(*i); - string value = db.get_document(*i).get_value(1); + std::string value = db.get_document(*i).get_value(1); TEST_REL(value,<=,end); } // Check that documents not in the MSet don't match the value range // filter. for (Xapian::docid j = db.get_lastdocid(); j != 0; --j) { if (matched.find(j) == matched.end()) { - string value = db.get_document(j).get_value(1); + std::string value = db.get_document(j).get_value(1); TEST_REL(value,>,end); } } diff -ur xapian-core-1.4.21/tests/api_percentages.cc xapian-core-1.4.21/tests/api_percentages.cc --- xapian-core-1.4.21/tests/api_percentages.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_percentages.cc 2022-11-08 16:44:15.548461259 +0100 @@ -67,11 +67,11 @@ } class MyPostingSource : public Xapian::PostingSource { - vector<pair<Xapian::docid, double>> weights; - vector<pair<Xapian::docid, double>>::const_iterator i; + std::vector<pair<Xapian::docid, double>> weights; + std::vector<pair<Xapian::docid, double>>::const_iterator i; bool started; - MyPostingSource(const vector<pair<Xapian::docid, double>>& weights_, + MyPostingSource(const std::vector<pair<Xapian::docid, double>>& weights_, double max_wt) : weights(weights_), started(false) { @@ -114,7 +114,7 @@ Xapian::docid get_docid() const { return i->first; } - string get_description() const { + std::string get_description() const { return "MyPostingSource"; } }; @@ -261,7 +261,7 @@ } static void -make_topercent7_db(Xapian::WritableDatabase &db, const string &) +make_topercent7_db(Xapian::WritableDatabase &db, const std::string &) { for (int i = 1; i <= 6; ++i) { Xapian::Document d; diff -ur xapian-core-1.4.21/tests/api_posdb.cc xapian-core-1.4.21/tests/api_posdb.cc --- xapian-core-1.4.21/tests/api_posdb.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_posdb.cc 2022-11-08 16:44:15.560461217 +0100 @@ -44,7 +44,7 @@ enquire.set_weighting_scheme(Xapian::BoolWeight()); // make a query - vector<Xapian::Query> subqs; + std::vector<Xapian::Query> subqs; Xapian::Query q; subqs.push_back(Xapian::Query(stemmer("phrase"))); subqs.push_back(Xapian::Query(stemmer("fridge"))); @@ -183,7 +183,7 @@ Xapian::MSet mymset; // make a query - vector<Xapian::Query> subqs; + std::vector<Xapian::Query> subqs; Xapian::Query q; subqs.push_back(Xapian::Query(Xapian::Query::OP_AND, Xapian::Query(stemmer("phrase")), @@ -233,7 +233,7 @@ enquire.set_weighting_scheme(Xapian::BoolWeight()); // make a query - vector<Xapian::Query> subqs; + std::vector<Xapian::Query> subqs; Xapian::Query q; subqs.push_back(Xapian::Query(stemmer("phrase"))); subqs.push_back(Xapian::Query(stemmer("fridge"))); @@ -420,7 +420,7 @@ Xapian::MSet mymset; // make a query - vector<Xapian::Query> subqs; + std::vector<Xapian::Query> subqs; Xapian::Query q; subqs.push_back(Xapian::Query(Xapian::Query::OP_AND, Xapian::Query(stemmer("phrase")), @@ -467,7 +467,7 @@ Xapian::Database mydb(get_database("apitest_poslist")); Xapian::Stem stemmer("english"); - string term = stemmer("sponge"); + std::string term = stemmer("sponge"); Xapian::PositionIterator pli = mydb.positionlist_begin(2, term); diff -ur xapian-core-1.4.21/tests/api_postingsource.cc xapian-core-1.4.21/tests/api_postingsource.cc --- xapian-core-1.4.21/tests/api_postingsource.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_postingsource.cc 2022-11-08 16:44:15.508461401 +0100 @@ -83,7 +83,7 @@ Xapian::docid get_docid() const { return did; } - string get_description() const { return "MyOddPostingSource"; } + std::string get_description() const { return "MyOddPostingSource"; } }; DEFINE_TESTCASE(externalsource1, backend && !remote && !multi) { @@ -187,7 +187,7 @@ Xapian::docid get_docid() const { return did; } - string get_description() const { + std::string get_description() const { return "MyOddWeightingPostingSource"; } }; @@ -288,7 +288,7 @@ Xapian::docid get_docid() const { return did; } - string get_description() const { + std::string get_description() const { return "MyDontAskWeightPostingSource"; } }; @@ -483,7 +483,7 @@ bool at_end() const { return did >= 5; } Xapian::docid get_docid() const { return did; } - string get_description() const { return "ChangeMaxweightPostingSource"; } + std::string get_description() const { return "ChangeMaxweightPostingSource"; } }; // Test a posting source with a variable maxweight. @@ -607,7 +607,7 @@ }; static void -make_matchtimelimit1_db(Xapian::WritableDatabase &db, const string &) +make_matchtimelimit1_db(Xapian::WritableDatabase &db, const std::string &) { for (int wt = 20; wt > 0; --wt) { Xapian::Document doc; @@ -715,7 +715,7 @@ Xapian::docid get_docid() const { return 0; } - string get_description() const { return "CloneTestPostingSource"; } + std::string get_description() const { return "CloneTestPostingSource"; } }; /// Test cloning of initial object, which regressed in 1.3.5. @@ -792,7 +792,7 @@ Xapian::docid get_docid() const { return did; } - string get_description() const { return "OnlyTheFirstPostingSource"; } + std::string get_description() const { return "OnlyTheFirstPostingSource"; } }; Xapian::doccount OnlyTheFirstPostingSource::shard_index; @@ -861,7 +861,7 @@ FAIL_TEST("EstimatePS::get_docid() shouldn't be called"); } - string get_description() const { return "EstimatePS"; } + std::string get_description() const { return "EstimatePS"; } }; /// Check estimate is rounded to suitable number of S.F. - new in 1.4.3. diff -ur xapian-core-1.4.21/tests/api_qpbackend.cc xapian-core-1.4.21/tests/api_qpbackend.cc --- xapian-core-1.4.21/tests/api_qpbackend.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_qpbackend.cc 2022-11-08 16:44:15.524461344 +0100 @@ -80,7 +80,7 @@ const test *p; for (p = test_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -102,7 +102,7 @@ } for (p = test_queries_auto; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -124,7 +124,7 @@ } for (p = test_queries_partial_auto; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else diff -ur xapian-core-1.4.21/tests/api_query.cc xapian-core-1.4.21/tests/api_query.cc --- xapian-core-1.4.21/tests/api_query.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_query.cc 2022-11-08 16:44:15.548461259 +0100 @@ -73,7 +73,7 @@ DEFINE_TESTCASE(matchnothing1, !backend) { TEST_STRINGS_EQUAL(Xapian::Query::MatchNothing.get_description(), "Query()"); - vector<Xapian::Query> subqs; + std::vector<Xapian::Query> subqs; subqs.push_back(Xapian::Query("foo")); subqs.push_back(Xapian::Query::MatchNothing); Xapian::Query q(Xapian::Query::OP_AND, subqs.begin(), subqs.end()); diff -ur xapian-core-1.4.21/tests/api_queryparser.cc xapian-core-1.4.21/tests/api_queryparser.cc --- xapian-core-1.4.21/tests/api_queryparser.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_queryparser.cc 2022-11-08 16:44:15.492461458 +0100 @@ -752,7 +752,7 @@ } FAIL_TEST("Unknown flag code: " << p->expect); } - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -822,7 +822,7 @@ } FAIL_TEST("Unknown flag code: " << p->expect); } - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -904,7 +904,7 @@ // Test query with odd characters in. DEFINE_TESTCASE(qp_odd_chars1, !backend) { Xapian::QueryParser qp; - string query("\x01weird\x00stuff\x7f", 13); + std::string query("\x01weird\x00stuff\x7f", 13); Xapian::Query qobj = qp.parse_query(query); tout << "Query: " << query << '\n'; TEST_STRINGS_EQUAL(qobj.get_description(), "Query((weird@1 OR stuff@2))"); // FIXME: should these be stemmed? @@ -1029,7 +1029,7 @@ static void test_qp_flag_wildcard3_helper(const Xapian::Database &db, Xapian::termcount max_expansion, - const string & query_string) + const std::string & query_string) { Xapian::QueryParser qp; qp.set_database(db); @@ -1292,7 +1292,7 @@ qp.set_stopper(&stop); qp.set_default_op(Xapian::Query::OP_AND); for (const test *p = test_stop_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1328,7 +1328,7 @@ qp.set_stemmer(Xapian::Stem("english")); qp.set_stemming_strategy(QueryParser::STEM_SOME); for (const test *p = test_pure_not_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1502,7 +1502,7 @@ Xapian::StringValueRangeProcessor vrp(1); qp.add_valuerangeprocessor(&vrp); for (const test *p = test_value_range1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1530,7 +1530,7 @@ Xapian::RangeProcessor rp(1); qp.add_rangeprocessor(&rp); for (const test *p = test_value_range1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1600,7 +1600,7 @@ qp.add_valuerangeprocessor(&vrp_weight); qp.add_valuerangeprocessor(&vrp_str); for (const test *p = test_value_range2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1638,7 +1638,7 @@ qp.add_rangeprocessor(&rp_weight); qp.add_rangeprocessor(&rp_str); for (const test *p = test_value_range2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1681,7 +1681,7 @@ double start = low + j * step; for (int k = 0; k <= steps; ++k) { double end = low + k * step; - string query = str(start) + ".." + str(end); + std::string query = str(start) + ".." + str(end); tout << "Query: " << query << '\n'; Xapian::Query qobj = qp.parse_query(query); Xapian::Enquire enq(db); @@ -1723,7 +1723,7 @@ double start = low + j * step; for (int k = 0; k <= steps; ++k) { double end = low + k * step; - string query = str(start) + ".." + str(end); + std::string query = str(start) + ".." + str(end); tout << "Query: " << query << '\n'; Xapian::Query qobj = qp.parse_query(query); Xapian::Enquire enq(db); @@ -1763,7 +1763,7 @@ Xapian::StringValueRangeProcessor vrp_str(1, "hello:"); qp.add_valuerangeprocessor(&vrp_str); for (const test *p = test_value_range4_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1797,7 +1797,7 @@ Xapian::RangeProcessor rp_str(1, "hello:"); qp.add_rangeprocessor(&rp_str); for (const test *p = test_value_range4_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1834,7 +1834,7 @@ Xapian::DateValueRangeProcessor vrp_date(1, true, 1960); qp.add_valuerangeprocessor(&vrp_date); for (const test *p = test_value_daterange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1861,7 +1861,7 @@ Xapian::DateRangeProcessor rp_date(1, Xapian::RP_DATE_PREFER_MDY, 1960); qp.add_rangeprocessor(&rp_date); for (const test *p = test_value_daterange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1912,7 +1912,7 @@ qp.add_valuerangeprocessor(&vrp_adate); qp.add_valuerangeprocessor(&vrp_ddate); for (const test *p = test_value_daterange2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1949,7 +1949,7 @@ qp.add_rangeprocessor(&rp_adate); qp.add_rangeprocessor(&rp_ddate); for (const test *p = test_value_daterange2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -1984,7 +1984,7 @@ qp.add_valuerangeprocessor(&vrp_tag); qp.add_valuerangeprocessor(&vrp_default); for (const test *p = test_value_stringrange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2013,7 +2013,7 @@ qp.add_rangeprocessor(&rp_tag); qp.add_rangeprocessor(&rp_default); for (const test *p = test_value_stringrange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2058,7 +2058,7 @@ AuthorValueRangeProcessor vrp_author; qp.add_valuerangeprocessor(&vrp_author); for (const test *p = test_value_customrange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2084,8 +2084,8 @@ Xapian::Query operator()(const std::string& b, const std::string& e) { - string begin = Xapian::Unicode::tolower(b); - string end = Xapian::Unicode::tolower(e); + std::string begin = Xapian::Unicode::tolower(b); + std::string end = Xapian::Unicode::tolower(e); return Xapian::RangeProcessor::operator()(begin, end); } }; @@ -2096,7 +2096,7 @@ AuthorRangeProcessor rp_author; qp.add_rangeprocessor(&rp_author); for (const test *p = test_value_customrange1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2129,7 +2129,7 @@ Xapian::Query operator()(const std::string & str) { if (str == "*") return Xapian::Query::MatchAll; - string res = "H"; + std::string res = "H"; for (string::const_iterator i = str.begin(); i != str.end(); ++i) res += C_tolower(*i); return Xapian::Query(res); @@ -2153,7 +2153,7 @@ qp.add_prefix("title", &title_fproc); qp.add_boolean_prefix("host", &host_fproc); for (const test *p = test_fieldproc1_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2208,7 +2208,7 @@ Xapian::DateValueRangeProcessor vrp_date(1, "date:"); qp.add_valuerangeprocessor(&vrp_date); for (const test *p = test_fieldproc2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2237,7 +2237,7 @@ Xapian::DateRangeProcessor rp_date(1, "date:"); qp.add_rangeprocessor(&rp_date); for (const test *p = test_fieldproc2_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2480,7 +2480,7 @@ qp.set_database(db); for (const test *p = test_synonym_queries; p->query; ++p) { - string expect = "Query("; + std::string expect = "Query("; expect += p->expect; expect += ')'; Xapian::Query q; @@ -2516,7 +2516,7 @@ qp.set_database(db); for (const test *p = test_multi_synonym_queries; p->query; ++p) { - string expect = "Query("; + std::string expect = "Query("; expect += p->expect; expect += ')'; Xapian::Query q; @@ -2566,7 +2566,7 @@ qp.add_prefix("foo", "XFOO"); for (const test *p = test_synonym_op_queries; p->query; ++p) { - string expect = "Query("; + std::string expect = "Query("; expect += p->expect; expect += ')'; Xapian::Query q; @@ -2594,7 +2594,7 @@ qp.set_stemming_strategy(qp.STEM_ALL); qp.add_prefix("title", "XT"); for (const test *p = test_stem_all_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2629,7 +2629,7 @@ qp.set_stemming_strategy(qp.STEM_ALL_Z); qp.add_prefix("title", "XT"); for (const test *p = test_stem_all_z_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2651,7 +2651,7 @@ } static double -time_query_parse(const Xapian::Database & db, const string & q, +time_query_parse(const Xapian::Database & db, const std::string & q, int repetitions, unsigned flags) { Xapian::QueryParser qp; @@ -2669,7 +2669,7 @@ } static void -qp_scale1_helper(const Xapian::Database &db, const string & q, unsigned n, +qp_scale1_helper(const Xapian::Database &db, const std::string & q, unsigned n, unsigned flags) { double time1; @@ -2687,7 +2687,7 @@ n /= 5; - string q_n; + std::string q_n; q_n.reserve(q.size() * n); for (unsigned i = n; i != 0; --i) { q_n += q; @@ -2710,12 +2710,12 @@ db.add_synonym("foo", "bar"); db.commit(); - string q1("foo "); - string q1b("baz "); + std::string q1("foo "); + std::string q1b("baz "); const unsigned repetitions = 5000; // A long multiword synonym. - string syn; + std::string syn; for (int j = 50; j != 0; --j) { syn += q1; } @@ -2792,7 +2792,7 @@ queryparser.add_boolean_prefix("dogegory", "XDOG", false); queryparser.set_default_op(Xapian::Query::OP_NEAR); for (const test *p = test_near_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2867,7 +2867,7 @@ queryparser.add_boolean_prefix("dogegory", "XDOG", false); queryparser.set_default_op(Xapian::Query::OP_PHRASE); for (const test *p = test_phrase_queries; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -2937,7 +2937,7 @@ const test *p = test_stopword_group_or_queries; for (int i = 1; i <= 2; ++i) { for ( ; p->query; ++p) { - string expect, parsed; + std::string expect, parsed; if (p->expect) expect = p->expect; else @@ -3042,7 +3042,7 @@ Xapian::QueryParser qp; const auto flags = qp.FLAG_DEFAULT | qp.FLAG_NO_POSITIONS; for (const test& p : tests) { - string expect, parsed; + std::string expect, parsed; if (p.expect) expect = p.expect; else diff -ur xapian-core-1.4.21/tests/api_replacedoc.cc xapian-core-1.4.21/tests/api_replacedoc.cc --- xapian-core-1.4.21/tests/api_replacedoc.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_replacedoc.cc 2022-11-08 16:44:15.484461486 +0100 @@ -118,7 +118,7 @@ DEFINE_TESTCASE(modtermwdf1, writable) { Xapian::WritableDatabase db(get_writable_database()); - string bdt(basic_docterms()); + std::string bdt(basic_docterms()); // Add a simple document. Xapian::Document doc1(basic_doc()); diff -ur xapian-core-1.4.21/tests/api_replicate.cc xapian-core-1.4.21/tests/api_replicate.cc --- xapian-core-1.4.21/tests/api_replicate.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_replicate.cc 2022-11-08 16:44:15.552461245 +0100 @@ -53,18 +53,18 @@ #ifdef XAPIAN_HAS_REMOTE_BACKEND -static void rmtmpdir(const string & path) { +static void rmtmpdir(const std::string & path) { rm_rf(path); } -static void mktmpdir(const string & path) { +static void mktmpdir(const std::string & path) { rmtmpdir(path); if (mkdir(path.c_str(), 0700) == -1 && errno != EEXIST) { FAIL_TEST("Can't make temporary directory"); } } -static off_t get_file_size(const string & path) { +static off_t get_file_size(const std::string & path) { off_t size = file_size(path); if (errno) { FAIL_TEST("Can't stat '" << path << "'"); @@ -104,7 +104,7 @@ // Make a truncated copy of a file. static off_t -truncated_copy(const string & srcpath, const string & destpath, off_t tocopy) +truncated_copy(const std::string & srcpath, const std::string & destpath, off_t tocopy) { FD fdin(open(srcpath.c_str(), O_RDONLY | O_BINARY)); if (fdin == -1) { @@ -137,7 +137,7 @@ } static void -get_changeset(const string & changesetpath, +get_changeset(const std::string & changesetpath, Xapian::DatabaseMaster & master, Xapian::DatabaseReplica & replica, int expected_changesets, @@ -161,7 +161,7 @@ } static int -apply_changeset(const string & changesetpath, +apply_changeset(const std::string & changesetpath, Xapian::DatabaseReplica & replica, int expected_changesets, int expected_fullcopies, @@ -201,13 +201,13 @@ static int replicate(Xapian::DatabaseMaster & master, Xapian::DatabaseReplica & replica, - const string & tempdir, + const std::string & tempdir, int expected_changesets, int expected_fullcopies, bool expected_changed, bool full_copy = false) { - string changesetpath = tempdir + "/changeset"; + std::string changesetpath = tempdir + "/changeset"; get_changeset(changesetpath, master, replica, expected_changesets, expected_fullcopies, @@ -221,7 +221,7 @@ // Check that the databases held at the given path are identical. static void -check_equal_dbs(const string & masterpath, const string & replicapath) +check_equal_dbs(const std::string & masterpath, const std::string & replicapath) { Xapian::Database master(masterpath); Xapian::Database replica(replicapath); @@ -256,9 +256,9 @@ DEFINE_TESTCASE(replicate1, replicas) { #ifdef XAPIAN_HAS_REMOTE_BACKEND UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(10); @@ -269,7 +269,7 @@ Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; { Xapian::DatabaseReplica replica(replicapath); @@ -337,20 +337,20 @@ SKIP_TEST_FOR_BACKEND("glass"); // Glass doesn't currently support this. UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(10); { Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; Xapian::DatabaseReplica replica(replicapath); Xapian::DatabaseMaster master2(replicapath); - string replica2path = tempdir + "/replica2"; + std::string replica2path = tempdir + "/replica2"; Xapian::DatabaseReplica replica2(replica2path); // Add a document to the original database. @@ -438,17 +438,17 @@ static void replicate_with_brokenness(Xapian::DatabaseMaster & master, Xapian::DatabaseReplica & replica, - const string & tempdir, + const std::string & tempdir, int expected_changesets, int expected_fullcopies, bool expected_changed) { - string changesetpath = tempdir + "/changeset"; + std::string changesetpath = tempdir + "/changeset"; get_changeset(changesetpath, master, replica, 1, 0, 1); // Try applying truncated changesets of various different lengths. - string brokenchangesetpath = tempdir + "/changeset_broken"; + std::string brokenchangesetpath = tempdir + "/changeset_broken"; off_t filesize = get_file_size(changesetpath); off_t len = 10; off_t copylen; @@ -480,16 +480,16 @@ DEFINE_TESTCASE(replicate3, replicas) { #ifdef XAPIAN_HAS_REMOTE_BACKEND UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(10); { Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; Xapian::DatabaseReplica replica(replicapath); // Add a document to the original database. @@ -531,16 +531,16 @@ DEFINE_TESTCASE(replicate4, replicas) { #ifdef XAPIAN_HAS_REMOTE_BACKEND UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(1); { Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; Xapian::DatabaseReplica replica(replicapath); // Add a document with no positions to the original database. @@ -630,16 +630,16 @@ #ifdef XAPIAN_HAS_REMOTE_BACKEND SKIP_TEST_FOR_BACKEND("chert"); UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(2); { Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; Xapian::DatabaseReplica replica(replicapath); // Add a document with no positions to the original database. @@ -761,16 +761,16 @@ DEFINE_TESTCASE(replicate6, replicas) { #ifdef XAPIAN_HAS_REMOTE_BACKEND UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(10); { Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; Xapian::DatabaseReplica replica(replicapath); // Add a document to the original database. @@ -827,15 +827,15 @@ DEFINE_TESTCASE(replicate7, replicas) { #ifdef XAPIAN_HAS_REMOTE_BACKEND UNSET_MAX_CHANGESETS_AFTERWARDS; - string tempdir = ".replicatmp"; + std::string tempdir = ".replicatmp"; mktmpdir(tempdir); - string masterpath = get_named_writable_database_path("master"); + std::string masterpath = get_named_writable_database_path("master"); set_max_changesets(10); Xapian::WritableDatabase orig(get_named_writable_database("master")); Xapian::DatabaseMaster master(masterpath); - string replicapath = tempdir + "/replica"; + std::string replicapath = tempdir + "/replica"; { Xapian::DatabaseReplica replica(replicapath); @@ -862,7 +862,7 @@ { // Corrupt replica by truncating all the files to size 0. - string d = replicapath; + std::string d = replicapath; d += "/replica_1"; DIR * dir = opendir(d.c_str()); TEST(dir != NULL); @@ -878,7 +878,7 @@ // Skip '.' and '..'. if (entry->d_name[0] == '.') continue; - string file = d; + std::string file = d; file += '/'; file += entry->d_name; int fd = open(file.c_str(), O_WRONLY|O_TRUNC, 0666); diff -ur xapian-core-1.4.21/tests/api_serialise.cc xapian-core-1.4.21/tests/api_serialise.cc --- xapian-core-1.4.21/tests/api_serialise.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_serialise.cc 2022-11-08 16:44:15.528461330 +0100 @@ -327,7 +327,7 @@ ExceptionalPostingSource(failmode fail_) : fail(fail_) { } - string name() const { + std::string name() const { return "ExceptionalPostingSource"; } @@ -385,7 +385,7 @@ ExceptionalWeight(failmode fail_) : fail(fail_) { } - string name() const { + std::string name() const { return "ExceptionalWeight"; } @@ -438,7 +438,7 @@ ExceptionalMatchSpy(failmode fail_) : fail(fail_) { } - string name() const { + std::string name() const { return "ExceptionalMatchSpy"; } diff -ur xapian-core-1.4.21/tests/api_snippets.cc xapian-core-1.4.21/tests/api_snippets.cc --- xapian-core-1.4.21/tests/api_snippets.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_snippets.cc 2022-11-08 16:44:15.496461444 +0100 @@ -126,9 +126,9 @@ /// Index file to a DB with TermGenerator. static void -make_tg_db(Xapian::WritableDatabase &db, const string & source) +make_tg_db(Xapian::WritableDatabase &db, const std::string & source) { - string file = test_driver::get_srcdir(); + std::string file = test_driver::get_srcdir(); file += "/testdata/"; file += source; file += ".txt"; @@ -143,7 +143,7 @@ while (!input.eof()) { Xapian::Document doc; tg.set_document(doc); - string line, data; + std::string line, data; while (true) { getline(input, line); if (find_if(line.begin(), line.end(), C_isnotspace) == line.end()) @@ -273,14 +273,14 @@ Xapian::MSet mset = enquire.get_mset(0, 0); // A non-matching text - const char *input = "A string without a match."; + const char *input = "A std::string without a match."; size_t len = strlen(input); // By default, snippet() returns len bytes of input without markup unsigned flags = 0; TEST_STRINGS_EQUAL(mset.snippet(input, len, stem, 0), input); - // force snippet() to return the empty string if no term got matched + // force snippet() to return the empty std::string if no term got matched flags |= Xapian::MSet::SNIPPET_EMPTY_WITHOUT_MATCH; TEST_STRINGS_EQUAL(mset.snippet(input, len, stem, flags), ""); @@ -510,7 +510,7 @@ size_t len = strlen(input); unsigned flags = Xapian::MSet::SNIPPET_CJK_NGRAM; - string s; + std::string s; s = mset.snippet(input, len, stem, flags, "<b>", "</b>", "..."); TEST_STRINGS_EQUAL(s, "明末時<b>已</b><b>經</b>有香港地方的概念"); diff -ur xapian-core-1.4.21/tests/api_sorting.cc xapian-core-1.4.21/tests/api_sorting.cc --- xapian-core-1.4.21/tests/api_sorting.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_sorting.cc 2022-11-08 16:44:15.556461230 +0100 @@ -44,7 +44,7 @@ for (auto m = mset.begin(); m != mset.end(); ++m) { const string& data = m.get_document().get_data(); - string exp; + std::string exp; exp += data[3]; exp += string(2, '\0'); exp += data[1]; @@ -63,7 +63,7 @@ for (auto m = mset.begin(); m != mset.end(); ++m) { const string& data = m.get_document().get_data(); - string exp; + std::string exp; exp += data[3]; exp += string(2, '\0'); exp += char(0xff - data[1]); @@ -84,7 +84,7 @@ for (auto m = mset.begin(); m != mset.end(); ++m) { const string& data = m.get_document().get_data(); - string exp; + std::string exp; exp += string(2, '\0'); exp += data[3]; exp += string(2, '\0'); @@ -105,7 +105,7 @@ for (auto m = mset.begin(); m != mset.end(); ++m) { const string& data = m.get_document().get_data(); - string exp; + std::string exp; if (data.size() > 10) exp += data[10]; exp += string(2, '\0'); exp += char(0xff - data[1]); diff -ur xapian-core-1.4.21/tests/api_spelling.cc xapian-core-1.4.21/tests/api_spelling.cc --- xapian-core-1.4.21/tests/api_spelling.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_spelling.cc 2022-11-08 16:44:15.548461259 +0100 @@ -259,7 +259,7 @@ db.add_spelling(target); db.commit(); - string s = db.get_spelling_suggestion("\xe4\xb8\x8d", 3); + std::string s = db.get_spelling_suggestion("\xe4\xb8\x8d", 3); TEST_EQUAL(s, target); } diff -ur xapian-core-1.4.21/tests/api_stem.cc xapian-core-1.4.21/tests/api_stem.cc --- xapian-core-1.4.21/tests/api_stem.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_stem.cc 2022-11-08 16:44:15.532461315 +0100 @@ -31,13 +31,13 @@ using namespace std; class MyStemImpl : public Xapian::StemImplementation { - string operator()(const string & word) { + std::string operator()(const std::string & word) { if (word == "vanish") return string(); return word.substr(0, 3); } - string get_description() const { + std::string get_description() const { return "MyStem()"; } }; @@ -100,7 +100,7 @@ /// Test invalid language names with various characters in. DEFINE_TESTCASE(stemlangs2, !backend) { - string lang("xdummy"); + std::string lang("xdummy"); for (unsigned ch = 0; ch <= 255; ++ch) { lang[0] = char(ch); TEST_EXCEPTION(Xapian::InvalidArgumentError, Xapian::Stem stem(lang)); diff -ur xapian-core-1.4.21/tests/api_termgen.cc xapian-core-1.4.21/tests/api_termgen.cc --- xapian-core-1.4.21/tests/api_termgen.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_termgen.cc 2022-11-08 16:44:15.500461429 +0100 @@ -38,7 +38,7 @@ namespace { struct test { - // A string of options, separated by commas. + // A std::string of options, separated by commas. // Valid options are: // - cont: don't clear the document, so add to the previous output // - nopos: Don't store positions. @@ -701,7 +701,7 @@ static string format_doc_termlist(const Xapian::Document & doc) { - string output; + std::string output; Xapian::TermIterator it; for (it = doc.termlist_begin(); it != doc.termlist_end(); ++it) { if (!output.empty()) output += ' '; @@ -734,7 +734,7 @@ Xapian::TermGenerator termgen; Xapian::Document doc; termgen.set_document(doc); - string prefix; + std::string prefix; for (const test *p = test_simple; p->text; ++p) { int weight = 1; @@ -757,7 +757,7 @@ ++o; } else if (strncmp(o, "stem=", 5) == 0) { o += 5; - string stemmer; + std::string stemmer; while (*o != '\0' && *o != ',') { stemmer += *o; ++o; @@ -818,7 +818,7 @@ termgen.increase_termpos(); } - string expect, output; + std::string expect, output; expect = p->expect; try { if (nopos) { diff -ur xapian-core-1.4.21/tests/apitest.cc xapian-core-1.4.21/tests/apitest.cc --- xapian-core-1.4.21/tests/apitest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/apitest.cc 2022-11-08 16:44:15.484461486 +0100 @@ -45,15 +45,15 @@ } Xapian::Database -get_database(const string &dbname) +get_database(const std::string &dbname) { return backendmanager->get_database(dbname); } Xapian::Database -get_database(const string &dbname, const string &dbname2) +get_database(const std::string &dbname, const std::string &dbname2) { - vector<string> dbnames; + std::vector<string> dbnames; dbnames.push_back(dbname); dbnames.push_back(dbname2); return backendmanager->get_database(dbnames); @@ -69,7 +69,7 @@ } string -get_database_path(const string &dbname) +get_database_path(const std::string &dbname) { return backendmanager->get_database_path(dbname); } @@ -84,7 +84,7 @@ } Xapian::WritableDatabase -get_writable_database(const string &dbname) +get_writable_database(const std::string &dbname) { return backendmanager->get_writable_database("dbw", dbname); } @@ -108,9 +108,9 @@ } Xapian::Database -get_remote_database(const string &dbname, unsigned int timeout) +get_remote_database(const std::string &dbname, unsigned int timeout) { - vector<string> dbnames; + std::vector<string> dbnames; dbnames.push_back(dbname); return backendmanager->get_remote_database(dbnames, timeout); } diff -ur xapian-core-1.4.21/tests/apitest.h xapian-core-1.4.21/tests/apitest.h --- xapian-core-1.4.21/tests/apitest.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/apitest.h 2022-11-08 16:44:01.064512748 +0100 @@ -60,14 +60,14 @@ // Skip the test for any backend not of the specified type. // // More precisely, this skips the test for any backend for which the -// get_dbtype() function does not return a string starting with backend_prefix. +// get_dbtype() function does not return a std::string starting with backend_prefix. // This allows backends like "multi_chert" to be covered by specifying "multi". void skip_test_unless_backend(const std::string & backend_prefix); // Skip the test for any backend of the specified type. // // More precisely, this skips the test for any backend for which the -// get_dbtype() function returns a string starting with backend_prefix. This +// get_dbtype() function returns a std::string starting with backend_prefix. This // allows backends like "multi_chert" to be covered by specifying "multi". void skip_test_for_backend(const std::string & backend_prefix); diff -ur xapian-core-1.4.21/tests/api_unicode.cc xapian-core-1.4.21/tests/api_unicode.cc --- xapian-core-1.4.21/tests/api_unicode.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_unicode.cc 2022-11-08 16:44:15.488461473 +0100 @@ -390,7 +390,7 @@ } DEFINE_TESTCASE(utf8convert1, !backend) { - string s; + std::string s; Xapian::Unicode::append_utf8(s, 'a'); Xapian::Unicode::append_utf8(s, 128); Xapian::Unicode::append_utf8(s, 160); diff -ur xapian-core-1.4.21/tests/api_valuestream.cc xapian-core-1.4.21/tests/api_valuestream.cc --- xapian-core-1.4.21/tests/api_valuestream.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_valuestream.cc 2022-11-08 16:44:15.556461230 +0100 @@ -42,7 +42,7 @@ Xapian::ValueIterator it = db.valuestream_begin(slot); while (it != db.valuestream_end(slot)) { TEST_EQUAL(it.get_valueno(), slot); - string value = *it; + std::string value = *it; Xapian::docid did = it.get_docid(); Xapian::Document doc = db.get_document(did); @@ -68,7 +68,7 @@ if (it == db.valuestream_end(slot)) break; while (it.skip_to(did), it != db.valuestream_end(slot)) { TEST_EQUAL(it.get_valueno(), slot); - string value = *it; + std::string value = *it; // Check that the skipped documents had no values. Xapian::docid actual_did = it.get_docid(); @@ -128,7 +128,7 @@ if (positioned) { if (it == db.valuestream_end(slot)) break; TEST_EQUAL(it.get_valueno(), slot); - string value = *it; + std::string value = *it; // Check that the skipped documents had no values. Xapian::docid actual_did = it.get_docid(); diff -ur xapian-core-1.4.21/tests/api_weight.cc xapian-core-1.4.21/tests/api_weight.cc --- xapian-core-1.4.21/tests/api_weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_weight.cc 2022-11-08 16:44:15.496461444 +0100 @@ -738,14 +738,14 @@ // Test for various cases of normalization string. DEFINE_TESTCASE(tfidfweight1, !backend) { - // InvalidArgumentError should be thrown if normalization string is invalid + // InvalidArgumentError should be thrown if normalization std::string is invalid TEST_EXCEPTION(Xapian::InvalidArgumentError, Xapian::TfIdfWeight b("JOHN_LENNON")); TEST_EXCEPTION(Xapian::InvalidArgumentError, Xapian::TfIdfWeight b("LOL")); - /* Normalization string should be set to "ntn" by constructor if none is + /* Normalization std::string should be set to "ntn" by constructor if none is given. */ Xapian::TfIdfWeight weight2; TEST_EQUAL(weight2.serialise(), Xapian::TfIdfWeight("ntn").serialise()); @@ -939,13 +939,13 @@ Xapian::Database db; - string term1; + std::string term1; // When testing OP_SYNONYM, term2 is also set. // When testing OP_WILDCARD, term2 == "*". // When testing a repeated term, term2 == "=" for the first occurrence and // "_" for subsequent occurrences. - mutable string term2; + mutable std::string term2; Xapian::termcount & sum; Xapian::termcount & sum_squares; @@ -955,8 +955,8 @@ mutable Xapian::termcount wdf_upper; CheckStatsWeight(const Xapian::Database & db_, - const string & term1_, - const string & term2_, + const std::string & term1_, + const std::string & term2_, Xapian::termcount & sum_, Xapian::termcount & sum_squares_) : factor(-1.0), db(db_), term1(term1_), term2(term2_), @@ -981,7 +981,7 @@ } CheckStatsWeight(const Xapian::Database & db_, - const string & term_, + const std::string & term_, Xapian::termcount & sum_, Xapian::termcount & sum_squares_) : CheckStatsWeight(db_, term_, string(), sum_, sum_squares_) { } @@ -1097,7 +1097,7 @@ Xapian::Enquire enquire(db); Xapian::TermIterator a; for (a = db.allterms_begin(); a != db.allterms_end(); ++a) { - const string & term = *a; + const std::string & term = *a; enquire.set_query(Xapian::Query(term)); Xapian::termcount sum = 0; Xapian::termcount sum_squares = 0; @@ -1131,9 +1131,9 @@ Xapian::Enquire enquire(db); Xapian::TermIterator a; for (a = db.allterms_begin(); a != db.allterms_end(); ++a) { - const string & term1 = *a; + const std::string & term1 = *a; if (++a == db.allterms_end()) break; - const string & term2 = *a; + const std::string & term2 = *a; Xapian::Query q(Xapian::Query::OP_SYNONYM, Xapian::Query(term1), Xapian::Query(term2)); tout << q.get_description() << endl; @@ -1277,7 +1277,7 @@ Xapian::Enquire enquire(db); Xapian::TermIterator a; for (a = db.allterms_begin(); a != db.allterms_end(); ++a) { - const string & term = *a; + const std::string & term = *a; enquire.set_query(Xapian::Query(term, 1, 1) | Xapian::Query(term, 1, 2)); Xapian::termcount sum = 0; diff -ur xapian-core-1.4.21/tests/api_wrdb.cc xapian-core-1.4.21/tests/api_wrdb.cc --- xapian-core-1.4.21/tests/api_wrdb.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/api_wrdb.cc 2022-11-08 16:44:15.480461501 +0100 @@ -277,7 +277,7 @@ for (Xapian::doccount i = 0; i < 2100; ++i) { Xapian::Document doc; for (Xapian::termcount t = 0; t < 100; ++t) { - string term("foo"); + std::string term("foo"); term += char(t ^ 70 ^ i); doc.add_posting(term, t); } @@ -294,7 +294,7 @@ for (Xapian::doccount i = 1; i <= 240; ++i) { Xapian::Document doc; - string term(i, 'X'); + std::string term(i, 'X'); doc.add_term(term); db.add_document(doc); } @@ -767,7 +767,7 @@ for (Xapian::docid i = 1; i <= maxdoc; ++i) { // TEST_EXCEPTION writes to tout each time if the test is run - // in verbose mode and some string stream implementations get + // in verbose mode and some std::string stream implementations get // very inefficient with large strings, so clear tout on each pass of // the loop to speed up the test since the older information isn't // interesting anyway. @@ -1201,7 +1201,7 @@ for (int n = 1; n <= 20; ++n) { Xapian::Document doc; - string uterm = "U" + str(n % 16); + std::string uterm = "U" + str(n % 16); doc.add_term(uterm); doc.add_term(str(n)); doc.add_term(str(n ^ 9)); @@ -1220,7 +1220,7 @@ 15, 15, 15, 15 }; for (int n = 1; n <= 20; ++n) { - string uterm = "U" + str(n % 16); + std::string uterm = "U" + str(n % 16); if (uterm == "U2") { db.delete_document(uterm); } else { @@ -1235,7 +1235,7 @@ TEST_EQUAL(db.get_doccount(), sizes[n - 1]); } - string uterm = "U571"; + std::string uterm = "U571"; Xapian::Document doc; doc.add_term(uterm); doc.set_data("pass3"); @@ -1522,8 +1522,8 @@ // Glass has a single version file per revision, rather than multiple base // files, so it simply can't get into the situations we are testing // recovery from. - const string & dbtype = get_dbtype(); - string path = "."; + const std::string & dbtype = get_dbtype(); + std::string path = "."; path += dbtype; path += "/dbw"; const char * base_ext = ".baseB"; @@ -1642,7 +1642,7 @@ db.add_synonym("goodbye", "farewell"); Xapian::TermIterator t; - string s; + std::string s; // Try these tests twice - once before committing and once after. for (int times = 1; times <= 2; ++times) { @@ -1750,7 +1750,7 @@ tout.str(string()); tout << "Term length " << i << endl; Xapian::Document doc; - string term(i, 'X'); + std::string term(i, 'X'); doc.add_term(term); try { db.add_document(doc); @@ -1768,7 +1768,7 @@ tout.str(string()); tout << "Term length " << j << endl; Xapian::Document doc; - string term(j, 'X'); + std::string term(j, 'X'); doc.add_term(term); db.add_document(doc); } @@ -1791,7 +1791,7 @@ // exception message - we've got this wrong in two different ways // in the past! tout << e.get_msg() << endl; - string target = " is "; + std::string target = " is "; target += str(limit); target += " bytes"; TEST(e.get_msg().find(target) != string::npos); @@ -1865,7 +1865,7 @@ db.add_document(doc); db.commit(); - string synonym(255, 'x'); + std::string synonym(255, 'x'); char buf[] = " iamafish!!!!!!!!!!"; for (int i = 33; i < 120; ++i) { db.add_synonym(buf, synonym); @@ -1912,7 +1912,7 @@ db.commit(); - const string & db_path = get_named_writable_database_path("cursordelbug1"); + const std::string & db_path = get_named_writable_database_path("cursordelbug1"); TEST_EQUAL(Xapian::Database::check(db_path), 0); } @@ -1920,17 +1920,17 @@ * * Check that the values stored in the database match */ static void -check_vals(const Xapian::Database & db, const map<Xapian::docid, string> & vals) +check_vals(const Xapian::Database & db, const std::map<Xapian::docid, string> & vals) { TEST_EQUAL(db.get_doccount(), vals.size()); if (vals.empty()) return; TEST_REL(vals.rbegin()->first,<=,db.get_lastdocid()); - map<Xapian::docid, string>::const_iterator i; + std::map<Xapian::docid, string>::const_iterator i; for (i = vals.begin(); i != vals.end(); ++i) { tout.str(string()); tout << "Checking value in doc " << i->first << " - should be '" << i->second << "'\n"; Xapian::Document doc = db.get_document(i->first); - string dbval = doc.get_value(1); + std::string dbval = doc.get_value(1); TEST_EQUAL(dbval, i->second); if (dbval.empty()) { TEST_EQUAL(0, doc.values_count()); @@ -1957,12 +1957,12 @@ const Xapian::doccount doccount = 1000; static_assert(doccount % 13 != 0, "doccount divisible by 13"); - map<Xapian::docid, string> vals; + std::map<Xapian::docid, string> vals; for (Xapian::doccount num = 1; num <= doccount; ++num) { tout.str(string()); Xapian::Document doc; - string val = "val" + str(num); + std::string val = "val" + str(num); tout << "Setting val '" << val << "' in doc " << num << "\n"; doc.add_value(1, val); db.add_document(doc); @@ -1976,7 +1976,7 @@ // the initial implementation of streaming values). { Xapian::Document doc; - string val = "newval0"; + std::string val = "newval0"; tout << "Setting val '" << val << "' in doc 2\n"; doc.add_value(1, val); db.replace_document(2, doc); @@ -2018,7 +2018,7 @@ tout.str(string()); Xapian::docid did = ((rand() >> 8) % doccount) + 1; Xapian::Document doc; - string val; + std::string val; if (num % 5 != 0) { val = "newval" + str(num); diff -ur xapian-core-1.4.21/tests/dbcheck.cc xapian-core-1.4.21/tests/dbcheck.cc --- xapian-core-1.4.21/tests/dbcheck.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/dbcheck.cc 2022-11-08 16:44:15.528461330 +0100 @@ -34,7 +34,7 @@ const Xapian::PositionIterator & end, Xapian::termcount * count) { - string result; + std::string result; bool need_comma = false; Xapian::termcount c = 0; while (it != end) { @@ -52,9 +52,9 @@ } string -postlist_to_string(const Xapian::Database & db, const string & tname) +postlist_to_string(const Xapian::Database & db, const std::string & tname) { - string result; + std::string result; bool need_comma = false; for (Xapian::PostingIterator p = db.postlist_begin(tname); @@ -64,7 +64,7 @@ result += ", "; Xapian::PositionIterator it(p.positionlist_begin()); - string posrepr = positions_to_string(it, p.positionlist_end()); + std::string posrepr = positions_to_string(it, p.positionlist_end()); if (!posrepr.empty()) { posrepr = ", pos=[" + posrepr + "]"; } @@ -81,14 +81,14 @@ string docterms_to_string(const Xapian::Database & db, Xapian::docid did) { - string result; + std::string result; bool need_comma = false; for (Xapian::TermIterator t = db.termlist_begin(did); t != db.termlist_end(did); ++t) { Xapian::PositionIterator it(t.positionlist_begin()); - string posrepr = positions_to_string(it, t.positionlist_end()); + std::string posrepr = positions_to_string(it, t.positionlist_end()); if (!posrepr.empty()) { posrepr = ", pos=[" + posrepr + "]"; } @@ -104,7 +104,7 @@ string docstats_to_string(const Xapian::Database & db, Xapian::docid did) { - string result; + std::string result; result += "len=" + str(db.get_doclength(did)); @@ -112,9 +112,9 @@ } string -termstats_to_string(const Xapian::Database & db, const string & term) +termstats_to_string(const Xapian::Database & db, const std::string & term) { - string result; + std::string result; result += "tf=" + str(db.get_termfreq(term)); result += ",cf=" + str(db.get_collection_freq(term)); @@ -137,8 +137,8 @@ // A map from term to a representation of the posting list for that term. // We build this up from the documents, and then check it against the // equivalent built up from the posting lists. - map<string, string> posting_reprs; - map<Xapian::valueno, string> value_reprs; + std::map<string, string> posting_reprs; + std::map<Xapian::valueno, string> value_reprs; Xapian::termcount doclen_lower_bound = Xapian::termcount(-1); Xapian::termcount doclen_upper_bound = 0; @@ -179,9 +179,9 @@ // Check the position lists are equal. Xapian::termcount tc1, tc2; Xapian::PositionIterator it1(t.positionlist_begin()); - string posrepr = positions_to_string(it1, t.positionlist_end(), &tc1); + std::string posrepr = positions_to_string(it1, t.positionlist_end(), &tc1); Xapian::PositionIterator it2(t2.positionlist_begin()); - string posrepr2 = positions_to_string(it2, t2.positionlist_end(), &tc2); + std::string posrepr2 = positions_to_string(it2, t2.positionlist_end(), &tc2); TEST_EQUAL(posrepr, posrepr2); TEST_EQUAL(tc1, tc2); try { @@ -194,12 +194,12 @@ if (!posrepr.empty()) { posrepr = ",[" + posrepr + "]"; } - string posting_repr = "(" + str(did) + "," + + std::string posting_repr = "(" + str(did) + "," + str(t.get_wdf()) + "/" + str(doclen) + posrepr + ")"; // Append the representation to the list for the term. - map<string, string>::iterator i = posting_reprs.find(*t); + std::map<string, string>::iterator i = posting_reprs.find(*t); if (i == posting_reprs.end()) { posting_reprs[*t] = posting_repr; } else { @@ -212,10 +212,10 @@ v != doc.values_end(); ++v, ++vcount) { TEST((*v).size() != 0); - string value_repr = "(" + str(did) + "," + *v + ")"; + std::string value_repr = "(" + str(did) + "," + *v + ")"; // Append the values to the value lists. - map<Xapian::valueno, string>::iterator i; + std::map<Xapian::valueno, string>::iterator i; i = value_reprs.find(v.get_valueno()); if (i == value_reprs.end()) { value_reprs[v.get_valueno()] = value_repr; @@ -241,7 +241,7 @@ TEST_REL(doclen_upper_bound, <=, db.get_doclength_upper_bound()); Xapian::TermIterator t; - map<string, string>::const_iterator i; + std::map<string, string>::const_iterator i; for (t = db.allterms_begin(), i = posting_reprs.begin(); t != db.allterms_end(); ++t, ++i) { @@ -252,7 +252,7 @@ Xapian::doccount tf_count = 0; Xapian::termcount cf_count = 0; Xapian::termcount wdf_upper_bound = 0; - string posting_repr; + std::string posting_repr; bool need_comma = false; for (Xapian::PostingIterator p = db.postlist_begin(*t); p != db.postlist_end(*t); @@ -265,7 +265,7 @@ cf_count += p.get_wdf(); Xapian::PositionIterator it(p.positionlist_begin()); - string posrepr = positions_to_string(it, p.positionlist_end()); + std::string posrepr = positions_to_string(it, p.positionlist_end()); if (!posrepr.empty()) { posrepr = ",[" + posrepr + "]"; } @@ -285,11 +285,11 @@ } TEST(i == posting_reprs.end()); - map<Xapian::valueno, string>::const_iterator j; + std::map<Xapian::valueno, string>::const_iterator j; for (j = value_reprs.begin(); j != value_reprs.end(); ++j) { - string value_repr; - string value_lower_bound; - string value_upper_bound; + std::string value_repr; + std::string value_lower_bound; + std::string value_upper_bound; bool first = true; for (Xapian::ValueIterator v = db.valuestream_begin(j->first); v != db.valuestream_end(j->first); ++v) { diff -ur xapian-core-1.4.21/tests/harness/backendmanager.cc xapian-core-1.4.21/tests/harness/backendmanager.cc --- xapian-core-1.4.21/tests/harness/backendmanager.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager.cc 2022-11-08 16:44:15.524461344 +0100 @@ -47,7 +47,7 @@ void BackendManager::index_files_to_database(Xapian::WritableDatabase & database, - const vector<string> & files) + const std::vector<string> & files) { FileIndexer(datadir, files).index_to(database); } @@ -57,7 +57,7 @@ * an exception if there was an error (eg not a directory). */ bool -BackendManager::create_dir_if_needed(const string &dirname) +BackendManager::create_dir_if_needed(const std::string &dirname) { if (mkdir(dirname.c_str(), 0700) == 0) { return true; @@ -84,25 +84,25 @@ } string -BackendManager::do_get_database_path(const vector<string> &) +BackendManager::do_get_database_path(const std::vector<string> &) { throw Xapian::InvalidArgumentError("Path isn't meaningful for this database type"); } Xapian::Database -BackendManager::do_get_database(const vector<string> & files) +BackendManager::do_get_database(const std::vector<string> & files) { return Xapian::Database(do_get_database_path(files)); } Xapian::Database -BackendManager::get_database(const vector<string> & files) +BackendManager::get_database(const std::vector<string> & files) { return do_get_database(files); } Xapian::Database -BackendManager::get_database(const string & file) +BackendManager::get_database(const std::string & file) { return do_get_database(vector<string>(1, file)); } @@ -113,7 +113,7 @@ const std::string &), const std::string &arg) { - string dbleaf = "db__"; + std::string dbleaf = "db__"; dbleaf += dbname; const string& path = get_generated_database_path(dbleaf); if (path.empty()) { @@ -132,9 +132,9 @@ } rm_rf(path); - string tmp_dbleaf(dbleaf); + std::string tmp_dbleaf(dbleaf); tmp_dbleaf += '~'; - string tmp_path(path); + std::string tmp_path(path); tmp_path += '~'; { @@ -155,7 +155,7 @@ const std::string &), const std::string &arg) { - string dbleaf = "db__"; + std::string dbleaf = "db__"; dbleaf += dbname; const string& path = get_generated_database_path(dbleaf); if (path_exists(path)) { @@ -167,9 +167,9 @@ } rm_rf(path); - string tmp_dbleaf(dbleaf); + std::string tmp_dbleaf(dbleaf); tmp_dbleaf += '~'; - string tmp_path(path); + std::string tmp_path(path); tmp_path += '~'; { @@ -189,19 +189,19 @@ } string -BackendManager::get_database_path(const vector<string> & files) +BackendManager::get_database_path(const std::vector<string> & files) { return do_get_database_path(files); } string -BackendManager::get_database_path(const string & file) +BackendManager::get_database_path(const std::string & file) { return do_get_database_path(vector<string>(1, file)); } Xapian::WritableDatabase -BackendManager::get_writable_database(const string &, const string &) +BackendManager::get_writable_database(const std::string &, const std::string &) { throw Xapian::InvalidArgumentError("Attempted to open a disabled database"); } @@ -209,7 +209,7 @@ Xapian::WritableDatabase BackendManager::get_remote_writable_database(string) { - string msg = "BackendManager::get_remote_writable_database() " + std::string msg = "BackendManager::get_remote_writable_database() " "called for non-remote database (type is "; msg += get_dbtype(); msg += ')'; @@ -245,9 +245,9 @@ { } Xapian::Database -BackendManager::get_remote_database(const vector<string> &, unsigned int) +BackendManager::get_remote_database(const std::vector<string> &, unsigned int) { - string msg = "BackendManager::get_remote_database() called for non-remote database (type is "; + std::string msg = "BackendManager::get_remote_database() called for non-remote database (type is "; msg += get_dbtype(); msg += ')'; throw Xapian::InvalidOperationError(msg); @@ -257,7 +257,7 @@ BackendManager::get_writable_database_args(const std::string&, unsigned int) { - string msg = "BackendManager::get_writable_database_args() " + std::string msg = "BackendManager::get_writable_database_args() " "called for non-remote database (type is "; msg += get_dbtype(); msg += ')'; @@ -273,7 +273,7 @@ Xapian::WritableDatabase BackendManager::get_writable_database_again() { - string msg = "Backend "; + std::string msg = "Backend "; msg += get_dbtype(); msg += " doesn't support get_writable_database_again()"; throw Xapian::InvalidOperationError(msg); @@ -282,7 +282,7 @@ string BackendManager::get_writable_database_path_again() { - string msg = "Backend "; + std::string msg = "Backend "; msg += get_dbtype(); msg += " doesn't support get_writable_database_path_again()"; throw Xapian::InvalidOperationError(msg); diff -ur xapian-core-1.4.21/tests/harness/backendmanager_chert.cc xapian-core-1.4.21/tests/harness/backendmanager_chert.cc --- xapian-core-1.4.21/tests/harness/backendmanager_chert.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_chert.cc 2022-11-08 16:44:15.516461372 +0100 @@ -46,9 +46,9 @@ } string -BackendManagerChert::do_get_database_path(const vector<string> & files) +BackendManagerChert::do_get_database_path(const std::vector<string> & files) { - string db_path = CACHE_DIRECTORY "/db"; + std::string db_path = CACHE_DIRECTORY "/db"; for (const string& file : files) { db_path += "__"; db_path += file; @@ -57,7 +57,7 @@ if (!dir_exists(db_path)) { // No cached DB exists. Create at a temporary path and rename // so we don't leave a partial DB in place upon failure. - string tmp_path = db_path + ".tmp"; + std::string tmp_path = db_path + ".tmp"; // Make sure there's nothing existing at our temporary path. rm_rf(tmp_path); auto flags = Xapian::DB_CREATE|Xapian::DB_BACKEND_CHERT; @@ -73,11 +73,11 @@ } Xapian::WritableDatabase -BackendManagerChert::get_writable_database(const string & name, - const string & file) +BackendManagerChert::get_writable_database(const std::string & name, + const std::string & file) { last_wdb_name = name; - string db_path = CACHE_DIRECTORY "/" + name; + std::string db_path = CACHE_DIRECTORY "/" + name; // We can't use a cached version, as it may have been modified by the // testcase. @@ -85,13 +85,13 @@ auto flags = Xapian::DB_CREATE|Xapian::DB_BACKEND_CHERT; Xapian::WritableDatabase wdb(db_path, flags, BLOCK_SIZE); - index_files_to_database(wdb, vector<string>(1, file)); + index_files_to_database(wdb, std::vector<string>(1, file)); return wdb; } string -BackendManagerChert::get_writable_database_path(const string & name) +BackendManagerChert::get_writable_database_path(const std::string & name) { return CACHE_DIRECTORY "/" + name; } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_chert.h xapian-core-1.4.21/tests/harness/backendmanager_chert.h --- xapian-core-1.4.21/tests/harness/backendmanager_chert.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_chert.h 2022-11-08 16:44:01.040512833 +0100 @@ -45,7 +45,7 @@ public: BackendManagerChert(const std::string& datadir_); - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a Chert Xapian::WritableDatabase object indexing a single file. diff -ur xapian-core-1.4.21/tests/harness/backendmanager_glass.cc xapian-core-1.4.21/tests/harness/backendmanager_glass.cc --- xapian-core-1.4.21/tests/harness/backendmanager_glass.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_glass.cc 2022-11-08 16:44:15.512461387 +0100 @@ -46,9 +46,9 @@ } string -BackendManagerGlass::do_get_database_path(const vector<string> & files) +BackendManagerGlass::do_get_database_path(const std::vector<string> & files) { - string db_path = CACHE_DIRECTORY "/db"; + std::string db_path = CACHE_DIRECTORY "/db"; for (const string& file : files) { db_path += "__"; db_path += file; @@ -57,7 +57,7 @@ if (!dir_exists(db_path)) { // No cached DB exists. Create at a temporary path and rename // so we don't leave a partial DB in place upon failure. - string tmp_path = db_path + ".tmp"; + std::string tmp_path = db_path + ".tmp"; // Make sure there's nothing existing at our temporary path. rm_rf(tmp_path); auto flags = Xapian::DB_CREATE|Xapian::DB_BACKEND_GLASS; @@ -73,11 +73,11 @@ } Xapian::WritableDatabase -BackendManagerGlass::get_writable_database(const string & name, - const string & file) +BackendManagerGlass::get_writable_database(const std::string & name, + const std::string & file) { last_wdb_name = name; - string db_path = CACHE_DIRECTORY "/" + name; + std::string db_path = CACHE_DIRECTORY "/" + name; // We can't use a cached version, as it may have been modified by the // testcase. @@ -85,13 +85,13 @@ auto flags = Xapian::DB_CREATE|Xapian::DB_BACKEND_GLASS; Xapian::WritableDatabase wdb(db_path, flags, BLOCK_SIZE); - index_files_to_database(wdb, vector<string>(1, file)); + index_files_to_database(wdb, std::vector<string>(1, file)); return wdb; } string -BackendManagerGlass::get_writable_database_path(const string & name) +BackendManagerGlass::get_writable_database_path(const std::string & name) { return CACHE_DIRECTORY "/" + name; } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_glass.h xapian-core-1.4.21/tests/harness/backendmanager_glass.h --- xapian-core-1.4.21/tests/harness/backendmanager_glass.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_glass.h 2022-11-08 16:44:01.048512805 +0100 @@ -45,7 +45,7 @@ public: BackendManagerGlass(const std::string& datadir_); - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a Glass Xapian::WritableDatabase object indexing a single file. diff -ur xapian-core-1.4.21/tests/harness/backendmanager_inmemory.cc xapian-core-1.4.21/tests/harness/backendmanager_inmemory.cc --- xapian-core-1.4.21/tests/harness/backendmanager_inmemory.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_inmemory.cc 2022-11-08 16:44:15.520461359 +0100 @@ -31,7 +31,7 @@ } Xapian::Database -BackendManagerInMemory::do_get_database(const vector<string>& files) +BackendManagerInMemory::do_get_database(const std::vector<string>& files) { Xapian::WritableDatabase wdb(string(), Xapian::DB_BACKEND_INMEMORY); index_files_to_database(wdb, files); @@ -43,7 +43,7 @@ const string& file) { Xapian::WritableDatabase wdb(string(), Xapian::DB_BACKEND_INMEMORY); - index_files_to_database(wdb, vector<string>(1, file)); + index_files_to_database(wdb, std::vector<string>(1, file)); return wdb; } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_inmemory.h xapian-core-1.4.21/tests/harness/backendmanager_inmemory.h --- xapian-core-1.4.21/tests/harness/backendmanager_inmemory.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_inmemory.h 2022-11-08 16:44:01.040512833 +0100 @@ -45,7 +45,7 @@ BackendManagerInMemory(const std::string& datadir_) : BackendManager(datadir_) {} - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a InMemory Xapian::WritableDatabase object indexing a single file. diff -ur xapian-core-1.4.21/tests/harness/backendmanager_multi.cc xapian-core-1.4.21/tests/harness/backendmanager_multi.cc --- xapian-core-1.4.21/tests/harness/backendmanager_multi.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_multi.cc 2022-11-08 16:44:15.520461359 +0100 @@ -37,7 +37,7 @@ using namespace std; BackendManagerMulti::BackendManagerMulti(const std::string& datadir_, - vector<BackendManager*> sub_managers_) + std::vector<BackendManager*> sub_managers_) : BackendManager(datadir_), sub_managers(sub_managers_) { @@ -57,7 +57,7 @@ std::string BackendManagerMulti::get_dbtype() const { - string dbtype = "multi"; + std::string dbtype = "multi"; if (sub_managers.size() == 2 && sub_managers[0]->get_dbtype() == sub_managers[1]->get_dbtype()) { dbtype += "_" + sub_managers[0]->get_dbtype(); @@ -73,9 +73,9 @@ string BackendManagerMulti::createdb_multi(const string& name, - const vector<string>& files) + const std::vector<string>& files) { - string dbname; + std::string dbname; if (!name.empty()) { dbname = name; } else { @@ -86,13 +86,13 @@ } } - string db_path = cachedir; + std::string db_path = cachedir; db_path += '/'; db_path += dbname; if (!name.empty()) { if (unlink(db_path.c_str()) < 0 && errno != ENOENT) { - string msg = "Couldn't unlink file '"; + std::string msg = "Couldn't unlink file '"; msg += db_path; msg += "' ("; errno_to_string(errno, msg); @@ -103,10 +103,10 @@ if (file_exists(db_path)) return db_path; } - string tmpfile = db_path + ".tmp"; + std::string tmpfile = db_path + ".tmp"; ofstream out(tmpfile.c_str()); if (!out.is_open()) { - string msg = "Couldn't create file '"; + std::string msg = "Couldn't create file '"; msg += tmpfile; msg += "' ("; errno_to_string(errno, msg); @@ -118,7 +118,7 @@ // a multi-db combining them contains the documents in the expected order. Xapian::WritableDatabase dbs; - string dbbase = db_path; + std::string dbbase = db_path; dbbase += "___"; size_t dbbase_len = dbbase.size(); @@ -140,7 +140,7 @@ dbbase += str(n); Xapian::WritableDatabase remote_db(dbbase, flags); remote_db.close(); - string args = sub_managers[n]->get_writable_database_args(dbbase, + std::string args = sub_managers[n]->get_writable_database_args(dbbase, 300000); dbs.add_database( @@ -149,7 +149,7 @@ out << "remote :" << BackendManager::get_xapian_progsrv_command() << " " << args << '\n'; } else { - string msg = "Unknown multidb subtype: "; + std::string msg = "Unknown multidb subtype: "; msg += subtype; throw msg; } @@ -183,7 +183,7 @@ } string -BackendManagerMulti::do_get_database_path(const vector<string> & files) +BackendManagerMulti::do_get_database_path(const std::vector<string> & files) { return createdb_multi(string(), files); } @@ -191,7 +191,7 @@ Xapian::WritableDatabase BackendManagerMulti::get_writable_database(const string& name, const string& file) { - vector<string> files; + std::vector<string> files; if (!file.empty()) files.push_back(file); return Xapian::WritableDatabase(createdb_multi(name, files)); } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_multi.h xapian-core-1.4.21/tests/harness/backendmanager_multi.h --- xapian-core-1.4.21/tests/harness/backendmanager_multi.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_multi.h 2022-11-08 16:44:01.044512820 +0100 @@ -56,7 +56,7 @@ BackendManagerMulti(const std::string& datadir_, std::vector<BackendManager*> sub_manager_); - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; Xapian::Database get_remote_database(const std::vector<std::string>& files, diff -ur xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.cc xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.cc --- xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.cc 2022-11-08 16:44:15.520461359 +0100 @@ -38,7 +38,7 @@ } Xapian::Database -BackendManagerRemoteProg::do_get_database(const vector<string> & files) +BackendManagerRemoteProg::do_get_database(const std::vector<string> & files) { // Default to a long (5 minute) timeout so that tests won't fail just // because the host is slow or busy. @@ -46,10 +46,10 @@ } Xapian::WritableDatabase -BackendManagerRemoteProg::get_writable_database(const string & name, - const string & file) +BackendManagerRemoteProg::get_writable_database(const std::string & name, + const std::string & file) { - string args = get_writable_database_args(name, file); + std::string args = get_writable_database_args(name, file); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { @@ -73,10 +73,10 @@ } Xapian::Database -BackendManagerRemoteProg::get_remote_database(const vector<string> & files, +BackendManagerRemoteProg::get_remote_database(const std::vector<string> & files, unsigned int timeout) { - string args = get_remote_database_args(files, timeout); + std::string args = get_remote_database_args(files, timeout); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { @@ -90,7 +90,7 @@ Xapian::Database BackendManagerRemoteProg::get_database_by_path(const string& path) { - string args = get_remote_database_args(path, 300000); + std::string args = get_remote_database_args(path, 300000); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { @@ -104,7 +104,7 @@ Xapian::Database BackendManagerRemoteProg::get_writable_database_as_database() { - string args = get_writable_database_as_database_args(); + std::string args = get_writable_database_as_database_args(); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { @@ -118,7 +118,7 @@ Xapian::WritableDatabase BackendManagerRemoteProg::get_writable_database_again() { - string args = get_writable_database_again_args(); + std::string args = get_writable_database_again_args(); #ifdef HAVE_VALGRIND if (RUNNING_ON_VALGRIND) { diff -ur xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.h xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.h --- xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_remoteprog.h 2022-11-08 16:44:01.036512848 +0100 @@ -48,7 +48,7 @@ explicit BackendManagerRemoteProg(BackendManager* sub_manager_) : BackendManagerRemote(sub_manager_) { } - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a RemoteProg Xapian::WritableDatabase object indexing a single file. diff -ur xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.cc xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.cc --- xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.cc 2022-11-08 16:44:15.516461372 +0100 @@ -105,7 +105,7 @@ } static int -launch_xapian_tcpsrv(const string & args) +launch_xapian_tcpsrv(const std::string & args) { int port = DEFAULT_PORT; @@ -113,7 +113,7 @@ // if xapian-tcpsrv doesn't start listening successfully. signal(SIGCHLD, SIG_DFL); try_next_port: - string cmd = XAPIAN_TCPSRV " --one-shot --interface " LOCALHOST " --port "; + std::string cmd = XAPIAN_TCPSRV " --one-shot --interface " LOCALHOST " --port "; cmd += str(port); cmd += " "; cmd += args; @@ -122,7 +122,7 @@ #endif int fds[2]; if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, PF_UNSPEC, fds) < 0) { - string msg("Couldn't create socketpair: "); + std::string msg("Couldn't create socketpair: "); errno_to_string(errno, msg); throw msg; } @@ -154,7 +154,7 @@ // Couldn't fork. int fork_errno = errno; close(fds[0]); - string msg("Couldn't fork: "); + std::string msg("Couldn't fork: "); errno_to_string(fork_errno, msg); throw msg; } @@ -164,14 +164,14 @@ // Wrap the file descriptor in a FILE * so we can read lines using fgets(). FILE * fh = fdopen(fds[0], "r"); if (fh == NULL) { - string msg("Failed to run command '"); + std::string msg("Failed to run command '"); msg += cmd; msg += "': "; errno_to_string(errno, msg); throw msg; } - string output; + std::string output; while (true) { char buf[256]; if (fgets(buf, sizeof(buf), fh) == NULL) { @@ -179,7 +179,7 @@ // Wait for the child to exit. int status; if (waitpid(child, &status, 0) == -1) { - string msg("waitpid failed: "); + std::string msg("waitpid failed: "); errno_to_string(errno, msg); throw msg; } @@ -191,7 +191,7 @@ goto try_next_port; } } - string msg("Failed to get 'Listening...' from command '"); + std::string msg("Failed to get 'Listening...' from command '"); msg += cmd; msg += "' (output: "; msg += output; @@ -238,7 +238,7 @@ XAPIAN_NORETURN(static void win32_throw_error_string(const char * str)); static void win32_throw_error_string(const char * str) { - string msg(str); + std::string msg(str); char * error = 0; DWORD len; len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER, @@ -259,12 +259,12 @@ // This implementation uses the WIN32 API to start xapian-tcpsrv as a child // process and read its output using a pipe. static int -launch_xapian_tcpsrv(const string & args) +launch_xapian_tcpsrv(const std::string & args) { int port = DEFAULT_PORT; try_next_port: - string cmd = XAPIAN_TCPSRV " --one-shot --interface " LOCALHOST " --port "; + std::string cmd = XAPIAN_TCPSRV " --one-shot --interface " LOCALHOST " --port "; cmd += str(port); cmd += " "; cmd += args; @@ -300,7 +300,7 @@ CloseHandle(hWrite); CloseHandle(procinfo.hThread); - string output; + std::string output; FILE *fh = fdopen(_open_osfhandle(intptr_t(hRead), O_RDONLY), "r"); while (true) { char buf[256]; @@ -319,7 +319,7 @@ // in use. goto try_next_port; } - string msg("Failed to get 'Listening...' from command '"); + std::string msg("Failed to get 'Listening...' from command '"); msg += cmd; msg += "' (output: "; msg += output; @@ -353,7 +353,7 @@ } Xapian::Database -BackendManagerRemoteTcp::do_get_database(const vector<string> & files) +BackendManagerRemoteTcp::do_get_database(const std::vector<string> & files) { // Default to a long (5 minute) timeout so that tests won't fail just // because the host is slow or busy. @@ -361,19 +361,19 @@ } Xapian::WritableDatabase -BackendManagerRemoteTcp::get_writable_database(const string & name, - const string & file) +BackendManagerRemoteTcp::get_writable_database(const std::string & name, + const std::string & file) { - string args = get_writable_database_args(name, file); + std::string args = get_writable_database_args(name, file); int port = launch_xapian_tcpsrv(args); return Xapian::Remote::open_writable(LOCALHOST, port); } Xapian::Database -BackendManagerRemoteTcp::get_remote_database(const vector<string> & files, +BackendManagerRemoteTcp::get_remote_database(const std::vector<string> & files, unsigned int timeout) { - string args = get_remote_database_args(files, timeout); + std::string args = get_remote_database_args(files, timeout); int port = launch_xapian_tcpsrv(args); return Xapian::Remote::open(LOCALHOST, port); } @@ -381,7 +381,7 @@ Xapian::Database BackendManagerRemoteTcp::get_database_by_path(const string& path) { - string args = get_remote_database_args(path, 300000); + std::string args = get_remote_database_args(path, 300000); int port = launch_xapian_tcpsrv(args); return Xapian::Remote::open(LOCALHOST, port); } @@ -389,7 +389,7 @@ Xapian::Database BackendManagerRemoteTcp::get_writable_database_as_database() { - string args = get_writable_database_as_database_args(); + std::string args = get_writable_database_as_database_args(); int port = launch_xapian_tcpsrv(args); return Xapian::Remote::open(LOCALHOST, port); } @@ -397,7 +397,7 @@ Xapian::WritableDatabase BackendManagerRemoteTcp::get_writable_database_again() { - string args = get_writable_database_again_args(); + std::string args = get_writable_database_again_args(); int port = launch_xapian_tcpsrv(args); return Xapian::Remote::open_writable(LOCALHOST, port); } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.h xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.h --- xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_remotetcp.h 2022-11-08 16:44:01.048512805 +0100 @@ -47,7 +47,7 @@ ~BackendManagerRemoteTcp(); - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a RemoteTcp Xapian::WritableDatabase object indexing a single file. diff -ur xapian-core-1.4.21/tests/harness/backendmanager_singlefile.cc xapian-core-1.4.21/tests/harness/backendmanager_singlefile.cc --- xapian-core-1.4.21/tests/harness/backendmanager_singlefile.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_singlefile.cc 2022-11-08 16:44:15.512461387 +0100 @@ -48,9 +48,9 @@ } string -BackendManagerSingleFile::do_get_database_path(const vector<string> & files) +BackendManagerSingleFile::do_get_database_path(const std::vector<string> & files) { - string db_path = cachedir + "/db"; + std::string db_path = cachedir + "/db"; for (const string& file : files) { db_path += "__"; db_path += file; @@ -59,7 +59,7 @@ if (!file_exists(db_path)) { // No cached DB exists. Create at a temporary path and rename // so we don't leave a partial DB in place upon failure. - string tmp_path = db_path + ".tmp"; + std::string tmp_path = db_path + ".tmp"; sub_manager->get_database(files).compact(tmp_path, Xapian::DBCOMPACT_SINGLE_FILE); if (rename(tmp_path.c_str(), db_path.c_str()) < 0) { @@ -71,7 +71,7 @@ } Xapian::WritableDatabase -BackendManagerSingleFile::get_writable_database(const string &, const string &) +BackendManagerSingleFile::get_writable_database(const std::string &, const std::string &) { throw Xapian::UnimplementedError("Single-file databases don't support writing"); } diff -ur xapian-core-1.4.21/tests/harness/backendmanager_singlefile.h xapian-core-1.4.21/tests/harness/backendmanager_singlefile.h --- xapian-core-1.4.21/tests/harness/backendmanager_singlefile.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/backendmanager_singlefile.h 2022-11-08 16:44:01.044512820 +0100 @@ -48,7 +48,7 @@ BackendManagerSingleFile(const std::string& datadir_, BackendManager* sub_manager_); - /// Return a string representing the current database type. + /// Return a std::string representing the current database type. std::string get_dbtype() const; /// Create a Xapian::WritableDatabase object. diff -ur xapian-core-1.4.21/tests/harness/fdtracker.cc xapian-core-1.4.21/tests/harness/fdtracker.cc --- xapian-core-1.4.21/tests/harness/fdtracker.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/fdtracker.cc 2022-11-08 16:44:15.512461387 +0100 @@ -137,7 +137,7 @@ continue; } - string proc_symlink = FD_DIRECTORY "/"; + std::string proc_symlink = FD_DIRECTORY "/"; proc_symlink += name; char buf[1024]; diff -ur xapian-core-1.4.21/tests/harness/fdtracker.h xapian-core-1.4.21/tests/harness/fdtracker.h --- xapian-core-1.4.21/tests/harness/fdtracker.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/fdtracker.h 2022-11-08 16:44:01.044512820 +0100 @@ -34,7 +34,7 @@ /** Which fds are open. * * The lowest unused fd is used whenever a new fd is needed so we - * can expect them to form a dense set and vector<bool> should be an + * can expect them to form a dense set and std::vector<bool> should be an * efficient representation both in space and time. */ std::vector<bool> fds; diff -ur xapian-core-1.4.21/tests/harness/index_utils.cc xapian-core-1.4.21/tests/harness/index_utils.cc --- xapian-core-1.4.21/tests/harness/index_utils.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/index_utils.cc 2022-11-08 16:44:15.508461401 +0100 @@ -32,13 +32,13 @@ using namespace std; -static string munge_term(const string &term); +static std::string munge_term(const std::string &term); /// Read a paragraph from stream @a input. static string get_paragraph(istream &input) { - string para, line; + std::string para, line; while (true) { getline(input, line); if (find_if(line.begin(), line.end(), C_isnotspace) == line.end()) @@ -57,12 +57,12 @@ if (input.eof()) next_file(); Xapian::Document doc; - string para = get_paragraph(input); + std::string para = get_paragraph(input); doc.set_data(para); // Value 0 contains all possible character values so we can check that // none of them cause problems. - string value0("X\0\0\0 \1\t" + std::string value0("X\0\0\0 \1\t" "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" @@ -104,7 +104,7 @@ string::const_iterator word_start; word_start = find_if(word_end, para_end, C_isnotspace); word_end = find_if(word_start, para_end, C_isspace); - string word = stemmer(munge_term(string(word_start, word_end))); + std::string word = stemmer(munge_term(string(word_start, word_end))); if (!word.empty()) doc.add_posting(word, ++pos); } @@ -114,9 +114,9 @@ // Strip unwanted characters, force to lower case, and handle \ escapes. static string -munge_term(const string &term) +munge_term(const std::string &term) { - string result; + std::string result; for (string::const_iterator i = term.begin(); i != term.end(); ++i) { char ch = *i; if (C_isalnum(ch)) @@ -169,7 +169,7 @@ } if (file == end) return; - string filename; + std::string filename; if (!datadir.empty()) { filename = datadir; bool need_slash = true; @@ -187,7 +187,7 @@ input.open(filename.c_str()); // Need to check is_open() - just using operator! fails with MSVC. if (!input.is_open()) { - string msg = "Can't read file '"; + std::string msg = "Can't read file '"; msg += filename; msg += "' for indexing ("; errno_to_string(errno, msg); diff -ur xapian-core-1.4.21/tests/harness/testrunner.cc xapian-core-1.4.21/tests/harness/testrunner.cc --- xapian-core-1.4.21/tests/harness/testrunner.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/testrunner.cc 2022-11-08 16:44:15.516461372 +0100 @@ -44,7 +44,7 @@ TestRunner::~TestRunner() { } bool -TestRunner::use_backend(const string & backend_name) +TestRunner::use_backend(const std::string & backend_name) { if (user_backend.empty()) return true; @@ -56,7 +56,7 @@ } void -TestRunner::set_properties_for_backend(const string & backend_name) +TestRunner::set_properties_for_backend(const std::string & backend_name) { /// A description of the properties which a particular backend supports. struct BackendProperties { @@ -141,7 +141,7 @@ test_driver::add_command_line_option("backend", 'b', &user_backend); test_driver::parse_command_line(argc, argv); srcdir = test_driver::get_srcdir(); - string datadir = srcdir + "/testdata/"; + std::string datadir = srcdir + "/testdata/"; do_tests_for_backend(BackendManager(string())); @@ -154,7 +154,7 @@ BackendManagerGlass glass_man(datadir); // Vector for multi backendmanagers. - vector<BackendManager*> multi_mans; + std::vector<BackendManager*> multi_mans; multi_mans = {&glass_man, &glass_man}; do_tests_for_backend(glass_man); @@ -182,7 +182,7 @@ BackendManagerChert chert_man(datadir); // Vector for multi backendmanagers. - vector<BackendManager*> multi_mans; + std::vector<BackendManager*> multi_mans; multi_mans = {&chert_man, &chert_man}; #ifdef XAPIAN_HAS_CHERT_BACKEND diff -ur xapian-core-1.4.21/tests/harness/testsuite.cc xapian-core-1.4.21/tests/harness/testsuite.cc --- xapian-core-1.4.21/tests/harness/testsuite.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/testsuite.cc 2022-11-08 16:44:15.520461359 +0100 @@ -107,7 +107,7 @@ test_driver::result test_driver::total; string test_driver::argv0; string test_driver::opt_help; -map<int, string *> test_driver::short_opts; +map<int, std::string *> test_driver::short_opts; vector<string> test_driver::test_names; bool test_driver::abort_on_error = false; string test_driver::col_red, test_driver::col_green; @@ -117,7 +117,7 @@ void test_driver::write_and_clear_tout() { - const string & s = tout.str(); + const std::string & s = tout.str(); if (!s.empty()) { out << '\n' << s; tout.str(string()); @@ -131,9 +131,9 @@ if (p != NULL) return string(p); // Default srcdir to the pathname of argv[0]. - string srcdir(argv0); + std::string srcdir(argv0); string::size_type i = srcdir.find_last_of(DIR_SEPS); - string srcfile; + std::string srcfile; if (i != string::npos) { srcfile.assign(srcdir, i + 1, string::npos); srcdir.erase(i); @@ -433,7 +433,7 @@ vg_dubious = vg_dubious2 - vg_dubious; vg_reachable = vg_reachable2 - vg_reachable; if (vg_errs) { - string fail_msg(buf); + std::string fail_msg(buf); if (fail_msg.empty()) fail_msg = "VALGRIND DETECTED A PROBLEM"; REPORT_FAIL_VG(fail_msg); @@ -511,7 +511,7 @@ #ifndef NO_LIBXAPIAN } catch (const Xapian::Error &err) { out << ' '; - string errclass = err.get_type(); + std::string errclass = err.get_type(); if (expected_exception && expected_exception == errclass) { out << col_yellow << "C++ FAILED TO CATCH " << errclass << col_reset; return SKIP; @@ -538,7 +538,7 @@ write_and_clear_tout(); return expected_failure ? XFAIL : FAIL; #endif - } catch (const string & msg) { + } catch (const std::string & msg) { out << ' '; if (expected_failure) { out << col_yellow << "XFAIL (" << expected_failure @@ -649,7 +649,7 @@ test_driver::result test_driver::run_tests(vector<string>::const_iterator b, - vector<string>::const_iterator e) + std::vector<string>::const_iterator e) { return do_run_tests(b, e); } @@ -657,13 +657,13 @@ test_driver::result test_driver::run_tests() { - const vector<string> blank; + const std::vector<string> blank; return do_run_tests(blank.begin(), blank.end()); } test_driver::result test_driver::do_run_tests(vector<string>::const_iterator b, - vector<string>::const_iterator e) + std::vector<string>::const_iterator e) { set<string> m(b, e); bool check_name = !m.empty(); @@ -677,7 +677,7 @@ if (!do_this_test) { // if this test is "foo123" see if "foo" was listed // this way "./testprog foo" can run foo1, foo2, etc. - string t = test->name; + std::string t = test->name; string::size_type i; i = t.find_last_not_of("0123456789") + 1; if (i != string::npos) { @@ -751,7 +751,7 @@ } void -test_driver::report(const test_driver::result &r, const string &desc) +test_driver::report(const test_driver::result &r, const std::string &desc) { // Report totals at the end if we reported two or more subtotals. if (++runs == 2) atexit(report_totals); @@ -785,7 +785,7 @@ } void -test_driver::add_command_line_option(const string &l, char s, string * arg) +test_driver::add_command_line_option(const std::string &l, char s, std::string * arg) { short_opts.insert(make_pair(int(s), arg)); opt_help += "[-"; @@ -839,8 +839,8 @@ {NULL, 0, 0, 0} }; - string short_opts_string = "voh"; - map<int, string *>::const_iterator i; + std::string short_opts_string = "voh"; + std::map<int, std::string *>::const_iterator i; for (i = short_opts.begin(); i != short_opts.end(); ++i) { short_opts_string += char(i->first); short_opts_string += ':'; diff -ur xapian-core-1.4.21/tests/harness/testsuite.h xapian-core-1.4.21/tests/harness/testsuite.h --- xapian-core-1.4.21/tests/harness/testsuite.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/testsuite.h 2022-11-08 16:44:01.044512820 +0100 @@ -91,7 +91,7 @@ // expensive. extern int verbose; -/** Set to a string explanation for testcases expected to fail. */ +/** Set to a std::string explanation for testcases expected to fail. */ extern const char* expected_failure; /// The exception type we were expecting in TEST_EXCEPTION. @@ -313,7 +313,7 @@ /** Mark a testcase as expected to fail. * - * @param msg An static string explaining why the testcase is expected to + * @param msg An static std::string explaining why the testcase is expected to * fail. Must not be NULL. * * This is intended to be used temporarily to mark tests for known bugs before diff -ur xapian-core-1.4.21/tests/harness/testutils.cc xapian-core-1.4.21/tests/harness/testutils.cc --- xapian-core-1.4.21/tests/harness/testutils.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/testutils.cc 2022-11-08 16:44:15.516461372 +0100 @@ -32,7 +32,7 @@ using namespace std; ostream & -operator<<(ostream &os, const vector<Xapian::docid> &ints) +operator<<(ostream &os, const std::vector<Xapian::docid> &ints) { copy(ints.begin(), ints.end(), ostream_iterator<Xapian::docid>(os, ", ")); @@ -80,7 +80,7 @@ bool mset_range_is_same(const Xapian::MSet& mset, unsigned int first, - const pair<Xapian::docid, double> to_compare[], + const std::pair<Xapian::docid, double> to_compare[], unsigned int count) { TEST_AND_EXPLAIN(mset.size() >= first + count - 1, @@ -157,7 +157,7 @@ Xapian::docid d5, Xapian::docid d6, Xapian::docid d7, Xapian::docid d8, Xapian::docid d9, Xapian::docid d10, Xapian::docid d11, Xapian::docid d12) { - vector<Xapian::docid> expect; + std::vector<Xapian::docid> expect; if (d1) { expect.push_back(d1); if (d2) { diff -ur xapian-core-1.4.21/tests/harness/unixcmds.cc xapian-core-1.4.21/tests/harness/unixcmds.cc --- xapian-core-1.4.21/tests/harness/unixcmds.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/harness/unixcmds.cc 2022-11-08 16:44:15.512461387 +0100 @@ -51,11 +51,11 @@ /// Call system() and throw exception if it fails. static void -checked_system(const string & cmd) +checked_system(const std::string & cmd) { int res = system(cmd.c_str()); if (res) { - string msg = "system(\""; + std::string msg = "system(\""; msg += cmd; msg += "\") failed, returning "; msg += str(res); @@ -70,9 +70,9 @@ // whether we want to create a directory or a file (which makes no sense // when copying a directory, but that's how xcopy seems to work!) mkdir(dest.c_str()); - string cmd("xcopy /E /q /Y"); + std::string cmd("xcopy /E /q /Y"); #else - string cmd("cp -R"); + std::string cmd("cp -R"); #endif if (!append_filename_argument(cmd, src)) return; if (!append_filename_argument(cmd, dest)) return; @@ -108,7 +108,7 @@ #endif /// Remove a directory and contents, just like the Unix "rm -rf" command. -void rm_rf(const string &filename) { +void rm_rf(const std::string &filename) { // Check filename exists and is actually a directory if (filename.empty() || !dir_exists(filename)) return; @@ -126,7 +126,7 @@ if (eno < 0) eno = errno; if (!(eno == EEXIST || eno == ENOTEMPTY) || --retries == 0) { - string msg = "recursive delete of \""; + std::string msg = "recursive delete of \""; msg += filename; msg += "\") failed, errno = "; errno_to_string(eno, msg); @@ -142,9 +142,9 @@ } #else # ifdef __WIN32__ - string cmd("rd /s /q"); + std::string cmd("rd /s /q"); # else - string cmd("rm -rf"); + std::string cmd("rm -rf"); # endif if (!append_filename_argument(cmd, filename)) return; checked_system(cmd); @@ -152,7 +152,7 @@ } /// Touch a file, just like the Unix "touch" command. -void touch(const string &filename) { +void touch(const std::string &filename) { int fd = open(filename.c_str(), O_CREAT|O_WRONLY|O_BINARY, 0644); if (fd >= 0) close(fd); } diff -ur xapian-core-1.4.21/tests/internaltest.cc xapian-core-1.4.21/tests/internaltest.cc --- xapian-core-1.4.21/tests/internaltest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/internaltest.cc 2022-11-08 16:44:15.556461230 +0100 @@ -205,11 +205,11 @@ TEST(deleted); } -// test string comparisons +// test std::string comparisons static void test_stringcomp1() { - string s1; - string s2; + std::string s1; + std::string s2; s1 = "foo"; s2 = "foo"; @@ -263,9 +263,9 @@ /// Test pack_uint_preserving_sort() static void test_pack_uint_preserving_sort1() { - string prev_packed; + std::string prev_packed; for (unsigned int i = 0; i != 1000; ++i) { - string packed; + std::string packed; pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -277,7 +277,7 @@ swap(prev_packed, packed); } for (unsigned int i = 2345; i < 65000; i += 113) { - string packed; + std::string packed; pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -290,7 +290,7 @@ } unsigned int prev = 64999; for (unsigned int i = 65000; i > prev; prev = i, i = (i << 1) ^ 1337) { - string packed; + std::string packed; pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -303,7 +303,7 @@ } /* Test packing multiple numbers to one string. */ - string packed; + std::string packed; for (unsigned int i = 23456; i < 765432; i += 1131) { pack_uint_preserving_sort(packed, i); } @@ -320,9 +320,9 @@ /// Test C_pack_uint_preserving_sort() static void test_pack_uint_preserving_sort2() { - string prev_packed; + std::string prev_packed; for (unsigned int i = 0; i != 1000; ++i) { - string packed; + std::string packed; C_pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -334,7 +334,7 @@ swap(prev_packed, packed); } for (unsigned int i = 2345; i < 65000; i += 113) { - string packed; + std::string packed; C_pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -347,7 +347,7 @@ } unsigned int prev = 64999; for (unsigned int i = 65000; i > prev; prev = i, i = (i << 1) ^ 1337) { - string packed; + std::string packed; C_pack_uint_preserving_sort(packed, i); const char * ptr = packed.data(); const char * end = ptr + packed.size(); @@ -360,7 +360,7 @@ } /* Test packing multiple numbers to one string. */ - string packed; + std::string packed; for (unsigned int i = 23456; i < 765432; i += 1131) { C_pack_uint_preserving_sort(packed, i); } diff -ur xapian-core-1.4.21/tests/perftest/perftest.cc xapian-core-1.4.21/tests/perftest/perftest.cc --- xapian-core-1.4.21/tests/perftest/perftest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/perftest/perftest.cc 2022-11-08 16:44:15.540461287 +0100 @@ -52,9 +52,9 @@ PerfTestLogger logger; static string -escape_xml(const string & str) +escape_xml(const std::string & str) { - string res; + std::string res; string::size_type p = 0; while (p < str.size()) { char ch = str[p++]; @@ -131,7 +131,7 @@ #ifdef __WIN32__ return string(); #else - string loadavg; + std::string loadavg; try { loadavg = stdout_to_string("uptime 2>/dev/null | sed 's/.*: \\([0-9][0-9]*\\)/\\1/;s/, .*//'"); } catch (const NoSuchProgram&) { @@ -145,7 +145,7 @@ static string get_ncpus() { - string ncpus; + std::string ncpus; #ifdef __WIN32__ SYSTEM_INFO siSysInfo; GetSystemInfo(&siSysInfo); @@ -188,7 +188,7 @@ static string get_distro() { - string distro; + std::string distro; #ifdef __WIN32__ OSVERSIONINFO osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); @@ -214,7 +214,7 @@ static string get_commit_ref() { - string commit_ref; + std::string commit_ref; try { commit_ref = stdout_to_string("cd \"$srcdir\" && git log -n1 --abbrev-commit --format=%h"); } catch (const NoSuchProgram&) { @@ -225,7 +225,7 @@ } bool -PerfTestLogger::open(const string & logpath) +PerfTestLogger::open(const std::string & logpath) { out.open(logpath.c_str(), ios::out | ios::binary | ios::trunc); if (!out.is_open()) { @@ -233,10 +233,10 @@ return false; } - string loadavg = get_loadavg(); - string hostname = get_hostname(); - string ncpus = get_ncpus(); - string distro = get_distro(); + std::string loadavg = get_loadavg(); + std::string hostname = get_hostname(); + std::string ncpus = get_ncpus(); + std::string distro = get_distro(); // Write header, and details of the machine. write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testrun>\n" @@ -252,7 +252,7 @@ write(" <physmem>" + str(get_total_physical_memory()) + "</physmem>\n"); write(" </machineinfo>\n"); - const string & commit_ref = get_commit_ref(); + const std::string & commit_ref = get_commit_ref(); write(" <sourceinfo>\n"); if (!commit_ref.empty()) @@ -264,7 +264,7 @@ } void -PerfTestLogger::write(const string & text) +PerfTestLogger::write(const std::string & text) { out.write(text.data(), text.size()); out.flush(); @@ -281,7 +281,7 @@ } void -PerfTestLogger::indexing_begin(const string & dbname, +PerfTestLogger::indexing_begin(const std::string & dbname, const std::map<std::string, std::string> & params) { searching_end(); @@ -352,7 +352,7 @@ } void -PerfTestLogger::searching_start(const string & description) +PerfTestLogger::searching_start(const std::string & description) { indexing_end(); searching_end(); @@ -397,7 +397,7 @@ } void -PerfTestLogger::testcase_begin(const string & testcase) +PerfTestLogger::testcase_begin(const std::string & testcase) { testcase_end(); write(" <testcase name=\"" + testcase + "\" backend=\"" + @@ -432,7 +432,7 @@ class PerfTestRunner : public TestRunner { - string repetitions_string; + std::string repetitions_string; mutable bool repetitions_parsed; mutable int repetitions; public: diff -ur xapian-core-1.4.21/tests/perftest/perftest_matchdecider.cc xapian-core-1.4.21/tests/perftest/perftest_matchdecider.cc --- xapian-core-1.4.21/tests/perftest/perftest_matchdecider.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/perftest/perftest_matchdecider.cc 2022-11-08 16:44:15.540461287 +0100 @@ -36,7 +36,7 @@ using namespace std; static void -builddb_valuestest1(Xapian::WritableDatabase &db, const string & dbname) +builddb_valuestest1(Xapian::WritableDatabase &db, const std::string & dbname) { logger.testcase_begin(dbname); unsigned int runsize = 1000000; @@ -50,7 +50,7 @@ Xapian::Document doc; doc.set_data("test document " + str(i)); doc.add_term("foo"); - string vs = str(v); + std::string vs = str(v); if (vs.size() == 1) vs = "0" + vs; doc.add_value(0, vs); doc.add_term("F" + vs); @@ -95,7 +95,7 @@ Xapian::ValueSetMatchDecider md(0, true); for (unsigned int i = 0; i < 100; ++i) { - string vs = str(i); + std::string vs = str(i); if (vs.size() == 1) vs = "0" + vs; md.add_value(vs); diff -ur xapian-core-1.4.21/tests/perftest/perftest_randomidx.cc xapian-core-1.4.21/tests/perftest/perftest_randomidx.cc --- xapian-core-1.4.21/tests/perftest/perftest_randomidx.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/perftest/perftest_randomidx.cc 2022-11-08 16:44:15.540461287 +0100 @@ -69,7 +69,7 @@ static string gen_word(unsigned int length, unsigned int char_range) { - string result; + std::string result; result.reserve(length); for (unsigned int i = 0; i != length; ++i) { char ch = char('a' + rand_int(char_range)); diff -ur xapian-core-1.4.21/tests/perftest/runprocess.cc xapian-core-1.4.21/tests/perftest/runprocess.cc --- xapian-core-1.4.21/tests/perftest/runprocess.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/perftest/runprocess.cc 2022-11-08 16:44:15.540461287 +0100 @@ -36,9 +36,9 @@ using namespace std; string -stdout_to_string(const string &cmd) +stdout_to_string(const std::string &cmd) { - string out; + std::string out; FILE * fh = popen(cmd.c_str(), "r"); if (fh == NULL) throw ReadError(); while (!feof(fh)) { diff -ur xapian-core-1.4.21/tests/soaktest/soaktest.cc xapian-core-1.4.21/tests/soaktest/soaktest.cc --- xapian-core-1.4.21/tests/soaktest/soaktest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/soaktest/soaktest.cc 2022-11-08 16:44:15.484461486 +0100 @@ -62,7 +62,7 @@ class SoakTestRunner : public TestRunner { - string seed_str; + std::string seed_str; public: SoakTestRunner() : seed_str("42") { test_driver::add_command_line_option("seed", 's', &seed_str); diff -ur xapian-core-1.4.21/tests/soaktest/soaktest_queries.cc xapian-core-1.4.21/tests/soaktest/soaktest_queries.cc --- xapian-core-1.4.21/tests/soaktest/soaktest_queries.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/soaktest/soaktest_queries.cc 2022-11-08 16:44:15.484461486 +0100 @@ -43,7 +43,7 @@ * contains all Nx for x from 1 to randint(maxtermsperfield). */ static void -builddb_queries1(Xapian::WritableDatabase &db, const string &arg) +builddb_queries1(Xapian::WritableDatabase &db, const std::string &arg) { unsigned int doccount = 1000; unsigned int maxtermsperfield = atoi(arg.c_str()); @@ -60,7 +60,7 @@ /// The environment used by the steps when building a query. struct QueryBuilderEnv { /// Workspace for the query builder steps. - list<Xapian::Query> pieces; + std::list<Xapian::Query> pieces; unsigned int maxtermsperfield; unsigned int maxchildren; @@ -80,7 +80,7 @@ } /// Get an iterator pointing to the "num"th element in pieces. - list<Xapian::Query>::iterator pick(unsigned int num) { + std::list<Xapian::Query>::iterator pick(unsigned int num) { list<Xapian::Query>::iterator i = pieces.begin(); for (unsigned int c = 0; c != num && i != pieces.end(); ++c, ++i) {} return i; @@ -103,7 +103,7 @@ */ static void combine_OR(QueryBuilderEnv & env) { - list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); + std::list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); Xapian::Query combined(Xapian::Query::OP_OR, env.pieces.begin(), i); env.pieces.erase(env.pieces.begin(), i); env.pieces.push_back(combined); @@ -116,7 +116,7 @@ */ static void combine_AND(QueryBuilderEnv & env) { - list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); + std::list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); Xapian::Query combined(Xapian::Query::OP_AND, env.pieces.begin(), i); env.pieces.erase(env.pieces.begin(), i); env.pieces.push_back(combined); @@ -129,7 +129,7 @@ */ static void combine_XOR(QueryBuilderEnv & env) { - list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); + std::list<Xapian::Query>::iterator i = env.pick(randint(env.maxchildren)); Xapian::Query combined(Xapian::Query::OP_XOR, env.pieces.begin(), i); env.pieces.erase(env.pieces.begin(), i); env.pieces.push_back(combined); @@ -143,7 +143,7 @@ static void combine_NOT(QueryBuilderEnv & env) { if (env.pieces.size() < 2) return; - list<Xapian::Query>::iterator i = env.pick(2); + std::list<Xapian::Query>::iterator i = env.pick(2); Xapian::Query combined(Xapian::Query::OP_AND_NOT, env.pieces.begin(), i); env.pieces.erase(env.pieces.begin(), i); env.pieces.push_back(combined); @@ -152,7 +152,7 @@ /// Random query builder. class QueryBuilder { /// The possible steps. - vector<QueryStep> options; + std::vector<QueryStep> options; /// The environment for the build steps. QueryBuilderEnv env; @@ -208,7 +208,7 @@ QueryBuilder builder(maxtermsperfield, 10, 10); Xapian::Database db; - string arg(str(maxtermsperfield)); + std::string arg(str(maxtermsperfield)); db = backendmanager->get_database("queries1_" + str(seed) + "_" + arg, builddb_queries1, arg); diff -ur xapian-core-1.4.21/tests/stemtest.cc xapian-core-1.4.21/tests/stemtest.cc --- xapian-core-1.4.21/tests/stemtest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/stemtest.cc 2022-11-08 16:44:15.492461458 +0100 @@ -36,11 +36,11 @@ static const int JUNKSIZE = 2 * 1048576; -static string language; +static std::string language; static Xapian::Stem stemmer; -static string srcdir; +static std::string srcdir; static int seed; @@ -54,7 +54,7 @@ tout << "Stemming random text... (seed " << seed << ")" << endl; srand(seed); - string word; + std::string word; int stemmed_size = 0; for (int c = JUNKSIZE; c; --c) { char ch = wordchars[(rand() >> 8) % sizeof wordchars]; @@ -86,7 +86,7 @@ tout << "Stemming random junk... (seed " << seed << ")" << endl; srand(seed); - string word; + std::string word; int stemmed_size = 0; for (int c = JUNKSIZE; c; --c) { char ch = char(rand() >> 8); @@ -114,7 +114,7 @@ static void test_stemdict() { - string dir = srcdir + "/../../xapian-data/stemming/"; + std::string dir = srcdir + "/../../xapian-data/stemming/"; ifstream voc((dir + language + "/voc.txt").c_str()); if (!voc.is_open()) { @@ -131,7 +131,7 @@ int pass = 1; while (true) { - string word, stem, expect; + std::string word, stem, expect; while (!voc.eof() && !st.eof()) { getline(voc, word); getline(st, expect); @@ -173,11 +173,11 @@ int main(int argc, char **argv) try { - string langs = Xapian::Stem::get_available_languages(); + std::string langs = Xapian::Stem::get_available_languages(); test_driver::add_command_line_option("languages", 'l', &langs); seed = 42; - string seed_str; + std::string seed_str; test_driver::add_command_line_option("seed", 's', &seed_str); test_driver::parse_command_line(argc, argv); diff -ur xapian-core-1.4.21/tests/unittest.cc xapian-core-1.4.21/tests/unittest.cc --- xapian-core-1.4.21/tests/unittest.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/tests/unittest.cc 2022-11-08 16:44:15.536461302 +0100 @@ -120,7 +120,7 @@ } static inline string -r_r_p(string a, const string & b) +r_r_p(string a, const std::string & b) { resolve_relative_path(a, b); return a; @@ -202,13 +202,13 @@ static void check_double_serialisation(double u) { - // Commonly C++ string implementations keep the string nul-terminated, and + // Commonly C++ std::string implementations keep the std::string nul-terminated, and // encoded.data() returns a pointer to a buffer including the nul (the same // as encoded.c_str()). This means that valgrind won't catch a read one // past the end of the serialised value, so we copy just the serialised // value into a temporary buffer. char buf[16]; - string encoded = serialise_double(u); + std::string encoded = serialise_double(u); TEST(encoded.size() < sizeof(buf)); memcpy(buf, encoded.data(), encoded.size()); // Put a NULL pointer either side, to catch incrementing/decrementing at @@ -262,7 +262,7 @@ { size_t n = 0; while (n < 0xff000000) { - string s = encode_length(n); + std::string s = encode_length(n); const char *p = s.data(); const char *p_end = p + s.size(); size_t decoded_n; @@ -283,7 +283,7 @@ { // Special case tests for 0 { - string s = encode_length(0); + std::string s = encode_length(0); { const char *p = s.data(); const char *p_end = p + s.size(); @@ -304,7 +304,7 @@ } // Special case tests for 1 { - string s = encode_length(1); + std::string s = encode_length(1); TEST_EXCEPTION(Xapian_NetworkError, const char *p = s.data(); const char *p_end = p + s.size(); @@ -333,7 +333,7 @@ } // Nothing magic here, just test a range of odd and even values. for (size_t n = 2; n < 1000; n = (n + 1) * 2 + (n >> 1)) { - string s = encode_length(n); + std::string s = encode_length(n); TEST_EXCEPTION(Xapian_NetworkError, const char *p = s.data(); const char *p_end = p + s.size(); @@ -373,7 +373,7 @@ // Check serialisation of Xapian::Error. static void test_serialiseerror1() { - string enoent_msg = errno_to_string(ENOENT); + std::string enoent_msg = errno_to_string(ENOENT); Xapian::DatabaseOpeningError e("Failed to open database", ENOENT); // Regression test for bug in 1.0.0 - it didn't convert errno values for // get_description() if they hadn't already been converted. @@ -381,7 +381,7 @@ TEST_STRINGS_EQUAL(e.get_error_string(), enoent_msg); - string serialisation = serialise_error(e); + std::string serialisation = serialise_error(e); // Test if unserialise_error() throws with a flag to avoid the possibility // of an "unreachable code" warning when we get around to marking @@ -473,12 +473,12 @@ static void test_sortableserialise1() { double prevnum = 0; - string prevstr; + std::string prevstr; bool started = false; for (const double *p = test_sortableserialise_numbers; *p != 64; ++p) { double num = *p; tout << "Number: " << num << '\n'; - string str = Xapian::sortable_serialise(num); + std::string str = Xapian::sortable_serialise(num); tout << "String: " << str << '\n'; TEST_EQUAL(Xapian::sortable_unserialise(str), num); @@ -498,7 +498,7 @@ TEST_AND_EXPLAIN(num_cmp == str_cmp, "Numbers " << prevnum << " and " << num << - " don't sort the same way as their string " + " don't sort the same way as their std::string " "counterparts"); } @@ -603,7 +603,7 @@ // Test a generated uuid. uuid.generate(); TEST(!uuid.is_null()); - string str = uuid.to_string(); + std::string str = uuid.to_string(); TEST_EQUAL(str.size(), 36); TEST_NOT_EQUAL(str, "00000000-0000-0000-0000-000000000000"); // Check UUID pattern is correct and that upper case is not used. diff -ur xapian-core-1.4.21/unicode/description_append.cc xapian-core-1.4.21/unicode/description_append.cc --- xapian-core-1.4.21/unicode/description_append.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/unicode/description_append.cc 2022-11-08 16:44:15.604461060 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Append a string to an object description, escaping invalid UTF-8 + * @brief Append a std::string to an object description, escaping invalid UTF-8 */ /* Copyright (C) 2013,2019 Olly Betts * diff -ur xapian-core-1.4.21/unicode/description_append.h xapian-core-1.4.21/unicode/description_append.h --- xapian-core-1.4.21/unicode/description_append.h 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/unicode/description_append.h 2022-11-08 16:44:01.108512592 +0100 @@ -1,5 +1,5 @@ /** @file - * @brief Append a string to an object description, escaping invalid UTF-8 + * @brief Append a std::string to an object description, escaping invalid UTF-8 */ /* Copyright (C) 2013 Olly Betts * diff -ur xapian-core-1.4.21/weight/bb2weight.cc xapian-core-1.4.21/weight/bb2weight.cc --- xapian-core-1.4.21/weight/bb2weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/bb2weight.cc 2022-11-08 16:44:15.428461685 +0100 @@ -129,7 +129,7 @@ } BB2Weight * -BB2Weight::unserialise(const string & s) const +BB2Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/bm25plusweight.cc xapian-core-1.4.21/weight/bm25plusweight.cc --- xapian-core-1.4.21/weight/bm25plusweight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/bm25plusweight.cc 2022-11-08 16:44:15.424461700 +0100 @@ -85,7 +85,7 @@ string BM25PlusWeight::serialise() const { - string result = serialise_double(param_k1); + std::string result = serialise_double(param_k1); result += serialise_double(param_k2); result += serialise_double(param_k3); result += serialise_double(param_b); @@ -95,7 +95,7 @@ } BM25PlusWeight * -BM25PlusWeight::unserialise(const string & s) const +BM25PlusWeight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/bm25weight.cc xapian-core-1.4.21/weight/bm25weight.cc --- xapian-core-1.4.21/weight/bm25weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/bm25weight.cc 2022-11-08 16:44:15.420461713 +0100 @@ -137,7 +137,7 @@ string BM25Weight::serialise() const { - string result = serialise_double(param_k1); + std::string result = serialise_double(param_k1); result += serialise_double(param_k2); result += serialise_double(param_k3); result += serialise_double(param_b); @@ -146,7 +146,7 @@ } BM25Weight * -BM25Weight::unserialise(const string & s) const +BM25Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/ifb2weight.cc xapian-core-1.4.21/weight/ifb2weight.cc --- xapian-core-1.4.21/weight/ifb2weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/ifb2weight.cc 2022-11-08 16:44:15.428461685 +0100 @@ -103,7 +103,7 @@ } IfB2Weight * -IfB2Weight::unserialise(const string & s) const +IfB2Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/ineb2weight.cc xapian-core-1.4.21/weight/ineb2weight.cc --- xapian-core-1.4.21/weight/ineb2weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/ineb2weight.cc 2022-11-08 16:44:15.432461672 +0100 @@ -102,7 +102,7 @@ } IneB2Weight * -IneB2Weight::unserialise(const string & s) const +IneB2Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/inl2weight.cc xapian-core-1.4.21/weight/inl2weight.cc --- xapian-core-1.4.21/weight/inl2weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/inl2weight.cc 2022-11-08 16:44:15.432461672 +0100 @@ -100,7 +100,7 @@ } InL2Weight * -InL2Weight::unserialise(const string & s) const +InL2Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/lmweight.cc xapian-core-1.4.21/weight/lmweight.cc --- xapian-core-1.4.21/weight/lmweight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/lmweight.cc 2022-11-08 16:44:15.420461713 +0100 @@ -99,7 +99,7 @@ string LMWeight::serialise() const { - string result = serialise_double(param_log); + std::string result = serialise_double(param_log); result += static_cast<unsigned char>(select_smoothing); result += serialise_double(param_smoothing1); result += serialise_double(param_smoothing2); @@ -107,7 +107,7 @@ } LMWeight * -LMWeight::unserialise(const string & s) const +LMWeight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/pl2plusweight.cc xapian-core-1.4.21/weight/pl2plusweight.cc --- xapian-core-1.4.21/weight/pl2plusweight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/pl2plusweight.cc 2022-11-08 16:44:15.428461685 +0100 @@ -141,13 +141,13 @@ string PL2PlusWeight::serialise() const { - string result = serialise_double(param_c); + std::string result = serialise_double(param_c); result += serialise_double(param_delta); return result; } PL2PlusWeight * -PL2PlusWeight::unserialise(const string & s) const +PL2PlusWeight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/pl2weight.cc xapian-core-1.4.21/weight/pl2weight.cc --- xapian-core-1.4.21/weight/pl2weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/pl2weight.cc 2022-11-08 16:44:15.428461685 +0100 @@ -141,7 +141,7 @@ } PL2Weight * -PL2Weight::unserialise(const string & s) const +PL2Weight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/tfidfweight.cc xapian-core-1.4.21/weight/tfidfweight.cc --- xapian-core-1.4.21/weight/tfidfweight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/tfidfweight.cc 2022-11-08 16:44:15.424461700 +0100 @@ -42,7 +42,7 @@ !strchr("nbslL", normalizations[0]) || !strchr("ntpfs", normalizations[1]) || !strchr("n", normalizations[2])) - throw Xapian::InvalidArgumentError("Normalization string is invalid"); + throw Xapian::InvalidArgumentError("Normalization std::string is invalid"); if (normalizations[1] != 'n') { need_stat(TERMFREQ); need_stat(COLLECTION_SIZE); @@ -89,7 +89,7 @@ } TfIdfWeight * -TfIdfWeight::unserialise(const string & s) const +TfIdfWeight::unserialise(const std::string & s) const { if (s.length() != 3) throw Xapian::SerialisationError("Extra data in TfIdfWeight::unserialise()"); diff -ur xapian-core-1.4.21/weight/tradweight.cc xapian-core-1.4.21/weight/tradweight.cc --- xapian-core-1.4.21/weight/tradweight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/tradweight.cc 2022-11-08 16:44:15.424461700 +0100 @@ -136,7 +136,7 @@ } TradWeight * -TradWeight::unserialise(const string & s) const +TradWeight::unserialise(const std::string & s) const { const char *ptr = s.data(); const char *end = ptr + s.size(); diff -ur xapian-core-1.4.21/weight/weight.cc xapian-core-1.4.21/weight/weight.cc --- xapian-core-1.4.21/weight/weight.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/weight.cc 2022-11-08 16:44:15.424461700 +0100 @@ -58,7 +58,7 @@ void Weight::init_(const Internal & stats, Xapian::termcount query_length, - const string & term, Xapian::termcount wqf, double factor, + const std::string & term, Xapian::termcount wqf, double factor, void* postlist_void) { LOGCALL_VOID(MATCH, "Weight::init_", stats | query_length | term | wqf | factor | postlist_void); @@ -91,7 +91,7 @@ void Weight::init_(const Internal & stats, Xapian::termcount query_length, - const string & term, Xapian::termcount wqf, double factor) + const std::string & term, Xapian::termcount wqf, double factor) { init_(stats, query_length, term, wqf, factor, nullptr); } @@ -144,7 +144,7 @@ } Weight * -Weight::unserialise(const string &) const +Weight::unserialise(const std::string &) const { throw Xapian::UnimplementedError("unserialise() not supported for this Xapian::Weight subclass"); } diff -ur xapian-core-1.4.21/weight/weightinternal.cc xapian-core-1.4.21/weight/weightinternal.cc --- xapian-core-1.4.21/weight/weightinternal.cc 2022-09-22 07:27:36.000000000 +0200 +++ xapian-core-1.4.21/weight/weightinternal.cc 2022-11-08 16:44:15.416461728 +0100 @@ -37,7 +37,7 @@ string TermFreqs::get_description() const { - string desc("TermFreqs(termfreq="); + std::string desc("TermFreqs(termfreq="); desc += str(termfreq); desc += ", reltermfreq="; desc += str(reltermfreq); @@ -63,7 +63,7 @@ rset_size += inc.rset_size; // Add termfreqs and reltermfreqs - map<string, TermFreqs>::const_iterator i; + std::map<string, TermFreqs>::const_iterator i; for (i = inc.termfreqs.begin(); i != inc.termfreqs.end(); ++i) { termfreqs[i->first] += i->second; } @@ -84,7 +84,7 @@ Xapian::TermIterator t; for (t = query.get_unique_terms_begin(); t != Xapian::TermIterator(); ++t) { - const string & term = *t; + const std::string & term = *t; Xapian::doccount sub_tf; Xapian::termcount sub_cf; @@ -103,9 +103,9 @@ // and we can skip the document's termlist, so look for each query term // in the document. AutoPtr<TermList> tl(subdb.open_term_list(did)); - map<string, TermFreqs>::iterator i; + std::map<string, TermFreqs>::iterator i; for (i = termfreqs.begin(); i != termfreqs.end(); ++i) { - const string & term = i->first; + const std::string & term = i->first; TermList * ret = tl->skip_to(term); Assert(ret == NULL); (void)ret; @@ -130,7 +130,7 @@ string Weight::Internal::get_description() const { - string desc = "Weight::Internal(totlen="; + std::string desc = "Weight::Internal(totlen="; desc += str(total_length); desc += ", collection_size="; desc += str(collection_size); @@ -143,7 +143,7 @@ desc += str(finalised); #endif desc += ", termfreqs={"; - map<string, TermFreqs>::const_iterator i; + std::map<string, TermFreqs>::const_iterator i; for (i = termfreqs.begin(); i != termfreqs.end(); ++i) { if (i != termfreqs.begin()) desc += ", ";
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor