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

@ -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")

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;
@ -299,6 +299,7 @@ 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);
}
@ -427,7 +428,6 @@ BOOL freerdp_disconnect(freerdp* instance)
{
wMessageQueue* inputQueue = freerdp_get_message_queue(instance,
FREERDP_INPUT_MESSAGE_QUEUE);
MessageQueue_PostQuit(inputQueue, 0);
}

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[] =
{