From cc0c72748eec2ca5e28c11a5caa9db0940e98581 Mon Sep 17 00:00:00 2001 From: dockes Date: Fri, 25 Nov 2005 09:13:07 +0000 Subject: [PATCH] get all mime list from mimeconf, not mimemap --- src/common/rclconfig.cpp | 38 +++++++++++++------------------------- src/common/rclconfig.h | 5 +++-- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 1d61106c..92fc1d95 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.13 2005-11-24 07:16:15 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.14 2005-11-25 09:13:06 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #include #include @@ -101,39 +101,27 @@ bool RclConfig::getConfParam(const std::string &name, int *ivp) bool RclConfig::getConfParam(const std::string &name, bool *bvp) { + if (!bvp) + return false; + *bvp = false; string s; if (!getConfParam(name, s)) return false; - if (s.empty()) - return true; - if (isdigit(s[0])) { - int val = atoi(s.c_str()); - *bvp = val ? true : false; - } else if (strchr("yYoOtT", s[0])) { - *bvp = true; - } + *bvp = stringToBool(s); return true; } -static ConfSimple::WalkerCode mtypesWalker(void *l, - const char *nm, const char *value) -{ - std::list *lst = (std::list *)l; - if (nm && nm[0] == '.') - lst->push_back(value); - return ConfSimple::WALK_CONTINUE; -} - -#include "idfile.h" +// Get all known document mime values. We get them from the mimeconf +// 'index' submap: values not in there (ie from mimemap or idfile) can't +// possibly belong to documents in the database. std::list RclConfig::getAllMimeTypes() { std::list lst; - if (mimemap == 0) + if (mimeconf == 0) return lst; - mimemap->sortwalk(mtypesWalker, &lst); - std::list l1 = idFileAllTypes(); - lst.insert(lst.end(), l1.begin(), l1.end()); + // mimeconf->sortwalk(mtypesWalker, &lst); + lst = mimeconf->getNames("index"); lst.sort(); lst.unique(); return lst; @@ -144,7 +132,7 @@ bool RclConfig::getStopSuffixes(list& sufflist) if (stopsuffixes == 0 && (stopsuffixes = new list) != 0) { string stp; if (mimemap->get("recoll_noindex", stp, keydir)) { - ConfTree::stringToStrings(stp, *stopsuffixes); + stringToStrings(stp, *stopsuffixes); } } @@ -224,7 +212,7 @@ bool RclConfig::getUncompressor(const string &mtype, list& cmd) if (hs.empty()) return false; list tokens; - ConfTree::stringToStrings(hs, tokens); + stringToStrings(hs, tokens); if (tokens.empty()) { LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str())); return false; diff --git a/src/common/rclconfig.h b/src/common/rclconfig.h index bf95afe4..aecdaace 100644 --- a/src/common/rclconfig.h +++ b/src/common/rclconfig.h @@ -1,10 +1,11 @@ #ifndef _RCLCONFIG_H_INCLUDED_ #define _RCLCONFIG_H_INCLUDED_ -/* @(#$Id: rclconfig.h,v 1.8 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: rclconfig.h,v 1.9 2005-11-25 09:13:07 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include "conftree.h" +#include "smallut.h" class RclConfig { public: @@ -39,7 +40,7 @@ class RclConfig { conf->get("defaultlanguage", deflang, keydir); string str; conf->get("guesscharset", str, keydir); - guesscharset = ConfTree::stringToBool(str); + guesscharset = stringToBool(str); } /**