Commit 3590487f authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

.

parent 4af8d396
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
{ {
unsigned short rdUShort = 0; unsigned short rdUShort = 0;
if ( stream != NULL ) if ( (stream != NULL) && (position + 2 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*)(&rdUShort), sizeof( rdUShort )); stream->read((unsigned char*)(&rdUShort), sizeof( rdUShort ));
...@@ -42,7 +42,7 @@ public: ...@@ -42,7 +42,7 @@ public:
{ {
short rdShort = 0; short rdShort = 0;
if ( stream != NULL ) if ( (stream != NULL) && (position + 2 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*)(&rdShort), sizeof( rdShort )); stream->read((unsigned char*)(&rdShort), sizeof( rdShort ));
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
{ {
int rdInt = 0; int rdInt = 0;
if ( stream != NULL ) if ( (stream != NULL) && (position + 4 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read( (unsigned char*) &rdInt, sizeof( rdInt ) ); stream->read( (unsigned char*) &rdInt, sizeof( rdInt ) );
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
{ {
int rdUInt = 0; int rdUInt = 0;
if ( stream != NULL ) if ( (stream != NULL) && (position + 4 < stream->size()))
{ {
stream->seek( position ); stream->seek( position );
stream->read((unsigned char*) &rdUInt, sizeof( rdUInt ) ); stream->read((unsigned char*) &rdUInt, sizeof( rdUInt ) );
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
{ {
unsigned char rdByte = 0; unsigned char rdByte = 0;
if ( this->stream != NULL ) if ( (stream != NULL) && (position + 1 < stream->size()))
{ {
stream->seek( position); stream->seek( position);
stream->read( (unsigned char*)&rdByte, sizeof( rdByte ) ); stream->read( (unsigned char*)&rdByte, sizeof( rdByte ) );
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
{ {
unsigned char *rdBytes = NULL; unsigned char *rdBytes = NULL;
if ( ( stream != NULL ) && ( count > 0 ) && isResultNeeded ) if ( ( stream != NULL ) && ( count > 0 ))
{ {
rdBytes = new unsigned char[count]; rdBytes = new unsigned char[count];
...@@ -114,10 +114,6 @@ public: ...@@ -114,10 +114,6 @@ public:
position += sizeof( unsigned char )*count; position += sizeof( unsigned char )*count;
} }
} }
else
{
position += sizeof( unsigned char )*count;
}
return rdBytes; return rdBytes;
} }
...@@ -225,7 +221,6 @@ public: ...@@ -225,7 +221,6 @@ public:
private: private:
POLE::uint64 position; POLE::uint64 position;
//std::streampos position;
POLE::Stream* stream; POLE::Stream* stream;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment