summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/aptconfiguration.cc56
-rw-r--r--apt-pkg/contrib/configuration.cc27
-rw-r--r--apt-pkg/contrib/configuration.h3
-rw-r--r--apt-pkg/contrib/strutl.cc15
-rw-r--r--buildlib/sizetable3
-rw-r--r--debian/changelog19
-rwxr-xr-xdebian/prerm15
-rw-r--r--doc/apt-cache.8.xml17
-rw-r--r--doc/apt-get.8.xml55
-rw-r--r--doc/apt.conf.5.xml42
-rw-r--r--doc/apt.ent64
-rw-r--r--doc/apt_preferences.5.xml10
-rw-r--r--doc/examples/configure-index9
-rw-r--r--methods/rred.cc2
14 files changed, 212 insertions, 125 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 1a8e8262f..45ae9bed5 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -14,6 +14,7 @@
#include <vector>
#include <string>
+#include <algorithm>
/*}}}*/
namespace APT {
// getCompressionTypes - Return Vector of usbale compressiontypes /*{{{*/
@@ -29,41 +30,52 @@ const Configuration::getCompressionTypes(bool const &Cached) {
types.clear();
}
+ // setup the defaults for the compressiontypes => method mapping
+ _config->CndSet("Acquire::CompressionTypes::bz2","bzip2");
+ _config->CndSet("Acquire::CompressionTypes::lzma","lzma");
+ _config->CndSet("Acquire::CompressionTypes::gz","gzip");
+
// Set default application paths to check for optional compression types
_config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
_config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
- ::Configuration::Item const *Opts = _config->Tree("Acquire::CompressionTypes");
- if (Opts != 0)
- Opts = Opts->Child;
+ // accept non-list order as override setting for config settings on commandline
+ std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
+ if (overrideOrder.empty() == false)
+ types.push_back(overrideOrder);
- // at first, move over the options to setup at least the default options
- bool foundLzma=false, foundBzip2=false, foundGzip=false;
- for (; Opts != 0; Opts = Opts->Next) {
- if (Opts->Value == "lzma")
- foundLzma = true;
- else if (Opts->Value == "bz2")
- foundBzip2 = true;
- else if (Opts->Value == "gz")
- foundGzip = true;
+ // load the order setting into our vector
+ std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order");
+ for (std::vector<std::string>::const_iterator o = order.begin();
+ o != order.end(); o++) {
+ if ((*o).empty() == true)
+ continue;
+ // ignore types we have no method ready to use
+ if (_config->Exists(string("Acquire::CompressionTypes::").append(*o)) == false)
+ continue;
+ // ignore types we have no app ready to use
+ string const appsetting = string("Dir::Bin::").append(*o);
+ if (_config->Exists(appsetting) == true) {
+ std::string const app = _config->FindFile(appsetting.c_str(), "");
+ if (app.empty() == false && FileExists(app) == false)
+ continue;
+ }
+ types.push_back(*o);
}
- // setup the defaults now
- if (!foundBzip2)
- _config->Set("Acquire::CompressionTypes::bz2","bzip2");
- if (!foundLzma)
- _config->Set("Acquire::CompressionTypes::lzma","lzma");
- if (!foundGzip)
- _config->Set("Acquire::CompressionTypes::gz","gzip");
-
- // move again over the option tree to finially calculate our result
+ // move again over the option tree to add all missing compression types
::Configuration::Item const *Types = _config->Tree("Acquire::CompressionTypes");
if (Types != 0)
Types = Types->Child;
for (; Types != 0; Types = Types->Next) {
+ if (Types->Tag == "Order" || Types->Tag.empty() == true)
+ continue;
+ // ignore types we already have in the vector
+ if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
+ continue;
+ // ignore types we have no app ready to use
string const appsetting = string("Dir::Bin::").append(Types->Value);
- // ignore compression types we have no app ready to use
if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
std::string const app = _config->FindFile(appsetting.c_str(), "");
if (app.empty() == false && FileExists(app) == false)
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 48a5f0bff..4e8586e83 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -223,6 +223,25 @@ string Configuration::FindDir(const char *Name,const char *Default) const
return Res;
}
/*}}}*/
+// Configuration::FindVector - Find a vector of values /*{{{*/
+// ---------------------------------------------------------------------
+/* Returns a vector of config values under the given item */
+vector<string> Configuration::FindVector(const char *Name) const
+{
+ vector<string> Vec;
+ const Item *Top = Lookup(Name);
+ if (Top == NULL)
+ return Vec;
+
+ Item *I = Top->Child;
+ while(I != NULL)
+ {
+ Vec.push_back(I->Value);
+ I = I->Next;
+ }
+ return Vec;
+}
+ /*}}}*/
// Configuration::FindI - Find an integer value /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -582,9 +601,11 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
InQuote = !InQuote;
if (InQuote == true)
continue;
-
- if ((*I == '/' && I + 1 != End && I[1] == '/') || *I == '#')
- {
+
+ if ((*I == '/' && I + 1 != End && I[1] == '/') ||
+ (*I == '#' && strcmp(string(I,I+6).c_str(),"#clear") != 0 &&
+ strcmp(string(I,I+8).c_str(),"#include") != 0))
+ {
End = I;
break;
}
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h
index 2534692a3..e2da83f5b 100644
--- a/apt-pkg/contrib/configuration.h
+++ b/apt-pkg/contrib/configuration.h
@@ -31,6 +31,7 @@
#include <string>
+#include <vector>
#include <iostream>
using std::string;
@@ -70,6 +71,8 @@ class Configuration
string Find(const string Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
string FindFile(const char *Name,const char *Default = 0) const;
string FindDir(const char *Name,const char *Default = 0) const;
+ std::vector<string> FindVector(const string &Name) const;
+ std::vector<string> FindVector(const char *Name) const;
int FindI(const char *Name,int Default = 0) const;
int FindI(const string Name,int Default = 0) const {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool Default = false) const;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 1683868c8..4c05f2df8 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -67,9 +67,20 @@ bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest)
outbuf = new char[insize+1];
outptr = outbuf;
- iconv(cd, &inptr, &insize, &outptr, &outsize);
- *outptr = '\0';
+ while (insize != 0)
+ {
+ size_t const err = iconv(cd, &inptr, &insize, &outptr, &outsize);
+ if (err == (size_t)(-1))
+ {
+ insize--;
+ outsize++;
+ inptr++;
+ *outptr = '?';
+ outptr++;
+ }
+ }
+ *outptr = '\0';
*dest = outbuf;
delete[] outbuf;
diff --git a/buildlib/sizetable b/buildlib/sizetable
index b5782360c..372ddd091 100644
--- a/buildlib/sizetable
+++ b/buildlib/sizetable
@@ -11,6 +11,7 @@
# The format is:-
# CPU endian sizeof: char, int, short, long
i386 little 1 4 2 4
+amd64 little 1 4 2 8
armeb big 1 4 2 4
arm little 1 4 2 4
alpha little 1 4 2 8
@@ -21,4 +22,4 @@ m68k big 1 4 2 4
powerpc big 1 4 2 4
mips big 1 4 2 4
hppa big 1 4 2 4
-m32r big 1 4 2 4 \ No newline at end of file
+m32r big 1 4 2 4
diff --git a/debian/changelog b/debian/changelog
index 48768ad88..b5cedbe2e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,25 @@ apt (0.7.24) UNRELEASED; urgency=low
- activate DOT_MULTI_TARGETS, it is default on since doxygen 1.5.9
* buildlib/po4a_manpage.mak, doc/makefile, configure:
- simplify the makefiles needed for po4a manpages
+ * apt-pkg/contrib/configuration.cc:
+ - add a helper to easily get a vector of strings from the config
+ * apt-pkg/contrib/strutl.cc:
+ - replace unknown multibytes with ? in UTF8ToCharset (Closes: #545208)
+ * doc/apt-get.8.xml:
+ - fix two little typos in the --simulate description.
+ * apt-pkg/aptconfiguration.cc, doc/apt.conf.5.xml:
+ - add an order subgroup to the compression types to simplify reordering
+ a bit and improve the documentation for this option group.
+ * doc/apt.ent, all man pages:
+ - move the description of files to globally usable entities
+ * doc/apt_preferences.5.xml:
+ - document the new preferences.d folder (Closes: #544017)
+ * methods/rred.cc:
+ - add at the top without failing (by Bernhard R. Link, Closes: #545694)
+ * buildlib/sizetable:
+ - add amd64 for cross building (by Mikhail Gusarov, Closes: #513058)
+ * debian/prerm:
+ - remove file as nobody will upgrade from 0.4.10 anymore
[ Christian Perrier ]
* doc/fr/*, doc/po/fr.po:
diff --git a/debian/prerm b/debian/prerm
deleted file mode 100755
index 4a8d47782..000000000
--- a/debian/prerm
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-
-set -e
-
-#DEBHELPER#
-
-if [ "$1" = "upgrade" -o "$1" = "failed-upgrade" ] &&
- dpkg --compare-versions "$2" "<<" 0.4.10
-then
- if [ ! -d /var/state/apt/ ]; then
- ln -s /var/lib/apt /var/state/apt
- touch /var/lib/apt/lists/partial/.delete-me-later
- fi
-fi
-
diff --git a/doc/apt-cache.8.xml b/doc/apt-cache.8.xml
index 8b76f55b9..26d55a519 100644
--- a/doc/apt-cache.8.xml
+++ b/doc/apt-cache.8.xml
@@ -357,21 +357,8 @@ Reverse Provides:
<refsect1><title>Files</title>
<variablelist>
- <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
- <listitem><para>Locations to fetch packages from.
- Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&statedir;/lists/</filename></term>
- <listitem><para>Storage area for state information for each package resource specified in
- &sources-list;
- Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
- <listitem><para>Storage area for state information in transit.
- Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
- </varlistentry>
+ &file-sourceslist;
+ &file-statelists;
</variablelist>
</refsect1>
diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml
index b87e17247..ec773edeb 100644
--- a/doc/apt-get.8.xml
+++ b/doc/apt-get.8.xml
@@ -384,9 +384,9 @@
Configuration Item: <literal>APT::Get::Simulate</literal>.</para>
<para>Simulation run as user will deactivate locking (<literal>Debug::NoLocking</literal>)
- automatical. Also a notice will be displayed indicating that this is only a simulation,
- if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true)
- Neigther NoLocking nor the notice will be triggered if run as root (root should know what
+ automatic. Also a notice will be displayed indicating that this is only a simulation,
+ if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true).
+ Neither NoLocking nor the notice will be triggered if run as root (root should know what
he is doing without further warnings by <literal>apt-get</literal>).</para>
<para>Simulate prints out
@@ -558,50 +558,11 @@
<refsect1><title>Files</title>
<variablelist>
- <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
- <listitem><para>Locations to fetch packages from.
- Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
- <listitem><para>APT configuration file.
- Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
- <listitem><para>APT configuration file fragments.
- Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>/etc/apt/preferences</filename></term>
- <listitem><para>Version preferences file.
- This is where you would specify "pinning",
- i.e. a preference to get certain packages
- from a separate source
- or from a different version of a distribution.
- Configuration Item: <literal>Dir::Etc::Preferences</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&cachedir;/archives/</filename></term>
- <listitem><para>Storage area for retrieved package files.
- Configuration Item: <literal>Dir::Cache::Archives</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&cachedir;/archives/partial/</filename></term>
- <listitem><para>Storage area for package files in transit.
- Configuration Item: <literal>Dir::Cache::Archives</literal> (implicit partial). </para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&statedir;/lists/</filename></term>
- <listitem><para>Storage area for state information for each package resource specified in
- &sources-list;
- Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
- <listitem><para> Storage area for state information in transit.
- Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
- </varlistentry>
+ &file-sourceslist;
+ &file-aptconf;
+ &file-preferences;
+ &file-cachearchives;
+ &file-statelists;
</variablelist>
</refsect1>
diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml
index e0ce0db40..81be753f9 100644
--- a/doc/apt.conf.5.xml
+++ b/doc/apt.conf.5.xml
@@ -90,7 +90,7 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
<literal>#include</literal> will include the given file, unless the filename
ends in a slash, then the whole directory is included.
<literal>#clear</literal> is used to erase a part of the configuration tree. The
- specified element and all its descendents are erased.</para>
+ specified element and all its descendants are erased.</para>
<para>All of the APT tools take a -o option which allows an arbitrary configuration
directive to be specified on the command line. The syntax is a full option
@@ -312,16 +312,30 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
<varlistentry><term>CompressionTypes</term>
<listitem><para>List of compression types which are understood by the acquire methods.
Files like <filename>Packages</filename> can be available in various compression formats.
- This list defines in which order the acquire methods will try to download these files.
- Per default <command>bzip2</command> compressed files will be prefered over
- <command>lzma</command>, <command>gzip</command> and uncompressed files. The syntax for
- the configuration fileentry is
+ Per default the acquire methods can decompress <command>bzip2</command>, <command>lzma</command>
+ and <command>gzip</command> compressed files, with this setting more formats can be added
+ on the fly or the used method can be changed. The syntax for this is:
<synopsis>Acquire::CompressionTypes::<replaceable>FileExtension</replaceable> "<replaceable>Methodname</replaceable>";</synopsis>
- e.g. <synopsis>Acquire::CompressionTypes::bz2 "bzip2";</synopsis>
- Note that at runtime the <literal>Dir::Bin::<replaceable>Methodname</replaceable></literal> will
+ </para><para>Also the <literal>Order</literal> subgroup can be used to define in which order
+ the acquire system will try to download the compressed files. The acquire system will try the first
+ and proceed with the next compression type in this list on error, so to prefer one over the other type
+ simple add the preferred type at first - not already added default types will be added at run time
+ to the end of the list, so e.g. <synopsis>Acquire::CompressionTypes::Order:: "gz";</synopsis> can
+ be used to prefer <command>gzip</command> compressed files over <command>bzip2</command> and <command>lzma</command>.
+ If <command>lzma</command> should be preferred over <command>gzip</command> and <command>bzip2</command> the
+ configure setting should look like this <synopsis>Acquire::CompressionTypes::Order { "lzma"; "gz"; };</synopsis>
+ It is not needed to add <literal>bz2</literal> explicit to the list as it will be added automatic.</para>
+ <para>Note that at run time the <literal>Dir::Bin::<replaceable>Methodname</replaceable></literal> will
be checked: If this setting exists the method will only be used if this file exists, e.g. for
- the bzip2 method above (the inbuilt) setting is <literallayout>Dir::Bin::bzip2 "/bin/bzip2";</literallayout>
- </para></listitem>
+ the bzip2 method (the inbuilt) setting is <literallayout>Dir::Bin::bzip2 "/bin/bzip2";</literallayout>
+ Note also that list entries specified on the commandline will be added at the end of the list
+ specified in the configuration files, but before the default entries. To prefer a type in this case
+ over the ones specified in in the configuration files you can set the option direct - not in list style.
+ This will not override the defined list, it will only prefix the list with this type.</para>
+ <para>While it is possible to add an empty compression type to the order list, but APT in its current
+ version doesn't understand it correctly and will display many warnings about not downloaded files -
+ these warnings are most of the time false negatives. Future versions will maybe include a way to
+ really prefer uncompressed files to support the usage of local mirrors.</para></listitem>
</varlistentry>
</variablelist>
</para>
@@ -844,15 +858,7 @@ is commented.
<refsect1><title>Files</title>
<variablelist>
- <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
- <listitem><para>APT configuration file.
- Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem>
- </varlistentry>
-
- <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
- <listitem><para>APT configuration file fragments.
- Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
- </varlistentry>
+ &file-aptconf;
</variablelist>
</refsect1>
diff --git a/doc/apt.ent b/doc/apt.ent
index 43ac2f8e5..9a4c17bcd 100644
--- a/doc/apt.ent
+++ b/doc/apt.ent
@@ -289,3 +289,67 @@
</para>
">
+<!ENTITY file-aptconf "
+ <varlistentry><term><filename>/etc/apt/apt.conf</filename></term>
+ <listitem><para>APT configuration file.
+ Configuration Item: <literal>Dir::Etc::Main</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><filename>/etc/apt/apt.conf.d/</filename></term>
+ <listitem><para>APT configuration file fragments.
+ Configuration Item: <literal>Dir::Etc::Parts</literal>.</para></listitem>
+ </varlistentry>
+">
+
+<!ENTITY file-cachearchives "
+ <varlistentry><term><filename>&cachedir;/archives/</filename></term>
+ <listitem><para>Storage area for retrieved package files.
+ Configuration Item: <literal>Dir::Cache::Archives</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><filename>&cachedir;/archives/partial/</filename></term>
+ <listitem><para>Storage area for package files in transit.
+ Configuration Item: <literal>Dir::Cache::Archives</literal> (implicit partial). </para></listitem>
+ </varlistentry>
+">
+
+<!ENTITY file-preferences "
+ <varlistentry><term><filename>/etc/apt/preferences</filename></term>
+ <listitem><para>Version preferences file.
+ This is where you would specify &quot;pinning&quot;,
+ i.e. a preference to get certain packages
+ from a separate source
+ or from a different version of a distribution.
+ Configuration Item: <literal>Dir::Etc::Preferences</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><filename>/etc/apt/preferences.d/</filename></term>
+ <listitem><para>File fragments for the version preferences.
+ Configuration Item: <literal>Dir::Etc::PreferencesParts</literal>.</para></listitem>
+ </varlistentry>
+">
+
+<!ENTITY file-sourceslist "
+ <varlistentry><term><filename>/etc/apt/sources.list</filename></term>
+ <listitem><para>Locations to fetch packages from.
+ Configuration Item: <literal>Dir::Etc::SourceList</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><filename>/etc/apt/sources.list.d/</filename></term>
+ <listitem><para>File fragments for locations to fetch packages from.
+ Configuration Item: <literal>Dir::Etc::SourceParts</literal>.</para></listitem>
+ </varlistentry>
+">
+
+<!ENTITY file-statelists "
+ <varlistentry><term><filename>&statedir;/lists/</filename></term>
+ <listitem><para>Storage area for state information for each package resource specified in
+ &sources-list;
+ Configuration Item: <literal>Dir::State::Lists</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
+ <listitem><para>Storage area for state information in transit.
+ Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
+ </varlistentry>
+">
diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml
index 12ea606b7..159d61f2b 100644
--- a/doc/apt_preferences.5.xml
+++ b/doc/apt_preferences.5.xml
@@ -32,7 +32,8 @@
<refsect1>
<title>Description</title>
<para>The APT preferences file <filename>/etc/apt/preferences</filename>
-can be used to control which versions of packages will be selected
+and the fragment files in the <filename>/etc/apt/preferences.d/</filename>
+folder can be used to control which versions of packages will be selected
for installation.</para>
<para>Several versions of a package may be available for installation when
@@ -611,6 +612,13 @@ apt-get install <replaceable>package</replaceable>/sid
</refsect1>
<refsect1>
+<title>Files</title>
+ <variablelist>
+ &file-preferences;
+ </variablelist>
+</refsect1>
+
+<refsect1>
<title>See Also</title>
<para>&apt-get; &apt-cache; &apt-conf; &sources-list;
</para>
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index 5dc7b5246..8025fa4b4 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -246,6 +246,15 @@ Acquire
{
Options {"--ignore-time-conflict";} // not very useful on a normal system
};
+
+ CompressionTypes
+ {
+ bz2 "bzip2";
+ lzma "lzma";
+ gz "gzip";
+
+ Order { "gz"; "lzma"; "bz2"; };
+ };
};
// Directory layout
diff --git a/methods/rred.cc b/methods/rred.cc
index 6fa57f3a6..27d95bdde 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -174,7 +174,7 @@ int RredMethod::ed_file(FILE *ed_cmds, FILE *in_file, FILE *out_file,
hash);
/* read the rest from infile */
- if (result > 0) {
+ if (result >= 0) {
while (fgets(buffer, BUF_SIZE, in_file) != NULL) {
written = fwrite(buffer, 1, strlen(buffer), out_file);
hash->Add((unsigned char*)buffer, written);