From 5727c3f6337994a4630b37eaed7db5b26a84828e Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 28 Dec 2013 17:44:00 +0000 Subject: [PATCH] .cosmetics git-svn-id: svn://ultimatepp.org/upp/trunk@6702 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Inet.h | 4 ++-- uppsrc/Core/Socket.cpp | 5 +++-- uppsrc/Core/src.tpp/TcpSocket$en-us.tpp | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/uppsrc/Core/Inet.h b/uppsrc/Core/Inet.h index 5e480ba89..45a202e68 100644 --- a/uppsrc/Core/Inet.h +++ b/uppsrc/Core/Inet.h @@ -207,14 +207,14 @@ public: int Get(void *buffer, int len); String Get(int len); - int Put(const char *s, int len); + int Put(const void *s, int len); int Put(const String& s) { return Put(s.Begin(), s.GetLength()); } bool GetAll(void *buffer, int len); String GetAll(int len); String GetLine(int maxlen = 65536); - bool PutAll(const char *s, int len); + bool PutAll(const void *s, int len); bool PutAll(const String& s); bool StartSSL(); diff --git a/uppsrc/Core/Socket.cpp b/uppsrc/Core/Socket.cpp index fece0f59f..80212d8c3 100644 --- a/uppsrc/Core/Socket.cpp +++ b/uppsrc/Core/Socket.cpp @@ -663,10 +663,11 @@ bool TcpSocket::Wait(dword flags) return Wait(flags, GetEndTime()); } -int TcpSocket::Put(const char *s, int length) +int TcpSocket::Put(const void *s_, int length) { LLOG("Put " << socket << ": " << length); ASSERT(IsOpen()); + const char *s = (const char *)s_; if(length < 0 && s) length = (int)strlen(s); if(!s || length <= 0 || IsError() || IsAbort()) @@ -690,7 +691,7 @@ int TcpSocket::Put(const char *s, int length) return done; } -bool TcpSocket::PutAll(const char *s, int len) +bool TcpSocket::PutAll(const void *s, int len) { if(Put(s, len) != len) { if(!IsError()) diff --git a/uppsrc/Core/src.tpp/TcpSocket$en-us.tpp b/uppsrc/Core/src.tpp/TcpSocket$en-us.tpp index d4ab7d5d6..b8f18ee74 100644 --- a/uppsrc/Core/src.tpp/TcpSocket$en-us.tpp +++ b/uppsrc/Core/src.tpp/TcpSocket$en-us.tpp @@ -187,9 +187,9 @@ actually read.&] [s2;%% Reads at most [%-*@3 len] bytes, trying to do so at most for specified timeout. Returns a String with read data.&] [s3;%% &] -[s4;%% &] -[s5;:TcpSocket`:`:Put`(const char`*`,int`): [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[@(0.0.255) c -har]_`*[*@3 s], [@(0.0.255) int]_[*@3 len])&] +[s4; &] +[s5;:TcpSocket`:`:Put`(const void`*`,int`): [@(0.0.255) int]_[* Put]([@(0.0.255) const]_[@(0.0.255) v +oid]_`*[*@3 s], [@(0.0.255) int]_[*@3 len])&] [s2;%% Writes at most [%-*@3 len] bytes from [%-*@3 buffer], trying to do so at most for specified timeout. Returns the number of bytes actually written.&] @@ -220,9 +220,9 @@ error for TcpSocket.&] If the whole line cannot be read within timeout or line length is longer than [%-*@3 maxlen] sets error and returns String`::GetVoid().&] [s3;%% &] -[s4;%% &] -[s5;:TcpSocket`:`:PutAll`(const char`*`,int`): [@(0.0.255) bool]_[* PutAll]([@(0.0.255) con -st]_[@(0.0.255) char]_`*[*@3 s], [@(0.0.255) int]_[*@3 len])&] +[s4; &] +[s5;:TcpSocket`:`:PutAll`(const void`*`,int`): [@(0.0.255) bool]_[* PutAll]([@(0.0.255) con +st]_[@(0.0.255) void]_`*[*@3 s], [@(0.0.255) int]_[*@3 len])&] [s2;%% Outputs exactly [%-*@3 len] bytes. If such number of bytes cannot be written in time specified by timeout, sets error and returns false.&]