Permalink
Browse files

#91 bunch of little compatibility crap

  • Loading branch information...
1 parent 28c6bc6 commit 8f51715e96f36bfcab7e7a2e7a1943ff87a32847 Caleb James DeLisle committed May 19, 2012
View
@@ -24,6 +24,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
# validation
add_definitions(-Wall -Wextra -std=c99 -Werror -pedantic)
+# ISO C does not support the ‘I64’ ms_printf length modifier
+# but PRId64 is #defined as "I64d"
+if(WIN32)
+ add_definitions(-Wno-error)
+endif()
+
# This breaks logging since loggers are passed to functions
# and only used if the log level is high.
add_definitions(-Wno-unused-parameter)
@@ -85,7 +91,7 @@ else()
add_definitions(-g)
endif()
-if(NOT DEFINED APPLE)
+if(NOT DEFINED APPLE AND NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${PIE} -Wl,-z,relro,-z,now,-z,noexecstack")
else()
# apple seems to set noexecstack by defualt and not support relro.
@@ -148,6 +154,7 @@ target_link_libraries(cjdroute
cjdadmin
cjdnet
${LIBEVENT2_LIBRARIES}
+ ${PLATFORM_LIBRARIES}
)
install_targets(/bin cjdroute)
View
@@ -11,6 +11,7 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
+set(WIN32 TRUE)
# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
@@ -32,3 +33,8 @@ set(NO_PIE TRUE)
# proceed with ifdef hell :(
add_definitions(-DWIN32)
+
+set(PLATFORM_LIBRARIES
+ ws2_32
+
+)
View
@@ -56,7 +56,7 @@
static String* TYPE = String_CONST_SO("type");
static String* REQUIRED = String_CONST_SO("required");
static String* STRING = String_CONST_SO("String");
-static String* INT = String_CONST_SO("Int");
+static String* INTEGER = String_CONST_SO("Int");
static String* DICT = String_CONST_SO("Dict");
static String* LIST = String_CONST_SO("List");
static String* TXID = String_CONST_SO("txid");
@@ -136,7 +136,7 @@ static bool checkArgs(Dict* args, struct Function* func, String* txid, struct Ad
String* type = Dict_getString(value, String_CONST("type"));
if ((type == STRING && !Dict_getString(args, key))
|| (type == DICT && !Dict_getDict(args, key))
- || (type == INT && !Dict_getInt(args, key))
+ || (type == INTEGER && !Dict_getInt(args, key))
|| (type == LIST && !Dict_getList(args, key)))
{
error = String_printf(alloc,
@@ -415,7 +415,7 @@ static void acceptConn(evutil_socket_t socket, short eventType, void* vcontext)
struct ChildContext* context = (struct ChildContext*) vcontext;
struct sockaddr_storage ss;
- socklen_t slen = sizeof(ss);
+ ev_socklen_t slen = sizeof(ss);
evutil_socket_t fd = accept(socket, (struct sockaddr*)&ss, &slen);
if (fd < 0) {
perror("acceptConn() fd < 0");
@@ -467,7 +467,7 @@ static void child(struct sockaddr_storage* addr,
return;
}
- if (getsockname(listener, (struct sockaddr*) addr, (socklen_t*) &addrLen)) {
+ if (getsockname(listener, (struct sockaddr*) addr, (ev_socklen_t*) &addrLen)) {
perror("getsockname()");
}
@@ -530,8 +530,8 @@ void Admin_registerFunctionWithArgCount(char* name,
String* type = NULL;
if (!strcmp(arguments[i].type, STRING->bytes)) {
type = STRING;
- } else if (!strcmp(arguments[i].type, INT->bytes)) {
- type = INT;
+ } else if (!strcmp(arguments[i].type, INTEGER->bytes)) {
+ type = INTEGER;
} else if (!strcmp(arguments[i].type, DICT->bytes)) {
type = DICT;
} else if (!strcmp(arguments[i].type, LIST->bytes)) {
Oops, something went wrong.

0 comments on commit 8f51715

Please sign in to comment.