+ re-add a few fixed for windows which where accidentely removed in r4170

This commit is contained in:
kelson42 2012-11-20 00:13:46 +00:00
parent 449d6ca472
commit 888b5920e6

View File

@ -26,17 +26,17 @@
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <WS2tcpip.h> // otherwise socklen_t is not a recognized type
#if (_MSC_VER < 1600) #if (_MSC_VER < 1600)
#include "stdint4win.h" #include "stdint4win.h"
#else
typedef unsigned __int64 uint64_t;
typedef unsigned __int16 uint16_t;
#endif #endif
#include <winsock2.h> #include <winsock2.h>
#include <Windows.h> // otherwise int is not a recognized type #include <WS2tcpip.h> // otherwise socklen_t is not a recognized type
typedef SSIZE_T ssize_t; //#include <Windows.h> // otherwise int is not a recognized type
typedef int off_t; typedef int off_t;
typedef SSIZE_T ssize_t;
typedef UINT64 uint64_t;
typedef UINT16 uint16_t;
extern "C" { extern "C" {
#include <microhttpd.h> #include <microhttpd.h>
} }
@ -160,11 +160,6 @@ static int accessHandlerCallback(void *cls,
size_t * upload_data_size, size_t * upload_data_size,
void ** ptr) { void ** ptr) {
/* Debug */
if (isVerbose()) {
std::cout << "Requesting " << url << std::endl;
}
/* Unexpected method */ /* Unexpected method */
if (0 != strcmp(method, "GET")) if (0 != strcmp(method, "GET"))
return MHD_NO; return MHD_NO;
@ -176,6 +171,11 @@ static int accessHandlerCallback(void *cls,
return MHD_YES; return MHD_YES;
} }
/* Debug */
if (isVerbose()) {
std::cout << "Requesting " << url << std::endl;
}
/* Check if the response can be compressed */ /* Check if the response can be compressed */
const string acceptEncodingHeaderValue = MHD_lookup_connection_value(connection, MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT_ENCODING) ? 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) : ""; 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 */ /* Setup the library manager and get the list of books */
if (libraryFlag) { if (libraryFlag) {
vector<string> libraryPaths = kiwix::split(libraryPath, ":"); vector<string> libraryPaths = kiwix::split(libraryPath, ";");
vector<string>::iterator itr; vector<string>::iterator itr;
for ( itr = libraryPaths.begin(); itr != libraryPaths.end(); ++itr ) { for ( itr = libraryPaths.begin(); itr != libraryPaths.end(); ++itr ) {
bool retVal = false; if (!(*itr).empty()) {
try { bool retVal = false;
retVal = libraryManager.readFile(*itr, true); try {
} catch (...) { retVal = libraryManager.readFile(*itr, true);
retVal = false; } catch (...) {
} retVal = false;
}
if (!retVal) { if (!retVal) {
cerr << "Unable to open the XML library file '" << *itr << "'." << endl; cerr << "Unable to open the XML library file '" << *itr << "'." << endl;
exit(1); exit(1);
}
} }
} }