diff --git a/CMakeLists.txt b/CMakeLists.txt index dd0f4c5b4..d4fcdf77e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 2.8) -project(FreeRDP C) +project(FreeRDP C CXX) if(NOT DEFINED VENDOR) set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor") @@ -116,6 +116,15 @@ if(MSVC) endif() endif() +CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined) +if(Wno-builtin-macro-redefined) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined") + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") +endif() + # Compiler-specific flags if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686") @@ -134,15 +143,6 @@ if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - # Hack to strip absolute paths out of the __FILE__ macro - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") - CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined) - if(Wno-builtin-macro-redefined) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined") - endif() - CHECK_C_COMPILER_FLAG (-Wno-unused-result Wno-unused-result) if(Wno-unused-result) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result") diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index d0b17377d..9eff40876 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -21,7 +21,6 @@ #include "config.h" #endif -#include #include #include #include @@ -160,8 +159,11 @@ static void* rdpei_schedule_thread(void* arg) RdpeiClientContext* context = (RdpeiClientContext*) rdpei->iface.pInterface; HANDLE hdl[] = {rdpei->event, rdpei->stopEvent}; - assert(NULL != rdpei); - assert(NULL != context); + if (!rdpei) + return NULL; + + if (!context) + return NULL; while (1) { @@ -516,7 +518,8 @@ static int rdpei_plugin_terminated(IWTSPlugin* pPlugin) DEBUG_DVC(""); - assert(NULL != pPlugin); + if (!pPlugin) + return -1; SetEvent(rdpei->stopEvent); EnterCriticalSection(&rdpei->lock); diff --git a/channels/rdpsnd/client/ios/TPCircularBuffer.c b/channels/rdpsnd/client/ios/TPCircularBuffer.c index d9e049ad2..1dcf47190 100644 --- a/channels/rdpsnd/client/ios/TPCircularBuffer.c +++ b/channels/rdpsnd/client/ios/TPCircularBuffer.c @@ -27,11 +27,14 @@ // 3. This notice may not be removed or altered from any source distribution. // +#include + #include "TPCircularBuffer.h" + #include #include -#define reportResult(result,operation) (_reportResult((result),(operation),strrchr(__FILE__, '/')+1,__LINE__)) +#define reportResult(result,operation) (_reportResult((result),(operation),__FILE__,__LINE__)) static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) { if ( result != ERR_SUCCESS ) { printf("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result)); diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index f7e5942af..1f704cc40 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -841,7 +841,7 @@ BOOL xf_pre_connect(freerdp* instance) fprintf(stderr, "--authonly, but no -p password. Please provide one.\n"); return FALSE; } - fprintf(stderr, "%s:%d: Authentication only. Don't connect to X.\n", __FILE__, __LINE__); + fprintf(stderr, "Authentication only. Don't connect to X.\n"); /* Avoid XWindows initialization and configuration below. */ return TRUE; } @@ -1457,7 +1457,7 @@ void* xf_thread(void* param) if (instance->settings->AuthenticationOnly) { freerdp_disconnect(instance); - fprintf(stderr, "%s:%d: Authentication only, exit status %d\n", __FILE__, __LINE__, !status); + fprintf(stderr, "Authentication only, exit status %d\n", !status); ExitThread(exit_code); } diff --git a/libfreerdp/cache/brush.c b/libfreerdp/cache/brush.c index b5e54f89c..6c3fa81d0 100644 --- a/libfreerdp/cache/brush.c +++ b/libfreerdp/cache/brush.c @@ -22,7 +22,6 @@ #endif #include -#include #include #include @@ -91,8 +90,11 @@ void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp) { void* entry; - assert(brushCache); - assert(bpp); + if (!brushCache) + return NULL; + + if (!bpp) + return NULL; if (*bpp == 1) { diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index d2aca2f58..e8104a866 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -90,7 +90,7 @@ BOOL freerdp_connect(freerdp* instance) freerdp_set_last_error(instance->context, FREERDP_ERROR_PRE_CONNECT_FAILED); } - fprintf(stderr, "%s:%d: freerdp_pre_connect failed\n", __FILE__, __LINE__); + fprintf(stderr, "freerdp_pre_connect failed\n"); goto freerdp_connect_finally; } @@ -100,7 +100,7 @@ BOOL freerdp_connect(freerdp* instance) /* --authonly tests the connection without a UI */ if (instance->settings->AuthenticationOnly) { - fprintf(stderr, "%s:%d: Authentication only, exit status %d\n", __FILE__, __LINE__, !status); + fprintf(stderr, "Authentication only, exit status %d\n", !status); goto freerdp_connect_finally; } diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 22ad623da..442a23823 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -64,13 +64,8 @@ endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS") -if(FREERDP_BUILD) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE) - include_directories(${CMAKE_CURRENT_BINARY_DIR}/include PARENT_SCOPE) -else() - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) -endif() +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/winpr/config.h)