~jr/ubuntu/oneiric/apt/bzr-get-rename

« back to all changes in this revision

Viewing changes to apt-inst/contrib/arfile.cc

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2005-03-07 20:08:33 UTC
  • Revision ID: james.westby@ubuntu.com-20050307200833-0lxdgg2cb4oculdv
Tags: 0.6.35
* Merge apt--mvo--0 (incorporates 0.6.34ubuntu1):
  - Implement MaxSize and MaxAge in apt.cron.daily, to prevent the cache
    from growing too large (Ubuntu #6761)
  - some comments about the pkgAcqMetaSig::Custom600Headers() added
  - use gpg --with-colons
  - commented the ftp no_proxy unseting in methods/ftp.cc
  - added support for "Acquire::gpgv::options" in methods/gpgv.cc
* Merge bubulle@debian.org--2005/apt--main--0
  - Make capitalization more consistent
  - Un-fuzzy translations resulting from capitalization changes
  - Italian translation update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- mode: cpp; mode: fold -*-
2
2
// Description                                                          /*{{{*/
3
 
// $Id: arfile.cc,v 1.2 2001/02/20 07:03:16 jgg Exp $
 
3
// $Id: arfile.cc,v 1.6.2.1 2004/01/16 18:58:50 mdz Exp $
4
4
/* ######################################################################
5
5
 
6
6
   AR File - Handle an 'AR' archive
23
23
 
24
24
#include <stdlib.h>
25
25
                                                                        /*}}}*/
 
26
#include <apti18n.h>
26
27
 
27
28
struct ARArchive::MemberHeader
28
29
{
69
70
   if (File.Read(Magic,sizeof(Magic)) == false)
70
71
      return false;
71
72
   if (memcmp(Magic,"!<arch>\012",sizeof(Magic)) != 0)
72
 
      return _error->Error("Invalid archive signature");
 
73
      return _error->Error(_("Invalid archive signature"));
73
74
   Left -= sizeof(Magic);
74
75
   
75
76
   // Read the member list
77
78
   {
78
79
      MemberHeader Head;
79
80
      if (File.Read(&Head,sizeof(Head)) == false)
80
 
         return _error->Error("Error reading archive member header");
 
81
         return _error->Error(_("Error reading archive member header"));
81
82
      Left -= sizeof(Head);
82
83
 
83
84
      // Convert all of the integer members
89
90
          StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false)
90
91
      {
91
92
         delete Memb;
92
 
         return _error->Error("Invalid archive member header");
 
93
         return _error->Error(_("Invalid archive member header"));
93
94
      }
94
95
         
95
96
      // Check for an extra long name string
101
102
             Len >= strlen(S))
102
103
         {
103
104
            delete Memb;
104
 
            return _error->Error("Invalid archive member header");
 
105
            return _error->Error(_("Invalid archive member header"));
105
106
         }
106
107
         if (File.Read(S,Len) == false)
107
108
            return false;
114
115
      {
115
116
         unsigned int I = sizeof(Head.Name) - 1;
116
117
         for (; Head.Name[I] == ' '; I--);
117
 
         Memb->Name = string(Head.Name,0,I+1);
 
118
         Memb->Name = string(Head.Name,I+1);
118
119
      }
119
120
 
120
121
      // Account for the AR header alignment 
127
128
      if (File.Skip(Memb->Size + Skip) == false)
128
129
         return false;
129
130
      if (Left < (signed)(Memb->Size + Skip))
130
 
         return _error->Error("Archive is too short");
 
131
         return _error->Error(_("Archive is too short"));
131
132
      Left -= Memb->Size + Skip;
132
133
   }   
133
134
   if (Left != 0)
134
 
      return _error->Error("Failed to read the archive headers");
 
135
      return _error->Error(_("Failed to read the archive headers"));
135
136
   
136
137
   return true;
137
138
}