Include <cstring> and use "std::" for memset in T[Server]Socket.cpp.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666498 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Reiss 2008-06-11 01:18:54 +00:00
parent a27c3cd0c9
commit c88eb8c9dd
2 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,7 @@
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/
#include <cstring>
#include <sys/socket.h>
#include <sys/poll.h>
#include <sys/types.h>
@ -92,7 +93,7 @@ void TServerSocket::listen() {
struct addrinfo hints, *res, *res0;
int error;
char port[sizeof("65536") + 1];
memset(&hints, 0, sizeof(hints));
std::memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
@ -260,7 +261,7 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {
int numEintrs = 0;
while (true) {
memset(fds, 0 , sizeof(fds));
std::memset(fds, 0 , sizeof(fds));
fds[0].fd = serverSocket_;
fds[0].events = POLLIN;
if (intSock2_ >= 0) {

View File

@ -5,6 +5,8 @@
// http://developers.facebook.com/thrift/
#include <config.h>
#include <cstring>
#include <sstream>
#include <sys/socket.h>
#include <sys/poll.h>
#include <sys/types.h>
@ -15,7 +17,6 @@
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sstream>
#include "concurrency/Monitor.h"
#include "TSocket.h"
@ -166,7 +167,7 @@ void TSocket::openConnection(struct addrinfo *res) {
struct pollfd fds[1];
memset(fds, 0 , sizeof(fds));
std::memset(fds, 0 , sizeof(fds));
fds[0].fd = socket_;
fds[0].events = POLLOUT;
ret = poll(fds, 1, connTimeout_);
@ -223,7 +224,7 @@ void TSocket::open() {
res0 = NULL;
int error;
char port[sizeof("65536")];
memset(&hints, 0, sizeof(hints));
std::memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;