1st mods to get a build under windows. Does not build yet, far from it
--HG-- branch : WINDOWSPORT
This commit is contained in:
@@ -26,3 +26,37 @@
|
||||
# define STD_SHARED_PTR RefCntr
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "safewindows.h"
|
||||
typedef int pid_t;
|
||||
inline int readlink(const char *cp, void *buf, int cnt) {
|
||||
return -1;
|
||||
}
|
||||
#define HAVE_STRUCT_TIMESPEC
|
||||
#define strdup _strdup
|
||||
#define timegm _mkgmtime
|
||||
// gmtime is supposedly thread-safe on windows
|
||||
#define gmtime_r(A, B) gmtime(A)
|
||||
#define localtime_r(A,B) localtime(A)
|
||||
|
||||
typedef DWORD32 u_int32_t;
|
||||
typedef DWORD64 u_int64_t;
|
||||
typedef unsigned __int8 u_int8_t;
|
||||
typedef int mode_t;
|
||||
typedef int ssize_t;
|
||||
#define strncasecmp _strnicmp
|
||||
#define ftruncate _chsize
|
||||
#define PATH_MAX MAX_PATH
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 4
|
||||
#define RECOLL_DATADIR "C:\\recoll\\"
|
||||
#define S_ISLNK(X) false
|
||||
#define lstat stat
|
||||
#define fseeko _fseeki64
|
||||
#define ftello _ftelli64
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifndef _WIN32
|
||||
#include <langinfo.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include "safesysstat.h"
|
||||
#include "safeunistd.h"
|
||||
#include <sys/param.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
@@ -200,6 +202,7 @@ RclConfig::RclConfig(const string *argcnf)
|
||||
// is called from the main thread at once, by constructing a config
|
||||
// from recollinit
|
||||
if (o_localecharset.empty()) {
|
||||
#ifndef _WIN32
|
||||
const char *cp;
|
||||
cp = nl_langinfo(CODESET);
|
||||
// We don't keep US-ASCII. It's better to use a superset
|
||||
@@ -217,6 +220,9 @@ RclConfig::RclConfig(const string *argcnf)
|
||||
// Use cp1252 instead of iso-8859-1, it's a superset.
|
||||
o_localecharset = string(cstr_cp1252);
|
||||
}
|
||||
#else
|
||||
o_localecharset = "UTF-8";
|
||||
#endif
|
||||
LOGDEB1(("RclConfig::getDefCharset: localecharset [%s]\n",
|
||||
o_localecharset.c_str()));
|
||||
}
|
||||
|
||||
+18
-1
@@ -31,9 +31,13 @@
|
||||
#include "pathut.h"
|
||||
#include "unac.h"
|
||||
#include "smallut.h"
|
||||
#ifndef _WIN32
|
||||
#include "execmd.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
static const int catchedSigs[] = {SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2};
|
||||
#endif
|
||||
|
||||
static pthread_t mainthread_id;
|
||||
|
||||
@@ -52,7 +56,9 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
|
||||
// We ignore SIGPIPE always. All pieces of code which can write to a pipe
|
||||
// must check write() return values.
|
||||
#ifndef _WIN32
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
// Make sure the locale is set. This is only for converting file names
|
||||
// to utf8 for indexing.
|
||||
@@ -63,6 +69,7 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
|
||||
// Install app signal handler
|
||||
if (sigcleanup) {
|
||||
#ifndef _WIN32
|
||||
struct sigaction action;
|
||||
action.sa_handler = sigcleanup;
|
||||
action.sa_flags = 0;
|
||||
@@ -73,8 +80,8 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
perror("Sigaction failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
DebugLog::getdbl()->setloglevel(DEBDEB1);
|
||||
DebugLog::setfilename("stderr");
|
||||
if (getenv("RECOLL_LOGDATE"))
|
||||
@@ -116,6 +123,7 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
DebugLog::getdbl()->setloglevel(lev);
|
||||
}
|
||||
// Install log rotate sig handler
|
||||
#ifndef _WIN32
|
||||
{
|
||||
struct sigaction action;
|
||||
action.sa_handler = siglogreopen;
|
||||
@@ -127,6 +135,7 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make sure the locale charset is initialized (so that multiple
|
||||
// threads don't try to do it at once).
|
||||
@@ -146,7 +155,9 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
unac_set_except_translations(unacex.c_str());
|
||||
|
||||
#ifndef IDX_THREADS
|
||||
#ifndef _WIN32
|
||||
ExecCmd::useVfork(true);
|
||||
#endif
|
||||
#else
|
||||
// Keep threads init behind log init, but make sure it's done before
|
||||
// we do the vfork choice ! The latter is not used any more actually,
|
||||
@@ -156,11 +167,15 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
bool novfork;
|
||||
config->getConfParam("novfork", &novfork);
|
||||
if (novfork) {
|
||||
#ifndef _WIN32
|
||||
LOGDEB0(("rclinit: will use fork() for starting commands\n"));
|
||||
ExecCmd::useVfork(false);
|
||||
#endif
|
||||
} else {
|
||||
#ifndef _WIN32
|
||||
LOGDEB0(("rclinit: will use vfork() for starting commands\n"));
|
||||
ExecCmd::useVfork(true);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -183,6 +198,7 @@ RclConfig *recollinit(RclInitFlags flags,
|
||||
// to block possible signals
|
||||
void recoll_threadinit()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
sigset_t sset;
|
||||
sigemptyset(&sset);
|
||||
|
||||
@@ -190,6 +206,7 @@ void recoll_threadinit()
|
||||
sigaddset(&sset, catchedSigs[i]);
|
||||
sigaddset(&sset, SIGHUP);
|
||||
pthread_sigmask(SIG_BLOCK, &sset, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool recoll_ismainthread()
|
||||
|
||||
@@ -110,7 +110,7 @@ bool SynGroups::setfile(const string& fn)
|
||||
lnum++;
|
||||
|
||||
{
|
||||
int ll = strlen(cline);
|
||||
size_t ll = strlen(cline);
|
||||
while (ll > 0 && (cline[ll-1] == '\n' || cline[ll-1] == '\r')) {
|
||||
cline[ll-1] = 0;
|
||||
ll--;
|
||||
|
||||
Reference in New Issue
Block a user