Merge pull request #3544 from akallabeth/multi_warn_fixes

Fix multiple warnings
This commit is contained in:
Bernhard Miklautz 2016-10-14 10:10:45 +02:00 committed by GitHub
commit da56839a45
7 changed files with 85 additions and 53 deletions

View File

@ -71,7 +71,7 @@ include(CMakePackageConfigHelpers)
# Soname versioning
set(BUILD_NUMBER 0)
if ($ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
endif()
set(WITH_LIBRARY_VERSIONING "ON")
set(FREERDP_VERSION_MAJOR "2")
@ -135,14 +135,14 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
endif()
if(BUILD_TESTING)
set(EXPORT_ALL_SYMBOLS TRUE)
set(EXPORT_ALL_SYMBOLS TRUE)
elseif(NOT DEFINED EXPORT_ALL_SYMBOLS)
set(EXPORT_ALL_SYMBOLS FALSE)
set(EXPORT_ALL_SYMBOLS FALSE)
endif()
if (EXPORT_ALL_SYMBOLS)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-DFREERDP_TEST_EXPORTS -DBUILD_TESTING)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-DFREERDP_TEST_EXPORTS -DBUILD_TESTING)
endif(EXPORT_ALL_SYMBOLS)
# BSD
@ -236,18 +236,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DNDEBUG)
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
if(Wno-builtin-macro-redefined)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-builtin-macro-redefined")
add_definitions("-D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
endif()
CHECK_CXX_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefinedCXX)
if(Wno-builtin-macro-redefinedCXX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-builtin-macro-redefined")
add_definitions("-D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
endif()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
@ -257,6 +245,23 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
endif()
# When building with Unix Makefiles and doing any release builds
# try to set __FILE__ to relative paths via a make specific macro
if (CMAKE_GENERATOR MATCHES "Unix Makefile*")
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
if(Wno-builtin-macro-redefined)
set(CMAKE_C_FLAGS_${UPPER_BUILD_TYPE} "${CMAKE_C_FLAGS_${UPPER_BUILD_TYPE}} -Wno-builtin-macro-redefined -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
endif()
CHECK_CXX_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefinedCXX)
if(Wno-builtin-macro-redefinedCXX)
set(CMAKE_CXX_FLAGS_${UPPER_BUILD_TYPE} "${CMAKE_CXX_FLAGS_${UPPER_BUILD_TYPE}} -Wno-builtin-macro-redefined -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
endif()
endif()
endif()
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-macros -Wno-padded")
@ -487,7 +492,7 @@ endif()
if(ANDROID)
set(WITH_LIBRARY_VERSIONING "OFF")
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF)
@ -808,7 +813,7 @@ endif()
include(CTest)
if(BUILD_TESTING)
enable_testing()
enable_testing()
if(MSVC)
set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
@ -860,7 +865,7 @@ include_directories("${CMAKE_BINARY_DIR}/rdtk/include")
add_subdirectory(rdtk)
if(WAYLAND_FOUND)
add_subdirectory(uwac)
add_subdirectory(uwac)
endif()
if(BSD)
@ -906,9 +911,9 @@ include(${CMAKE_CPACK_INCLUDE_FILE})
set(FREERDP_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()
string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h)

View File

@ -24,6 +24,8 @@
#include <freerdp/api.h>
#include <winpr/wlog.h>
#include <freerdp/log.h>
#define CTAG FREERDP_TAG("codec.color")
#define FREERDP_PIXEL_FORMAT_TYPE_A 0
#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1
@ -570,6 +572,20 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
tmp = palette->palette[color];
SplitColor(tmp, palette->format, _r, _g, _b, _a, NULL);
}
else
{
if (_r)
*_r = 0x00;
if (_g)
*_g = 0x00;
if (_b)
*_b = 0x00;
if (_a)
*_a = 0x00;
}
break;
@ -592,7 +608,19 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
/* 4 bpp formats */
case PIXEL_FORMAT_A4:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
if (_r)
*_r = 0x00;
if (_g)
*_g = 0x00;
if (_b)
*_b = 0x00;
if (_a)
*_a = 0x00;
WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
break;
}
}
@ -686,7 +714,7 @@ static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
return 0;
}
}
@ -762,7 +790,7 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
break;
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
color = 0;
break;
}
@ -815,7 +843,7 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
break;
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
return FALSE;
}

View File

@ -299,7 +299,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
UINT32 subWidth;
UINT32 subHeight;
UINT32 planeSize;
INT32 rleSizes[4];
INT32 rleSizes[4] = { 0, 0, 0, 0 };
UINT32 rawSizes[4];
UINT32 rawWidths[4];
UINT32 rawHeights[4];

View File

@ -94,7 +94,7 @@ rdpChannels* freerdp_channel_get_channels_context(void)
*/
BOOL freerdp_connect(freerdp* instance)
{
UINT status2;
UINT status2 = CHANNEL_RC_OK;
rdpRdp* rdp;
BOOL status = TRUE;
rdpSettings* settings;
@ -116,7 +116,7 @@ BOOL freerdp_connect(freerdp* instance)
if (status)
status2 = freerdp_channels_pre_connect(instance->context->channels,
instance);
instance);
if (settings->KeyboardLayout == KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002)
{
@ -153,7 +153,7 @@ BOOL freerdp_connect(freerdp* instance)
if (instance->settings->DumpRemoteFx)
{
instance->update->pcap_rfx = pcap_open(instance->settings->DumpRemoteFxFile,
TRUE);
TRUE);
if (instance->update->pcap_rfx)
instance->update->dump_rfx = TRUE;
@ -220,7 +220,7 @@ BOOL freerdp_connect(freerdp* instance)
if (rdp->errorInfo == ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES)
freerdp_set_last_error(instance->context,
FREERDP_ERROR_INSUFFICIENT_PRIVILEGES);
FREERDP_ERROR_INSUFFICIENT_PRIVILEGES);
SetEvent(rdp->transport->connectedEvent);
freerdp_connect_finally:
@ -239,7 +239,7 @@ BOOL freerdp_abort_connect(freerdp* instance)
}
BOOL freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds,
int* wcount)
int* wcount)
{
rdpRdp* rdp = instance->context->rdp;
transport_get_fds(rdp->transport, rfds, rcount);
@ -278,7 +278,7 @@ BOOL freerdp_check_fds(freerdp* instance)
}
DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events,
DWORD count)
DWORD count)
{
DWORD nCount = 0;
nCount += transport_get_event_handles(context->rdp->transport, events, count);
@ -299,8 +299,9 @@ DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events,
{
if (nCount >= count)
return 0;
events[nCount++] = freerdp_get_message_queue_event_handle(
context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
}
return nCount;
@ -336,7 +337,7 @@ BOOL freerdp_check_event_handles(rdpContext* context)
if (context->settings->AsyncInput)
{
status = freerdp_message_queue_process_pending_messages(
context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
context->instance, FREERDP_INPUT_MESSAGE_QUEUE);
}
return status;
@ -373,7 +374,7 @@ HANDLE freerdp_get_message_queue_event_handle(freerdp* instance, DWORD id)
}
int freerdp_message_queue_process_message(freerdp* instance, DWORD id,
wMessage* message)
wMessage* message)
{
int status = -1;
@ -410,7 +411,7 @@ int freerdp_message_queue_process_pending_messages(freerdp* instance, DWORD id)
}
static int freerdp_send_channel_data(freerdp* instance, UINT16 channelId,
BYTE* data, int size)
BYTE* data, int size)
{
return rdp_send_channel_data(instance->context->rdp, channelId, data, size);
}
@ -426,13 +427,12 @@ BOOL freerdp_disconnect(freerdp* instance)
if (instance->settings->AsyncInput)
{
wMessageQueue* inputQueue = freerdp_get_message_queue(instance,
FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(inputQueue, 0);
FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(inputQueue, 0);
}
if (freerdp_channels_disconnect(instance->context->channels,
instance) != CHANNEL_RC_OK)
instance) != CHANNEL_RC_OK)
rc = FALSE;
IFCALL(instance->PostDisconnect, instance);
@ -574,7 +574,7 @@ BOOL freerdp_context_new(freerdp* instance)
goto fail;
PubSub_AddEventTypes(context->pubSub, FreeRDP_Events,
sizeof(FreeRDP_Events) / sizeof(wEventType));
sizeof(FreeRDP_Events) / sizeof(wEventType));
context->metrics = metrics_new(context);
if (!context->metrics)
@ -748,7 +748,7 @@ void freerdp_set_last_error(rdpContext* context, UINT32 lastError)
{
if (lastError)
WLog_ERR(TAG, "freerdp_set_last_error %s [0x%04X]",
freerdp_get_last_error_name(lastError), lastError);
freerdp_get_last_error_name(lastError), lastError);
context->LastError = lastError;
@ -854,7 +854,7 @@ BOOL checkChannelErrorEvent(rdpContext* context)
if (WaitForSingleObject(context->channelErrorEvent, 0) == WAIT_OBJECT_0)
{
WLog_ERR(TAG, "%s. Error was %lu", context->errorDescription,
context->channelErrorNum);
context->channelErrorNum);
return FALSE;
}

View File

@ -380,7 +380,6 @@ static void transport_bio_error_log(LPCSTR tag, LPCSTR biofunc, BIO* bio,
unsigned long sslerr;
char* buf;
wLog* log;
wLogMessage log_message;
int saveerrno;
DWORD level;
saveerrno = errno;

View File

@ -443,8 +443,8 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat)
BOOL rc = FALSE;
BOOL failed = FALSE;
UINT32 x;
HGDI_DC hdcSrc;
HGDI_DC hdcDst;
HGDI_DC hdcSrc = NULL;
HGDI_DC hdcDst = NULL;
const UINT32 RawFormat = PIXEL_FORMAT_RGB8;
struct test_bitblt tests[] =
{
@ -491,9 +491,9 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat)
{GDI_DPo, bmp_SRC, NULL}
};
const UINT32 number_tests = sizeof(tests) / sizeof(tests[0]);
HGDI_BITMAP hBmpSrc;
HGDI_BITMAP hBmpDst;
HGDI_BITMAP hBmpDstOriginal;
HGDI_BITMAP hBmpSrc = NULL;
HGDI_BITMAP hBmpDst = NULL;
HGDI_BITMAP hBmpDstOriginal = NULL;
HGDI_BRUSH brush;
gdiPalette g;
gdiPalette* hPalette = &g;

View File

@ -670,8 +670,8 @@ int TestGdiLine(int argc, char* argv[])
for (i = 0; i < number_formats; i++)
{
HGDI_DC hdc;
HGDI_PEN pen;
HGDI_DC hdc = NULL;
HGDI_PEN pen = NULL;
HGDI_BITMAP hBmp = NULL;
struct ropMap rop_map[] =
{