]> git.saurik.com Git - apt.git/blobdiff - methods/http.cc
* merged daniels wonderful doxygen work
[apt.git] / methods / http.cc
index ba86aa6b654904a4579e397be946d509cb4c7e3a..dbf2d1b438d7042908bcc595be09c03931588f98 100644 (file)
@@ -58,6 +58,7 @@ unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 bool Debug = false;
 
+
 // CircleBuf::CircleBuf - Circular input buffer                                /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -95,7 +96,7 @@ bool CircleBuf::Read(int Fd)
       // Woops, buffer is full
       if (InP - OutP == Size)
         return true;
-      
+
       // Write the buffer segment
       int Res;
       Res = read(Fd,Buf + (InP%Size),LeftRead());
@@ -204,28 +205,23 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
       if (Buf[I%Size] != '\n')
         continue;
       ++I;
-      if (I < InP  && Buf[I%Size] == '\r')
-         ++I;
       
       if (Single == false)
       {
-        if (Buf[I%Size] != '\n')
-           continue;
-         ++I;
          if (I < InP  && Buf[I%Size] == '\r')
             ++I;
+         if (I >= InP || Buf[I%Size] != '\n')
+            continue;
+         ++I;
       }
       
-      if (I > InP)
-        I = InP;
-      
       Data = "";
       while (OutP < I)
       {
         unsigned long Sz = LeftWrite();
         if (Sz == 0)
            return false;
-        if (I - OutP < LeftWrite())
+        if (I - OutP < Sz)
            Sz = I - OutP;
         Data += string((char *)(Buf + (OutP%Size)),Sz);
         OutP += Sz;