Changeset 11157
- Timestamp:
- 2008-09-02 13:34:04 (3 months ago)
- Location:
- branches/1.0/xapian-core
- Files:
-
- 2 modified
-
ChangeLog (modified) (1 diff)
-
examples/copydatabase.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/xapian-core/ChangeLog
r11156 r11157 1 Tue Sep 02 12:33:51 GMT 2008 Olly Betts <olly@survex.com> 2 3 * Backport change from trunk: 4 * examples/copydatabase.cc: Use C++ forms of C headers. Only treat 5 '\' as a directory separator on platforms where it is. Update 6 counter every 13 counting up to the end so that the digits all 7 "rotate" and the counter ends up on the exact total. 8 1 9 Tue Sep 02 12:06:26 GMT 2008 Olly Betts <olly@survex.com> 2 10 -
branches/1.0/xapian-core/examples/copydatabase.cc
r9075 r11157 2 2 * @brief Perform a document-by-document copy of one or more Xapian databases. 3 3 */ 4 /* Copyright (C) 2006,2007 Olly Betts4 /* Copyright (C) 2006,2007,2008 Olly Betts 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify … … 26 26 #include <iostream> 27 27 28 #include < math.h> // For log10().29 #include < stdlib.h> // For exit().30 #include < string.h> // For strcmp() and strrchr().28 #include <cmath> // For log10(). 29 #include <cstdlib> // For exit(). 30 #include <cstring> // For strcmp() and strrchr(). 31 31 32 32 using namespace std; … … 82 82 // Find the leaf-name of the database path for reporting progress. 83 83 const char * leaf = strrchr(src, '/'); 84 #if defined __WIN32__ || defined __EMX__ 84 85 if (!leaf) leaf = strrchr(src, '\\'); 86 #endif 85 87 if (leaf) ++leaf; else leaf = src; 86 88 … … 98 100 db_out.add_document(db_in.get_document(*it)); 99 101 102 // Update for the first 10, and then every 13th document 103 // counting back from the end (this means that all the 104 // digits "rotate" and the counter ends up on the exact 105 // total. 100 106 ++c; 101 // Update for the first 10, and then every 10th document. 102 if (c <= 10 || c % 10 == 0) { 107 if (c <= 10 || (dbsize - c) % 13 == 0) { 103 108 cout << '\r' << leaf << ": "; 104 109 cout << setw(width) << c << '/' << dbsize << flush; … … 117 122 ++spellword; 118 123 } 119 cout << " Done." << endl;124 cout << " done." << endl; 120 125 121 126 cout << "Copying synonym data..." << flush; … … 130 135 ++synkey; 131 136 } 132 cout << " Done." << endl;137 cout << " done." << endl; 133 138 } 134 139
