]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/md5.cc
enable APT in unpack/configure ordering to handle loops as well
[apt.git] / apt-pkg / contrib / md5.cc
index 6c60ffd743a69bfad91b7ce66031be367e34a831..4351aeb22f23d6b0d17e7b54cf5c4e066798ad6e 100644 (file)
@@ -35,6 +35,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/md5.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
@@ -43,7 +45,6 @@
 #include <unistd.h>
 #include <netinet/in.h>                          // For htonl
 #include <inttypes.h>
 #include <unistd.h>
 #include <netinet/in.h>                          // For htonl
 #include <inttypes.h>
-#include <config.h>
                                                                        /*}}}*/
 
 // byteSwap - Swap bytes in a buffer                                   /*{{{*/
                                                                        /*}}}*/
 
 // byteSwap - Swap bytes in a buffer                                   /*{{{*/
@@ -186,7 +187,7 @@ MD5Summation::MD5Summation()
 // MD5Summation::Add - 'Add' a data set to the hash                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // MD5Summation::Add - 'Add' a data set to the hash                    /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool MD5Summation::Add(const unsigned char *data,unsigned long len)
+bool MD5Summation::Add(const unsigned char *data,unsigned long long len)
 {
    if (Done == true)
       return false;
 {
    if (Done == true)
       return false;
@@ -231,29 +232,6 @@ bool MD5Summation::Add(const unsigned char *data,unsigned long len)
    return true;   
 }
                                                                        /*}}}*/
    return true;   
 }
                                                                        /*}}}*/
-// MD5Summation::AddFD - Add the contents of a FD to the hash          /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool MD5Summation::AddFD(int Fd,unsigned long Size)
-{
-   unsigned char Buf[64*64];
-   int Res = 0;
-   int ToEOF = (Size == 0);
-   while (Size != 0 || ToEOF)
-   {
-      unsigned n = sizeof(Buf);
-      if (!ToEOF) n = min(Size,(unsigned long)n);
-      Res = read(Fd,Buf,n);
-      if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
-         return false;
-      if (ToEOF && Res == 0) // EOF
-         break;
-      Size -= Res;
-      Add(Buf,Res);
-   }
-   return true;
-}
-                                                                       /*}}}*/
 // MD5Summation::Result - Returns the value of the sum                 /*{{{*/
 // ---------------------------------------------------------------------
 /* Because this must add in the last bytes of the series it prevents anyone
 // MD5Summation::Result - Returns the value of the sum                 /*{{{*/
 // ---------------------------------------------------------------------
 /* Because this must add in the last bytes of the series it prevents anyone
@@ -298,7 +276,7 @@ MD5SumValue MD5Summation::Result()
    }
    
    MD5SumValue V;
    }
    
    MD5SumValue V;
-   V.Set((char *)buf);
+   V.Set((unsigned char *)buf);
    return V;
 }
                                                                        /*}}}*/
    return V;
 }
                                                                        /*}}}*/