|
a/src/index/mimetype.cpp |
|
b/src/index/mimetype.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: mimetype.cpp,v 1.19 2006-12-19 08:40:50 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: mimetype.cpp,v 1.20 2006-12-20 09:54:18 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
115 |
return "application/x-fsspecial";
|
115 |
return "application/x-fsspecial";
|
116 |
|
116 |
|
117 |
if (cfg == 0)
|
117 |
if (cfg == 0)
|
118 |
return "";
|
118 |
return "";
|
119 |
|
119 |
|
120 |
const list<string>* stoplist = cfg->getStopSuffixes();
|
120 |
if (cfg->inStopSuffixes(fn)) {
|
121 |
if (stoplist && !stoplist->empty()) {
|
|
|
122 |
for (list<string>::const_iterator it = stoplist->begin();
|
|
|
123 |
it != stoplist->end(); it++) {
|
|
|
124 |
if (!stringisuffcmp(fn, *it)) {
|
|
|
125 |
LOGDEB(("mimetype: fn %s in stoplist (%s)\n", fn.c_str(),
|
121 |
LOGDEB(("mimetype: fn [%s] in stopsuffixes\n", fn.c_str()));
|
126 |
it->c_str()));
|
|
|
127 |
return "";
|
122 |
return "";
|
128 |
}
|
|
|
129 |
}
|
|
|
130 |
}
|
123 |
}
|
131 |
|
124 |
|
132 |
// Look for suffix in mimetype map
|
125 |
// First look for suffix in mimetype map
|
133 |
string::size_type dot = fn.find_last_of(".");
|
126 |
string::size_type dot = fn.find_last_of(".");
|
134 |
string suff;
|
127 |
string suff;
|
135 |
if (dot != string::npos) {
|
128 |
if (dot != string::npos) {
|
136 |
suff = fn.substr(dot);
|
129 |
suff = fn.substr(dot);
|
137 |
for (unsigned int i = 0; i < suff.length(); i++)
|
130 |
for (unsigned int i = 0; i < suff.length(); i++)
|
|
... |
|
... |
140 |
string mtype = cfg->getMimeTypeFromSuffix(suff);
|
133 |
string mtype = cfg->getMimeTypeFromSuffix(suff);
|
141 |
if (!mtype.empty())
|
134 |
if (!mtype.empty())
|
142 |
return mtype;
|
135 |
return mtype;
|
143 |
}
|
136 |
}
|
144 |
|
137 |
|
|
|
138 |
// Then examine data
|
145 |
return mimetypefromdata(fn, usfc);
|
139 |
return mimetypefromdata(fn, usfc);
|
146 |
}
|
140 |
}
|
147 |
|
141 |
|
148 |
|
142 |
|
149 |
|
143 |
|