got rid of compiler warnings

This commit is contained in:
Stefan Strobel 2019-12-05 14:39:26 +01:00
parent 33e4e20474
commit 3194012bae
9 changed files with 16 additions and 26 deletions

View File

@ -38,8 +38,8 @@ UNITTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(UNITTEST_SOURCES))
INTEGRATIONTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES)) INTEGRATIONTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES))
CFLAGS := $(INCLUDES:%=-I%) -g CFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror
TESTFLAGS := $(INCLUDES:%=-I%) -g -fprofile-arcs -ftest-coverage TESTFLAGS := $(INCLUDES:%=-I%) -g -Wall -Werror -fprofile-arcs -ftest-coverage
TESTLFLAGS := -fprofile-arcs -Wl,--allow-multiple-definition TESTLFLAGS := -fprofile-arcs -Wl,--allow-multiple-definition
DEPEND = -MT $@ -MF "$(@:%.o=%.d)" -MG -MM DEPEND = -MT $@ -MF "$(@:%.o=%.d)" -MG -MM

View File

@ -69,7 +69,7 @@ uint32_t utils_shellItoa(int32_t value, char *buffer, uint32_t base)
do do
{ {
digitValue = (char) (value % base); digitValue = (char) (value % base);
tempBuffer[i] = (digitValue < 10u) ? ('0' + digitValue) : (('A' - 10) + digitValue); tempBuffer[i] = (digitValue < 10) ? ('0' + digitValue) : (('A' - 10) + digitValue);
value /= base; value /= base;
i ++; i ++;
}while(value > 0); }while(value > 0);
@ -327,7 +327,7 @@ static shellmatta_retCode_t helpCmdFct(shellmatta_handle_t handle, const char *a
return ret; return ret;
} }
shellmatta_cmd_t helpCmd = {"help", "h", "Print this help text", "help", helpCmdFct, NULL}; shellmatta_cmd_t helpCmd = {(char*)"help", (char*)"h", (char*)"Print this help text", (char*)"help", helpCmdFct, NULL};
/** /**
* @brief terminates an input and prints the prompt again * @brief terminates an input and prints the prompt again

View File

@ -31,7 +31,7 @@ static shellmatta_retCode_t doSomething(shellmatta_handle_t handle, const char *
shellmatta_printf(handle, "%s - length: %u", arguments, length); shellmatta_printf(handle, "%s - length: %u", arguments, length);
return SHELLMATTA_OK; return SHELLMATTA_OK;
} }
shellmatta_cmd_t doSomethingCmd = {"doSomething", "do", "Function does something", "use me, please", doSomething, NULL}; shellmatta_cmd_t doSomethingCmd = {(char*)"doSomething", (char*)"do", (char*)"Function does something", (char*)"use me, please", doSomething, NULL};
TEST_CASE( "shellmatta empty function" ) { TEST_CASE( "shellmatta empty function" ) {
@ -40,7 +40,7 @@ TEST_CASE( "shellmatta empty function" ) {
shellmatta_handle_t handle; shellmatta_handle_t handle;
char buffer[1024]; char buffer[1024];
char historyBuffer[1024]; char historyBuffer[1024];
char *dummyData = "\r\nshellmatta->"; char *dummyData = (char*)"\r\nshellmatta->";
shellmatta_doInit( &inst, shellmatta_doInit( &inst,
&handle, &handle,
@ -56,7 +56,7 @@ TEST_CASE( "shellmatta empty function" ) {
memset(write_data, 0, sizeof(write_data)); memset(write_data, 0, sizeof(write_data));
write_length = 0u; write_length = 0u;
shellmatta_processData(handle, "\r", 1); shellmatta_processData(handle, (char*)"\r", 1);
CHECK( write_length == 14u); CHECK( write_length == 14u);
REQUIRE( strcmp(dummyData, write_data) == 0); REQUIRE( strcmp(dummyData, write_data) == 0);
@ -69,7 +69,7 @@ TEST_CASE( "shellmatta help function" ) {
shellmatta_handle_t handle; shellmatta_handle_t handle;
char buffer[1024]; char buffer[1024];
char historyBuffer[1024]; char historyBuffer[1024];
char *dummyData = "h\r\n" char *dummyData = (char*)"h\r\n"
"doSomething do Function does something use me, please\r\n" "doSomething do Function does something use me, please\r\n"
"help h Print this help text help\r\n" "help h Print this help text help\r\n"
"\r\nshellmatta->"; "\r\nshellmatta->";
@ -89,7 +89,7 @@ TEST_CASE( "shellmatta help function" ) {
memset(write_data, 0, sizeof(write_data)); memset(write_data, 0, sizeof(write_data));
write_length = 0u; write_length = 0u;
shellmatta_processData(handle, "h\r", 2); shellmatta_processData(handle, (char*)"h\r", 2);
CHECK( write_length == 123u); CHECK( write_length == 123u);
CHECK( strcmp(dummyData, write_data) == 0); CHECK( strcmp(dummyData, write_data) == 0);
@ -99,12 +99,12 @@ TEST_CASE( "shellmatta help function" ) {
memset(write_data, 0, sizeof(write_data)); memset(write_data, 0, sizeof(write_data));
write_length = 0u; write_length = 0u;
dummyData = "h 564 321 56 465 46\r\n" dummyData = (char*)"h 564 321 56 465 46\r\n"
"doSomething do Function does something use me, please\r\n" "doSomething do Function does something use me, please\r\n"
"help h Print this help text help\r\n" "help h Print this help text help\r\n"
"\r\nshellmatta->"; "\r\nshellmatta->";
shellmatta_processData(handle, "h 564 321 56 465 46\r", 20); shellmatta_processData(handle, (char*)"h 564 321 56 465 46\r", 20);
CHECK( write_length == 141u); CHECK( write_length == 141u);
CHECK( strcmp(dummyData, write_data) == 0); CHECK( strcmp(dummyData, write_data) == 0);
@ -114,11 +114,11 @@ TEST_CASE( "shellmatta help function" ) {
memset(write_data, 0, sizeof(write_data)); memset(write_data, 0, sizeof(write_data));
write_length = 0u; write_length = 0u;
dummyData = "hr\r\n" dummyData = (char*)"hr\r\n"
"Command: hr not found" "Command: hr not found"
"\r\nshellmatta->"; "\r\nshellmatta->";
shellmatta_processData(handle, "hr\r", 3); shellmatta_processData(handle, (char*)"hr\r", 3);
CHECK( write_length == 39u); CHECK( write_length == 39u);
REQUIRE( strcmp(dummyData, write_data) == 0); REQUIRE( strcmp(dummyData, write_data) == 0);
@ -132,7 +132,7 @@ TEST_CASE( "shellmatta heredoc test" ) {
shellmatta_handle_t handle; shellmatta_handle_t handle;
char buffer[1024]; char buffer[1024];
char historyBuffer[1024]; char historyBuffer[1024];
char *dummyData = "do this \r\n" char *dummyData = (char*)"do this \r\n"
"asdf\r\n" "asdf\r\n"
"1234"; "1234";
@ -150,7 +150,7 @@ TEST_CASE( "shellmatta heredoc test" ) {
doSomethingArguments = NULL; doSomethingArguments = NULL;
doSomethingLength = 0u; doSomethingLength = 0u;
shellmatta_processData(handle, "do this << EOF\r\n" shellmatta_processData(handle, (char*)"do this << EOF\r\n"
"asdf\r\n" "asdf\r\n"
"1234\r\n" "1234\r\n"
"EOF\r\n" "EOF\r\n"

View File

@ -19,7 +19,6 @@ TEST_CASE( "shellmatta_utils_eraseLine" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;

View File

@ -19,7 +19,6 @@ TEST_CASE( "shellmatta_utils_forwardCursor normal" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;
@ -44,7 +43,6 @@ TEST_CASE( "shellmatta_utils_forwardCursor normal echo off" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;
@ -70,7 +68,6 @@ TEST_CASE( "shellmatta_utils_forwardCursor forward by 12 with cursor at 5 and in
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;
@ -95,7 +92,6 @@ TEST_CASE( "shellmatta_utils_forwardCursor forward by 0" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;

View File

@ -19,7 +19,7 @@ TEST_CASE( "shellmatta_insertChars normal call" ) {
inst.write = writeFct; inst.write = writeFct;
utils_insertChars(&inst, "blksdflsd kfjlk", 4); utils_insertChars(&inst, (char*)"blksdflsd kfjlk", 4);
CHECK( inst.cursor == 12); CHECK( inst.cursor == 12);
REQUIRE( inst.inputCount == 14); REQUIRE( inst.inputCount == 14);

View File

@ -19,7 +19,6 @@ TEST_CASE( "shellmatta_utils_restoreCursorPos" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;

View File

@ -19,7 +19,6 @@ TEST_CASE( "shellmatta_utils_rewindCursor normal" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;
@ -45,7 +44,6 @@ TEST_CASE( "shellmatta_utils_rewindCursor rewind by 12 with cursor at 10" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;
@ -70,7 +68,6 @@ TEST_CASE( "shellmatta_utils_rewindCursor rewind by 0" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;

View File

@ -19,7 +19,6 @@ TEST_CASE( "shellmatta_utils_saveCursorPos" ) {
shellmatta_instance_t inst; shellmatta_instance_t inst;
char buffer[20]; char buffer[20];
char dummyData[29];
inst.buffer = buffer; inst.buffer = buffer;
inst.bufferSize = 20; inst.bufferSize = 20;