summaryrefslogtreecommitdiff
path: root/files.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2003-02-24 01:11:57 +0000
committerweidai <weidai11@users.noreply.github.com>2003-02-24 01:11:57 +0000
commit9ffe5ae0357710e00f0dea7da0e29e55032d8e51 (patch)
tree0a2fa2f29dfbc63bccb0ac631693ce9dc5558030 /files.cpp
parent7c7958ccc0d48a0ec54a58585fa1ae482b6e1eb8 (diff)
downloadcryptopp-git-9ffe5ae0357710e00f0dea7da0e29e55032d8e51.tar.gz
fix whitespace problems
Diffstat (limited to 'files.cpp')
-rw-r--r--files.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/files.cpp b/files.cpp
index 469e7702..2b42010a 100644
--- a/files.cpp
+++ b/files.cpp
@@ -1,11 +1,11 @@
-// files.cpp - written and placed in the public domain by Wei Dai
+// files.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "files.h"
NAMESPACE_BEGIN(CryptoPP)
-using namespace std;
+using namespace std;
void Files_TestInstantiations()
{
@@ -20,7 +20,7 @@ void FileStore::StoreInitialize(const NameValuePairs &parameters)
if (parameters.GetValue("InputFileName", fileName))
{
ios::openmode binary = parameters.GetValueWithDefault("InputBinaryMode", true) ? ios::binary : ios::openmode(0);
- m_file.open(fileName, ios::in | binary);
+ m_file.open(fileName, ios::in | binary);
if (!m_file)
throw OpenErr(fileName);
m_stream = &m_file;
@@ -30,7 +30,7 @@ void FileStore::StoreInitialize(const NameValuePairs &parameters)
m_stream = NULL;
parameters.GetValue("InputStreamPointer", m_stream);
}
- m_waiting = false;
+ m_waiting = false;
}
unsigned long FileStore::MaxRetrievable() const
@@ -38,42 +38,42 @@ unsigned long FileStore::MaxRetrievable() const
if (!m_stream)
return 0;
- streampos current = m_stream->tellg();
- streampos end = m_stream->seekg(0, ios::end).tellg();
+ streampos current = m_stream->tellg();
+ streampos end = m_stream->seekg(0, ios::end).tellg();
m_stream->seekg(current);
return end-current;
}
-unsigned int FileStore::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
+unsigned int FileStore::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
{
if (!m_stream)
{
- transferBytes = 0;
+ transferBytes = 0;
return 0;
}
unsigned long size=transferBytes;
- transferBytes = 0;
+ transferBytes = 0;
if (m_waiting)
goto output;
- while (size && m_stream->good())
+ while (size && m_stream->good())
{
{
unsigned int spaceSize = 1024;
- m_space = HelpCreatePutSpace(target, channel, 1, (unsigned int)STDMIN(size, (unsigned long)UINT_MAX), spaceSize);
+ m_space = HelpCreatePutSpace(target, channel, 1, (unsigned int)STDMIN(size, (unsigned long)UINT_MAX), spaceSize);
- m_stream->read((char *)m_space, STDMIN(size, (unsigned long)spaceSize));
+ m_stream->read((char *)m_space, STDMIN(size, (unsigned long)spaceSize));
}
- m_len = m_stream->gcount();
+ m_len = m_stream->gcount();
unsigned int blockedBytes;
output:
- blockedBytes = target.ChannelPutModifiable2(channel, m_space, m_len, 0, blocking);
- m_waiting = blockedBytes > 0;
+ blockedBytes = target.ChannelPutModifiable2(channel, m_space, m_len, 0, blocking);
+ m_waiting = blockedBytes > 0;
if (m_waiting)
return blockedBytes;
- size -= m_len;
+ size -= m_len;
transferBytes += m_len;
}
@@ -83,41 +83,41 @@ output:
return 0;
}
-unsigned int FileStore::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
+unsigned int FileStore::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
{
if (!m_stream)
return 0;
if (begin == 0 && end == 1)
{
- int result = m_stream->peek();
+ int result = m_stream->peek();
if (result == EOF) // GCC workaround: 2.95.2 doesn't have char_traits<char>::eof()
return 0;
else
{
- unsigned int blockedBytes = target.ChannelPut(channel, byte(result), blocking);
+ unsigned int blockedBytes = target.ChannelPut(channel, byte(result), blocking);
begin += 1-blockedBytes;
return blockedBytes;
}
}
- // TODO: figure out what happens on cin
- streampos current = m_stream->tellg();
- streampos endPosition = m_stream->seekg(0, ios::end).tellg();
- streampos newPosition = current + (streamoff)begin;
+ // TODO: figure out what happens on cin
+ streampos current = m_stream->tellg();
+ streampos endPosition = m_stream->seekg(0, ios::end).tellg();
+ streampos newPosition = current + (streamoff)begin;
- if (newPosition >= endPosition)
+ if (newPosition >= endPosition)
{
m_stream->seekg(current);
- return 0; // don't try to seek beyond the end of file
+ return 0; // don't try to seek beyond the end of file
}
m_stream->seekg(newPosition);
- unsigned long total = 0;
+ unsigned long total = 0;
try
{
assert(!m_waiting);
- unsigned long copyMax = end-begin;
- unsigned int blockedBytes = const_cast<FileStore *>(this)->TransferTo2(target, copyMax, channel, blocking);
+ unsigned long copyMax = end-begin;
+ unsigned int blockedBytes = const_cast<FileStore *>(this)->TransferTo2(target, copyMax, channel, blocking);
begin += copyMax;
if (blockedBytes)
{
@@ -137,13 +137,13 @@ unsigned int FileStore::CopyRangeTo2(BufferedTransformation &target, unsigned lo
return 0;
}
-void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
+void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
{
const char *fileName;
if (parameters.GetValue("OutputFileName", fileName))
{
- ios::openmode binary = parameters.GetValueWithDefault("OutputBinaryMode", true) ? ios::binary : ios::openmode(0);
- m_file.open(fileName, ios::out | ios::trunc | binary);
+ ios::openmode binary = parameters.GetValueWithDefault("OutputBinaryMode", true) ? ios::binary : ios::openmode(0);
+ m_file.open(fileName, ios::out | ios::trunc | binary);
if (!m_file)
throw OpenErr(fileName);
m_stream = &m_file;
@@ -158,7 +158,7 @@ void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
bool FileSink::IsolatedFlush(bool hardFlush, bool blocking)
{
if (!m_stream)
- throw Err("FileSink: output stream not opened");
+ throw Err("FileSink: output stream not opened");
m_stream->flush();
if (!m_stream->good())
@@ -167,12 +167,12 @@ bool FileSink::IsolatedFlush(bool hardFlush, bool blocking)
return false;
}
-unsigned int FileSink::Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
+unsigned int FileSink::Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
{
if (!m_stream)
- throw Err("FileSink: output stream not opened");
+ throw Err("FileSink: output stream not opened");
- m_stream->write((const char *)inString, length);
+ m_stream->write((const char *)inString, length);
if (messageEnd)
m_stream->flush();