Hi Tommi,
Thank you to have integrated the diff and clean it a little bite. It works now almost, and only almost because you do not modify the bunzip2stream.cc like indicated in the diff.
I give you now the whol log of the compilation, you will see expect the error on bunzip2strea.cc there are alos a few warnings, maybe you will have ideas to avoid them.
------ Neues Erstellen gestartet: Projekt: zimlib, Konfiguration: Debug Win32 ------ Die Zwischen- und Ausgabedateien für das Projekt "zimlib" mit der Konfiguration "Debug|Win32" werden gelöscht. Kompilieren... article.cpp zintstream.cpp ..\src\zintstream.cpp(40) : warning C4554: '<<': Prüfen Sie Operatorrangfolge auf mögliche Fehler; verwenden Sie runde Klammern, um den Vorrang zu verdeutlichen uuid.cpp unicode.cpp c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(33) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(39) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(45) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(51) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(57) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(63) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(68) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(74) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(86) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/unicode.h(92) : warning C4800: 'int': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) template.cpp search.cpp qunicode.cpp ptrstream.cpp inflatestream.cpp ..\src\inflatestream.cpp(123) : warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' with [ _Elem=char, _Traits=std::char_traits<char> ] C:\Programme\Microsoft Visual Studio 9.0\VC\include\streambuf(121): Siehe Deklaration von 'std::basic_streambuf<_Elem,_Traits>::sgetn' with [ _Elem=char, _Traits=std::char_traits<char> ] ..\src\inflatestream.cpp(128) : warning C4996: 'std::basic_streambuf<_Elem,_Traits>::sgetn': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' with [ _Elem=char, _Traits=std::char_traits<char> ] C:\Programme\Microsoft Visual Studio 9.0\VC\include\streambuf(121): Siehe Deklaration von 'std::basic_streambuf<_Elem,_Traits>::sgetn' with [ _Elem=char, _Traits=std::char_traits<char> ] indexarticle.cpp ..\src\indexarticle.cpp(72) : warning C4800: 'void *': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(70) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\indexarticle.cpp(130): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "T fromLittleEndianzim::size_type(const T *,bool)". with [ T=zim::size_type ] fileimpl.cpp ..\src\fileimpl.cpp(65) : warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\Programme\Microsoft Visual Studio 9.0\VC\include\string.h(126): Siehe Deklaration von 'strerror' ..\src\fileimpl.cpp(82) : warning C4244: 'Argument': Konvertierung von 'zim::offset_type' in 'std::streamoff', möglicher Datenverlust ..\src\fileimpl.cpp(97) : warning C4244: 'Argument': Konvertierung von 'zim::offset_type' in 'std::streamoff', möglicher Datenverlust ..\src\fileimpl.cpp(132) : warning C4244: 'Argument': Konvertierung von 'unsigned __int64' in 'std::streamoff', möglicher Datenverlust ..\src\fileimpl.cpp(169) : warning C4244: 'Argument': Konvertierung von 'unsigned __int64' in 'std::streamoff', möglicher Datenverlust c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(70) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\fileimpl.cpp(90): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "T fromLittleEndian<unsigned __int64>(const T *,bool)". with [ T=unsigned __int64 ] fileheader.cpp ..\src\fileheader.cpp(38) : warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\xutility(2576): Siehe Deklaration von 'std::copy' c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(51) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\fileheader.cpp(36): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void toLittleEndianzim::size_type(const T &,char *,bool)". with [ T=zim::size_type ] c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(58) : warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\xutility(2576): Siehe Deklaration von 'std::copy' c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(51) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\fileheader.cpp(40): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void toLittleEndianzim::offset_type(const T &,char *,bool)". with [ T=zim::offset_type ] c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(58) : warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\xutility(2576): Siehe Deklaration von 'std::copy' c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(70) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\fileheader.cpp(63): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "T fromLittleEndianzim::size_type(const T *,bool)". with [ T=zim::size_type ] file.cpp dirent.cpp ..\src\dirent.cpp(91) : warning C4800: 'char': Variable wird auf booleschen Wert ('True' oder 'False') gesetzt (Auswirkungen auf Leistungsverhalten möglich) c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(51) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\dirent.cpp(50): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void toLittleEndianzim::size_type(const T &,char *,bool)". with [ T=zim::size_type ] c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(58) : warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\xutility(2576): Siehe Deklaration von 'std::copy' c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(51) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\dirent.cpp(51): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "void toLittleEndian<uint16_t>(const T &,char *,bool)". with [ T=uint16_t ] c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(58) : warning C4996: 'std::copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\xutility(2576): Siehe Deklaration von 'std::copy' c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(70) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\dirent.cpp(98): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "T fromLittleEndianzim::size_type(const T *,bool)". with [ T=zim::size_type ] deflatestream.cpp cluster.cpp c:\code\moulinkiwix\dependences\win\zimlib\include\zim/endian.h(70) : warning C4996: 'std::reverse_copy': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Programme\Microsoft Visual Studio 9.0\VC\include\algorithm(1632): Siehe Deklaration von 'std::reverse_copy' ..\src\cluster.cpp(61): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "T fromLittleEndianzim::size_type(const T *,bool)". with [ T=zim::size_type ] bzip2stream.cpp bzip2.cpp bunzip2stream.cpp ..\src\bunzip2stream.cpp(117) : error C2589: '(': Ungültiges Token auf der rechten Seite von '::' ..\src\bunzip2stream.cpp(117) : error C2059: Syntaxfehler: '::' articlesearch.cpp Code wird generiert... Das Buildprotokoll wurde unter "file://c:\code\moulinkiwix\dependences\win\zimlib\zimlib\Debug\BuildLog.htm" gespeichert. zimlib - 2 Fehler, 34 Warnung(en) ========== Alles neu erstellen: 0 erfolgreich, Fehler bei 1, 0 übersprungen ==========
Besten Dank Emmanuel Le ven 31/07/09 22:36, "Tommi Mäkitalo" tommi@tntnet.org a écrit:
Hi again,
I was impatient and applied the patch and after some cleanup I checked it in.
Can you please test, if the version in svn still compile on windows?
Tommi
On Freitag, 31. Juli 2009 21:54:03 Tommi Mäkitalo wrote:
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
+++ 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
+++ 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
- =
static_cast<int32_t>(tv.tv_sec);
*reinterpret_cast<int32_t*>(ret.data
- =
static_cast<int32_t>(tv.tv_usec);
- #if defined(_MSC_VER)
- *reinterpret_cast<int32_t*>(ret.data +
- =
static_cast<int32_t>(GetCurrentProcessId());
- #else
*reinterpret_cast<int32_t*>(ret.data
- =
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@openz
im.org
dev-l mailing list
dev-l@openz
im.org https://intern.openzim.org/mailman/listinfo/dev-l
dev-l mailing list dev-l@openz im.org
Hi,
it was not that I did not apply your patch in bunzip2stream.cpp but because I tried (and failed) to do it better.
I use std::min from <algorithm>, but this header was not included. So I added it and assumed, it would fix the missing template in VC++. But no I found this: http://www.devx.com/tips/Tip/14540. It tells us, that VC++ do not define this std::min at all but std::_cpp_min. But of course gcc and other standard conformant C++ compilers do not define std::_cpp_min. The suggested solution is stupid, since this bounds the code to a non-standard behaviour of VC++.
So the question is, how to convince VC++ to be standard conformant since std::min is perfectly that.
I try to prevent #ifdef's, but prefer always to use standard conformant c++. But here I currently see no alternative.
Tommi