diff --git a/CMakeLists.txt b/CMakeLists.txt index b3445098d..bff60e918 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,12 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") # -fPIC is not used on Windows platform (all DLLs are # relocable), -Wall generates about 30k stupid warnings # that can hide useful ones. - set(PLATFORM_DEPENDENT_COMPILER_OPTIONS "-D_CRT_SECURE_NO_WARNINGS") + if (${MSVC}) + set(PLATFORM_DEPENDENT_COMPILER_OPTIONS "-D_CRT_SECURE_NO_WARNINGS") + elseif (${MINGW}) + set(LIBS ${LIBS} ws2_32) + + endif() # needed for windows sockets (not verified) add_definitions(-D_WIN32_WINNT=0x0501) diff --git a/include/cql/internal/cql_connection_impl.hpp b/include/cql/internal/cql_connection_impl.hpp index 07d5b675d..8c4476f8d 100644 --- a/include/cql/internal/cql_connection_impl.hpp +++ b/include/cql/internal/cql_connection_impl.hpp @@ -229,7 +229,8 @@ class cql_connection_impl_t : public cql::cql_connection_t _callback_storage.set_callbacks(stream, callback_pair_t(callback, errback)); - create_request(new cql::cql_message_query_impl_t(query), + cql::cql_message_query_impl_t message(query); + create_request(&message, boost::bind(&cql_connection_impl_t::write_handle, this, boost::asio::placeholders::error, @@ -254,8 +255,9 @@ class cql_connection_impl_t : public cql::cql_connection_t _callback_storage.set_callbacks(stream, callback_pair_t(callback, errback)); + cql::cql_message_prepare_impl_t message(query); create_request( - new cql::cql_message_prepare_impl_t(query), + &message, boost::bind(&cql_connection_impl_t::write_handle, this, boost::asio::placeholders::error, @@ -814,8 +816,9 @@ class cql_connection_impl_t : public cql::cql_connection_t void options_write() { + std::auto_ptr m(new cql::cql_message_options_impl_t()); create_request( - new cql::cql_message_options_impl_t(), + m.release(), (boost::function)boost::bind( &cql_connection_impl_t::write_handle, this, diff --git a/src/cql/cql_serialization.cpp b/src/cql/cql_serialization.cpp index 276687c78..fefb5f73b 100644 --- a/src/cql/cql_serialization.cpp +++ b/src/cql/cql_serialization.cpp @@ -33,7 +33,7 @@ using namespace std; inline double swap_double(double source) { -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__GNUC__) uint64_t bytes = *reinterpret_cast(&source); uint64_t swapped = _byteswap_uint64(bytes); return *reinterpret_cast(&swapped); @@ -50,7 +50,7 @@ swap_double(double source) { inline float swap_float(float source) { -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__GNUC__) uint32_t bytes = *reinterpret_cast(&source); uint32_t swapped = _byteswap_ulong(bytes); return *reinterpret_cast(&swapped);