fixes for windows

This commit is contained in:
unknown 2011-09-04 11:14:55 -07:00
parent 30a41a4315
commit 9ec36cae77
3 changed files with 26 additions and 5 deletions

View File

@ -87,11 +87,11 @@ void Buffer::setData(const void* data, int bytes) {
}
const void* Buffer::data() const {
return &data_[0];
return bytes() == 0 ? NULL : &data_[0];
}
void* Buffer::data() {
return &data_[0];
return bytes() == 0 ? NULL : &data_[0];
}
int Buffer::bytes() const {

View File

@ -29,16 +29,36 @@
namespace metacall {
namespace {
//
// Constants
//
namespace {
const int SOCKET_INVALID = -1;
//
// Winsock
//
#ifdef _WIN32
struct WsaScope {
WsaScope() {
WSAData data;
WSAStartup(MAKEWORD(2, 2), &data);
}
~WsaScope() {
WSACleanup();
}
} wsa;
#endif
}

View File

@ -31,6 +31,7 @@
#ifdef _WIN32
#pragma comment(lib, "ws2_32.lib")
#define NOMINMAX
#include <ws2tcpip.h>
#else
#include <sys/socket.h>