From a5e53b0bdea8f80bb4c24b660a00dccaa0f16e8d Mon Sep 17 00:00:00 2001 From: David Anthony Date: Fri, 10 May 2024 09:42:06 -0500 Subject: [PATCH] Changing hard coded default port value and improving string allocation --- gpsd_client/src/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpsd_client/src/client.cpp b/gpsd_client/src/client.cpp index 3d306f8..019e77d 100644 --- a/gpsd_client/src/client.cpp +++ b/gpsd_client/src/client.cpp @@ -48,12 +48,12 @@ namespace gpsd_client publish_period_ms = std::chrono::milliseconds{(int)(1000 / publish_rate_)}; std::string host = "localhost"; - int port = 2947; + int port = atoi(DEFAULT_GPSD_PORT); this->get_parameter_or("host", host, host); this->get_parameter_or("port", port, port); char port_s[12]; - snprintf(port_s, 12, "%d", port); + snprintf(port_s, sizeof(port_s), "%d", port); gps_data_t* resp = nullptr;