Fix compilation errors on OS X

This commit is contained in:
Cheng Zhao 2016-03-08 23:28:53 +09:00
parent 4503aafe64
commit 5fae63a2f5
93 changed files with 242 additions and 317 deletions

View file

@ -17,6 +17,7 @@
#include "net/base/net_errors.h"
#endif
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@ -27,6 +28,7 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/sockaddr_storage.h"
#include "net/socket/socket_descriptor.h"
using std::string;
@ -125,7 +127,7 @@ SocketDescriptor StreamListenSocket::AcceptSocket() {
if (conn == kInvalidSocket)
LOG(ERROR) << "Error accepting connection.";
else
SetNonBlocking(conn);
base::SetNonBlocking(conn);
return conn;
}

View file

@ -28,7 +28,7 @@
#include "base/message_loop/message_loop.h"
#endif
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"

View file

@ -34,14 +34,14 @@ namespace test_server {
// static
scoped_ptr<TCPListenSocket> TCPListenSocket::CreateAndListen(
const string& ip,
uint16 port,
uint16_t port,
StreamListenSocket::Delegate* del) {
SocketDescriptor s = CreateAndBind(ip, port);
if (s == kInvalidSocket)
return scoped_ptr<TCPListenSocket>();
scoped_ptr<TCPListenSocket> sock(new TCPListenSocket(s, del));
sock->Listen();
return sock.Pass();
return sock;
}
TCPListenSocket::TCPListenSocket(SocketDescriptor s,
@ -52,7 +52,8 @@ TCPListenSocket::TCPListenSocket(SocketDescriptor s,
TCPListenSocket::~TCPListenSocket() {
}
SocketDescriptor TCPListenSocket::CreateAndBind(const string& ip, uint16 port) {
SocketDescriptor TCPListenSocket::CreateAndBind(const string& ip,
uint16_t port) {
SocketDescriptor s = CreatePlatformSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s != kInvalidSocket) {
#if defined(OS_POSIX)
@ -79,7 +80,7 @@ SocketDescriptor TCPListenSocket::CreateAndBind(const string& ip, uint16 port) {
}
SocketDescriptor TCPListenSocket::CreateAndBindAnyPort(const string& ip,
uint16* port) {
uint16_t* port) {
SocketDescriptor s = CreateAndBind(ip, 0);
if (s == kInvalidSocket)
return kInvalidSocket;
@ -110,7 +111,7 @@ void TCPListenSocket::Accept() {
#if defined(OS_POSIX)
sock->WatchSocket(WAITING_READ);
#endif
socket_delegate_->DidAccept(this, sock.Pass());
socket_delegate_->DidAccept(this, std::move(sock));
}
} // namespace test_server

View file

@ -7,7 +7,7 @@
#include <string>
#include "base/basictypes.h"
#include "base/macros.h"
#include "net/base/net_export.h"
#include "net/socket/socket_descriptor.h"
#include "net/test/embedded_test_server/stream_listen_socket.h"
@ -25,7 +25,7 @@ class TCPListenSocket : public StreamListenSocket {
// accept local connections.
static scoped_ptr<TCPListenSocket> CreateAndListen(
const std::string& ip,
uint16 port,
uint16_t port,
StreamListenSocket::Delegate* del);
protected:
@ -39,11 +39,11 @@ class TCPListenSocket : public StreamListenSocket {
friend class TCPListenSocketTester;
// Get raw TCP socket descriptor bound to ip:port.
static SocketDescriptor CreateAndBind(const std::string& ip, uint16 port);
static SocketDescriptor CreateAndBind(const std::string& ip, uint16_t port);
// Get raw TCP socket descriptor bound to ip and return port it is bound to.
static SocketDescriptor CreateAndBindAnyPort(const std::string& ip,
uint16* port);
uint16_t* port);
DISALLOW_COPY_AND_ASSIGN(TCPListenSocket);
};