]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added new and improved GetBuffer function based on research on crappy redhat 7.3
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 28 Apr 2005 16:06:48 +0000 (16:06 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 28 Apr 2005 16:06:48 +0000 (16:06 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1241 e03df62e-2008-0410-955e-edbf42e46eb7

src/connection.cpp

index c77db382ce5cdffa9ba845ebbbd874a28da118ae..8a6557e9d5373cf05a515a117f188d3acdd07ab3 100644 (file)
@@ -166,18 +166,21 @@ void ircd_connector::ClearBuffer()
 
 std::string ircd_connector::GetBuffer()
 {
-       char* line = (char*)ircdbuffer.c_str();
-       char ret[MAXBUF];
-       std::stringstream* stream = new std::stringstream(std::stringstream::in | std::stringstream::out);
-       *stream << ircdbuffer;
-       stream->getline(ret,MAXBUF);
-       while ((*line != '\n') && (strlen(line)))
-               line++;
-       if ((*line == '\n') || (*line == '\r'))
-               line++;
-       ircdbuffer = line;
-       delete stream;
-       return ret;
+       // Fix by Brain 28th Apr 2005
+       // seems my stringstream code isnt liked by linux
+       // EVEN THOUGH IT IS CORRECT! Fixed by using a different
+       // (SLOWER) algorithm...
+        char* line = (char*)ircdbuffer.c_str();
+        std::string ret = "";
+        while ((*line != '\n') && (strlen(line)))
+        {
+                ret = ret + *line;
+                line++;
+        }
+        if ((*line == '\n') || (*line == '\r'))
+                line++;
+        ircdbuffer = line;
+        return ret;
 }
 
 bool ircd_connector::MakeOutboundConnection(char* newhost, int newport)