Auto C++ typing introduced where appropriate

This commit is contained in:
Simon Rozman 2016-10-06 11:39:28 +02:00
parent dacca1409e
commit ba8254c097
16 changed files with 50 additions and 53 deletions

View File

@ -100,13 +100,10 @@ wxString wxZRColaCharGrid::GetToolTipText(int idx)
ZRColaApp *app = (ZRColaApp*)wxTheApp; ZRColaApp *app = (ZRColaApp*)wxTheApp;
// See if this character has a key sequence registered. // See if this character has a key sequence registered.
ZRCola::keyseq_db::indexKey::size_type start;
bool found;
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {}; char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
((ZRCola::keyseq_db::keyseq*)ks)->chr = m_chars[idx]; ((ZRCola::keyseq_db::keyseq*)ks)->chr = m_chars[idx];
found = app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start); ZRCola::keyseq_db::indexKey::size_type start;
if (app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start)) {
if (found) {
ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start]; ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start];
wxString ks_str; wxString ks_str;
if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq, seq.seq_len, ks_str)) if (ZRCola::keyseq_db::GetSequenceAsText(seq.seq, seq.seq_len, ks_str))

View File

@ -43,7 +43,7 @@ wxZRColaCharSelect::wxZRColaCharSelect(wxWindow* parent) :
// Fill categories. // Fill categories.
ZRColaApp *app = (ZRColaApp*)wxTheApp; ZRColaApp *app = (ZRColaApp*)wxTheApp;
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) { for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i]; const auto &cc = app->m_cc_db.idxRnk[i];
int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name, cc.name_len), wxT("ZRCola-zrcdb")), i); int idx = m_categories->Insert(wxGetTranslation(wxString(cc.name, cc.name_len), wxT("ZRCola-zrcdb")), i);
m_categories->Check(idx); m_categories->Check(idx);
m_ccOrder.insert(std::make_pair(cc.id, idx)); m_ccOrder.insert(std::make_pair(cc.id, idx));
@ -82,14 +82,14 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
((ZRCola::character_db::character*)chr)->chr = m_char; ((ZRCola::character_db::character*)chr)->chr = m_char;
size_t start; size_t start;
if (app->m_chr_db.idxChr.find(*(ZRCola::character_db::character*)chr, start)) { if (app->m_chr_db.idxChr.find(*(ZRCola::character_db::character*)chr, start)) {
const ZRCola::character_db::character &chr = app->m_chr_db.idxChr[start]; const auto &chr = app->m_chr_db.idxChr[start];
// Update characted description. // Update characted description.
m_description->SetValue(wxString(chr.data, chr.desc_len)); m_description->SetValue(wxString(chr.data, chr.desc_len));
{ {
// See if this character has a key sequence registered. // See if this character has a key sequence registered.
ZRCola::keyseq_db::indexKey::size_type start;
char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {}; char ks[sizeof(ZRCola::keyseq_db::keyseq)] = {};
((ZRCola::keyseq_db::keyseq*)ks)->chr = m_char; ((ZRCola::keyseq_db::keyseq*)ks)->chr = m_char;
ZRCola::keyseq_db::indexKey::size_type start;
if (app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start)) { if (app->m_ks_db.idxChr.find(*(ZRCola::keyseq_db::keyseq*)ks, start)) {
ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start]; ZRCola::keyseq_db::keyseq &seq = app->m_ks_db.idxChr[start];
wxString ks_str; wxString ks_str;
@ -106,7 +106,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
size_t start; size_t start;
// Update character category. // Update character category.
if (app->m_cc_db.idxChrCat.find(*((ZRCola::chrcat_db::chrcat*)cc), start)) { if (app->m_cc_db.idxChrCat.find(*((ZRCola::chrcat_db::chrcat*)cc), start)) {
const ZRCola::chrcat_db::chrcat &cat = app->m_cc_db.idxChrCat[start]; const auto &cat = app->m_cc_db.idxChrCat[start];
m_category->SetValue(wxGetTranslation(wxString(cat.name, cat.name_len), wxT("ZRCola-zrcdb"))); m_category->SetValue(wxGetTranslation(wxString(cat.name, cat.name_len), wxT("ZRCola-zrcdb")));
} else } else
m_category->SetValue(wxEmptyString); m_category->SetValue(wxEmptyString);
@ -145,7 +145,7 @@ void wxZRColaCharSelect::OnIdle(wxIdleEvent& event)
// Select categories. // Select categories.
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) { for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i]; const auto &cc = app->m_cc_db.idxRnk[i];
if (m_categories->IsChecked(i)) if (m_categories->IsChecked(i))
m_searchThread->m_cats.insert(cc.id); m_searchThread->m_cats.insert(cc.id);
} }
@ -239,7 +239,7 @@ void wxZRColaCharSelect::OnSearchComplete(wxThreadEvent& event)
// Display results. // Display results.
wxString chars; wxString chars;
chars.reserve(m_searchThread->m_hits.size()); chars.reserve(m_searchThread->m_hits.size());
for (std::vector<std::pair<ZRCola::charrank_t, wchar_t> >::const_iterator i = m_searchThread->m_hits.cbegin(), i_end = m_searchThread->m_hits.cend(); i != i_end; ++i) for (auto i = m_searchThread->m_hits.cbegin(), i_end = m_searchThread->m_hits.cend(); i != i_end; ++i)
chars += i->second; chars += i->second;
m_gridResults->SetCharacters(chars); m_gridResults->SetCharacters(chars);
@ -413,8 +413,8 @@ void wxZRColaCharSelect::ResetResults()
wxString val; wxString val;
val.reserve(n); val.reserve(n);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
const ZRCola::character_db::character &chr = app->m_chr_db.idxChr[i]; const auto &chr = app->m_chr_db.idxChr[i];
std::map<ZRCola::chrcatid_t, int>::const_iterator idx = m_ccOrder.find(chr.cat); auto idx = m_ccOrder.find(chr.cat);
if (idx == m_ccOrder.end() || m_categories->IsChecked(idx->second)) if (idx == m_ccOrder.end() || m_categories->IsChecked(idx->second))
val += chr.chr; val += chr.chr;
} }
@ -450,7 +450,7 @@ void wxZRColaCharSelect::NavigateBy(int offset)
} }
m_navigateBack->Enable(m_historyCursor != m_history.begin()); m_navigateBack->Enable(m_historyCursor != m_history.begin());
std::list<NavigationState>::iterator cursor_next(m_historyCursor); auto cursor_next = m_historyCursor;
++cursor_next; ++cursor_next;
m_navigateForward->Enable(cursor_next != m_history.end()); m_navigateForward->Enable(cursor_next != m_history.end());
@ -477,7 +477,7 @@ void wxZRColaCharSelect::NavigateTo(wchar_t c)
m_historyCursor = m_history.insert(m_historyCursor, state); m_historyCursor = m_history.insert(m_historyCursor, state);
// Purge the history's tail. // Purge the history's tail.
std::list<NavigationState>::iterator cursor_next(m_historyCursor); auto cursor_next = m_historyCursor;
++cursor_next; ++cursor_next;
m_history.erase(cursor_next, m_history.end()); m_history.erase(cursor_next, m_history.end());
@ -509,9 +509,9 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
// Search by indexes and merge results. // Search by indexes and merge results.
std::map<wchar_t, ZRCola::charrank_t> hits_sub; std::map<wchar_t, ZRCola::charrank_t> hits_sub;
if (!app->m_chr_db.Search(m_search.c_str(), m_cats, hits, hits_sub, TestDestroyS, this)) return (wxThread::ExitCode)1; if (!app->m_chr_db.Search(m_search.c_str(), m_cats, hits, hits_sub, TestDestroyS, this)) return (wxThread::ExitCode)1;
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits_sub.cbegin(), i_end = hits_sub.cend(); i != i_end; ++i) { for (auto i = hits_sub.cbegin(), i_end = hits_sub.cend(); i != i_end; ++i) {
if (TestDestroy()) return (wxThread::ExitCode)1; if (TestDestroy()) return (wxThread::ExitCode)1;
std::map<wchar_t, ZRCola::charrank_t>::iterator idx = hits.find(i->first); auto idx = hits.find(i->first);
if (idx == hits.end()) if (idx == hits.end())
hits.insert(std::make_pair(i->first, i->second / 4)); hits.insert(std::make_pair(i->first, i->second / 4));
else else
@ -521,7 +521,7 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
// Get best rank. // Get best rank.
ZRCola::charrank_t rank_ref = 0; ZRCola::charrank_t rank_ref = 0;
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) { for (auto i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
if (TestDestroy()) return (wxThread::ExitCode)1; if (TestDestroy()) return (wxThread::ExitCode)1;
if (i->second > rank_ref) if (i->second > rank_ref)
rank_ref = i->second; rank_ref = i->second;
@ -530,7 +530,7 @@ wxThread::ExitCode wxZRColaCharSelect::SearchThread::Entry()
// Now sort the characters by rank (taking only top 3/4 by rank). // Now sort the characters by rank (taking only top 3/4 by rank).
ZRCola::charrank_t rank_threshold = rank_ref*3/4; ZRCola::charrank_t rank_threshold = rank_ref*3/4;
m_hits.reserve(hits.size()); m_hits.reserve(hits.size());
for (std::map<wchar_t, ZRCola::charrank_t>::const_iterator i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) { for (auto i = hits.cbegin(), i_end = hits.cend(); i != i_end; ++i) {
if (TestDestroy()) return (wxThread::ExitCode)1; if (TestDestroy()) return (wxThread::ExitCode)1;
if (i->second > rank_threshold) if (i->second > rank_threshold)
m_hits.push_back(std::make_pair(i->second, i->first)); m_hits.push_back(std::make_pair(i->second, i->first));
@ -586,7 +586,7 @@ void wxPersistentZRColaCharSelect::Save() const
ZRColaApp *app = (ZRColaApp*)wxTheApp; ZRColaApp *app = (ZRColaApp*)wxTheApp;
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) { for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i]; const auto &cc = app->m_cc_db.idxRnk[i];
wxString name(wxT("category")); wxString name(wxT("category"));
name.Append(cc.id.data, _countof(cc.id.data)); name.Append(cc.id.data, _countof(cc.id.data));
SaveValue(name, wnd->m_categories->IsChecked(i)); SaveValue(name, wnd->m_categories->IsChecked(i));
@ -606,7 +606,7 @@ bool wxPersistentZRColaCharSelect::Restore()
ZRColaApp *app = (ZRColaApp*)wxTheApp; ZRColaApp *app = (ZRColaApp*)wxTheApp;
for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) { for (size_t i = 0, n = app->m_cc_db.idxRnk.size(); i < n; i++) {
const ZRCola::chrcat_db::chrcat &cc = app->m_cc_db.idxRnk[i]; const auto &cc = app->m_cc_db.idxRnk[i];
wxString name(wxT("category")); wxString name(wxT("category"));
name.Append(cc.id.data, _countof(cc.id.data)); name.Append(cc.id.data, _countof(cc.id.data));
bool val; bool val;

View File

@ -459,7 +459,7 @@ void wxZRColaFrame::DoSend(const wxString& str)
{ {
// Prepare the INPUT table. // Prepare the INPUT table.
wxString::size_type n = str.length(); wxString::size_type n = str.length();
wxString::const_iterator i_str = str.begin(); auto i_str = str.begin();
std::vector<INPUT> input; std::vector<INPUT> input;
input.reserve(n*2); input.reserve(n*2);
for (std::vector<INPUT>::size_type i = 0; i < n; i++, i_str++) { for (std::vector<INPUT>::size_type i = 0; i < n; i++, i_str++) {

View File

@ -96,7 +96,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
(e.AltDown() ? ZRCola::keyseq_db::keyseq::ALT : 0); (e.AltDown() ? ZRCola::keyseq_db::keyseq::ALT : 0);
m_seq.push_back(key); m_seq.push_back(key);
std::vector<ZRCola::keyseq_db::keyseq::key_t>::size_type n = m_seq.size(); auto n = m_seq.size();
ZRCola::keyseq_db::keyseq *ks = (ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::keyseq_db::keyseq::key_t)*n]; ZRCola::keyseq_db::keyseq *ks = (ZRCola::keyseq_db::keyseq*)new char[sizeof(ZRCola::keyseq_db::keyseq) + sizeof(ZRCola::keyseq_db::keyseq::key_t)*n];
ks->chr = 0; ks->chr = 0;
ks->seq_len = n; ks->seq_len = n;
@ -147,7 +147,7 @@ bool wxZRColaKeyHandler::ProcessEvent(wxEvent& event)
if (pFrame && pFrame->GetStatusBar()) if (pFrame && pFrame->GetStatusBar())
pFrame->SetStatusText(wxEmptyString); pFrame->SetStatusText(wxEmptyString);
std::vector<char>::size_type count = m_insert_seq.size(); auto count = m_insert_seq.size();
if (count) { if (count) {
// Zero terminate sequence and parse the Unicode value. // Zero terminate sequence and parse the Unicode value.
m_insert_seq.push_back(0); m_insert_seq.push_back(0);

View File

@ -32,7 +32,7 @@ wxZRColaSettings::wxZRColaSettings(wxWindow* parent) :
ZRColaApp *app = ((ZRColaApp*)wxTheApp); ZRColaApp *app = ((ZRColaApp*)wxTheApp);
m_languages->Clear(); m_languages->Clear();
for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) { for (size_t i = 0, n = app->m_lang_db.idxLng.size(); i < n; i++) {
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[i]; const auto &lang = app->m_lang_db.idxLng[i];
wxString wxString
label(lang.name, lang.name_len), label(lang.name, lang.name_len),
label_tran(wxGetTranslation(label, wxT("ZRCola-zrcdb"))); label_tran(wxGetTranslation(label, wxT("ZRCola-zrcdb")));
@ -122,7 +122,7 @@ void wxZRColaSettings::OnApplyButtonClick(wxCommandEvent& event)
m_lang_auto = false; m_lang_auto = false;
ZRColaApp *app = ((ZRColaApp*)wxTheApp); ZRColaApp *app = ((ZRColaApp*)wxTheApp);
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[m_languages->GetSelection()]; const auto &lang = app->m_lang_db.idxLng[m_languages->GetSelection()];
if (m_lang != lang.id) { if (m_lang != lang.id) {
m_lang = lang.id; m_lang = lang.id;
@ -181,7 +181,7 @@ bool wxPersistentZRColaSettings::Restore()
// The language was read from configuration. // The language was read from configuration.
wnd->m_lang = lang.c_str(); wnd->m_lang = lang.c_str();
} else if (!app->m_lang_db.idxLng.empty()) { } else if (!app->m_lang_db.idxLng.empty()) {
const ZRCola::language_db::language &lang = app->m_lang_db.idxLng[0]; const auto &lang = app->m_lang_db.idxLng[0];
wnd->m_lang = lang.id; wnd->m_lang = lang.id;
} else } else
wnd->m_lang = ZRCola::langid_t_blank; wnd->m_lang = ZRCola::langid_t_blank;

View File

@ -96,13 +96,13 @@ unsigned int ZRCola::DBSource::character_bank::build_related_worker::process()
set<wstring, less<wstring>, heap_allocator<wstring> > matching(less<wstring>(), al); set<wstring, less<wstring>, heap_allocator<wstring> > matching(less<wstring>(), al);
for (size_type i = m_from; i < m_to; i++) { for (size_type i = m_from; i < m_to; i++) {
ZRCola::DBSource::character &chr = *(m_cb->at(i).get()); auto &chr = *(m_cb->at(i).get());
if (&chr == NULL) continue; if (&chr == NULL) continue;
rel.clear(); rel.clear();
// Remove all unexisting, inactive, or self related characters. // Remove all unexisting, inactive, or self related characters.
for (wstring::size_type j = chr.rel.length(); j--;) { for (auto j = chr.rel.length(); j--;) {
wchar_t c = chr.rel[j]; wchar_t c = chr.rel[j];
if (m_cb->at(c) && (wchar_t)j != c) if (m_cb->at(c) && (wchar_t)j != c)
rel += c; rel += c;
@ -112,17 +112,17 @@ unsigned int ZRCola::DBSource::character_bank::build_related_worker::process()
for (size_type j = 0, j_end = m_cb->size(); j < j_end; j++) { for (size_type j = 0, j_end = m_cb->size(); j < j_end; j++) {
if (i == j || rel.find((wchar_t)j) != wstring::npos) if (i == j || rel.find((wchar_t)j) != wstring::npos)
continue; continue;
const ZRCola::DBSource::character &chr2 = *(m_cb->at(j).get()); const auto &chr2 = *(m_cb->at(j).get());
if (&chr2 == NULL) if (&chr2 == NULL)
continue; continue;
set<wstring>::size_type comparisons = 0; set<wstring>::size_type comparisons = 0;
matching.clear(); matching.clear();
for (set<wstring>::const_iterator term = chr.terms.cbegin(), term_end = chr.terms.cend(); term != term_end; ++term) { for (auto term = chr.terms.cbegin(), term_end = chr.terms.cend(); term != term_end; ++term) {
// Test for ignored word(s). // Test for ignored word(s).
if (m_cb->m_ignore.find(*term) != m_cb->m_ignore.cend()) if (m_cb->m_ignore.find(*term) != m_cb->m_ignore.cend())
continue; continue;
for (set<wstring>::const_iterator term2 = chr2.terms.cbegin(), term2_end = chr2.terms.cend(); term2 != term2_end; ++term2) { for (auto term2 = chr2.terms.cbegin(), term2_end = chr2.terms.cend(); term2 != term2_end; ++term2) {
// Test for ignored word(s). // Test for ignored word(s).
if (m_cb->m_ignore.find(*term2) != m_cb->m_ignore.cend()) if (m_cb->m_ignore.find(*term2) != m_cb->m_ignore.cend())
continue; continue;
@ -134,7 +134,7 @@ unsigned int ZRCola::DBSource::character_bank::build_related_worker::process()
if (comparisons) { if (comparisons) {
// If 1/2 terms match, assume related. // If 1/2 terms match, assume related.
set<wstring>::size_type hits = matching.size(); auto hits = matching.size();
if (hits*hits*2 >= comparisons) if (hits*hits*2 >= comparisons)
rel += chr2.chr; rel += chr2.chr;
} }
@ -205,7 +205,7 @@ void ZRCola::DBSource::character_desc_idx::parse_keywords(const wchar_t *str, se
void ZRCola::DBSource::character_desc_idx::add_keywords(const set<wstring> &terms, wchar_t chr, size_t sub) void ZRCola::DBSource::character_desc_idx::add_keywords(const set<wstring> &terms, wchar_t chr, size_t sub)
{ {
for (set<wstring>::const_iterator term = terms.cbegin(), term_end = terms.cend(); term != term_end; ++term) { for (auto term = terms.cbegin(), term_end = terms.cend(); term != term_end; ++term) {
if (sub) { if (sub) {
wstring::size_type j_end = term->size(); wstring::size_type j_end = term->size();
if (j_end >= sub) { if (j_end >= sub) {

View File

@ -256,7 +256,7 @@ namespace ZRCola {
} else { } else {
// Append to existing keyword. // Append to existing keyword.
std::vector<wchar_t> &val = idx->second; std::vector<wchar_t> &val = idx->second;
for (std::vector<wchar_t>::iterator i = val.begin(), i_end = val.end(); ; ++i) { for (auto i = val.cbegin(), i_end = val.cend(); ; ++i) {
if (i == i_end) { if (i == i_end) {
// End-of-values reached. Append character. // End-of-values reached. Append character.
val.push_back(chr); val.push_back(chr);

View File

@ -398,7 +398,7 @@ int _tmain(int argc, _TCHAR *argv[])
// Read character from the database. // Read character from the database.
unique_ptr<ZRCola::DBSource::character> c(new ZRCola::DBSource::character); unique_ptr<ZRCola::DBSource::character> c(new ZRCola::DBSource::character);
if (src.GetCharacter(rs, *c)) { if (src.GetCharacter(rs, *c)) {
const ZRCola::DBSource::character &chr = *c.get(); const auto &chr = *c.get();
chrs[chr.chr].swap(c); chrs[chr.chr].swap(c);
} else } else
has_errors = true; has_errors = true;
@ -415,7 +415,7 @@ int _tmain(int argc, _TCHAR *argv[])
// Phase 3: Parse characters and build index and data. // Phase 3: Parse characters and build index and data.
for (size_t i = 0, i_end = chrs.size(); i < i_end; i++) { for (size_t i = 0, i_end = chrs.size(); i < i_end; i++) {
const ZRCola::DBSource::character &chr = *(chrs[i].get()); const auto &chr = *(chrs[i].get());
if (&chr == NULL) continue; if (&chr == NULL) continue;
// Add character to index and data. // Add character to index and data.
@ -542,7 +542,7 @@ int _tmain(int argc, _TCHAR *argv[])
<< "\"X-Generator: ZRColaCompile\\n\"" << endl; << "\"X-Generator: ZRColaCompile\\n\"" << endl;
wstring_convert<codecvt_utf8<wchar_t>> conv; wstring_convert<codecvt_utf8<wchar_t>> conv;
for (set<wstring>::const_iterator i = pot.cbegin(); i != pot.cend(); ++i) { for (auto i = pot.cbegin(); i != pot.cend(); ++i) {
// Convert UTF-16 to UTF-8 and escape. // Convert UTF-16 to UTF-8 and escape.
string t(conv.to_bytes(*i)), u; string t(conv.to_bytes(*i)), u;
for (size_t i = 0, n = t.size(); i < n; i++) { for (size_t i = 0, n = t.size(); i < n; i++) {

View File

@ -452,7 +452,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::c
stream << db.idxDscSub; stream << db.idxDscSub;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {
@ -491,7 +491,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::c
stream << db.idxRnk; stream << db.idxRnk;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {

View File

@ -557,7 +557,7 @@ template <class T, class T_idx, class T_data>
inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::index<T, T_idx, T_data> &idx) inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::index<T, T_idx, T_data> &idx)
{ {
// Write index count. // Write index count.
ZRCola::index<T, T_idx, T_data>::size_type idx_count = idx.size(); auto idx_count = idx.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (idx_count > 0xffffffff) { if (idx_count > 0xffffffff) {
@ -619,7 +619,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
unsigned __int32 count; unsigned __int32 count;
// Write index count. // Write index count.
ZRCola::textindex<T_key, T_val, T_idx>::size_type idx_count = idx.size(); auto idx_count = idx.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (idx_count > 0xffffffff) { if (idx_count > 0xffffffff) {
@ -636,7 +636,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
stream.write((const char*)idx.data(), sizeof(ZRCola::textindex<T_key, T_val, T_idx>::value_type)*count); stream.write((const char*)idx.data(), sizeof(ZRCola::textindex<T_key, T_val, T_idx>::value_type)*count);
// Write key count. // Write key count.
std::vector<T_key>::size_type key_count = idx.keys.size(); auto key_count = idx.keys.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (idx_count > 0xffffffff) { if (idx_count > 0xffffffff) {
@ -653,7 +653,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
stream.write((const char*)idx.keys.data(), sizeof(std::vector<T_key>::value_type)*count); stream.write((const char*)idx.keys.data(), sizeof(std::vector<T_key>::value_type)*count);
// Write value count. // Write value count.
std::vector<T_val>::size_type value_count = idx.values.size(); auto value_count = idx.values.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (idx_count > 0xffffffff) { if (idx_count > 0xffffffff) {

View File

@ -280,7 +280,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::l
#endif #endif
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {
@ -351,7 +351,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::l
stream << db.idxLng; stream << db.idxLng;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {

View File

@ -267,7 +267,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::t
stream << db.idxDecomp; stream << db.idxDecomp;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {

View File

@ -77,7 +77,7 @@ bool ZRCola::character_db::Search(_In_z_ const wchar_t *str, _In_ const std::set
if (fn_abort && fn_abort(cookie)) return false; if (fn_abort && fn_abort(cookie)) return false;
wchar_t c = data[i]; wchar_t c = data[i];
if (cats.find(GetCharCat(c)) != cats.end()) { if (cats.find(GetCharCat(c)) != cats.end()) {
std::map<wchar_t, charrank_t>::iterator idx = hits.find(c); auto idx = hits.find(c);
if (idx == hits.end()) { if (idx == hits.end()) {
// New character. // New character.
hits.insert(std::make_pair(data[i], 1.0/len)); hits.insert(std::make_pair(data[i], 1.0/len));
@ -95,7 +95,7 @@ bool ZRCola::character_db::Search(_In_z_ const wchar_t *str, _In_ const std::set
if (fn_abort && fn_abort(cookie)) return false; if (fn_abort && fn_abort(cookie)) return false;
wchar_t c = data[i]; wchar_t c = data[i];
if (cats.find(GetCharCat(c)) != cats.end()) { if (cats.find(GetCharCat(c)) != cats.end()) {
std::map<wchar_t, charrank_t>::iterator idx = hits_sub.find(c); auto idx = hits_sub.find(c);
if (idx == hits_sub.end()) { if (idx == hits_sub.end()) {
// New character. // New character.
hits_sub.insert(std::make_pair(data[i], 1.0/len)); hits_sub.insert(std::make_pair(data[i], 1.0/len));

View File

@ -34,7 +34,7 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input
if (map) if (map)
map->clear(); map->clear();
indexComp::size_type compositionsCount = idxComp.size(); auto compositionsCount = idxComp.size();
for (size_t i = 0; i < inputMax;) { for (size_t i = 0; i < inputMax;) {
// Find the longest matching composition at i-th character. // Find the longest matching composition at i-th character.
@ -116,7 +116,7 @@ void ZRCola::translation_db::Decompose(_In_z_count_(inputMax) const wchar_t* inp
if (map) if (map)
map->clear(); map->clear();
indexDecomp::size_type decompositionsCount = idxDecomp.size(); auto decompositionsCount = idxDecomp.size();
for (size_t i = 0; i < inputMax;) { for (size_t i = 0; i < inputMax;) {
// Find whether the character can be decomposed. // Find whether the character can be decomposed.

View File

@ -165,7 +165,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::c
stream << db.idxRnk; stream << db.idxRnk;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {

View File

@ -264,7 +264,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::k
stream << db.idxKey; stream << db.idxKey;
// Write data count. // Write data count.
std::vector<unsigned __int16>::size_type data_count = db.data.size(); auto data_count = db.data.size();
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) #if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
// 4G check // 4G check
if (data_count > 0xffffffff) { if (data_count > 0xffffffff) {