| 116 | //--------------------------------------------------------------------------- |
| 117 | |
| 118 | struct IStream |
| 119 | { |
| 120 | public: |
| 121 | IStream(bool use_iostream, const char* filename) : |
| 122 | m_use_iostream(use_iostream), |
| 123 | m_filename(filename), |
| 124 | ifile(NULL), |
| 125 | streami(NULL) |
| 126 | { |
| 127 | if (m_use_iostream) |
| 128 | { |
| 129 | #ifdef LZ_WIN32_VC6 |
| 130 | ifb.open(filename, ios::in); |
| 131 | ifb.setmode(filebuf::binary); |
| 132 | streami = new istream(&ifb); |
| 133 | #else |
| 134 | streami = new ifstream(); |
| 135 | streami->open(filename, std::ios::in | std::ios::binary); |
| 136 | #endif |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | ifile = fopen(filename, "rb"); |
| 141 | } |
| 142 | }; |
| 143 | |
| 144 | ~IStream() |
| 145 | { |
| 146 | if (m_use_iostream) |
| 147 | { |
| 148 | delete streami; |
| 149 | #ifdef LZ_WIN32_VC6 |
| 150 | ifb.close(); |
| 151 | #endif |
| 152 | } |
| 153 | else |
| 154 | { |
| 155 | if (ifile) |
| 156 | fclose(ifile); |
| 157 | } |
| 158 | }; |
| 159 | |
| 160 | bool m_use_iostream; |
| 161 | const char* m_filename; |
| 162 | FILE* ifile; |
| 163 | filebuf ifb; |
| 164 | #ifdef LZ_WIN32_VC6 |
| 165 | istream* streami; |
| 166 | #else |
| 167 | ifstream* streami; |
| 168 | #endif |
| 169 | }; |
| 170 | |
| 171 | |
| 172 | //--------------------------------------------------------------------------- |
nothing calls this directly
no outgoing calls
no test coverage detected