Fixes needed as part of enabling stricter warnings

This commit is contained in:
Mahesh Rohera 2018-05-30 15:42:03 -07:00
Родитель adcdd2306f
Коммит 770c24aa9e
11 изменённых файлов: 21 добавлений и 22 удалений

Просмотреть файл

@ -128,6 +128,8 @@ if(MSVC)
endif()
elseif(UNIX) #LINUX OR APPLE
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat=2 -Wformat-security ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Wformat-security ")
if(${use_openssl})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_OPENSSL")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_OPENSSL")

Просмотреть файл

@ -832,7 +832,7 @@ static HTTPAPI_RESULT SendHeadsToXIO(HTTP_HANDLE_DATA* http_instance, HTTPAPI_RE
/*Codes_SRS_HTTPAPI_COMPACT_21_038: [ The HTTPAPI_ExecuteRequest shall execute the resquest for the path in relativePath parameter. ]*/
/*Codes_SRS_HTTPAPI_COMPACT_21_036: [ The request type shall be provided in the parameter requestType. ]*/
if (((ret = snprintf(buf, sizeof(buf), "%s %s HTTP/1.1\r\n", get_request_type(requestType), relativePath)) < 0) ||
(ret >= sizeof(buf)))
((size_t)ret >= sizeof(buf)))
{
/*Codes_SRS_HTTPAPI_COMPACT_21_027: [ If the HTTPAPI_ExecuteRequest cannot create a buffer to send the request, it shall not send any request and return HTTPAPI_STRING_PROCESSING_ERROR. ]*/
result = HTTPAPI_STRING_PROCESSING_ERROR;

Просмотреть файл

@ -814,7 +814,7 @@ int socketio_send(CONCRETE_IO_HANDLE socket_io, const void* buffer, size_t size,
signal(SIGPIPE, SIG_IGN);
ssize_t send_result = send(socket_io_instance->socket, buffer, size, 0);
if (send_result != size)
if ((send_result < 0) || ((size_t)send_result != size))
{
if (send_result == INVALID_SOCKET)
{
@ -879,7 +879,7 @@ void socketio_dowork(CONCRETE_IO_HANDLE socket_io)
signal(SIGPIPE, SIG_IGN);
ssize_t send_result = send(socket_io_instance->socket, pending_socket_io->bytes, pending_socket_io->size, 0);
if (send_result != pending_socket_io->size)
if ((send_result < 0) || ((size_t)send_result != pending_socket_io->size))
{
if (send_result == INVALID_SOCKET)
{

Просмотреть файл

@ -191,12 +191,12 @@ function(add_files_to_install filesToBeInstalled)
set(INSTALL_H_FILES ${INSTALL_H_FILES} ${filesToBeInstalled} CACHE INTERNAL "Files that will be installed on the system")
endfunction()
# XCode warns about unused variables and unused static functions,
# both of which are produced by serializer
# XCode and stricter warning levels such as -Wall and -Wextra warn about unused
# variables and unused static functions, both of which are produced by serializer
function(usePermissiveRulesForSamplesAndTests)
if(XCODE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-function -Wno-missing-braces" PARENT_SCOPE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable -Wno-unused-function -Wno-missing-braces" PARENT_SCOPE)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-missing-braces " PARENT_SCOPE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-missing-braces " PARENT_SCOPE)
endif()
endfunction()

Просмотреть файл

@ -70,7 +70,7 @@ int main(int argc, char** argv)
}
else
{
TLSIO_CONFIG tlsio_config = { "www.google.com", 443 };
TLSIO_CONFIG tlsio_config = { "www.google.com", 443, NULL, NULL};
XIO_HANDLE tlsio;
tlsio = xio_create(tlsio_interface, &tlsio_config);

Просмотреть файл

@ -10,11 +10,11 @@ typedef struct simpleItem_tag
DLIST_ENTRY link;
} simpleItem,*pSimpleItem;
static simpleItem simp1 = { 1 };
static simpleItem simp2 = { 2 };
static simpleItem simp3 = { 3 };
static simpleItem simp4 = { 4 };
static simpleItem simp5 = { 5 };
static simpleItem simp1 = { 1, { NULL, NULL } };
static simpleItem simp2 = { 2, { NULL, NULL } };
static simpleItem simp3 = { 3, { NULL, NULL } };
static simpleItem simp4 = { 4, { NULL, NULL } };
static simpleItem simp5 = { 5, { NULL, NULL } };
static TEST_MUTEX_HANDLE g_dllByDll;
static TEST_MUTEX_HANDLE g_testByTest;

Просмотреть файл

@ -256,7 +256,7 @@ TEST_SUITE_INITIALIZE(a)
{
///arrange
// no calls expected
int i;
size_t i;
size_t received_count_receptor = BAD_BUFFER_COUNT;
send_receive_parameters_t parameters[3];
@ -369,7 +369,7 @@ TEST_SUITE_INITIALIZE(a)
{
///arrange
// no calls expected
int i;
size_t i;
size_t sent_count_receptor = BAD_BUFFER_COUNT;
send_receive_parameters_t parameters[2];
// buffer size received_count fail_msg

Просмотреть файл

@ -40,7 +40,7 @@
#define TEST_CREATE_CONNECTION_HOST_NAME (const char*)"https://test.azure-devices.net"
#define TEST_CREATE_CONNECTION_PORT (int)443
static const TLSIO_CONFIG tlsio_config = { TEST_CREATE_CONNECTION_HOST_NAME, TEST_CREATE_CONNECTION_PORT };
static const TLSIO_CONFIG tlsio_config = { TEST_CREATE_CONNECTION_HOST_NAME, TEST_CREATE_CONNECTION_PORT, NULL, NULL };
static int g_ssl_write_success = 1;
static int g_ssl_read_returns_data = 1;

@ -1 +1 @@
Subproject commit a500106bb2339a988cf7f6445f2686333746efc4
Subproject commit b1caa0c5029f1448c6b05ff5137294ede4221842

Просмотреть файл

@ -74,14 +74,11 @@ public:
return theValue;
}
#pragma warning (push)
#pragma warning (disable : 4100) /*'size' : unreferenced formal parameter*/
void setArraySize(_In_ size_t size)
{
UNREFERENCED_PARAMETER(size);
ASSERT_FAIL("Setting an array size for something that is not a pointer is CATASTROPHIC failure");
}
#pragma warning (pop)
};
/*template template parameter partial specialization, or something*/

@ -1 +1 @@
Subproject commit a9be4df165633c0ac6fcff2bf94b1ae384856d39
Subproject commit 531a6f4432489bff70fb8725aefd2dfd9dc015a7