Skip to content

Commit

Permalink
Convert to std::array and std::string. (mythzoneminder)
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed Aug 28, 2020
1 parent e1c1779 commit 668d513
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 120 deletions.
6 changes: 3 additions & 3 deletions mythplugins/mythzoneminder/mythzmserver/main.cpp
Expand Up @@ -60,7 +60,7 @@ int main(int argc, char **argv)
int fdmax = -1; // maximum file descriptor number
int listener = -1; // listening socket descriptor
int newfd = -1; // newly accept()ed socket descriptor
char buf[4096]; // buffer for client data
std::array<char,4096> buf {}; // buffer for client data
int yes=1; // for setsockopt() SO_REUSEADDR, below
bool quit = false; // quit flag

Expand Down Expand Up @@ -361,7 +361,7 @@ int main(int argc, char **argv)
else
{
// handle data from a client
int nbytes = recv(i, buf, sizeof(buf), 0);
int nbytes = recv(i, buf.data(), buf.size(), 0);
if (nbytes <= 0)
{
// got error or connection closed by client
Expand All @@ -388,7 +388,7 @@ int main(int argc, char **argv)
else
{
ZMServer *server = serverList[i];
quit = server->processRequest(buf, nbytes);
quit = server->processRequest(buf.data(), nbytes);
}
}
}
Expand Down

0 comments on commit 668d513

Please sign in to comment.