G++3 fixes from Randolph
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:58:00 +0000 (16:58 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:58:00 +0000 (16:58 +0000)
Author: jgg
Date: 2001-05-22 04:17:18 GMT
G++3 fixes from Randolph

apt-pkg/acquire-method.cc
apt-pkg/acquire.cc
apt-pkg/acquire.h
apt-pkg/algorithms.h

index 0ecd8df..df86289 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-method.cc,v 1.26 2001/03/13 06:51:46 jgg Exp $
+// $Id: acquire-method.cc,v 1.27 2001/05/22 04:27:11 jgg Exp $
 /* ######################################################################
 
    Acquire Method
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/hashes.h>
-    
+
+#include <iostream>
 #include <stdarg.h>
 #include <stdio.h>
 #include <unistd.h>
                                                                        /*}}}*/
 
+using namespace std;
+
 // AcqMethod::pkgAcqMethod - Constructor                               /*{{{*/
 // ---------------------------------------------------------------------
 /* This constructs the initialization text */
@@ -86,7 +89,7 @@ void pkgAcqMethod::Fail(bool Transient)
 void pkgAcqMethod::Fail(string Err,bool Transient)
 {
    // Strip out junk from the error messages
-   for (char *I = Err.begin(); I != Err.end(); I++)
+   for (string::iterator I = Err.begin(); I != Err.end(); I++)
    {
       if (*I == '\r') 
         *I = ' ';
@@ -283,10 +286,11 @@ bool pkgAcqMethod::Configuration(string Message)
 {
    ::Configuration &Cnf = *_config;
    
-   const char *I = Message.begin();
+   const char *I = Message.c_str();
+   const char *MsgEnd = I + Message.length();
    
    unsigned int Length = strlen("Config-Item");
-   for (; I + Length < Message.end(); I++)
+   for (; I + Length < MsgEnd; I++)
    {
       // Not a config item
       if (I[Length] != ':' || stringcasecmp(I,I+Length,"Config-Item") != 0)
@@ -294,11 +298,11 @@ bool pkgAcqMethod::Configuration(string Message)
       
       I += Length + 1;
       
-      for (; I < Message.end() && *I == ' '; I++);
+      for (; I < MsgEnd && *I == ' '; I++);
       const char *Equals = I;
-      for (; Equals < Message.end() && *Equals != '='; Equals++);
+      for (; Equals < MsgEnd && *Equals != '='; Equals++);
       const char *End = Equals;
-      for (; End < Message.end() && *End != '\n'; End++);
+      for (; End < MsgEnd && *End != '\n'; End++);
       if (End == Equals)
         return false;
       
index 1be8551..ae3ba2e 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.cc,v 1.47 2001/02/20 07:03:17 jgg Exp $
+// $Id: acquire.cc,v 1.48 2001/05/22 04:17:18 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -24,6 +24,8 @@
 #include <apt-pkg/strutl.h>
 
 #include <apti18n.h>
+
+#include <iostream>
     
 #include <dirent.h>
 #include <sys/time.h>
@@ -31,6 +33,8 @@
 #include <sys/stat.h>
                                                                        /*}}}*/
 
+using namespace std;
+
 // Acquire::pkgAcquire - Constructor                                   /*{{{*/
 // ---------------------------------------------------------------------
 /* We grab some runtime state from the configuration space */
@@ -109,10 +113,13 @@ void pkgAcquire::Remove(Item *Itm)
 {
    Dequeue(Itm);
    
-   for (vector<Item *>::iterator I = Items.begin(); I < Items.end(); I++)
+   for (ItemIterator I = Items.begin(); I != Items.end(); I++)
    {
       if (*I == Itm)
+      {
         Items.erase(I);
+        I = Items.begin();
+      }      
    }
 }
                                                                        /*}}}*/
@@ -364,7 +371,7 @@ pkgAcquire::RunResult pkgAcquire::Run()
       I->Shutdown(false);
 
    // Shut down the items
-   for (Item **I = Items.begin(); I != Items.end(); I++)
+   for (ItemIterator I = Items.begin(); I != Items.end(); I++)
       (*I)->Finished(); 
    
    if (_error->PendingError())
@@ -419,7 +426,7 @@ bool pkgAcquire::Clean(string Dir)
         continue;
       
       // Look in the get list
-      vector<Item *>::iterator I = Items.begin();
+      ItemCIterator I = Items.begin();
       for (; I != Items.end(); I++)
         if (flNotDir((*I)->DestFile) == Dir->d_name)
            break;
@@ -440,7 +447,7 @@ bool pkgAcquire::Clean(string Dir)
 double pkgAcquire::TotalNeeded()
 {
    double Total = 0;
-   for (pkgAcquire::Item **I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
       Total += (*I)->FileSize;
    return Total;
 }
@@ -451,7 +458,7 @@ double pkgAcquire::TotalNeeded()
 double pkgAcquire::FetchNeeded()
 {
    double Total = 0;
-   for (pkgAcquire::Item **I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
       if ((*I)->Local == false)
         Total += (*I)->FileSize;
    return Total;
@@ -463,7 +470,7 @@ double pkgAcquire::FetchNeeded()
 double pkgAcquire::PartialPresent()
 {
   double Total = 0;
-   for (pkgAcquire::Item **I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
       if ((*I)->Local == false)
         Total += (*I)->PartialSize;
    return Total;
@@ -728,7 +735,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    // Compute the total number of bytes to fetch
    unsigned int Unknown = 0;
    unsigned int Count = 0;
-   for (pkgAcquire::Item **I = Owner->ItemsBegin(); I != Owner->ItemsEnd(); 
+   for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin(); I != Owner->ItemsEnd();
        I++, Count++)
    {
       TotalItems++;
index d5b759c..1881e80 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.h,v 1.28 2001/02/20 07:03:17 jgg Exp $
+// $Id: acquire.h,v 1.29 2001/05/22 04:17:18 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -35,6 +35,9 @@
 #include <vector>
 #include <string>
 
+using std::vector;
+using std::string;
+
 #ifdef __GNUG__
 #pragma interface "apt-pkg/acquire.h"
 #endif 
@@ -54,6 +57,9 @@ class pkgAcquire
    struct ItemDesc;
    friend class Item;
    friend class Queue;
+
+   typedef vector<Item *>::iterator ItemIterator;
+   typedef vector<Item *>::const_iterator ItemCIterator;
    
    protected:
    
@@ -100,8 +106,8 @@ class pkgAcquire
    // Simple iteration mechanism
    inline Worker *WorkersBegin() {return Workers;};
    Worker *WorkerStep(Worker *I);
-   inline Item **ItemsBegin() {return Items.begin();};
-   inline Item **ItemsEnd() {return Items.end();};
+   inline ItemIterator ItemsBegin() {return Items.begin();};
+   inline ItemIterator ItemsEnd() {return Items.end();};
    
    // Iterate over queued Item URIs
    class UriIterator;
index 00b7882..0b38e42 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.h,v 1.9 2001/02/20 07:03:17 jgg Exp $
+// $Id: algorithms.h,v 1.10 2001/05/22 04:17:41 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/depcache.h>
 
+#include <iostream>
+
+using std::ostream;
+
 class pkgSimulate : public pkgPackageManager
 {
    protected: