@@ -26,10 +26,11 @@ template<typename Stream>
2626class OverrideStream
2727{
2828 Stream* stream;
29- public:
29+
3030 const int nType;
3131 const int nVersion;
3232
33+ public:
3334 OverrideStream (Stream* stream_, int nType_, int nVersion_) : stream(stream_), nType(nType_), nVersion(nVersion_) {}
3435
3536 template <typename T>
@@ -66,9 +67,10 @@ class CDataStream
6667 typedef CSerializeData vector_type;
6768 vector_type vch;
6869 unsigned int nReadPos;
69- public:
70+
7071 int nType;
7172 int nVersion;
73+ public:
7274
7375 typedef vector_type::allocator_type allocator_type;
7476 typedef vector_type::size_type size_type;
@@ -251,9 +253,9 @@ class CDataStream
251253 int in_avail () { return size (); }
252254
253255 void SetType (int n) { nType = n; }
254- int GetType () { return nType; }
256+ int GetType () const { return nType; }
255257 void SetVersion (int n) { nVersion = n; }
256- int GetVersion () { return nVersion; }
258+ int GetVersion () const { return nVersion; }
257259
258260 void read (char * pch, size_t nSize)
259261 {
@@ -380,17 +382,15 @@ class CAutoFile
380382 CAutoFile (const CAutoFile&);
381383 CAutoFile& operator =(const CAutoFile&);
382384
383- int nType;
384- int nVersion;
385-
385+ const int nType;
386+ const int nVersion;
387+
386388 FILE* file;
387389
388390public:
389- CAutoFile (FILE* filenew, int nTypeIn, int nVersionIn)
391+ CAutoFile (FILE* filenew, int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn)
390392 {
391393 file = filenew;
392- nType = nTypeIn;
393- nVersion = nVersionIn;
394394 }
395395
396396 ~CAutoFile ()
@@ -425,10 +425,8 @@ class CAutoFile
425425 //
426426 // Stream subset
427427 //
428- void SetType (int n) { nType = n; }
429- int GetType () { return nType; }
430- void SetVersion (int n) { nVersion = n; }
431- int GetVersion () { return nVersion; }
428+ int GetType () const { return nType; }
429+ int GetVersion () const { return nVersion; }
432430
433431 void read (char * pch, size_t nSize)
434432 {
@@ -500,8 +498,8 @@ class CBufferedFile
500498 CBufferedFile (const CBufferedFile&);
501499 CBufferedFile& operator =(const CBufferedFile&);
502500
503- int nType;
504- int nVersion;
501+ const int nType;
502+ const int nVersion;
505503
506504 FILE *src; // source file
507505 uint64_t nSrcPos; // how many bytes have been read from source
@@ -531,11 +529,9 @@ class CBufferedFile
531529
532530public:
533531 CBufferedFile (FILE *fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn) :
534- nSrcPos (0 ), nReadPos(0 ), nReadLimit((uint64_t )(-1 )), nRewind(nRewindIn), vchBuf(nBufSize, 0 )
532+ nType (nTypeIn), nVersion(nVersionIn), nSrcPos(0 ), nReadPos(0 ), nReadLimit((uint64_t )(-1 )), nRewind(nRewindIn), vchBuf(nBufSize, 0 )
535533 {
536534 src = fileIn;
537- nType = nTypeIn;
538- nVersion = nVersionIn;
539535 }
540536
541537 ~CBufferedFile ()
0 commit comments