From fb051970ae774b67120fceba6af36030f6388270 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 25 Mar 2010 18:50:57 +0000 Subject: Use size_t for lengths in Socket interface --- src/ssl/socket.h | 6 +++--- src/ssl/unix_socket/unx_sock.cpp | 8 ++++---- src/ssl/unix_socket/unx_sock.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ssl/socket.h b/src/ssl/socket.h index 3d893ea77..836a2f004 100644 --- a/src/ssl/socket.h +++ b/src/ssl/socket.h @@ -19,10 +19,10 @@ namespace Botan { class BOTAN_DLL Socket { public: - virtual u32bit read(byte[], u32bit) = 0; - virtual void write(const byte[], u32bit) = 0; + virtual size_t read(byte[], size_t) = 0; + virtual void write(const byte[], size_t) = 0; - u32bit read(byte& x) { return read(&x, 1); } + size_t read(byte& x) { return read(&x, 1); } void write(byte x) { write(&x, 1); } virtual std::string peer_id() const = 0; diff --git a/src/ssl/unix_socket/unx_sock.cpp b/src/ssl/unix_socket/unx_sock.cpp index 0552a33b6..f9d9629fb 100644 --- a/src/ssl/unix_socket/unx_sock.cpp +++ b/src/ssl/unix_socket/unx_sock.cpp @@ -64,12 +64,12 @@ Unix_Socket::Unix_Socket(int fd, const std::string& peer_id) /** * Read from a Unix socket */ -u32bit Unix_Socket::read(byte buf[], u32bit length) +size_t Unix_Socket::read(byte buf[], size_t length) { if(sockfd == -1) throw Stream_IO_Error("Unix_Socket::read: Socket not connected"); - u32bit got = 0; + size_t got = 0; while(length) { @@ -95,12 +95,12 @@ u32bit Unix_Socket::read(byte buf[], u32bit length) /** * Write to a Unix socket */ -void Unix_Socket::write(const byte buf[], u32bit length) +void Unix_Socket::write(const byte buf[], size_t length) { if(sockfd == -1) throw Stream_IO_Error("Unix_Socket::write: Socket not connected"); - u32bit offset = 0; + size_t offset = 0; while(length) { ssize_t sent = ::send(sockfd, buf + offset, length, MSG_NOSIGNAL); diff --git a/src/ssl/unix_socket/unx_sock.h b/src/ssl/unix_socket/unx_sock.h index c1ff53ae3..58c7ada69 100644 --- a/src/ssl/unix_socket/unx_sock.h +++ b/src/ssl/unix_socket/unx_sock.h @@ -28,8 +28,8 @@ namespace Botan { class BOTAN_DLL Unix_Socket : public Socket { public: - u32bit read(byte[], u32bit); - void write(const byte[], u32bit); + size_t read(byte[], size_t); + void write(const byte[], size_t); std::string peer_id() const; -- cgit v1.2.3