From be84c0e4c23a19b39edaf91d4341fa454f32c602 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sun, 8 Sep 2019 23:42:48 +0200 Subject: [PATCH] fix: cleanup --- controllers/api_v1_controllers.cc | 1 - helpers/get_server_port.cc | 4 ++-- helpers/open_tcp_connection.cc | 2 +- helpers/send_udp_broadcast.cc | 3 +-- models/controller_dbo.cc | 1 - models/period.cc | 2 -- models/period_list.cc | 3 --- models/relay_dbo.cc | 1 - models/schedule_dbo.cc | 8 +------- 9 files changed, 5 insertions(+), 20 deletions(-) diff --git a/controllers/api_v1_controllers.cc b/controllers/api_v1_controllers.cc index 61ecffb..59b3833 100644 --- a/controllers/api_v1_controllers.cc +++ b/controllers/api_v1_controllers.cc @@ -1,4 +1,3 @@ -#include #include #include #include "api_v1_controllers.h" diff --git a/helpers/get_server_port.cc b/helpers/get_server_port.cc index 6a22743..fe69560 100644 --- a/helpers/get_server_port.cc +++ b/helpers/get_server_port.cc @@ -9,8 +9,8 @@ helpers::get_server_port(int fd) return -1; } struct sockaddr_in sin{}; - socklen_t addrlen = sizeof(sin); - if(getsockname(fd, (struct sockaddr *)&sin, &addrlen) == 0) + socklen_t addr_len = sizeof(sin); + if(getsockname(fd, (struct sockaddr *)&sin, &addr_len) == 0) { return ntohs(sin.sin_port); } diff --git a/helpers/open_tcp_connection.cc b/helpers/open_tcp_connection.cc index 9b4c1ec..07055fe 100644 --- a/helpers/open_tcp_connection.cc +++ b/helpers/open_tcp_connection.cc @@ -13,7 +13,7 @@ helpers::open_tcp_connection(char *host, char *port) if ((status = getaddrinfo(host, port, &hints, &res)) != 0) { - LOG_ERROR << "Error getting addressinfo: " << gai_strerror(status); + LOG_ERROR << "Error getting address info: " << gai_strerror(status); freeaddrinfo(res); return 0; } diff --git a/helpers/send_udp_broadcast.cc b/helpers/send_udp_broadcast.cc index 3d3a597..f8a57af 100644 --- a/helpers/send_udp_broadcast.cc +++ b/helpers/send_udp_broadcast.cc @@ -1,9 +1,8 @@ -#include #include #include #include "config.h" -#include #include +#include int helpers::send_udp_broadcast(const char *addr, uint16_t port, const char* message) diff --git a/models/controller_dbo.cc b/models/controller_dbo.cc index 038dfe1..6092c76 100644 --- a/models/controller_dbo.cc +++ b/models/controller_dbo.cc @@ -1,6 +1,5 @@ #include #include -#include #include #include #include diff --git a/models/period.cc b/models/period.cc index 518fbd1..d840808 100644 --- a/models/period.cc +++ b/models/period.cc @@ -1,7 +1,5 @@ #include -#include #include -#include #include "period.h" period::period(uint16_t start, uint16_t end) diff --git a/models/period_list.cc b/models/period_list.cc index 08f8ae7..820c23c 100644 --- a/models/period_list.cc +++ b/models/period_list.cc @@ -1,8 +1,5 @@ -#include -#include #include #include -#include #include "period_list.h" period_list::period_list() diff --git a/models/relay_dbo.cc b/models/relay_dbo.cc index b6397b8..c1c6683 100644 --- a/models/relay_dbo.cc +++ b/models/relay_dbo.cc @@ -1,6 +1,5 @@ #include #include -#include #include #include #include "relay_dbo.h" diff --git a/models/schedule_dbo.cc b/models/schedule_dbo.cc index 9309433..5d45553 100644 --- a/models/schedule_dbo.cc +++ b/models/schedule_dbo.cc @@ -1,9 +1,3 @@ -// -// Created by tobias on 08/07/19. -// - -#include -#include #include #include #include @@ -15,7 +9,7 @@ static bool schedule_db_update_insert(schedule_dbo *schedule, sqlite3_stmt *stmt { int rc; uint16_t *periods_blob = schedule->periods->to_db_blob(); - int blob_size = sizeof(uint16_t) * ((periods_blob[0] * 2) + 1); + int blob_size = (int)sizeof(uint16_t) * ((periods_blob[0] * 2) + 1); sqlite3_bind_text(stmt, 1, schedule->id, -1, SQLITE_STATIC); sqlite3_bind_text(stmt, 2, schedule->name, -1, SQLITE_STATIC);