fix: use -O3 for more warnings

fix. strncat warning
This commit is contained in:
Tobias Reisinger 2020-08-18 13:52:19 +02:00
parent d23655eb61
commit 4d58933972
3 changed files with 4 additions and 3 deletions

View file

@ -9,8 +9,9 @@ target_link_libraries(core -lsqlite3)
target_link_libraries(core -luuid)
set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wpedantic -Werror -Wall -Wextra -ffile-prefix-map=${CMAKE_SOURCE_DIR}/src/=")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -std=gnu99 -Wpedantic -Werror -Wall -Wextra -ffile-prefix-map=${CMAKE_SOURCE_DIR}/src/=")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -fprofile-arcs -ftest-coverage")
add_definitions("-DMG_ENABLE_EXTRA_ERRORS_DESC -DMG_ENABLE_MQTT_BROKER")

View file

@ -40,7 +40,7 @@ junction_relay_schedule_insert_weekdays(int relay_id, int *schedule_ids)
static const char query_base[] = "INSERT INTO junction_relay_schedule (weekday, schedule_id, relay_id) VALUES";
static const char query_extender[] = " (?, ?, ?)";
size_t query_len = STRLEN(query_base) + (7 * (STRLEN(query_extender) + 1));
size_t query_len = STRLEN(query_base) + (7 * (STRLEN(query_extender) + 1)) + 1;
char *query = malloc(sizeof(char) * query_len + 1);
strncpy(query, query_base, query_len);
query_len -= STRLEN(query_base);

View file

@ -67,7 +67,7 @@ junction_tag_insert_list(int *tag_ids, int relay_id, int schedule_id, int count)
static const char query_base[] = "INSERT INTO junction_tag(tag_id, schedule_id, relay_id) VALUES";
static const char query_extender[] = " (?, ?, ?)";
size_t query_len = STRLEN(query_base) + (count * (STRLEN(query_extender) + 1));
size_t query_len = STRLEN(query_base) + (count * (STRLEN(query_extender) + 1)) + 1;
char *query = malloc(sizeof(char) * query_len + 1);
strncpy(query, query_base, query_len);
query_len -= STRLEN(query_base);