]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fixes for valgrind
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 26 Feb 2006 22:50:52 +0000 (22:50 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 26 Feb 2006 22:50:52 +0000 (22:50 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3355 e03df62e-2008-0410-955e-edbf42e46eb7

src/socket.cpp

index fe6516bb5c94548daf1b62def6e48afc44563c8c..1db915e4a36d0de6c49ea0454845745283ebdb41 100644 (file)
@@ -259,19 +259,20 @@ int InspSocket::Write(std::string data)
 void InspSocket::FlushWriteBuffer()
 {
        int result = 0;
 void InspSocket::FlushWriteBuffer()
 {
        int result = 0;
-       if (this->Buffer.length())
+       const char* n = this->Buffer.c_str();
+       int v = this->Buffer.length();
+       if (v > 0)
        {
        {
-               result = send(this->fd,this->Buffer.c_str(),this->Buffer.length(),0);
+               result = send(this->fd,n,v,0);
                if (result > 0)
                {
                if (result > 0)
                {
-                       if (result == (int)this->Buffer.length())
+                       if (result == v)
                        {
                                this->Buffer = "";
                        }
                        else
                        {
                                /* If we wrote some, advance the buffer forwards */
                        {
                                this->Buffer = "";
                        }
                        else
                        {
                                /* If we wrote some, advance the buffer forwards */
-                               char* n = (char*)this->Buffer.c_str();
                                n += result;
                                this->Buffer = n;
                        }
                                n += result;
                                this->Buffer = n;
                        }