Skip to content

Commit 8af504f

Browse files
authored
Changing hard coded default port value and improving string allocation (#101)
1 parent d3f7d23 commit 8af504f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gpsd_client/src/client.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ namespace gpsd_client
4848
publish_period_ms = std::chrono::milliseconds{(int)(1000 / publish_rate_)};
4949

5050
std::string host = "localhost";
51-
int port = 2947;
51+
int port = atoi(DEFAULT_GPSD_PORT);
5252
this->get_parameter_or("host", host, host);
5353
this->get_parameter_or("port", port, port);
5454

5555
char port_s[12];
56-
snprintf(port_s, 12, "%d", port);
56+
snprintf(port_s, sizeof(port_s), "%d", port);
5757

5858
gps_data_t* resp = nullptr;
5959

0 commit comments

Comments
 (0)