[vlc-commits] adaptive: do not reinvent net_Gets()
Rémi Denis-Courmont
git at videolan.org
Sun May 10 19:32:56 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 10 20:32:37 2015 +0300| [a1e00d40dea9797734f7078457e9b68978e7c9ee] | committer: Rémi Denis-Courmont
adaptive: do not reinvent net_Gets()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1e00d40dea9797734f7078457e9b68978e7c9ee
---
modules/demux/adaptative/http/IHTTPConnection.cpp | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/modules/demux/adaptative/http/IHTTPConnection.cpp b/modules/demux/adaptative/http/IHTTPConnection.cpp
index 3ecf70e..1a5efd6 100644
--- a/modules/demux/adaptative/http/IHTTPConnection.cpp
+++ b/modules/demux/adaptative/http/IHTTPConnection.cpp
@@ -144,22 +144,14 @@ bool IHTTPConnection::parseReply()
std::string IHTTPConnection::readLine()
{
std::stringstream ss;
- char c[1];
- ssize_t size = net_Read(stream, httpSocket, NULL, c, 1, false);
- while(size >= 0)
- {
- ss << c[0];
- if(c[0] == '\n')
- break;
-
- size = net_Read(stream, httpSocket, NULL, c, 1, false);
- }
-
- if(size > 0)
- return ss.str();
+ char *line = ::net_Gets(stream, httpSocket, NULL);
+ if(line == NULL)
+ return "";
- return "";
+ ss << line << "\r\n";
+ ::free(line);
+ return ss.str();
}
std::string IHTTPConnection::buildRequestHeader(const std::string &path) const
More information about the vlc-commits
mailing list