Small fixes for porting recent changes to windows
This commit is contained in:
parent
ce8b68dec9
commit
021c142cee
@ -337,7 +337,9 @@ RclConfig *recollinit(RclInitFlags flags,
|
|||||||
// Keep threads init behind log init, but make sure it's done before
|
// 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,
|
// we do the vfork choice ! The latter is not used any more actually,
|
||||||
// we always use vfork except if forbidden by config.
|
// we always use vfork except if forbidden by config.
|
||||||
config->initThrConf();
|
if ((flags & RCLINIT_IDX)) {
|
||||||
|
config->initThrConf();
|
||||||
|
}
|
||||||
|
|
||||||
bool novfork;
|
bool novfork;
|
||||||
config->getConfParam("novfork", &novfork);
|
config->getConfParam("novfork", &novfork);
|
||||||
|
|||||||
@ -45,6 +45,7 @@ HEADERS += \
|
|||||||
systray.h \
|
systray.h \
|
||||||
uiprefs_w.h \
|
uiprefs_w.h \
|
||||||
viewaction_w.h \
|
viewaction_w.h \
|
||||||
|
webcache.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
advsearch_w.cpp \
|
advsearch_w.cpp \
|
||||||
@ -79,6 +80,7 @@ SOURCES += \
|
|||||||
systray.cpp \
|
systray.cpp \
|
||||||
uiprefs_w.cpp \
|
uiprefs_w.cpp \
|
||||||
viewaction_w.cpp \
|
viewaction_w.cpp \
|
||||||
|
webcache.cpp \
|
||||||
widgets/qxtconfirmationmessage.cpp \
|
widgets/qxtconfirmationmessage.cpp \
|
||||||
xmltosd.cpp
|
xmltosd.cpp
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ FORMS = \
|
|||||||
ssearchb.ui \
|
ssearchb.ui \
|
||||||
uiprefs.ui \
|
uiprefs.ui \
|
||||||
viewaction.ui \
|
viewaction.ui \
|
||||||
|
webcache.ui
|
||||||
|
|
||||||
RESOURCES = recoll.qrc
|
RESOURCES = recoll.qrc
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,10 @@
|
|||||||
#include MEMORY_INCLUDE
|
#include MEMORY_INCLUDE
|
||||||
#include UNORDERED_MAP_INCLUDE
|
#include UNORDERED_MAP_INCLUDE
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define USING_STD_REGEX
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef USING_STD_REGEX
|
#ifndef USING_STD_REGEX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
@ -99,7 +103,7 @@ void WebcacheModel::reload()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(0,0,0), createIndex(1, m->all.size(),0));
|
emit dataChanged(createIndex(0,0), createIndex(1, m->all.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebcacheModel::deleteIdx(unsigned int idx)
|
bool WebcacheModel::deleteIdx(unsigned int idx)
|
||||||
@ -194,9 +198,9 @@ void WebcacheModel::setSearchFilter(const QString& _txt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
basic_regex exp;
|
basic_regex<char> exp;
|
||||||
try {
|
try {
|
||||||
exp = basic_regexp(txt, std::regex_constants::nosubs |
|
exp = basic_regex<char>(txt, std::regex_constants::nosubs |
|
||||||
std::regex_constants::extended);
|
std::regex_constants::extended);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
return;
|
return;
|
||||||
@ -212,7 +216,7 @@ void WebcacheModel::setSearchFilter(const QString& _txt)
|
|||||||
// m->all[i].url.c_str();
|
// m->all[i].url.c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit dataChanged(createIndex(0,0,0), createIndex(1, m->all.size(),0));
|
emit dataChanged(createIndex(0,0), createIndex(1, m->all.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int ROWHEIGHTPAD = 2;
|
static const int ROWHEIGHTPAD = 2;
|
||||||
|
|||||||
@ -466,7 +466,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string buf(d.padsize, ' ');
|
string buf(d.padsize, ' ');
|
||||||
if (write(m_fd, buf.c_str(), d.padsize) != d.padsize) {
|
if (write(m_fd, buf.c_str(), d.padsize) != (ssize_t)d.padsize) {
|
||||||
m_reason << "CirCache::weh: write failed. errno " << errno;
|
m_reason << "CirCache::weh: write failed. errno " << errno;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,21 +14,21 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEST_CPUCONF
|
#ifndef TEST_CPUCONF
|
||||||
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
#include "cpuconf.h"
|
||||||
|
|
||||||
|
#if defined(__gnu_linux__)
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "cpuconf.h"
|
|
||||||
#include "execmd.h"
|
#include "execmd.h"
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
#if defined(__gnu_linux__)
|
// It seems that we could use sysconf as on macosx actually
|
||||||
bool getCpuConf(CpuConf& conf)
|
bool getCpuConf(CpuConf& conf)
|
||||||
{
|
{
|
||||||
vector<string> cmdv = create_vector<string>("sh")("-c")
|
vector<string> cmdv = create_vector<string>("sh")("-c")
|
||||||
@ -56,8 +56,35 @@ bool getCpuConf(CpuConf& conf)
|
|||||||
conf.ncpus = 1;
|
conf.ncpus = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//#elif defined(__APPLE__)
|
|
||||||
|
|
||||||
|
#elif 0 && defined(_WIN32)
|
||||||
|
// On windows, indexing is actually twice slower with threads enabled +
|
||||||
|
// there is a bug and the process does not exit at the end of indexing.
|
||||||
|
// Until these are solved, pretend there is only 1 cpu
|
||||||
|
#include <thread>
|
||||||
|
bool getCpuConf(CpuConf& cpus)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
// Native way
|
||||||
|
SYSTEM_INFO sysinfo;
|
||||||
|
GetSystemInfo( &sysinfo );
|
||||||
|
cpus.ncpus = sysinfo.dwNumberOfProcessors;
|
||||||
|
#else
|
||||||
|
// c++11
|
||||||
|
cpus.ncpus = std::thread::hardware_concurrency();
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
bool getCpuConf(CpuConf& cpus)
|
||||||
|
{
|
||||||
|
cpus.ncpus = sysconf( _SC_NPROCESSORS_ONLN );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#else // Any other system
|
#else // Any other system
|
||||||
|
|
||||||
// Generic, pretend there is one
|
// Generic, pretend there is one
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user