summaryrefslogtreecommitdiff
path: root/files.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2003-04-15 00:38:48 +0000
committerweidai <weidai11@users.noreply.github.com>2003-04-15 00:38:48 +0000
commitd52b49c51f5c87180cb561b666dd6085556f6c3b (patch)
tree2be608b49b99003d7d6f49ac33abd7bbe763d7d9 /files.cpp
parentb4f6ef8e16db0be6ebc3e8aa01bf51ee52082aeb (diff)
downloadcryptopp-git-d52b49c51f5c87180cb561b666dd6085556f6c3b.tar.gz
fix bug in Grouper
add RIPEMD-???, Whirlpool, Shacal2, Camellia, Two-Track MAC (Kevin Springle) change ChannelSwitch to allow non-blocking input (denis bider) change Redirector to allow more options (denis bider) fix MaurerRandomnessTest optimize MD2 (Kevin Springle)
Diffstat (limited to 'files.cpp')
-rw-r--r--files.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/files.cpp b/files.cpp
index 2b42010a..fc32b4b4 100644
--- a/files.cpp
+++ b/files.cpp
@@ -16,10 +16,12 @@ void Files_TestInstantiations()
void FileStore::StoreInitialize(const NameValuePairs &parameters)
{
+ m_file.close();
+ m_file.clear();
const char *fileName;
- if (parameters.GetValue("InputFileName", fileName))
+ if (parameters.GetValue(Name::InputFileName(), fileName))
{
- ios::openmode binary = parameters.GetValueWithDefault("InputBinaryMode", true) ? ios::binary : ios::openmode(0);
+ ios::openmode binary = parameters.GetValueWithDefault(Name::InputBinaryMode(), true) ? ios::binary : ios::openmode(0);
m_file.open(fileName, ios::in | binary);
if (!m_file)
throw OpenErr(fileName);
@@ -28,7 +30,7 @@ void FileStore::StoreInitialize(const NameValuePairs &parameters)
else
{
m_stream = NULL;
- parameters.GetValue("InputStreamPointer", m_stream);
+ parameters.GetValue(Name::InputStreamPointer(), m_stream);
}
m_waiting = false;
}
@@ -137,12 +139,19 @@ unsigned int FileStore::CopyRangeTo2(BufferedTransformation &target, unsigned lo
return 0;
}
+unsigned long FileStore::Skip(unsigned long skipMax)
+{
+ unsigned long oldPos = m_stream->tellg();
+ m_stream->seekg(skipMax, ios_base::cur);
+ return (unsigned long)m_stream->tellg() - oldPos;
+}
+
void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
{
const char *fileName;
- if (parameters.GetValue("OutputFileName", fileName))
+ if (parameters.GetValue(Name::OutputFileName(), fileName))
{
- ios::openmode binary = parameters.GetValueWithDefault("OutputBinaryMode", true) ? ios::binary : ios::openmode(0);
+ ios::openmode binary = parameters.GetValueWithDefault(Name::OutputBinaryMode(), true) ? ios::binary : ios::openmode(0);
m_file.open(fileName, ios::out | ios::trunc | binary);
if (!m_file)
throw OpenErr(fileName);
@@ -151,7 +160,7 @@ void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
else
{
m_stream = NULL;
- parameters.GetValue("OutputStreamPointer", m_stream);
+ parameters.GetValue(Name::OutputStreamPointer(), m_stream);
}
}