From b4fc9b6f648694ecb0d161cb14859da88b36881c Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:58:00 +0000 Subject: G++3 fixes from Randolph Author: jgg Date: 2001-05-22 04:17:18 GMT G++3 fixes from Randolph --- apt-pkg/acquire-method.cc | 20 ++++++++++++-------- apt-pkg/acquire.cc | 23 +++++++++++++++-------- apt-pkg/acquire.h | 12 +++++++++--- apt-pkg/algorithms.h | 6 +++++- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 0ecd8df93..df8628916 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -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 @@ -24,12 +24,15 @@ #include #include #include - + +#include #include #include #include /*}}}*/ +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; diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 1be8551f4..ae3ba2e01 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -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 #include + +#include #include #include @@ -31,6 +33,8 @@ #include /*}}}*/ +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::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::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++; diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index d5b759cb3..1881e80d5 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -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 #include +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::iterator ItemIterator; + typedef vector::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; diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 00b7882e2..0b38e4244 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -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 @@ -37,6 +37,10 @@ #include #include +#include + +using std::ostream; + class pkgSimulate : public pkgPackageManager { protected: -- cgit v1.2.3