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

Core correctness patches
Author: jgg
Date: 2001-03-13 05:23:42 GMT
Core correctness patches

Arch Librarian лет назад: 22
Родитель
Сommit
20ebd488ff
4 измененных файлов с 13 добавлено и 11 удалено
  1. 2 2
      apt-pkg/policy.cc
  2. 3 2
      cmdline/apt-cdrom.cc
  3. 2 2
      cmdline/apt-get.cc
  4. 6 5
      cmdline/indexcopy.cc

+ 2 - 2
apt-pkg/policy.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: policy.cc,v 1.4 2001/03/05 02:43:28 jgg Exp $
+// $Id: policy.cc,v 1.5 2001/03/13 05:23:42 jgg Exp $
 /* ######################################################################
 
    Package Version Policy implementation
@@ -73,7 +73,7 @@ bool pkgPolicy::InitDefaults()
    }
 
    // Apply the defaults..
-   SPtr<bool> Fixed = new bool[Cache->HeaderP->PackageFileCount];
+   SPtrArray<bool> Fixed = new bool[Cache->HeaderP->PackageFileCount];
    memset(Fixed,0,sizeof(*Fixed)*Cache->HeaderP->PackageFileCount);
    signed Cur = 989;
    StatusOverride = false;

+ 3 - 2
cmdline/apt-cdrom.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-cdrom.cc,v 1.36 2001/02/20 07:03:17 jgg Exp $
+// $Id: apt-cdrom.cc,v 1.37 2001/03/13 05:23:42 jgg Exp $
 /* ######################################################################
    
    APT CDROM - Tool for handling APT's CDROM database.
@@ -134,7 +134,8 @@ bool FindPackages(string CD,vector<string> &List,vector<string> &SList,
 bool DropBinaryArch(vector<string> &List)
 {
    char S[300];
-   sprintf(S,"/binary-%s/",_config->Find("Apt::Architecture").c_str());
+   snprintf(S,sizeof(S),"/binary-%s/",
+	    _config->Find("Apt::Architecture").c_str());
    
    for (unsigned int I = 0; I < List.size(); I++)
    {

+ 2 - 2
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: apt-get.cc,v 1.103 2001/03/03 23:12:07 jgg Exp $
+// $Id: apt-get.cc,v 1.104 2001/03/13 05:23:42 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -429,7 +429,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
 	    Added[P->ID] = true;
 	    
 	    char S[300];
-	    sprintf(S,_("%s (due to %s) "),P.Name(),I.Name());
+	    snprintf(S,sizeof(S),_("%s (due to %s) "),P.Name(),I.Name());
 	    List += S;
 	 }	 
       }      

+ 6 - 5
cmdline/indexcopy.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: indexcopy.cc,v 1.6 2001/02/20 07:03:17 jgg Exp $
+// $Id: indexcopy.cc,v 1.7 2001/03/13 05:23:42 jgg Exp $
 /* ######################################################################
 
    Index Copying - Aid for copying and verifying the index files
@@ -113,8 +113,8 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List)
       
       // Open the output file
       char S[400];
-      sprintf(S,"cdrom:[%s]/%s%s",Name.c_str(),(*I).c_str() + CDROM.length(),
-	      GetFileName());
+      snprintf(S,sizeof(S),"cdrom:[%s]/%s%s",Name.c_str(),
+	       (*I).c_str() + CDROM.length(),GetFileName());
       string TargetF = _config->FindDir("Dir::State::lists") + "partial/";
       TargetF += URItoFileName(S);
       if (_config->FindB("APT::CDROM::NoAct",false) == true)
@@ -229,7 +229,8 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List)
 	    return _error->Errno("rename","Failed to rename");
 
 	 // Copy the release file
-	 sprintf(S,"cdrom:[%s]/%sRelease",Name.c_str(),(*I).c_str() + CDROM.length());
+	 snprintf(S,sizeof(S),"cdrom:[%s]/%sRelease",Name.c_str(),
+		  (*I).c_str() + CDROM.length());
 	 string TargetF = _config->FindDir("Dir::State::lists") + "partial/";
 	 TargetF += URItoFileName(S);
 	 if (FileExists(*I + "Release") == true)
@@ -381,7 +382,7 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File)
 void IndexCopy::ConvertToSourceList(string CD,string &Path)
 {
    char S[300];
-   sprintf(S,"binary-%s",_config->Find("Apt::Architecture").c_str());
+   snprintf(S,sizeof(S),"binary-%s",_config->Find("Apt::Architecture").c_str());
    
    // Strip the cdrom base path
    Path = string(Path,CD.length());