Hi Emmanuel,
great to hear. I'm sure it will work if it compile.
Can you please send me the patch as attachement. The lines are wrapped so the
patch can't be applied easily.
Tommi
On Mittwoch, 29. Juli 2009 20:54:41 Emmanuel Engelhart wrote:
Hi,
I have achieved to compile a first version of a zimlib.lib (static
library under Windows). I do not really know if I can use it... but at
least it compiles.
I want to give you here the modifications I have done to achieve that.
Tommi, it would be great to include them (or others with the same
purpose) into the SVN.
Index: include/zim/zim.h
===================================================================
--- include/zim/zim.h (revision 236)
+++ include/zim/zim.h (working copy)
@@ -22,6 +22,12 @@
#include <stdint.h>
+#ifdef _WIN32
+typedef unsigned __int64 uint64_t;
+typedef signed __int8 int8_t;
+typedef signed __int32 int32_t;
+#endif
+
namespace zim
{
typedef uint32_t size_type;
Index: src/search.cpp
===================================================================
--- src/search.cpp (revision 236)
+++ src/search.cpp (working copy)
@@ -106,7 +106,7 @@
// weight position of words in the document
if (Search::getWeightPos())
for (itp = posList.begin(); itp != posList.end(); ++itp)
- priority += Search::getWeightPos() / pow(1.01, itp->first);
+ priority += Search::getWeightPos() / pow((double)1.01,
(double)itp->first); // here is a ambiguity between to pow() functions
(pow(double, int) or pow(double, double))
if (Search::getWeightPosRel())
for (itp = posList.begin(); itp != posList.end(); ++itp)
Index: src/bunzip2stream.cpp
===================================================================
--- src/bunzip2stream.cpp (revision 236)
+++ src/bunzip2stream.cpp (working copy)
@@ -113,7 +113,8 @@
// there is data already available
// read compressed data from source into ibuffer
log_debug("in_avail=" << sinksource->in_avail());
- stream.avail_in = sinksource->sgetn(ibuffer(),
std::min(sinksource->in_avail(), ibuffer_size()));
+
+ stream.avail_in = sinksource->sgetn(ibuffer(),
min(sinksource->in_avail(), ibuffer_size())); // compile genereates an
error if you have the "std::", do not know exactly why.
}
else
{
Index: src/uuid.cpp
===================================================================
--- src/uuid.cpp (revision 236)
+++ src/uuid.cpp (working copy)
@@ -20,12 +20,31 @@
#include <zim/uuid.h>
#include <iostream>
#include <time.h>
-#include <sys/time.h>
+#include <zim/zim.h> // necessary to have the new types
#include "log.h"
#ifdef WITH_CXXTOOLS
#include <cxxtools/md5stream.h>
#endif
+#if defined(_MSC_VER) || defined(__MINGW32__)
+# include <time.h>
+# include <Windows.h>
+#else
+# include <sys/time.h>
+#endif
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+int gettimeofday(struct timeval* tp, void* tzp) {
+ DWORD t;
+ t = timeGetTime();
+ tp->tv_sec = t / 1000;
+ tp->tv_usec = t % 1000;
+ /* 0 indicates that the call succeeded. */
+ return 0;
+}
+#endif // time related function/headers are differents und win32
+
+
log_define("zim.uuid")
namespace zim
@@ -62,7 +81,12 @@
*reinterpret_cast<int32_t*>(ret.data) =
reinterpret_cast<int32_t>(&ret);
*reinterpret_cast<int32_t*>(ret.data + 4) =
static_cast<int32_t>(tv.tv_sec);
*reinterpret_cast<int32_t*>(ret.data + 8) =
static_cast<int32_t>(tv.tv_usec);
+
+ #if defined(_MSC_VER)
+ *reinterpret_cast<int32_t*>(ret.data + 12) =
static_cast<int32_t>(GetCurrentProcessId());
+ #else
*reinterpret_cast<int32_t*>(ret.data + 12) =
static_cast<int32_t>(getpid()); // getpid() is GetCurrentProcessId()
under win32
+ #endif
#endif
Index: src/qunicode.cpp
===================================================================
--- src/qunicode.cpp (revision 236)
+++ src/qunicode.cpp (working copy)
@@ -18,6 +18,7 @@
*/
#include <zim/qunicode.h>
+#include <zim/zim.h> // for the types compatibilty
#include "log.h"
#include <iostream>
#include <sstream>
_______________________________________________
dev-l mailing list
dev-l(a)openzim.org
https://intern.openzim.org/mailman/listinfo/dev-l