fix: use -O3 for more warnings
fix. strncat warning
This commit is contained in:
parent
d23655eb61
commit
4d58933972
3 changed files with 4 additions and 3 deletions
|
@ -9,8 +9,9 @@ target_link_libraries(core -lsqlite3)
|
||||||
target_link_libraries(core -luuid)
|
target_link_libraries(core -luuid)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
|
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")
|
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")
|
add_definitions("-DMG_ENABLE_EXTRA_ERRORS_DESC -DMG_ENABLE_MQTT_BROKER")
|
||||||
|
|
|
@ -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_base[] = "INSERT INTO junction_relay_schedule (weekday, schedule_id, relay_id) VALUES";
|
||||||
static const char query_extender[] = " (?, ?, ?)";
|
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);
|
char *query = malloc(sizeof(char) * query_len + 1);
|
||||||
strncpy(query, query_base, query_len);
|
strncpy(query, query_base, query_len);
|
||||||
query_len -= STRLEN(query_base);
|
query_len -= STRLEN(query_base);
|
||||||
|
|
|
@ -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_base[] = "INSERT INTO junction_tag(tag_id, schedule_id, relay_id) VALUES";
|
||||||
static const char query_extender[] = " (?, ?, ?)";
|
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);
|
char *query = malloc(sizeof(char) * query_len + 1);
|
||||||
strncpy(query, query_base, query_len);
|
strncpy(query, query_base, query_len);
|
||||||
query_len -= STRLEN(query_base);
|
query_len -= STRLEN(query_base);
|
||||||
|
|
Loading…
Reference in a new issue