Просмотр исходного кода

G++3 fixes from Randolph
Author: jgg
Date: 2001-05-14 05:47:30 GMT
G++3 fixes from Randolph

Arch Librarian лет назад: 22
Родитель
Сommit
851a45a85f
4 измененных файлов с 22 добавлено и 11 удалено
  1. 6 3
      apt-pkg/contrib/configuration.cc
  2. 6 4
      apt-pkg/pkgcache.cc
  3. 4 1
      apt-pkg/tagfile.cc
  4. 6 3
      apt-pkg/version.h

+ 6 - 3
apt-pkg/contrib/configuration.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: configuration.cc,v 1.21 2001/04/29 05:24:42 jgg Exp $
+// $Id: configuration.cc,v 1.22 2001/05/14 05:47:30 jgg Exp $
 /* ######################################################################
 
    Configuration Class
@@ -24,11 +24,14 @@
 #include <vector>
 #include <algorithm>
 #include <fstream>
+#include <iostream>
     
 #include <stdio.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <unistd.h>
+
+using namespace std;
 									/*}}}*/
 
 Configuration *_config = new Configuration;
@@ -92,7 +95,7 @@ Configuration::Item *Configuration::Lookup(Item *Head,const char *S,
    if (Len != 0)
    {
       for (; I != 0; Last = &I->Next, I = I->Next)
-	 if ((Res = stringcasecmp(I->Tag.begin(),I->Tag.end(),S,S + Len)) == 0)
+	 if ((Res = stringcasecmp(I->Tag,S,S + Len)) == 0)
 	    break;
    }
    else
@@ -438,7 +441,7 @@ bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional,
 		    unsigned Depth)
 {   
    // Open the stream for reading
-   ifstream F(FName.c_str(),ios::in | ios::nocreate);
+   ifstream F(FName.c_str(),ios::in); 
    if (!F != 0)
       return _error->Errno("ifstream::ifstream",_("Opening configuration file %s"),FName.c_str());
    

+ 6 - 4
apt-pkg/pkgcache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: pkgcache.cc,v 1.34 2001/04/29 05:13:51 jgg Exp $
+// $Id: pkgcache.cc,v 1.35 2001/05/14 05:54:10 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
@@ -37,10 +37,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include <ctype.h>
 #include <system.h>
-
 									/*}}}*/
 
+using std::string;
+
 // Cache::Header::Header - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* Simply initialize the header */
@@ -154,7 +156,7 @@ bool pkgCache::ReMap()
 unsigned long pkgCache::sHash(string Str) const
 {
    unsigned long Hash = 0;
-   for (const char *I = Str.begin(); I != Str.end(); I++)
+   for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
       Hash = 5*Hash + tolower(*I);
    return Hash % _count(HeaderP->HashTable);
 }
@@ -178,7 +180,7 @@ pkgCache::PkgIterator pkgCache::FindPkg(string Name)
    for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
    {
       if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] &&
-	  stringcasecmp(Name.begin(),Name.end(),StrP + Pkg->Name) == 0)
+	  stringcasecmp(Name,StrP + Pkg->Name) == 0)
 	 return PkgIterator(*this,Pkg);
    }
    return PkgIterator(*this,0);

+ 4 - 1
apt-pkg/tagfile.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.cc,v 1.29 2001/04/22 05:42:52 jgg Exp $
+// $Id: tagfile.cc,v 1.30 2001/05/14 05:56:26 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -23,8 +23,11 @@
     
 #include <string>
 #include <stdio.h>
+#include <ctype.h>
 									/*}}}*/
 
+using std::string;
+
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* */

+ 6 - 3
apt-pkg/version.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: version.h,v 1.6 2001/02/20 07:03:17 jgg Exp $
+// $Id: version.h,v 1.7 2001/05/14 05:58:33 jgg Exp $
 /* ######################################################################
 
    Version - Versioning system..
@@ -26,6 +26,8 @@
 
 #include <string>
 
+using std::string;
+
 class pkgVersioningSystem
 {
    public:
@@ -39,6 +41,7 @@ class pkgVersioningSystem
    // Compare versions..
    virtual int DoCmpVersion(const char *A,const char *Aend,
 			  const char *B,const char *Bend) = 0;   
+
    virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
    virtual int DoCmpReleaseVer(const char *A,const char *Aend,
 			       const char *B,const char *Bend) = 0;
@@ -55,7 +58,7 @@ class pkgVersioningSystem
    };
    inline int CmpVersion(string A,string B)
    {
-      return DoCmpVersion(A.begin(),A.end(),B.begin(),B.end());
+      return DoCmpVersion(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());
    };  
    inline int CmpReleaseVer(const char *A, const char *B)
    {
@@ -63,7 +66,7 @@ class pkgVersioningSystem
    };
    inline int CmpReleaseVer(string A,string B)
    {
-      return DoCmpReleaseVer(A.begin(),A.end(),B.begin(),B.end());
+      return DoCmpReleaseVer(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());
    };  
    
    pkgVersioningSystem();