From 076d01b04c20200fc72fc22de41c4872af484650 Mon Sep 17 00:00:00 2001
From: Arch Librarian <arch@canonical.com>
Date: Mon, 20 Sep 2004 16:58:05 +0000
Subject: [PATCH] G++3 fixes from Randolph Author: jgg Date: 2001-05-27
 04:45:49 GMT G++3 fixes from Randolph

---
 cmdline/acqprogress.cc |  5 ++++-
 cmdline/apt-cache.cc   | 19 ++++++++++---------
 cmdline/apt-cdrom.cc   |  6 ++++--
 cmdline/apt-get.cc     | 18 ++++++++++--------
 cmdline/indexcopy.cc   |  9 ++++++---
 cmdline/indexcopy.h    |  5 ++++-
 6 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc
index e7b6b9ab8..ee833923c 100644
--- a/cmdline/acqprogress.cc
+++ b/cmdline/acqprogress.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: acqprogress.cc,v 1.21 2001/02/20 07:03:17 jgg Exp $
+// $Id: acqprogress.cc,v 1.22 2001/05/27 04:46:43 jgg Exp $
 /* ######################################################################
 
    Acquire Progress - Command line progress meter 
@@ -18,8 +18,11 @@
     
 #include <stdio.h>
 #include <signal.h>
+#include <iostream>
 									/*}}}*/
 
+using namespace std;
+
 // AcqTextStatus::AcqTextStatus - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 /* */
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index eeeb1fb90..6792b5767 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-cache.cc,v 1.48 2001/05/11 05:07:06 jgg Exp $
+// $Id: apt-cache.cc,v 1.49 2001/05/27 04:46:43 jgg Exp $
 /* ######################################################################
    
    apt-cache - Manages the cache files
@@ -337,7 +337,8 @@ bool Dump(CommandLine &Cmd)
 	 cout << " Version: " << V.VerStr() << endl;
 	 cout << "     File: " << V.FileList().File().FileName() << endl;
 	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
-	    cout << "  Depends: " << D.TargetPkg().Name() << ' ' << D.TargetVer() << endl;
+	    cout << "  Depends: " << D.TargetPkg().Name() << ' ' << 
+	                     DeNull(D.TargetVer()) << endl;
       }      
    }
 
@@ -349,13 +350,13 @@ bool Dump(CommandLine &Cmd)
       cout << " ID: " << F->ID << endl;
       cout << " Flags: " << F->Flags << endl;
       cout << " Time: " << TimeRFC1123(F->mtime) << endl;
-      cout << " Archive: " << F.Archive() << endl;
-      cout << " Component: " << F.Component() << endl;
-      cout << " Version: " << F.Version() << endl;
-      cout << " Origin: " << F.Origin() << endl;
-      cout << " Site: " << F.Site() << endl;
-      cout << " Label: " << F.Label() << endl;
-      cout << " Architecture: " << F.Architecture() << endl;
+      cout << " Archive: " << DeNull(F.Archive()) << endl;
+      cout << " Component: " << DeNull(F.Component()) << endl;
+      cout << " Version: " << DeNull(F.Version()) << endl;
+      cout << " Origin: " << DeNull(F.Origin()) << endl;
+      cout << " Site: " << DeNull(F.Site()) << endl;
+      cout << " Label: " << DeNull(F.Label()) << endl;
+      cout << " Architecture: " << DeNull(F.Architecture()) << endl;
    }
 
    return true;
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index 0c948098b..aad4dff1a 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-cdrom.cc,v 1.37 2001/03/13 05:23:42 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.38 2001/05/27 04:46:43 jgg Exp $
 /* ######################################################################
    
    APT CDROM - Tool for handling APT's CDROM database.
@@ -34,6 +34,8 @@
 #include <stdio.h>
 									/*}}}*/
 
+using namespace std;
+
 // FindPackages - Find the package files on the CDROM			/*{{{*/
 // ---------------------------------------------------------------------
 /* We look over the cdrom for package files. This is a recursive
@@ -364,7 +366,7 @@ bool WriteSourceList(string Name,vector<string> &List,bool Source)
 
    // Open the stream for reading
    ifstream F((FileExists(File)?File.c_str():"/dev/null"),
-	      ios::in | ios::nocreate);
+	      ios::in );
    if (!F != 0)
       return _error->Errno("ifstream::ifstream","Opening %s",File.c_str());
 
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1e3a94663..70e86f219 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.106 2001/04/28 01:18:37 doogie Exp $
+// $Id: apt-get.cc,v 1.107 2001/05/27 04:45:49 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -58,9 +58,11 @@
 #include <sys/wait.h>
 									/*}}}*/
 
-ostream c0out;
-ostream c1out;
-ostream c2out;
+using namespace std;
+
+ostream c0out(0);
+ostream c1out(0);
+ostream c2out(0);
 ofstream devnull("/dev/null");
 unsigned int ScreenWidth = 80;
 
@@ -766,7 +768,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
       bool Transient = false;
       if (_config->FindB("APT::Get::Download",true) == false)
       {
-	 for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd();)
+	 for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd();)
 	 {
 	    if ((*I)->Local == true)
 	    {
@@ -790,7 +792,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
       
       // Print out errors
       bool Failed = false;
-      for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+      for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
       {
 	 if ((*I)->Status == pkgAcquire::Item::StatDone &&
 	     (*I)->Complete == true)
@@ -1149,7 +1151,7 @@ bool DoUpdate(CommandLine &CmdL)
       return false;
 
    bool Failed = false;
-   for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+   for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
    {
       if ((*I)->Status == pkgAcquire::Item::StatDone)
 	 continue;
@@ -1694,7 +1696,7 @@ bool DoSource(CommandLine &CmdL)
 
    // Print error messages
    bool Failed = false;
-   for (pkgAcquire::Item **I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+   for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
    {
       if ((*I)->Status == pkgAcquire::Item::StatDone &&
 	  (*I)->Complete == true)
diff --git a/cmdline/indexcopy.cc b/cmdline/indexcopy.cc
index 73d9e5077..d7efaa949 100644
--- a/cmdline/indexcopy.cc
+++ b/cmdline/indexcopy.cc
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: indexcopy.cc,v 1.7 2001/03/13 05:23:42 jgg Exp $
+// $Id: indexcopy.cc,v 1.8 2001/05/27 04:47:21 jgg Exp $
 /* ######################################################################
 
    Index Copying - Aid for copying and verifying the index files
@@ -25,6 +25,8 @@
 #include <stdio.h>
 									/*}}}*/
 
+using namespace std;
+
 // IndexCopy::CopyPackages - Copy the package files from the CD		/*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -94,7 +96,8 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List)
 	    SetCloseExec(STDOUT_FILENO,false);
 	    
 	    const char *Args[3];
-	    Args[0] = _config->Find("Dir::bin::gzip","gzip").c_str();
+	    string Tmp =  _config->Find("Dir::bin::gzip","gzip");
+	    Args[0] = Tmp.c_str();
 	    Args[1] = "-d";
 	    Args[2] = 0;
 	    execvp(Args[0],(char **)Args);
@@ -394,7 +397,7 @@ void IndexCopy::ConvertToSourceList(string CD,string &Path)
       return;
    
    // Not a dists type.
-   if (stringcmp(Path.begin(),Path.begin()+strlen("dists/"),"dists/") != 0)
+   if (stringcmp(Path.c_str(),Path.c_str()+strlen("dists/"),"dists/") != 0)
       return;
       
    // Isolate the dist
diff --git a/cmdline/indexcopy.h b/cmdline/indexcopy.h
index 44a5e7d6b..e44a91727 100644
--- a/cmdline/indexcopy.h
+++ b/cmdline/indexcopy.h
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: indexcopy.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
+// $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $
 /* ######################################################################
 
    Index Copying - Aid for copying and verifying the index files
@@ -14,6 +14,9 @@
 #include <string>
 #include <stdio.h>
 
+using std::string;
+using std::vector;
+
 class pkgTagSection;
 class FileFd;
 
-- 
2.47.2