recollindex builds. Still need to implement quite a lot of ifndefed stuff (pathut, rclconfig)

This commit is contained in:
Jean-Francois Dockes 2015-08-30 15:30:50 +02:00
parent ca55c34b28
commit 60fd34e40f
24 changed files with 344 additions and 59 deletions

186
src/common/autoconfig-win.h Normal file
View file

@ -0,0 +1,186 @@
/* Manually edited version of autoconfig.h for windows. Many things are
overriden in the c++ code by ifdefs _WIN32 anyway */
#ifndef _AUTOCONFIG_H_INCLUDED
#define _AUTOCONFIG_H_INCLUDED
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Path to the aspell api include file */
/* #undef ASPELL_INCLUDE "aspell-local.h" */
/* Path to the aspell program */
/* #define ASPELL_PROG "/usr/bin/aspell" */
/* No X11 session monitoring support */
#define DISABLE_X11MON
/* Path to the fam api include file */
/* #undef FAM_INCLUDE */
/* Path to the file program */
#define FILE_PROG "/usr/bin/file"
/* "Have C++0x" */
#undef HAVE_CXX0X_UNORDERED
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `dl' library (-ldl). */
#define HAVE_LIBDL 1
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mkdtemp' function. */
/* #undef HAVE_MKDTEMP */
/* Define to 1 if you have the `posix_spawn,' function. */
/* #undef HAVE_POSIX_SPAWN_ */
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* Has std::shared_ptr */
#define HAVE_SHARED_PTR_STD
/* Has std::tr1::shared_ptr */
/* #undef HAVE_SHARED_PTR_TR1 */
/* Define to 1 if you have the <spawn.h> header file. */
#define HAVE_SPAWN_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/mount.h> header file. */
/* #undef HAVE_SYS_MOUNT_H */
/* Define to 1 if you have the <sys/param.h,> header file. */
/* #undef HAVE_SYS_PARAM_H_ */
/* Define to 1 if you have the <sys/statfs.h> header file. */
/* #undef HAVE_SYS_STATFS_H */
/* Define to 1 if you have the <sys/statvfs.h> header file. */
/* #undef HAVE_SYS_STATVFS_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/vfs.h> header file. */
/* #undef HAVE_SYS_VFS_H */
/* "Have tr1" */
/* #undef HAVE_TR1_UNORDERED */
/* Define to 1 if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Use multiple threads for indexing */
#define IDX_THREADS 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "Recoll"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "Recoll 1.22.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "recoll"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.22.0"
/* putenv parameter is const */
/* #undef PUTENV_ARG_CONST */
/* iconv parameter 2 is const char** */
#define RCL_ICONV_INBUF_CONST 1
/* Real time monitoring option */
#undef RCL_MONITOR
/* Split camelCase words */
/* #undef RCL_SPLIT_CAMELCASE */
/* Compile the aspell interface */
/* #undef RCL_USE_ASPELL */
/* Compile the fam interface */
/* #undef RCL_USE_FAM */
/* Compile the inotify interface */
#define RCL_USE_INOTIFY 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Use posix_spawn() */
/* #undef USE_POSIX_SPAWN */
/* Enable using the system's 'file' command to id mime if we fail internally
*/
/* #undef USE_SYSTEM_FILE_COMMAND */
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
#define DISABLE_WEB_INDEXER
#include "conf_post.h"
#endif // already included

View file

@ -45,6 +45,7 @@ typedef unsigned __int8 u_int8_t;
typedef int mode_t; typedef int mode_t;
typedef int ssize_t; typedef int ssize_t;
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp
#define ftruncate _chsize #define ftruncate _chsize
#define PATH_MAX MAX_PATH #define PATH_MAX MAX_PATH
#define MAXPATHLEN PATH_MAX #define MAXPATHLEN PATH_MAX
@ -56,7 +57,7 @@ typedef int ssize_t;
#define lstat stat #define lstat stat
#define fseeko _fseeki64 #define fseeko _fseeki64
#define ftello _ftelli64 #define ftello _ftelli64
#define timegm _mkgmtime
#endif #endif

View file

@ -465,10 +465,14 @@ void RclConfig::initThrConf()
if (vq.size() > 0 && vq[0] == 0) { if (vq.size() > 0 && vq[0] == 0) {
LOGDEB(("RclConfig::initThrConf: autoconf requested\n")); LOGDEB(("RclConfig::initThrConf: autoconf requested\n"));
CpuConf cpus; CpuConf cpus;
#ifdef _WIN32
cpus.ncpus = 1;
#else
if (!getCpuConf(cpus) || cpus.ncpus < 1) { if (!getCpuConf(cpus) || cpus.ncpus < 1) {
LOGERR(("RclConfig::initThrConf: could not retrieve cpu conf\n")); LOGERR(("RclConfig::initThrConf: could not retrieve cpu conf\n"));
cpus.ncpus = 1; cpus.ncpus = 1;
} }
#endif
// Arbitrarily set threads config based on number of CPUS. This also // Arbitrarily set threads config based on number of CPUS. This also
// depends on the IO setup actually, so we're bound to be wrong... // depends on the IO setup actually, so we're bound to be wrong...
if (cpus.ncpus == 1) { if (cpus.ncpus == 1) {

View file

@ -33,8 +33,10 @@ DocFetcher *docFetcherMake(const Rcl::Doc& idoc)
idoc.getmeta(Rcl::Doc::keybcknd, &backend); idoc.getmeta(Rcl::Doc::keybcknd, &backend);
if (backend.empty() || !backend.compare("FS")) { if (backend.empty() || !backend.compare("FS")) {
return new FSDocFetcher; return new FSDocFetcher;
#ifndef DISABLE_WEB_INDEXER
} else if (!backend.compare("BGL")) { } else if (!backend.compare("BGL")) {
return new BGLDocFetcher; return new BGLDocFetcher;
#endif
} else { } else {
LOGERR(("DocFetcherFactory: unknown backend [%s]\n", backend.c_str())); LOGERR(("DocFetcherFactory: unknown backend [%s]\n", backend.c_str()));
return 0; return 0;

View file

@ -14,9 +14,7 @@
* Free Software Foundation, Inc., * Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "autoconfig.h" #include "autoconfig.h"
#endif
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
@ -27,7 +25,9 @@
#include "debuglog.h" #include "debuglog.h"
#include "indexer.h" #include "indexer.h"
#include "fsindexer.h" #include "fsindexer.h"
#ifndef DISABLE_WEB_INDEXER
#include "beaglequeue.h" #include "beaglequeue.h"
#endif
#include "mimehandler.h" #include "mimehandler.h"
#include "pathut.h" #include "pathut.h"
@ -46,7 +46,9 @@ ConfIndexer::ConfIndexer(RclConfig *cnf, DbIxStatusUpdater *updfunc)
ConfIndexer::~ConfIndexer() ConfIndexer::~ConfIndexer()
{ {
deleteZ(m_fsindexer); deleteZ(m_fsindexer);
#ifndef DISABLE_WEB_INDEXER
deleteZ(m_beagler); deleteZ(m_beagler);
#endif
} }
// Determine if this is likely the first time that the user runs // Determine if this is likely the first time that the user runs
@ -107,7 +109,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
return false; return false;
} }
} }
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && (typestorun & IxTBeagleQueue)) { if (m_dobeagle && (typestorun & IxTBeagleQueue)) {
deleteZ(m_beagler); deleteZ(m_beagler);
m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater); m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater);
@ -116,7 +118,7 @@ bool ConfIndexer::index(bool resetbefore, ixType typestorun, int flags)
return false; return false;
} }
} }
#endif
if (typestorun == IxTAll) { if (typestorun == IxTAll) {
// Get rid of all database entries that don't exist in the // Get rid of all database entries that don't exist in the
// filesystem anymore. Only if all *configured* indexers ran. // filesystem anymore. Only if all *configured* indexers ran.
@ -173,6 +175,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
ret = m_fsindexer->indexFiles(myfiles, flag); ret = m_fsindexer->indexFiles(myfiles, flag);
LOGDEB2(("ConfIndexer::indexFiles: fsindexer returned %d, " LOGDEB2(("ConfIndexer::indexFiles: fsindexer returned %d, "
"%d files remainining\n", ret, myfiles.size())); "%d files remainining\n", ret, myfiles.size()));
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) { if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) {
if (!m_beagler) if (!m_beagler)
@ -183,7 +186,7 @@ bool ConfIndexer::indexFiles(list<string>& ifiles, int flag)
ret = false; ret = false;
} }
} }
#endif
// The close would be done in our destructor, but we want status here // The close would be done in our destructor, but we want status here
if (!m_db.close()) { if (!m_db.close()) {
LOGERR(("ConfIndexer::index: error closing database in %s\n", LOGERR(("ConfIndexer::index: error closing database in %s\n",
@ -255,6 +258,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
if (m_fsindexer) if (m_fsindexer)
ret = m_fsindexer->purgeFiles(myfiles); ret = m_fsindexer->purgeFiles(myfiles);
#ifndef DISABLE_WEB_INDEXER
if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) { if (m_dobeagle && !myfiles.empty() && !(flag & IxFNoWeb)) {
if (!m_beagler) if (!m_beagler)
m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater); m_beagler = new BeagleQueueIndexer(m_config, &m_db, m_updater);
@ -264,6 +268,7 @@ bool ConfIndexer::purgeFiles(std::list<string> &files, int flag)
ret = false; ret = false;
} }
} }
#endif
// The close would be done in our destructor, but we want status here // The close would be done in our destructor, but we want status here
if (!m_db.close()) { if (!m_db.close()) {

View file

@ -16,20 +16,18 @@
*/ */
#ifndef _INDEXER_H_INCLUDED_ #ifndef _INDEXER_H_INCLUDED_
#define _INDEXER_H_INCLUDED_ #define _INDEXER_H_INCLUDED_
#include "rclconfig.h"
#include <string> #include <string>
#include <list> #include <list>
#include <map> #include <map>
#include <vector> #include <vector>
#ifndef NO_NAMESPACES
using std::string; using std::string;
using std::list; using std::list;
using std::map; using std::map;
using std::vector; using std::vector;
#endif
#include "rclconfig.h"
#include "rcldb.h" #include "rcldb.h"
#include "rcldoc.h" #include "rcldoc.h"
#ifdef IDX_THREADS #ifdef IDX_THREADS

View file

@ -142,6 +142,7 @@ string mimetype(const string &fn, const struct stat *stp,
string mtype; string mtype;
#ifndef _WIN32
// Extended attribute has priority on everything, as per: // Extended attribute has priority on everything, as per:
// http://freedesktop.org/wiki/CommonExtendedAttributes // http://freedesktop.org/wiki/CommonExtendedAttributes
if (pxattr::get(fn, "mime_type", &mtype)) { if (pxattr::get(fn, "mime_type", &mtype)) {
@ -152,6 +153,7 @@ string mimetype(const string &fn, const struct stat *stp,
return mtype; return mtype;
} }
} }
#endif
if (cfg == 0) { if (cfg == 0) {
LOGERR(("Mimetype: null config ??\n")); LOGERR(("Mimetype: null config ??\n"));
@ -179,7 +181,6 @@ string mimetype(const string &fn, const struct stat *stp,
if (mtype.empty() && stp) if (mtype.empty() && stp)
mtype = mimetypefromdata(cfg, fn, usfc); mtype = mimetypefromdata(cfg, fn, usfc);
out:
return mtype; return mtype;
} }

View file

@ -42,7 +42,9 @@ using namespace std;
#include "x11mon.h" #include "x11mon.h"
#include "cancelcheck.h" #include "cancelcheck.h"
#include "rcldb.h" #include "rcldb.h"
#ifndef DISABLE_WEB_INDEXER
#include "beaglequeue.h" #include "beaglequeue.h"
#endif
#include "recollindex.h" #include "recollindex.h"
#include "fsindexer.h" #include "fsindexer.h"
#ifndef _WIN32 #ifndef _WIN32
@ -135,6 +137,7 @@ class MyUpdater : public DbIxStatusUpdater {
return false; return false;
} }
#ifndef DISABLE_X11MON
// If we are in the monitor, we also need to check X11 status // If we are in the monitor, we also need to check X11 status
// during the initial indexing pass (else the user could log // during the initial indexing pass (else the user could log
// out and the indexing would go on, not good (ie: if the user // out and the indexing would go on, not good (ie: if the user
@ -144,7 +147,7 @@ class MyUpdater : public DbIxStatusUpdater {
stopindexing = true; stopindexing = true;
return false; return false;
} }
#endif
return true; return true;
} }
@ -520,9 +523,11 @@ int main(int argc, char **argv)
if (op_flags & OPT_k) { if (op_flags & OPT_k) {
indexerFlags &= ~ConfIndexer::IxFNoRetryFailed; indexerFlags &= ~ConfIndexer::IxFNoRetryFailed;
} else { } else {
#ifndef _WIN32
if (checkRetryFailed(config, false)) { if (checkRetryFailed(config, false)) {
indexerFlags &= ~ConfIndexer::IxFNoRetryFailed; indexerFlags &= ~ConfIndexer::IxFNoRetryFailed;
} }
#endif
} }
Pidfile pidfile(config->getPidfile()); Pidfile pidfile(config->getPidfile());
@ -646,10 +651,12 @@ int main(int argc, char **argv)
"not going into monitor mode\n")); "not going into monitor mode\n"));
exit(1); exit(1);
} else { } else {
#ifndef _WIN32
// Record success of indexing pass with failed files retries. // Record success of indexing pass with failed files retries.
if (!(indexerFlags & ConfIndexer::IxFNoRetryFailed)) { if (!(indexerFlags & ConfIndexer::IxFNoRetryFailed)) {
checkRetryFailed(config, true); checkRetryFailed(config, true);
} }
#endif
} }
deleteZ(confindexer); deleteZ(confindexer);
#ifndef _WIN32 #ifndef _WIN32
@ -687,11 +694,12 @@ int main(int argc, char **argv)
makeIndexerOrExit(config, inPlaceReset); makeIndexerOrExit(config, inPlaceReset);
bool status = confindexer->index(rezero, ConfIndexer::IxTAll, bool status = confindexer->index(rezero, ConfIndexer::IxTAll,
indexerFlags); indexerFlags);
#ifndef _WIN32
// Record success of indexing pass with failed files retries. // Record success of indexing pass with failed files retries.
if (status && !(indexerFlags & ConfIndexer::IxFNoRetryFailed)) { if (status && !(indexerFlags & ConfIndexer::IxFNoRetryFailed)) {
checkRetryFailed(config, true); checkRetryFailed(config, true);
} }
#endif
if (!status) if (!status)
cerr << "Indexing failed" << endl; cerr << "Indexing failed" << endl;
if (!confindexer->getReason().empty()) if (!confindexer->getReason().empty())

View file

@ -46,7 +46,7 @@ void reapXAttrs(const RclConfig* cfg, const string& path,
map<string, string>& xfields) map<string, string>& xfields)
{ {
LOGDEB2(("reapXAttrs: [%s]\n", path.c_str())); LOGDEB2(("reapXAttrs: [%s]\n", path.c_str()));
#ifndef _WIN32
// Retrieve xattrs names from files and mapping table from config // Retrieve xattrs names from files and mapping table from config
vector<string> xnames; vector<string> xnames;
if (!pxattr::list(path, &xnames)) { if (!pxattr::list(path, &xnames)) {
@ -79,6 +79,7 @@ void reapXAttrs(const RclConfig* cfg, const string& path,
xfields[key] = value; xfields[key] = value;
LOGDEB2(("reapXAttrs: [%s] -> [%s]\n", key.c_str(), value.c_str())); LOGDEB2(("reapXAttrs: [%s] -> [%s]\n", key.c_str(), value.c_str()));
} }
#endif
} }
void docFieldsFromXattrs(RclConfig *cfg, const map<string, string>& xfields, void docFieldsFromXattrs(RclConfig *cfg, const map<string, string>& xfields,

View file

@ -14,6 +14,7 @@
* Free Software Foundation, Inc., * Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "autoconfig.h"
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
@ -21,6 +22,7 @@
#include "safeunistd.h" #include "safeunistd.h"
#include <time.h> #include <time.h>
#include <cstdlib> #include <cstdlib>
#include "safesysstat.h"
#include <map> #include <map>
#include <sstream> #include <sstream>

View file

@ -18,10 +18,13 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "safefcntl.h"
#include <sys/types.h>
#include "safesysstat.h"
#include "safeunistd.h"
#include <iostream> #include <iostream>
#include <string> #include <string>
using namespace std;
#include "cstr.h" #include "cstr.h"
#include "mh_text.h" #include "mh_text.h"
@ -32,6 +35,8 @@ using namespace std;
#include "pxattr.h" #include "pxattr.h"
#include "pathut.h" #include "pathut.h"
using namespace std;
const int MB = 1024*1024; const int MB = 1024*1024;
const int KB = 1024; const int KB = 1024;
@ -51,9 +56,11 @@ bool MimeHandlerText::set_document_file(const string& mt, const string &fn)
return false; return false;
} }
#ifndef _WIN32
// Check for charset defined in extended attribute as per: // Check for charset defined in extended attribute as per:
// http://freedesktop.org/wiki/CommonExtendedAttributes // http://freedesktop.org/wiki/CommonExtendedAttributes
pxattr::get(m_fn, "charset", &m_charsetfromxattr); pxattr::get(m_fn, "charset", &m_charsetfromxattr);
#endif
// Max file size parameter: texts over this size are not indexed // Max file size parameter: texts over this size are not indexed
int maxmbs = 20; int maxmbs = 20;

View file

@ -195,6 +195,9 @@ static const string cstr_mh_charset("charset");
MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs, MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
bool multiple, const string& id) bool multiple, const string& id)
{ {
#ifdef _WIN32
return 0;
#else
ConfSimple attrs; ConfSimple attrs;
string cmdstr; string cmdstr;
@ -238,6 +241,7 @@ MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
#endif #endif
return h; return h;
#endif
} }
/* Get handler/filter object for given mime type: */ /* Get handler/filter object for given mime type: */

View file

@ -23,6 +23,10 @@
* -----END-LICENCE----- * -----END-LICENCE-----
*/ */
#include <time.h> #include <time.h>
#ifdef _WIN32
// Local implementation in windows directory
#include "strptime.h"
#endif
#include <stdio.h> #include <stdio.h>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>

View file

@ -82,7 +82,7 @@ bool Query::Native::getMatchTerms(unsigned long xdocid, vector<string>& terms)
{ {
if (!xenquire) { if (!xenquire) {
LOGERR(("Query::getMatchTerms: no query opened\n")); LOGERR(("Query::getMatchTerms: no query opened\n"));
return -1; return false;
} }
terms.clear(); terms.clear();

View file

@ -16,15 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H #ifdef BUILDING_RECOLL
#ifdef RECOLL_DATADIR
#include "autoconfig.h" #include "autoconfig.h"
#else #else
#include "config.h" #include "config.h"
#endif /* RECOLL */ #endif /* RECOLL */
#endif /* HAVE_CONFIG_H */
#ifdef RECOLL_DATADIR #ifdef BUILDING_RECOLL
/* Yes, recoll unac is actually c++, lets face modernity, I will not be /* Yes, recoll unac is actually c++, lets face modernity, I will not be
caught writing another binary search */ caught writing another binary search */
#include <vector> #include <vector>

View file

@ -16,6 +16,8 @@
*/ */
#ifndef TEST_MD5 #ifndef TEST_MD5
#include "autoconfig.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -16,6 +16,7 @@
*/ */
#ifndef TEST_MIMEPARSE #ifndef TEST_MIMEPARSE
#include "autoconfig.h"
#include <string> #include <string>
#include <vector> #include <vector>
@ -32,10 +33,7 @@
#include "transcode.h" #include "transcode.h"
#include "smallut.h" #include "smallut.h"
#ifndef NO_NAMESPACES
using namespace std; using namespace std;
#endif /* NO_NAMESPACES */
//#define DEBUG_MIMEPARSE //#define DEBUG_MIMEPARSE
#ifdef DEBUG_MIMEPARSE #ifdef DEBUG_MIMEPARSE

View file

@ -25,11 +25,11 @@
#include <string> #include <string>
using std::string;
#include "readfile.h" #include "readfile.h"
#include "smallut.h" #include "smallut.h"
using std::string;
#ifndef MIN #ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B)) #define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif #endif

View file

@ -20,7 +20,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <string> #include <string>
using std::string;
/** /**
* Read file in chunks, calling an accumulator for each chunk. Can be used * Read file in chunks, calling an accumulator for each chunk. Can be used
@ -29,23 +28,23 @@ using std::string;
class FileScanDo { class FileScanDo {
public: public:
virtual ~FileScanDo() {} virtual ~FileScanDo() {}
virtual bool init(size_t size, string *reason) = 0; virtual bool init(size_t size, std::string *reason) = 0;
virtual bool data(const char *buf, int cnt, string* reason) = 0; virtual bool data(const char *buf, int cnt, std::string* reason) = 0;
}; };
bool file_scan(const string &filename, FileScanDo* doer, string *reason = 0); bool file_scan(const std::string &filename, FileScanDo* doer, std::string *reason = 0);
/* Same but only process count cnt from offset offs. Set cnt to size_t(-1) /* Same but only process count cnt from offset offs. Set cnt to size_t(-1)
* for no limit */ * for no limit */
bool file_scan(const string &fn, FileScanDo* doer, off_t offs, size_t cnt, bool file_scan(const std::string &fn, FileScanDo* doer, off_t offs, size_t cnt,
string *reason = 0); std::string *reason = 0);
/** /**
* Read file into string. * Read file into string.
* @return true for ok, false else * @return true for ok, false else
*/ */
bool file_to_string(const string &filename, string &data, string *reason = 0); bool file_to_string(const std::string &filename, std::string &data, std::string *reason = 0);
/** Read file chunk into string. Set cnt to size_t(-1) for whole file */ /** Read file chunk into string. Set cnt to size_t(-1) for whole file */
bool file_to_string(const string &filename, string &data, bool file_to_string(const std::string &filename, std::string &data,
off_t offs, size_t cnt, string *reason = 0); off_t offs, size_t cnt, std::string *reason = 0);
#endif /* _READFILE_H_INCLUDED_ */ #endif /* _READFILE_H_INCLUDED_ */

View file

@ -75,10 +75,10 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;__WIN32__;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BUILDING_RECOLL;WIN32;__WIN32__;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck> <SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>C:\xapian\xapian-core-1.2.8\include;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\bincimapmime;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\windows;C:\zlib\include;C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\common;C:\Users\Bill\recoll\src\utils;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Iconv\include;C:\xapian\xapian-core-1.2.8\include;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\bincimapmime;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\windows;C:\zlib\include;C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\common;C:\Users\Bill\recoll\src\utils;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800</DisableSpecificWarnings> <DisableSpecificWarnings>4800;4996</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -140,16 +140,25 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="..\common\autoconfig.h" /> <ClInclude Include="..\common\autoconfig.h" />
<ClInclude Include="..\common\conf_post.h" /> <ClInclude Include="..\common\conf_post.h" />
<ClInclude Include="..\index\indexer.h" />
<ClInclude Include="..\index\mimetype.h" />
<ClInclude Include="..\internfile\internfile.h" />
<ClInclude Include="..\internfile\mh_symlink.h" /> <ClInclude Include="..\internfile\mh_symlink.h" />
<ClInclude Include="..\utils\debuglog.h" /> <ClInclude Include="..\utils\debuglog.h" />
<ClInclude Include="..\utils\execmd.h" /> <ClInclude Include="..\utils\execmd.h" />
<ClInclude Include="..\utils\md5.h" />
<ClInclude Include="..\utils\md5ut.h" />
<ClInclude Include="..\utils\mimeparse.h" />
<ClInclude Include="..\utils\pathut.h" /> <ClInclude Include="..\utils\pathut.h" />
<ClInclude Include="..\utils\readfile.h" />
<ClInclude Include="..\utils\smallut.h" /> <ClInclude Include="..\utils\smallut.h" />
<ClInclude Include="..\utils\wipedir.h" />
<ClInclude Include="..\xaposix\safefcntl.h" /> <ClInclude Include="..\xaposix\safefcntl.h" />
<ClInclude Include="..\xaposix\safesysstat.h" /> <ClInclude Include="..\xaposix\safesysstat.h" />
<ClInclude Include="..\xaposix\safeunistd.h" /> <ClInclude Include="..\xaposix\safeunistd.h" />
<ClInclude Include="..\xaposix\safewindows.h" /> <ClInclude Include="..\xaposix\safewindows.h" />
<ClInclude Include="fnmatch.h" /> <ClInclude Include="fnmatch.h" />
<ClInclude Include="strptime.h" />
<ClInclude Include="targetver.h" /> <ClInclude Include="targetver.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -178,6 +187,7 @@
<ClCompile Include="..\internfile\mh_mbox.cpp" /> <ClCompile Include="..\internfile\mh_mbox.cpp" />
<ClCompile Include="..\internfile\mh_text.cpp" /> <ClCompile Include="..\internfile\mh_text.cpp" />
<ClCompile Include="..\internfile\mimehandler.cpp" /> <ClCompile Include="..\internfile\mimehandler.cpp" />
<ClCompile Include="..\internfile\myhtmlparse.cpp" />
<ClCompile Include="..\internfile\txtdcode.cpp" /> <ClCompile Include="..\internfile\txtdcode.cpp" />
<ClCompile Include="..\internfile\uncomp.cpp" /> <ClCompile Include="..\internfile\uncomp.cpp" />
<ClCompile Include="..\rcldb\daterange.cpp" /> <ClCompile Include="..\rcldb\daterange.cpp" />
@ -194,7 +204,7 @@
<ClCompile Include="..\rcldb\stemdb.cpp" /> <ClCompile Include="..\rcldb\stemdb.cpp" />
<ClCompile Include="..\rcldb\stoplist.cpp" /> <ClCompile Include="..\rcldb\stoplist.cpp" />
<ClCompile Include="..\rcldb\synfamily.cpp" /> <ClCompile Include="..\rcldb\synfamily.cpp" />
<ClCompile Include="..\unac\unac.c" /> <ClCompile Include="..\unac\unac.cpp" />
<ClCompile Include="..\utils\appformime.cpp" /> <ClCompile Include="..\utils\appformime.cpp" />
<ClCompile Include="..\utils\base64.cpp" /> <ClCompile Include="..\utils\base64.cpp" />
<ClCompile Include="..\utils\circache.cpp" /> <ClCompile Include="..\utils\circache.cpp" />
@ -205,10 +215,20 @@
<ClCompile Include="..\utils\fstreewalk.cpp" /> <ClCompile Include="..\utils\fstreewalk.cpp" />
<ClCompile Include="..\utils\idfile.cpp" /> <ClCompile Include="..\utils\idfile.cpp" />
<ClCompile Include="..\utils\md5.cpp" /> <ClCompile Include="..\utils\md5.cpp" />
<ClCompile Include="..\utils\md5ut.cpp" />
<ClCompile Include="..\utils\mimeparse.cpp" />
<ClCompile Include="..\utils\pathut.cpp" /> <ClCompile Include="..\utils\pathut.cpp" />
<ClCompile Include="..\utils\readfile.cpp" />
<ClCompile Include="..\utils\smallut.cpp" /> <ClCompile Include="..\utils\smallut.cpp" />
<ClCompile Include="..\utils\transcode.cpp" />
<ClCompile Include="..\utils\wipedir.cpp" />
<ClCompile Include="..\xaposix\safe.cc" /> <ClCompile Include="..\xaposix\safe.cc" />
<ClCompile Include="dirent.c" /> <ClCompile Include="dirent.c" />
<ClCompile Include="fnmatch.c" />
<ClCompile Include="strptime.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="ClassDiagram.cd" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View file

@ -57,6 +57,33 @@
<ClInclude Include="..\utils\execmd.h"> <ClInclude Include="..\utils\execmd.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="strptime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\md5.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\md5ut.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\readfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\internfile\internfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\index\indexer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\mimeparse.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\index\mimetype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\wipedir.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\utils\smallut.cpp"> <ClCompile Include="..\utils\smallut.cpp">
@ -224,8 +251,35 @@
<ClCompile Include="..\utils\pathut.cpp"> <ClCompile Include="..\utils\pathut.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\unac\unac.c"> <ClCompile Include="..\unac\unac.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\utils\readfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\internfile\myhtmlparse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="strptime.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\utils\md5ut.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\utils\transcode.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="fnmatch.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\utils\mimeparse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\utils\wipedir.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="ClassDiagram.cd" />
</ItemGroup>
</Project> </Project>

View file

@ -13,10 +13,9 @@ Library General Public License for more details. */
/* Modified slightly by Brian Berliner <berliner@sun.com> and /* Modified slightly by Brian Berliner <berliner@sun.com> and
Jim Blandy <jimb@cyclic.com> for CVS use */ Jim Blandy <jimb@cyclic.com> for CVS use */
/* Modified slightly by j.f. dockes for recoll use */
#ifdef HAVE_CONFIG_H #include "autoconfig.h"
#include "config.h"
#endif
/* Some file systems are case-insensitive. If FOLD_FN_CHAR is /* Some file systems are case-insensitive. If FOLD_FN_CHAR is
#defined, it maps the character C onto its "canonical" form. In a #defined, it maps the character C onto its "canonical" form. In a
@ -27,27 +26,13 @@ Library General Public License for more details. */
#define FOLD_FN_CHAR(c) (c) #define FOLD_FN_CHAR(c) (c)
#endif #endif
/* IGNORE(@ */
/* #include <ansidecl.h> */
/* @) */
#include <errno.h> #include <errno.h>
#include <fnmatch.h> #include "fnmatch.h"
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
extern int errno;
#endif
/* Match STRING against the filename pattern PATTERN, returning zero if /* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */ it matches, nonzero if not. */
int int fnmatch (const char *pattern, const char *string, int flags)
#if __STDC__
fnmatch (const char *pattern, const char *string, int flags)
#else
fnmatch (pattern, string, flags)
char *pattern;
char *string;
int flags;
#endif
{ {
register const char *p = pattern, *n = string; register const char *p = pattern, *n = string;
register char c; register char c;

View file

@ -31,7 +31,13 @@ Library General Public License for more details. */
/* Match STRING against the filename pattern PATTERN, /* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */ returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch (const char *pattern, const char *string, int flags); #ifdef __cplusplus
extern "C" {
#endif
extern int fnmatch (const char *pattern, const char *str, int flags);
#ifdef __cplusplus
}
#endif
#endif /* fnmatch.h */ #endif /* fnmatch.h */

View file

@ -94,7 +94,7 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\xapian\xapian-core-1.2.8\win32\Debug;C:\Users\Bill\recoll\src\windows\Debug;C:\pthreads-w32\Pre-built.2\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\xapian\xapian-core-1.2.8\win32\Debug;C:\Users\Bill\recoll\src\windows\Debug;C:\pthreads-w32\Pre-built.2\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>C:\Users\Bill\recoll\src\windows\Debug\Win32ProjectRecoll.lib;C:\xapian\xapian-core-1.2.8\win32\Debug\xapian-core.lib;C:\zlib\lib\zdll.lib;Ws2_32.lib;Rpcrt4.lib;pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>C:\Users\Bill\recoll\src\windows\Debug\Win32ProjectRecoll.lib;C:\xapian\xapian-core-1.2.8\win32\Debug\xapian-core.lib;C:\Iconv\lib\iconv.lib;C:\Iconv\lib/charset.lib;C:\zlib\lib\zdll.lib;Ws2_32.lib;Rpcrt4.lib;pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">