Explorar o código

Patchs for apt-cdrom
Author: jgg
Date: 1998-11-27 01:14:06 GMT
Patchs for apt-cdrom

Arch Librarian %!s(int64=22) %!d(string=hai) anos
pai
achega
a05599f12f
Modificáronse 4 ficheiros con 40 adicións e 7 borrados
  1. 2 2
      apt-pkg/contrib/fileutl.cc
  2. 2 2
      apt-pkg/contrib/fileutl.h
  3. 26 1
      apt-pkg/tagfile.cc
  4. 10 2
      apt-pkg/tagfile.h

+ 2 - 2
apt-pkg/contrib/fileutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: fileutl.cc,v 1.14 1998/11/23 07:03:06 jgg Exp $
+// $Id: fileutl.cc,v 1.15 1998/11/27 01:14:08 jgg Exp $
 /* ######################################################################
    
    File Utilities
@@ -234,7 +234,7 @@ bool FileFd::Read(void *To,unsigned long Size)
 // FileFd::Write - Write to the file					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool FileFd::Write(void *From,unsigned long Size)
+bool FileFd::Write(const void *From,unsigned long Size)
 {
    if (write(iFd,From,Size) != (signed)Size)
    {

+ 2 - 2
apt-pkg/contrib/fileutl.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: fileutl.h,v 1.9 1998/11/23 07:03:07 jgg Exp $
+// $Id: fileutl.h,v 1.10 1998/11/27 01:14:09 jgg Exp $
 /* ######################################################################
    
    File Utilities
@@ -41,7 +41,7 @@ class FileFd
    enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny};
    
    bool Read(void *To,unsigned long Size);
-   bool Write(void *From,unsigned long Size);
+   bool Write(const void *From,unsigned long Size);
    bool Seek(unsigned long To);
    unsigned long Size();
    bool Close();

+ 26 - 1
apt-pkg/tagfile.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.cc,v 1.14 1998/11/13 04:23:36 jgg Exp $
+// $Id: tagfile.cc,v 1.15 1998/11/27 01:14:06 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -180,3 +180,28 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start,
    return false;
 }
 									/*}}}*/
+// pkgTagSection::FindS - Find a string					/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgTagSection::FindS(const char *Tag)
+{
+   const char *Start;
+   const char *End;
+   if (Find(Tag,Start,End) == false)
+      return string();
+   return string(Start,End);      
+}
+									/*}}}*/
+// TagSection::FindI - Find an integer					/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned int pkgTagSection::FindI(const char *Tag)
+{
+   const char *Start;
+   const char *End;
+   if (Find(Tag,Start,End) == false)
+      return 0;
+   
+   return atoi(string(Start,End).c_str());
+}
+									/*}}}*/

+ 10 - 2
apt-pkg/tagfile.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.h,v 1.9 1998/08/26 04:52:24 jgg Exp $
+// $Id: tagfile.h,v 1.10 1998/11/27 01:14:07 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -42,9 +42,17 @@ class pkgTagSection
    inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs.Section;};
    
    bool Find(const char *Tag,const char *&Start, const char *&End);
+   string FindS(const char *Tag);
+   unsigned int FindI(const char *Tag);   
    bool Scan(const char *Start,unsigned long MaxLength);
    inline unsigned long size() {return Stop - Section;};
-
+   
+   inline void GetSection(const char *&Start,const char *&Stop)
+   {
+      Start = Section;
+      Stop = this->Stop;
+   };
+   
    pkgTagSection() : Section(0), Stop(0) {};
 };