summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc22
-rw-r--r--apt-pkg/tagfile.cc78
-rw-r--r--apt-pkg/tagfile.h2
3 files changed, 34 insertions, 68 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index bf0434ccc..2b167dbf6 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -355,28 +355,28 @@ bool pkgDPkgPM::Go(int OutStatusFd)
static const struct DpkgState DpkgStatesOpMap[][5] = {
// Install operation
{
- {"half-installed", _("Preparing %s")},
- {"unpacked", _("Unpacking %s") },
+ {"half-installed", N_("Preparing %s")},
+ {"unpacked", N_("Unpacking %s") },
{NULL, NULL}
},
// Configure operation
{
- {"unpacked",_("Preparing to configure %s") },
- {"half-configured", _("Configuring %s") },
- { "installed", _("Installed %s")},
+ {"unpacked",N_("Preparing to configure %s") },
+ {"half-configured", N_("Configuring %s") },
+ { "installed", N_("Installed %s")},
{NULL, NULL}
},
// Remove operation
{
- {"half-configured", _("Preparing for removal of %s")},
- {"half-installed", _("Removing %s")},
- {"config-files", _("Removed %s")},
+ {"half-configured", N_("Preparing for removal of %s")},
+ {"half-installed", N_("Removing %s")},
+ {"config-files", N_("Removed %s")},
{NULL, NULL}
},
// Purge operation
{
- {"config-files", _("Preparing to completely remove %s")},
- {"not-installed", _("Completely removed %s")},
+ {"config-files", N_("Preparing to completely remove %s")},
+ {"not-installed", N_("Completely removed %s")},
{NULL, NULL}
},
};
@@ -670,7 +670,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
{
// only read the translation if there is actually a next
// action
- const char *translation = states[PackageOpsDone[pkg]].str;
+ const char *translation = _(states[PackageOpsDone[pkg]].str);
char s[200];
snprintf(s, sizeof(s), translation, pkg);
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 8fcbeb23b..040562fff 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -33,33 +33,22 @@ using std::string;
/* */
pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) :
Fd(*pFd),
- Size(Size),
- Map(NULL),
- Buffer(0)
+ Size(Size)
{
if (Fd.IsOpen() == false)
{
+ Buffer = 0;
Start = End = Buffer = 0;
Done = true;
iOffset = 0;
- Map = NULL;
return;
}
- // check if we can MMap it
- if(Fd.Size() == 0)
- {
- Buffer = new char[Size];
- Start = End = Buffer;
- Done = false;
- Fill();
- } else {
- Map = new MMap (Fd, MMap::Public | MMap::ReadOnly);
- Buffer = (char *) Map->Data ();
- Start = Buffer;
- End = Buffer + Map->Size ();
- }
+ Buffer = new char[Size];
+ Start = End = Buffer;
+ Done = false;
iOffset = 0;
+ Fill();
}
/*}}}*/
// TagFile::~pkgTagFile - Destructor /*{{{*/
@@ -67,8 +56,7 @@ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) :
/* */
pkgTagFile::~pkgTagFile()
{
- if(!Map) delete [] Buffer;
- delete Map;
+ delete [] Buffer;
}
/*}}}*/
// TagFile::Step - Advance to the next section /*{{{*/
@@ -76,15 +64,8 @@ pkgTagFile::~pkgTagFile()
/* If the Section Scanner fails we refill the buffer and try again. */
bool pkgTagFile::Step(pkgTagSection &Tag)
{
- if ((Map != NULL) && (Start == End))
- return false;
-
if (Tag.Scan(Start,End - Start) == false)
{
- if (Map != NULL)
- return _error->Error(_("Unable to parse package file %s (1)"),
- Fd.Name().c_str());
-
if (Fill() == false)
return false;
@@ -158,30 +139,23 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
return Step(Tag);
}
+ // Reposition and reload..
iOffset = Offset;
- if (Map != NULL)
- {
- Start = Buffer + iOffset;
- }
- else
- {
- // Reposition and reload..
- Done = false;
- if (Fd.Seek(Offset) == false)
- return false;
- End = Start = Buffer;
+ Done = false;
+ if (Fd.Seek(Offset) == false)
+ return false;
+ End = Start = Buffer;
- if (Fill() == false)
- return false;
+ if (Fill() == false)
+ return false;
- if (Tag.Scan(Start,End - Start) == true)
- return true;
+ if (Tag.Scan(Start,End - Start) == true)
+ return true;
+
+ // This appends a double new line (for the real eof handling)
+ if (Fill() == false)
+ return false;
- // This appends a double new line (for the real eof handling)
- if (Fill() == false)
- return false;
- }
-
if (Tag.Scan(Start,End - Start) == false)
return _error->Error(_("Unable to parse package file %s (2)"),Fd.Name().c_str());
@@ -192,12 +166,12 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
// ---------------------------------------------------------------------
/* This looks for the first double new line in the data stream. It also
indexes the tags in the section. This very simple hash function for the
- first 3 letters gives very good performance on the debian package files */
+ last 8 letters gives very good performance on the debian package files */
inline static unsigned long AlphaHash(const char *Text, const char *End = 0)
{
unsigned long Res = 0;
for (; Text != End && *Text != ':' && *Text != 0; Text++)
- Res = (unsigned long)(*Text) ^ (Res << 2);
+ Res = ((unsigned long)(*Text) & 0xDF) ^ (Res << 1);
return Res & 0xFF;
}
@@ -207,7 +181,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
Stop = Section = Start;
memset(AlphaIndexes,0,sizeof(AlphaIndexes));
- if (Stop == 0 || MaxLength == 0)
+ if (Stop == 0)
return false;
TagCount = 0;
@@ -238,12 +212,6 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
Stop++;
}
- if ((Stop+1 >= End) && (End[-1] == '\n' || End[-1] == '\r'))
- {
- Indexes[TagCount] = (End - 1) - Section;
- return true;
- }
-
return false;
}
/*}}}*/
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index dd481ba51..f7f8155a5 100644
--- a/apt-pkg/tagfile.h
+++ b/apt-pkg/tagfile.h
@@ -25,7 +25,6 @@
#endif
#include <apt-pkg/fileutl.h>
-#include <apt-pkg/mmap.h>
#include <stdio.h>
class pkgTagSection
@@ -70,7 +69,6 @@ class pkgTagSection
class pkgTagFile
{
FileFd &Fd;
- MMap *Map;
char *Buffer;
char *Start;
char *End;