From ab22f8eb41b9fc55a1fdc09622bacb17955bd348 Mon Sep 17 00:00:00 2001 From: Evgeniy Dushistov Date: Sat, 6 Jul 2013 12:52:48 +0000 Subject: [PATCH] replace array with variable size with vector, this should help clang compiler to compile our source code --- src/lib/file.hpp | 2 +- src/lib/lib.cpp | 4 ++-- src/lib/lib.h | 2 +- src/libwrapper.cpp | 4 ++-- tests/t_utf8input | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/file.hpp b/src/lib/file.hpp index 53e55c7..826ac8f 100644 --- a/src/lib/file.hpp +++ b/src/lib/file.hpp @@ -43,7 +43,7 @@ void for_each_file(const List& dirs_list, const std::string& suff, List::const_iterator it; for (it=order_list.begin(); it!=order_list.end(); ++it) { bool disable=std::find(disable_list.begin(), disable_list.end(), - *it)!=disable_list.end(); + *it)!=disable_list.end(); f(*it, disable); } for (it=dirs_list.begin(); it!=dirs_list.end(); ++it) diff --git a/src/lib/lib.cpp b/src/lib/lib.cpp index 7a4b1d7..bd40886 100644 --- a/src/lib/lib.cpp +++ b/src/lib/lib.cpp @@ -750,12 +750,12 @@ bool wordlist_index::load(const std::string& url, gulong wc, gulong fsize) idxdatabuf = (gchar *)g_malloc(fsize); - gulong len = gzread(in, idxdatabuf, fsize); + const int len = gzread(in, idxdatabuf, fsize); gzclose(in); if (len < 0) return false; - if (len != fsize) + if (gulong(len) != fsize) return false; wordlist.resize(wc+1); diff --git a/src/lib/lib.h b/src/lib/lib.h index 7def747..39f39df 100644 --- a/src/lib/lib.h +++ b/src/lib/lib.h @@ -119,7 +119,7 @@ public: glong narticles(int idict) { return oLib[idict]->narticles(); } const std::string& dict_name(int idict) { return oLib[idict]->dict_name(); } - gint ndicts() { return oLib.size(); } + gint ndicts() const { return oLib.size(); } const gchar * poGetWord(glong iIndex,int iLib) { return oLib[iLib]->get_key(iIndex); diff --git a/src/libwrapper.cpp b/src/libwrapper.cpp index cb23f2f..95e8192 100644 --- a/src/libwrapper.cpp +++ b/src/libwrapper.cpp @@ -209,8 +209,8 @@ void Library::LookupWithRule(const string &str, TSearchResultList& res_list) void Library::LookupData(const string &str, TSearchResultList& res_list) { - std::vector drl[ndicts()]; - if (!Libs::LookupData(str.c_str(), drl)) + std::vector > drl(ndicts()); + if (!Libs::LookupData(str.c_str(), &drl[0])) return; for (int idict=0; idict::size_type j=0; j&1`; do done if [ $j -eq 1 ]; then - echo "empty results of search: test failed" >&2 + echo "$0: empty results of search: test failed" >&2 exit 1 fi