From 888b5920e668a2f6287b04f3d527152d6c6dd536 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Tue, 20 Nov 2012 00:13:46 +0000 Subject: [PATCH] + re-add a few fixed for windows which where accidentely removed in r4170 --- src/server/kiwix-serve.cpp | 50 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 281d1cc..23165c4 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -26,17 +26,17 @@ #endif #ifdef _WIN32 -#include // otherwise socklen_t is not a recognized type -#if (_MSC_VER < 1600) -#include "stdint4win.h" -#else -typedef unsigned __int64 uint64_t; -typedef unsigned __int16 uint16_t; -#endif + +#if (_MSC_VER < 1600) +#include "stdint4win.h" +#endif #include -#include // otherwise int is not a recognized type -typedef SSIZE_T ssize_t; +#include // otherwise socklen_t is not a recognized type +//#include // otherwise int is not a recognized type typedef int off_t; +typedef SSIZE_T ssize_t; +typedef UINT64 uint64_t; +typedef UINT16 uint16_t; extern "C" { #include } @@ -160,11 +160,6 @@ static int accessHandlerCallback(void *cls, size_t * upload_data_size, void ** ptr) { - /* Debug */ - if (isVerbose()) { - std::cout << "Requesting " << url << std::endl; - } - /* Unexpected method */ if (0 != strcmp(method, "GET")) return MHD_NO; @@ -176,6 +171,11 @@ static int accessHandlerCallback(void *cls, return MHD_YES; } + /* Debug */ + if (isVerbose()) { + std::cout << "Requesting " << url << std::endl; + } + /* Check if the response can be compressed */ const string acceptEncodingHeaderValue = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT_ENCODING) ? MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT_ENCODING) : ""; @@ -494,19 +494,21 @@ int main(int argc, char **argv) { /* Setup the library manager and get the list of books */ if (libraryFlag) { - vector libraryPaths = kiwix::split(libraryPath, ":"); + vector libraryPaths = kiwix::split(libraryPath, ";"); vector::iterator itr; for ( itr = libraryPaths.begin(); itr != libraryPaths.end(); ++itr ) { - bool retVal = false; - try { - retVal = libraryManager.readFile(*itr, true); - } catch (...) { - retVal = false; - } + if (!(*itr).empty()) { + bool retVal = false; + try { + retVal = libraryManager.readFile(*itr, true); + } catch (...) { + retVal = false; + } - if (!retVal) { - cerr << "Unable to open the XML library file '" << *itr << "'." << endl; - exit(1); + if (!retVal) { + cerr << "Unable to open the XML library file '" << *itr << "'." << endl; + exit(1); + } } }