summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/BasicStream.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-06-23 21:17:04 +0000
committerMarc Laukien <marc@zeroc.com>2002-06-23 21:17:04 +0000
commit59788b8663f1f05a95b7afbbc6d2846dae11c96a (patch)
treec3ed292df270f11157decb83827d9af4144db52d /cpp/src/Ice/BasicStream.cpp
parentfile run.py was initially added on branch location. (diff)
downloadice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.tar.bz2
ice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.tar.xz
ice-59788b8663f1f05a95b7afbbc6d2846dae11c96a.zip
removed spaces after keywords
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rw-r--r--cpp/src/Ice/BasicStream.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index a960f1d27d8..123178503b6 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -52,7 +52,7 @@ IceInternal::BasicStream::swap(BasicStream& other)
void
IceInternal::BasicStream::resize(int total)
{
- if (total > 1024 * 1024) // TODO: configurable
+ if(total > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
@@ -62,7 +62,7 @@ IceInternal::BasicStream::resize(int total)
void
IceInternal::BasicStream::reserve(int total)
{
- if (total > 1024 * 1024) // TODO: configurable
+ if(total > 1024 * 1024) // TODO: configurable
{
throw MemoryLimitException(__FILE__, __LINE__);
}
@@ -85,7 +85,7 @@ IceInternal::BasicStream::endWriteEncaps()
assert(_currentWriteEncaps);
int start = _currentWriteEncaps->start;
_writeEncapsStack.pop_back();
- if (_writeEncapsStack.empty())
+ if(_writeEncapsStack.empty())
{
_currentWriteEncaps = 0;
}
@@ -107,7 +107,7 @@ IceInternal::BasicStream::startReadEncaps()
{
Byte encoding;
read(encoding);
- if (encoding != 0)
+ if(encoding != 0)
{
throw UnsupportedEncodingException(__FILE__, __LINE__);
}
@@ -120,7 +120,7 @@ IceInternal::BasicStream::startReadEncaps()
// readSize()/writeSize(), it could be 1 or 5 bytes.
//
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -136,7 +136,7 @@ IceInternal::BasicStream::endReadEncaps()
assert(_currentReadEncaps);
int start = _currentReadEncaps->start;
_readEncapsStack.pop_back();
- if (_readEncapsStack.empty())
+ if(_readEncapsStack.empty())
{
_currentReadEncaps = 0;
}
@@ -147,12 +147,12 @@ IceInternal::BasicStream::endReadEncaps()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -167,12 +167,12 @@ IceInternal::BasicStream::checkReadEncaps()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i = save;
- if (sz != i - (b.begin() + start))
+ if(sz != i - (b.begin() + start))
{
throw EncapsulationException(__FILE__, __LINE__);
}
@@ -187,7 +187,7 @@ IceInternal::BasicStream::getReadEncapsSize()
i = b.begin() + start - sizeof(Int);
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -200,18 +200,18 @@ IceInternal::BasicStream::skipEncaps()
{
Byte encoding;
read(encoding);
- if (encoding != 0)
+ if(encoding != 0)
{
throw UnsupportedEncodingException(__FILE__, __LINE__);
}
Int sz;
read(sz);
- if (sz < 0)
+ if(sz < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -220,7 +220,7 @@ IceInternal::BasicStream::skipEncaps()
void
IceInternal::BasicStream::writeSize(Int v)
{
- if (v > 127)
+ if(v > 127)
{
write(Byte(-1));
write(v);
@@ -236,10 +236,10 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
{
Byte b;
read(b);
- if (b < 0)
+ if(b < 0)
{
read(v);
- if (v < 0)
+ if(v < 0)
{
throw NegativeSizeException(__FILE__, __LINE__);
}
@@ -263,7 +263,7 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
{
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -284,7 +284,7 @@ IceInternal::BasicStream::write(const vector<Byte>& v)
void
IceInternal::BasicStream::read(Byte& v)
{
- if (i >= b.end())
+ if(i >= b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -298,7 +298,7 @@ IceInternal::BasicStream::read(vector<Byte>& v)
readSize(sz);
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -319,7 +319,7 @@ IceInternal::BasicStream::write(const vector<bool>& v)
void
IceInternal::BasicStream::read(bool& v)
{
- if (i >= b.end())
+ if(i >= b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -333,7 +333,7 @@ IceInternal::BasicStream::read(vector<bool>& v)
readSize(sz);
Container::iterator begin = i;
i += sz;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -359,13 +359,13 @@ IceInternal::BasicStream::write(const vector<Short>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Short));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Short), b.begin() + pos);
p += sizeof(Short);
@@ -382,7 +382,7 @@ IceInternal::BasicStream::read(Short& v)
{
Container::iterator begin = i;
i += sizeof(Short);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -400,15 +400,15 @@ IceInternal::BasicStream::read(vector<Short>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Short);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Short), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Short);
@@ -437,13 +437,13 @@ IceInternal::BasicStream::write(const vector<Int>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Int));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Int), b.begin() + pos);
p += sizeof(Int);
@@ -460,7 +460,7 @@ IceInternal::BasicStream::read(Int& v)
{
Container::iterator begin = i;
i += sizeof(Int);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -478,15 +478,15 @@ IceInternal::BasicStream::read(vector<Int>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Int);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Int), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Int);
@@ -515,13 +515,13 @@ IceInternal::BasicStream::write(const vector<Long>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Long));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Long), b.begin() + pos);
p += sizeof(Long);
@@ -538,7 +538,7 @@ IceInternal::BasicStream::read(Long& v)
{
Container::iterator begin = i;
i += sizeof(Long);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -556,15 +556,15 @@ IceInternal::BasicStream::read(vector<Long>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Long);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Long), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Long);
@@ -593,13 +593,13 @@ IceInternal::BasicStream::write(const vector<Float>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Float));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Float), b.begin() + pos);
p += sizeof(Float);
@@ -616,7 +616,7 @@ IceInternal::BasicStream::read(Float& v)
{
Container::iterator begin = i;
i += sizeof(Float);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -634,15 +634,15 @@ IceInternal::BasicStream::read(vector<Float>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Float);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Float), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Float);
@@ -671,13 +671,13 @@ IceInternal::BasicStream::write(const vector<Double>& v)
{
Int sz = v.size();
writeSize(sz);
- if (sz > 0)
+ if(sz > 0)
{
int pos = b.size();
resize(pos + sz * sizeof(Double));
const Byte* p = reinterpret_cast<const Byte*>(&v[0]);
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(p, p + sizeof(Double), b.begin() + pos);
p += sizeof(Double);
@@ -694,7 +694,7 @@ IceInternal::BasicStream::read(Double& v)
{
Container::iterator begin = i;
i += sizeof(Double);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -712,15 +712,15 @@ IceInternal::BasicStream::read(vector<Double>& v)
readSize(sz);
Container::iterator begin = i;
i += sz * sizeof(Double);
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
v.resize(sz);
- if (sz > 0)
+ if(sz > 0)
{
#ifdef ICE_UTIL_BIGENDIAN
- for (int j = 0 ; j < sz ; ++j)
+ for(int j = 0 ; j < sz ; ++j)
{
reverse_copy(begin, begin + sizeof(Double), reinterpret_cast<Byte*>(&v[j]));
begin += sizeof(Double);
@@ -736,7 +736,7 @@ IceInternal::BasicStream::write(const string& v)
{
Int len = v.size();
writeSize(len);
- if (len > 0)
+ if(len > 0)
{
int pos = b.size();
resize(pos + len);
@@ -749,7 +749,7 @@ IceInternal::BasicStream::write(const vector<string>& v)
{
writeSize(Int(v.size()));
vector<string>::const_iterator p;
- for (p = v.begin(); p != v.end(); ++p)
+ for(p = v.begin(); p != v.end(); ++p)
{
write(*p);
}
@@ -761,7 +761,7 @@ IceInternal::BasicStream::read(string& v)
Int len;
readSize(len);
- if (len <= 0)
+ if(len <= 0)
{
v.erase();
}
@@ -769,7 +769,7 @@ IceInternal::BasicStream::read(string& v)
{
Container::iterator begin = i;
i += len;
- if (i > b.end())
+ if(i > b.end())
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
@@ -785,7 +785,7 @@ IceInternal::BasicStream::read(vector<string>& v)
readSize(sz);
// Don't use v.resize(sz) or v.reserve(sz) here, as it cannot be
// checked whether sz is a reasonable value
- while (sz--)
+ while(sz--)
{
string s;
read(s);
@@ -808,14 +808,14 @@ IceInternal::BasicStream::read(ObjectPrx& v)
void
IceInternal::BasicStream::write(const ObjectPtr& v)
{
- if (!_currentWriteEncaps) // Lazy initialization
+ if(!_currentWriteEncaps) // Lazy initialization
{
_writeEncapsStack.resize(1);
_currentWriteEncaps = &_writeEncapsStack.back();
}
map<ObjectPtr, Int>::const_iterator p = _currentWriteEncaps->objectsWritten.find(v.get());
- if (p != _currentWriteEncaps->objectsWritten.end())
+ if(p != _currentWriteEncaps->objectsWritten.end())
{
write(p->second);
}
@@ -823,7 +823,7 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
{
write(Int(-1));
- if (v)
+ if(v)
{
Int num = _currentWriteEncaps->objectsWritten.size();
_currentWriteEncaps->objectsWritten[v.get()] = num;
@@ -841,7 +841,7 @@ IceInternal::BasicStream::write(const ObjectPtr& v)
void
IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryPtr& factory, ObjectPtr& v)
{
- if (!_currentReadEncaps) // Lazy initialization
+ if(!_currentReadEncaps) // Lazy initialization
{
_readEncapsStack.resize(1);
_currentReadEncaps = &_readEncapsStack.back();
@@ -850,9 +850,9 @@ IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryP
Int pos;
read(pos);
- if (pos >= 0)
+ if(pos >= 0)
{
- if (static_cast<vector<ObjectPtr>::size_type>(pos) >= _currentReadEncaps->objectsRead.size())
+ if(static_cast<vector<ObjectPtr>::size_type>(pos) >= _currentReadEncaps->objectsRead.size())
{
throw IllegalIndirectionException(__FILE__, __LINE__);
}
@@ -864,31 +864,31 @@ IceInternal::BasicStream::read(const string& signatureType, const ObjectFactoryP
string id;
read(id);
- if (id.empty())
+ if(id.empty())
{
v = 0;
return;
}
- else if (id == iceObject)
+ else if(id == iceObject)
{
v = new ::Ice::Object;
}
else
{
ObjectFactoryPtr userFactory = _instance->servantFactoryManager()->find(id);
- if (userFactory)
+ if(userFactory)
{
v = userFactory->create(id);
}
- if (!v && id == signatureType)
+ if(!v && id == signatureType)
{
assert(factory);
v = factory->create(id);
assert(v);
}
- if (!v)
+ if(!v)
{
throw NoObjectFactoryException(__FILE__, __LINE__);
}
@@ -912,7 +912,7 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
read(id);
UserExceptionFactoryPtr factory = _instance->userExceptionFactoryManager()->find(id);
- if (factory)
+ if(factory)
{
try
{
@@ -921,9 +921,9 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
catch (UserException& ex)
{
static const string userException("::Ice::UserException");
- for (const string* p = ex.__getExceptionIds(); *p != userException != 0; ++p)
+ for(const string* p = ex.__getExceptionIds(); *p != userException != 0; ++p)
{
- if (binary_search(throwsBegin, throwsEnd, string(*p)))
+ if(binary_search(throwsBegin, throwsEnd, string(*p)))
{
ex.__read(this);
ex.ice_throw();
@@ -935,7 +935,7 @@ IceInternal::BasicStream::throwException(const string* throwsBegin, const string
}
pair<const string*, const string*> p = equal_range(throwsBegin, throwsEnd, id);
- if (p.first != p.second)
+ if(p.first != p.second)
{
return p.first - throwsBegin;
}