Procházet zdrojové kódy

* apt-pkg/pkgcache.h:
- enhance the Groups ABI by providing a ID as the other structs does
- check also the size of the Group struct then checking for the others

David Kalnischkies před 16 roky
rodič
revize
52c4148509
4 změnil soubory, kde provedl 14 přidání a 5 odebrání
  1. 3 0
      apt-pkg/pkgcache.cc
  2. 7 3
      apt-pkg/pkgcache.h
  3. 1 2
      apt-pkg/pkgcachegen.cc
  4. 3 0
      debian/changelog

+ 3 - 0
apt-pkg/pkgcache.cc

@@ -55,6 +55,7 @@ pkgCache::Header::Header()
    Dirty = false;
    
    HeaderSz = sizeof(pkgCache::Header);
+   GroupSz = sizeof(pkgCache::Group);
    PackageSz = sizeof(pkgCache::Package);
    PackageFileSz = sizeof(pkgCache::PackageFile);
    VersionSz = sizeof(pkgCache::Version);
@@ -64,6 +65,7 @@ pkgCache::Header::Header()
    VerFileSz = sizeof(pkgCache::VerFile);
    DescFileSz = sizeof(pkgCache::DescFile);
    
+   GroupCount = 0;
    PackageCount = 0;
    VersionCount = 0;
    DescriptionCount = 0;
@@ -90,6 +92,7 @@ pkgCache::Header::Header()
 bool pkgCache::Header::CheckSizes(Header &Against) const
 {
    if (HeaderSz == Against.HeaderSz &&
+       GroupSz == Against.GroupSz &&
        PackageSz == Against.PackageSz &&
        PackageFileSz == Against.PackageFileSz &&
        VersionSz == Against.VersionSz &&

+ 7 - 3
apt-pkg/pkgcache.h

@@ -244,6 +244,7 @@ struct pkgCache::Header
        If any of the size values do not exactly match what the client expects
        then the client should refuse the load the file. */
    unsigned short HeaderSz;
+   unsigned short GroupSz;
    unsigned short PackageSz;
    unsigned short PackageFileSz;
    unsigned short VersionSz;
@@ -329,12 +330,15 @@ struct pkgCache::Group
    map_ptrloc Name;		// StringItem
 
    // Linked List
-   /** Link to the first package which belongs to the group */
+   /** \brief Link to the first package which belongs to the group */
    map_ptrloc FirstPackage;	// Package
-   /** Link to the last package which belongs to the group */
+   /** \brief Link to the last package which belongs to the group */
    map_ptrloc LastPackage;	// Package
-   /** Link to the next Group */
+   /** \brief Link to the next Group */
    map_ptrloc Next;		// Group
+   /** \brief unique sequel ID */
+   unsigned int ID;
+
 };
 									/*}}}*/
 // Package structure							/*{{{*/

+ 1 - 2
apt-pkg/pkgcachegen.cc

@@ -356,8 +356,7 @@ bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name)
    Grp->Next = Cache.HeaderP->GrpHashTable[Hash];
    Cache.HeaderP->GrpHashTable[Hash] = Group;
 
-   Cache.HeaderP->GroupCount++;
-
+   Grp->ID = Cache.HeaderP->GroupCount++;
    return true;
 }
 									/*}}}*/

+ 3 - 0
debian/changelog

@@ -43,6 +43,9 @@ apt (0.7.26~exp4) experimental; urgency=low
       use, extended_states and uri schemes.
   * doc/cache.sgml:
     - drop the file in favor of inplace documentation with doxygen
+  * apt-pkg/pkgcache.h:
+    - enhance the Groups ABI by providing a ID as the other structs does
+    - check also the size of the Group struct then checking for the others
 
   [ Jari Aalto ]
   * cmdline/apt-get.cc: