diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-04-15 00:38:48 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-04-15 00:38:48 +0000 |
commit | 78cbd84a0068db09b6d08ff14a316800ad9be89a (patch) | |
tree | 2be608b49b99003d7d6f49ac33abd7bbe763d7d9 /files.cpp | |
parent | 0a0244dacface689335de6e0edf978b29ddb66e1 (diff) | |
download | cryptopp-78cbd84a0068db09b6d08ff14a316800ad9be89a.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)
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@55 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'files.cpp')
-rw-r--r-- | files.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -16,10 +16,12 @@ void Files_TestInstantiations() void FileStore::StoreInitialize(const NameValuePairs ¶meters) { + 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 ¶meters) 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 ¶meters) { 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 ¶meters) else { m_stream = NULL; - parameters.GetValue("OutputStreamPointer", m_stream); + parameters.GetValue(Name::OutputStreamPointer(), m_stream); } } |