Skip to content

Commit

Permalink
Fix windows compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Subsentient committed Mar 17, 2016
1 parent 76233ba commit 970e3b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ OUTFILE = ../NEXUS
OBJECTS = config.o netcore.o irc.o state.o server.o nexus.o scrollback.o ignore.o

ifeq ($(OS),WIN)
CXXFLAGS += -lws2_32 -DWIN
CXXFLAGS += -DWIN
LDFLAGS = -lws2_32
OUTFILE = ../NEXUS.exe
OBJECTS += ../win32/win.o
endif
Expand Down
6 changes: 3 additions & 3 deletions src/netcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ bool Net::Read(int Descriptor, void *OutStream_, unsigned MaxLength, bool IsText
unsigned char Byte = 0;
unsigned char *OutStream = static_cast<unsigned char*>(OutStream_);
unsigned Inc = 0;

do
{
Status = recv(Descriptor, (void*)&Byte, 1, 0);
Status = recv(Descriptor, (char*)&Byte, 1, 0);


*OutStream++ = Byte;
Expand Down Expand Up @@ -193,7 +193,7 @@ bool Net::InitServer(unsigned short PortNum)
return false;
}

setsockopt(ServerDescriptor, SOL_SOCKET, SO_REUSEADDR, (void*)&True, sizeof(int)); //The cast shuts up Windows compilation.
setsockopt(ServerDescriptor, SOL_SOCKET, SO_REUSEADDR, (const char*)&True, sizeof(int)); //The cast shuts up Windows compilation.

if (bind(ServerDescriptor, Res->ai_addr, Res->ai_addrlen) == -1)
{
Expand Down
8 changes: 6 additions & 2 deletions src/nexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,16 @@ int main(int argc, char **argv)


//Ignore sigpipe from send() in Net::Write()
#ifndef WIN
signal(SIGPIPE, SIG_IGN);

#endif //WIN

puts("NEXUS BNC " NEXUS_VERSION "\n");

#ifndef WIN
bool Background = false;
#endif
#endif //WIN

///Process command line arguments.
if (argc > 1)
{ //Command line arguments override any values in configuration files.
Expand Down

0 comments on commit 970e3b8

Please sign in to comment.