Patchs for apt-cdrom
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:42 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:42 +0000 (16:51 +0000)
Author: jgg
Date: 1998-11-27 01:14:06 GMT
Patchs for apt-cdrom

apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/fileutl.h
apt-pkg/tagfile.cc
apt-pkg/tagfile.h

index 3ca3637..b5cdf78 100644 (file)
@@ -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)
    {
index 31af3d2..46eefc6 100644 (file)
@@ -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();
index 1d6d10d..a55d521 100644 (file)
@@ -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());
+}
+                                                                       /*}}}*/
index c97f86d..7782b54 100644 (file)
@@ -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) {};
 };