- resolved compilation issues with visual studio 2017

pull/93/head
Michael Zillgith 7 years ago
parent 5e35e6694b
commit 9826749400

@ -75,10 +75,12 @@ include_directories(
)
set(API_HEADERS
hal/inc/hal_base.h
hal/inc/hal_time.h
hal/inc/hal_thread.h
hal/inc/hal_filesystem.h
hal/inc/hal_ethernet.h
hal/inc/hal_socket.h
hal/inc/tls_config.h
hal/inc/platform_endian.h
hal/inc/lib_memory.h
@ -114,11 +116,11 @@ set(API_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/config/stack_config.h
)
if(MSVC)
if(MSVC AND MSVC_VERSION LESS 1800)
include_directories(
${CMAKE_CURRENT_LIST_DIR}/src/vs
)
endif(MSVC)
endif()
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/third_party/mbedtls/mbedtls-2.6.0)
set(WITH_MBEDTLS 1)

@ -78,15 +78,15 @@ message("Found winpcap -> can compile with GOOSE support")
set(WITH_WPCAP 1)
endif()
IF(MSVC)
set_source_files_properties(${libhal_windows_SRCS}
PROPERTIES LANGUAGE CXX)
ENDIF()
set (libhal_SRCS
${libhal_windows_SRCS}
)
IF(MSVC)
set_source_files_properties(${libhal_SRCS}
PROPERTIES LANGUAGE CXX)
ENDIF()
ELSEIF(UNIX)
IF(APPLE)
set (libhal_SRCS
@ -122,9 +122,14 @@ file(GLOB tls_SRCS ${CMAKE_CURRENT_LIST_DIR}/../third_party/mbedtls/mbedtls-2.6.
add_definitions(-DMBEDTLS_CONFIG_FILE="mbedtls_config.h")
set (libhal_SRCS ${libhal_SRCS}
${CMAKE_CURRENT_LIST_DIR}/tls/mbedtls/tls_mbedtls.c
${CMAKE_CURRENT_LIST_DIR}/tls/mbedtls/tls_mbedtls.c
)
IF(MSVC)
set_source_files_properties(${libhal_SRCS}
PROPERTIES LANGUAGE CXX)
ENDIF()
list (APPEND libhal_SRCS ${tls_SRCS})
endif(WITH_MBEDTLS)

@ -32,7 +32,7 @@
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <netinet/tcp.h> // required for TCP keepalive
#include <netinet/tcp.h> /* required for TCP keepalive */
#include "hal_thread.h"
#include "lib_memory.h"
@ -258,7 +258,7 @@ closeAndShutdownSocket(int socketFd)
if (DEBUG_SOCKET)
printf("socket_linux.c: call shutdown for %i!\n", socketFd);
// shutdown is required to unblock read or accept in another thread!
/* shutdown is required to unblock read or accept in another thread! */
shutdown(socketFd, SHUT_RDWR);
close(socketFd);
@ -312,10 +312,6 @@ Socket_connectAsync(Socket self, const char* address, int port)
activateTcpNoDelay(self);
#if (CONFIG_ACTIVATE_TCP_KEEPALIVE == 1)
activateKeepAlive(self->fd);
#endif
fcntl(self->fd, F_SETFL, O_NONBLOCK);
if (connect(self->fd, (struct sockaddr *) &serverAddress, sizeof(serverAddress)) < 0) {
@ -510,7 +506,7 @@ Socket_write(Socket self, uint8_t* buf, int size)
if (self->fd == -1)
return -1;
// MSG_NOSIGNAL - prevent send to signal SIGPIPE when peer unexpectedly closed the socket
/* MSG_NOSIGNAL - prevent send to signal SIGPIPE when peer unexpectedly closed the socket */
return send(self->fd, buf, size, MSG_NOSIGNAL);
}

@ -342,10 +342,6 @@ Socket_connectAsync(Socket self, const char* address, int port)
self->fd = socket(AF_INET, SOCK_STREAM, 0);
#if CONFIG_ACTIVATE_TCP_KEEPALIVE == 1
activateKeepAlive(self->fd);
#endif
setSocketNonBlocking(self);
if (connect(self->fd, (struct sockaddr *) &serverAddress, sizeof(serverAddress)) == SOCKET_ERROR) {
@ -517,7 +513,7 @@ Socket_read(Socket self, uint8_t* buf, int size)
{
int bytes_read = recv(self->fd, (char*) buf, size, 0);
if (bytes_read == 0) // peer has closed socket
if (bytes_read == 0) /* peer has closed socket */
return -1;
if (bytes_read == SOCKET_ERROR) {

Loading…
Cancel
Save