From 4141db6d501c2ae6471b41284192ce6afb8e7d16 Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 13 Dec 2006 09:13:18 +0000 Subject: [PATCH] move findFilter usage out of mh_exec --- src/common/rclconfig.cpp | 12 ++++++++---- src/internfile/internfile.cpp | 4 ++-- src/internfile/mh_exec.cpp | 5 +++-- src/internfile/mimehandler.cpp | 16 ++++++++-------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 164e7f88..036e905c 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.34 2006-12-11 14:50:53 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.35 2006-12-13 09:13:18 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -389,10 +389,14 @@ bool RclConfig::getUncompressor(const string &mtype, list& cmd) LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str())); return false; } - if (stringlowercmp("uncompress", tokens.front())) - return false; list::iterator it = tokens.begin(); - cmd.assign(++it, tokens.end()); + if (tokens.size() < 2) + return false; + if (stringlowercmp("uncompress", *it++)) + return false; + cmd.clear(); + cmd.push_back(findFilter(*it++)); + cmd.insert(cmd.end(), it, tokens.end()); return true; } diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index e98821bb..46bf5eb4 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: internfile.cpp,v 1.17 2006-11-10 13:29:39 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: internfile.cpp,v 1.18 2006-12-13 09:13:18 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -49,7 +49,7 @@ static bool uncompressfile(RclConfig *conf, const string& ifn, LOGERR(("uncompressfile: can't clear temp dir %s\n", tdir.c_str())); return false; } - string cmd = conf->findFilter(cmdv.front()); + string cmd = cmdv.front(); // Substitute file name and temp dir in command elements list::const_iterator it = cmdv.begin(); diff --git a/src/internfile/mh_exec.cpp b/src/internfile/mh_exec.cpp index 6406a24a..f9192b2c 100644 --- a/src/internfile/mh_exec.cpp +++ b/src/internfile/mh_exec.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.6 2006-01-26 17:59:50 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.7 2006-12-13 09:13:18 dockes Exp $ (C) 2005 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -47,8 +47,9 @@ MimeHandlerExec::mkDoc(RclConfig *conf, const string &fn, mtype.c_str())); return MimeHandler::MHError; } + // Command name - string cmd = conf->findFilter(params.front()); + string cmd = params.front(); // Build parameter list: delete cmd name and add the file name list::iterator it = params.begin(); diff --git a/src/internfile/mimehandler.cpp b/src/internfile/mimehandler.cpp index 081c84e1..5812eda1 100644 --- a/src/internfile/mimehandler.cpp +++ b/src/internfile/mimehandler.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: mimehandler.cpp,v 1.18 2006-03-29 13:08:08 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: mimehandler.cpp,v 1.19 2006-12-13 09:13:18 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -68,20 +68,20 @@ MimeHandler *getMimeHandler(const string &mtype, RclConfig *cfg) } // Retrieve handler function according to type - if (!stringlowercmp("internal", toks.front())) { + list::iterator it = toks.begin(); + if (!stringlowercmp("internal", *it)) { return mhFactory(mtype); - } else if (!stringlowercmp("dll", toks.front())) { - } else if (!stringlowercmp("exec", toks.front())) { + } else if (!stringlowercmp("dll", *it)) { + } else if (!stringlowercmp("exec", *it)) { if (toks.size() < 2) { LOGERR(("getMimeHandler: bad line for %s: %s\n", mtype.c_str(), hs.c_str())); return 0; } MimeHandlerExec *h = new MimeHandlerExec; - list::const_iterator it1 = toks.begin(); - it1++; - for (;it1 != toks.end();it1++) - h->params.push_back(*it1); + it++; + h->params.push_back(cfg->findFilter(*it++)); + h->params.insert(h->params.end(), it, toks.end()); return h; } }