--------------------------------------------------------------------- Setup a temporary read limit * * @param _limit Maximum number of bytes to be read from * the beginning of the file. Specifying UINT_MAX * resets the limit to the original end of the stream. * @return The previously set limit. */
| 263 | * resets the limit to the original end of the stream. |
| 264 | * @return The previously set limit. */ |
| 265 | unsigned int SetReadLimit(unsigned int _limit) { |
| 266 | unsigned int prev = GetReadLimit(); |
| 267 | if (UINT_MAX == _limit) { |
| 268 | mLimit = mEnd; |
| 269 | return prev; |
| 270 | } |
| 271 | |
| 272 | mLimit = mBuffer + _limit; |
| 273 | if (mLimit > mEnd) { |
| 274 | throw DeadlyImportError("StreamReader: Invalid read limit"); |
| 275 | } |
| 276 | return prev; |
| 277 | } |
| 278 | |
| 279 | // --------------------------------------------------------------------- |
| 280 | /** Get the current read limit in bytes. Reading over this limit |
no test coverage detected