| @@ -24,16 +24,13 @@ namespace juce | |||||
| { | { | ||||
| DirectoryIterator::DirectoryIterator (const File& directory, bool recursive, | DirectoryIterator::DirectoryIterator (const File& directory, bool recursive, | ||||
| const String& pattern, const int type) | |||||
| const String& pattern, int type) | |||||
| : wildCards (parseWildcards (pattern)), | : wildCards (parseWildcards (pattern)), | ||||
| fileFinder (directory, (recursive || wildCards.size() > 1) ? "*" : pattern), | fileFinder (directory, (recursive || wildCards.size() > 1) ? "*" : pattern), | ||||
| wildCard (pattern), | wildCard (pattern), | ||||
| path (File::addTrailingSeparator (directory.getFullPathName())), | path (File::addTrailingSeparator (directory.getFullPathName())), | ||||
| index (-1), | |||||
| totalNumFiles (-1), | |||||
| whatToLookFor (type), | whatToLookFor (type), | ||||
| isRecursive (recursive), | |||||
| hasBeenAdvanced (false) | |||||
| isRecursive (recursive) | |||||
| { | { | ||||
| // you have to specify the type of files you're looking for! | // you have to specify the type of files you're looking for! | ||||
| jassert ((type & (File::findFiles | File::findDirectories)) != 0); | jassert ((type & (File::findFiles | File::findDirectories)) != 0); | ||||
| @@ -53,10 +50,10 @@ StringArray DirectoryIterator::parseWildcards (const String& pattern) | |||||
| return s; | return s; | ||||
| } | } | ||||
| bool DirectoryIterator::fileMatches (const StringArray& wildCards, const String& filename) | |||||
| bool DirectoryIterator::fileMatches (const StringArray& wildcards, const String& filename) | |||||
| { | { | ||||
| for (int i = 0; i < wildCards.size(); ++i) | |||||
| if (filename.matchesWildcard (wildCards[i], ! File::areFileNamesCaseSensitive())) | |||||
| for (auto& w : wildcards) | |||||
| if (filename.matchesWildcard (w, ! File::areFileNamesCaseSensitive())) | |||||
| return true; | return true; | ||||
| return false; | return false; | ||||
| @@ -67,8 +64,8 @@ bool DirectoryIterator::next() | |||||
| return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); | return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); | ||||
| } | } | ||||
| bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResult, int64* const fileSize, | |||||
| Time* const modTime, Time* const creationTime, bool* const isReadOnly) | |||||
| bool DirectoryIterator::next (bool* isDirResult, bool* isHiddenResult, int64* fileSize, | |||||
| Time* modTime, Time* creationTime, bool* isReadOnly) | |||||
| { | { | ||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| @@ -156,8 +153,8 @@ float DirectoryIterator::getEstimatedProgress() const | |||||
| if (totalNumFiles <= 0) | if (totalNumFiles <= 0) | ||||
| return 0.0f; | return 0.0f; | ||||
| const float detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress() | |||||
| : (float) index; | |||||
| auto detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress() | |||||
| : (float) index; | |||||
| return jlimit (0.0f, 1.0f, detailedIndex / totalNumFiles); | return jlimit (0.0f, 1.0f, detailedIndex / totalNumFiles); | ||||
| } | } | ||||
| @@ -140,11 +140,11 @@ private: | |||||
| StringArray wildCards; | StringArray wildCards; | ||||
| NativeIterator fileFinder; | NativeIterator fileFinder; | ||||
| String wildCard, path; | String wildCard, path; | ||||
| int index; | |||||
| mutable int totalNumFiles; | |||||
| int index = -1; | |||||
| mutable int totalNumFiles = -1; | |||||
| const int whatToLookFor; | const int whatToLookFor; | ||||
| const bool isRecursive; | const bool isRecursive; | ||||
| bool hasBeenAdvanced; | |||||
| bool hasBeenAdvanced = false; | |||||
| ScopedPointer<DirectoryIterator> subIterator; | ScopedPointer<DirectoryIterator> subIterator; | ||||
| File currentFile; | File currentFile; | ||||
| @@ -27,11 +27,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); | |||||
| //============================================================================== | //============================================================================== | ||||
| FileInputStream::FileInputStream (const File& f) | |||||
| : file (f), | |||||
| fileHandle (nullptr), | |||||
| currentPosition (0), | |||||
| status (Result::ok()) | |||||
| FileInputStream::FileInputStream (const File& f) : file (f) | |||||
| { | { | ||||
| openHandle(); | openHandle(); | ||||
| } | } | ||||
| @@ -53,7 +49,7 @@ int FileInputStream::read (void* buffer, int bytesToRead) | |||||
| // sign that something is broken! | // sign that something is broken! | ||||
| jassert (buffer != nullptr && bytesToRead >= 0); | jassert (buffer != nullptr && bytesToRead >= 0); | ||||
| const size_t num = readInternal (buffer, (size_t) bytesToRead); | |||||
| auto num = readInternal (buffer, (size_t) bytesToRead); | |||||
| currentPosition += (int64) num; | currentPosition += (int64) num; | ||||
| return (int) num; | return (int) num; | ||||
| @@ -75,9 +75,9 @@ public: | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| const File file; | const File file; | ||||
| void* fileHandle; | |||||
| int64 currentPosition; | |||||
| Result status; | |||||
| void* fileHandle = nullptr; | |||||
| int64 currentPosition = 0; | |||||
| Result status { Result::ok() }; | |||||
| void openHandle(); | void openHandle(); | ||||
| size_t readInternal (void*, size_t); | size_t readInternal (void*, size_t); | ||||
| @@ -28,11 +28,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); | |||||
| //============================================================================== | //============================================================================== | ||||
| FileOutputStream::FileOutputStream (const File& f, const size_t bufferSizeToUse) | FileOutputStream::FileOutputStream (const File& f, const size_t bufferSizeToUse) | ||||
| : file (f), | : file (f), | ||||
| fileHandle (nullptr), | |||||
| status (Result::ok()), | |||||
| currentPosition (0), | |||||
| bufferSize (bufferSizeToUse), | bufferSize (bufferSizeToUse), | ||||
| bytesInBuffer (0), | |||||
| buffer (jmax (bufferSizeToUse, (size_t) 16)) | buffer (jmax (bufferSizeToUse, (size_t) 16)) | ||||
| { | { | ||||
| openHandle(); | openHandle(); | ||||
| @@ -102,7 +98,7 @@ bool FileOutputStream::write (const void* const src, const size_t numBytes) | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const ssize_t bytesWritten = writeInternal (src, numBytes); | |||||
| auto bytesWritten = writeInternal (src, numBytes); | |||||
| if (bytesWritten < 0) | if (bytesWritten < 0) | ||||
| return false; | return false; | ||||
| @@ -94,10 +94,10 @@ public: | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| File file; | File file; | ||||
| void* fileHandle; | |||||
| Result status; | |||||
| int64 currentPosition; | |||||
| size_t bufferSize, bytesInBuffer; | |||||
| void* fileHandle = nullptr; | |||||
| Result status { Result::ok() }; | |||||
| int64 currentPosition = 0; | |||||
| size_t bufferSize, bytesInBuffer = 0; | |||||
| HeapBlock<char> buffer; | HeapBlock<char> buffer; | ||||
| void openHandle(); | void openHandle(); | ||||
| @@ -55,8 +55,8 @@ void FileSearchPath::init (const String& path) | |||||
| directories.trim(); | directories.trim(); | ||||
| directories.removeEmptyStrings(); | directories.removeEmptyStrings(); | ||||
| for (int i = directories.size(); --i >= 0;) | |||||
| directories.set (i, directories[i].unquoted()); | |||||
| for (auto& d : directories) | |||||
| d = d.unquoted(); | |||||
| } | } | ||||
| int FileSearchPath::getNumPaths() const | int FileSearchPath::getNumPaths() const | ||||
| @@ -64,37 +64,38 @@ int FileSearchPath::getNumPaths() const | |||||
| return directories.size(); | return directories.size(); | ||||
| } | } | ||||
| File FileSearchPath::operator[] (const int index) const | |||||
| File FileSearchPath::operator[] (int index) const | |||||
| { | { | ||||
| return File (directories [index]); | |||||
| return File (directories[index]); | |||||
| } | } | ||||
| String FileSearchPath::toString() const | String FileSearchPath::toString() const | ||||
| { | { | ||||
| StringArray directories2 (directories); | |||||
| for (int i = directories2.size(); --i >= 0;) | |||||
| if (directories2[i].containsChar (';')) | |||||
| directories2.set (i, directories2[i].quoted()); | |||||
| auto dirs = directories; | |||||
| for (auto& d : dirs) | |||||
| if (d.containsChar (';')) | |||||
| d = d.quoted(); | |||||
| return directories2.joinIntoString (";"); | |||||
| return dirs.joinIntoString (";"); | |||||
| } | } | ||||
| void FileSearchPath::add (const File& dir, const int insertIndex) | |||||
| void FileSearchPath::add (const File& dir, int insertIndex) | |||||
| { | { | ||||
| directories.insert (insertIndex, dir.getFullPathName()); | directories.insert (insertIndex, dir.getFullPathName()); | ||||
| } | } | ||||
| bool FileSearchPath::addIfNotAlreadyThere (const File& dir) | bool FileSearchPath::addIfNotAlreadyThere (const File& dir) | ||||
| { | { | ||||
| for (int i = 0; i < directories.size(); ++i) | |||||
| if (File (directories[i]) == dir) | |||||
| for (auto& d : directories) | |||||
| if (File (d) == dir) | |||||
| return false; | return false; | ||||
| add (dir); | add (dir); | ||||
| return true; | return true; | ||||
| } | } | ||||
| void FileSearchPath::remove (const int index) | |||||
| void FileSearchPath::remove (int index) | |||||
| { | { | ||||
| directories.remove (index); | directories.remove (index); | ||||
| } | } | ||||
| @@ -115,7 +116,7 @@ void FileSearchPath::removeRedundantPaths() | |||||
| { | { | ||||
| const File d2 (directories[j]); | const File d2 (directories[j]); | ||||
| if ((i != j) && (d1.isAChildOf (d2) || d1 == d2)) | |||||
| if (i != j && (d1.isAChildOf (d2) || d1 == d2)) | |||||
| { | { | ||||
| directories.remove (i); | directories.remove (i); | ||||
| break; | break; | ||||
| @@ -131,18 +132,13 @@ void FileSearchPath::removeNonExistentPaths() | |||||
| directories.remove (i); | directories.remove (i); | ||||
| } | } | ||||
| int FileSearchPath::findChildFiles (Array<File>& results, | |||||
| const int whatToLookFor, | |||||
| const bool searchRecursively, | |||||
| const String& wildCardPattern) const | |||||
| int FileSearchPath::findChildFiles (Array<File>& results, int whatToLookFor, | |||||
| bool recurse, const String& wildcard) const | |||||
| { | { | ||||
| int total = 0; | int total = 0; | ||||
| for (int i = 0; i < directories.size(); ++i) | |||||
| total += operator[] (i).findChildFiles (results, | |||||
| whatToLookFor, | |||||
| searchRecursively, | |||||
| wildCardPattern); | |||||
| for (auto& d : directories) | |||||
| total += File (d).findChildFiles (results, whatToLookFor, recurse, wildcard); | |||||
| return total; | return total; | ||||
| } | } | ||||
| @@ -150,18 +146,16 @@ int FileSearchPath::findChildFiles (Array<File>& results, | |||||
| bool FileSearchPath::isFileInPath (const File& fileToCheck, | bool FileSearchPath::isFileInPath (const File& fileToCheck, | ||||
| const bool checkRecursively) const | const bool checkRecursively) const | ||||
| { | { | ||||
| for (int i = directories.size(); --i >= 0;) | |||||
| for (auto& d : directories) | |||||
| { | { | ||||
| const File d (directories[i]); | |||||
| if (checkRecursively) | if (checkRecursively) | ||||
| { | { | ||||
| if (fileToCheck.isAChildOf (d)) | |||||
| if (fileToCheck.isAChildOf (File (d))) | |||||
| return true; | return true; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| if (fileToCheck.getParentDirectory() == d) | |||||
| if (fileToCheck.getParentDirectory() == File (d)) | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -24,7 +24,7 @@ namespace juce | |||||
| { | { | ||||
| static File createTempFile (const File& parentDirectory, String name, | static File createTempFile (const File& parentDirectory, String name, | ||||
| const String& suffix, const int optionFlags) | |||||
| const String& suffix, int optionFlags) | |||||
| { | { | ||||
| if ((optionFlags & TemporaryFile::useHiddenFile) != 0) | if ((optionFlags & TemporaryFile::useHiddenFile) != 0) | ||||
| name = "." + name; | name = "." + name; | ||||
| @@ -26,23 +26,22 @@ namespace juce | |||||
| static void parseWildcard (const String& pattern, StringArray& result) | static void parseWildcard (const String& pattern, StringArray& result) | ||||
| { | { | ||||
| result.addTokens (pattern.toLowerCase(), ";,", "\"'"); | result.addTokens (pattern.toLowerCase(), ";,", "\"'"); | ||||
| result.trim(); | result.trim(); | ||||
| result.removeEmptyStrings(); | result.removeEmptyStrings(); | ||||
| // special case for *.*, because people use it to mean "any file", but it | // special case for *.*, because people use it to mean "any file", but it | ||||
| // would actually ignore files with no extension. | // would actually ignore files with no extension. | ||||
| for (int i = result.size(); --i >= 0;) | |||||
| if (result[i] == "*.*") | |||||
| result.set (i, "*"); | |||||
| for (auto& r : result) | |||||
| if (r == "*.*") | |||||
| r = "*"; | |||||
| } | } | ||||
| static bool matchWildcard (const File& file, const StringArray& wildcards) | static bool matchWildcard (const File& file, const StringArray& wildcards) | ||||
| { | { | ||||
| const String filename (file.getFileName()); | |||||
| auto filename = file.getFileName(); | |||||
| for (int i = wildcards.size(); --i >= 0;) | |||||
| if (filename.matchesWildcard (wildcards[i], true)) | |||||
| for (auto& w : wildcards) | |||||
| if (filename.matchesWildcard (w, true)) | |||||
| return true; | return true; | ||||
| return false; | return false; | ||||
| @@ -59,8 +59,10 @@ BufferedInputStream::~BufferedInputStream() | |||||
| //============================================================================== | //============================================================================== | ||||
| char BufferedInputStream::peekByte() | char BufferedInputStream::peekByte() | ||||
| { | { | ||||
| ensureBuffered(); | |||||
| return position < lastReadPos ? *(buffer + (int) (position - bufferStart)) : 0; | |||||
| if (! ensureBuffered()) | |||||
| return 0; | |||||
| return position < lastReadPos ? buffer[(int) (position - bufferStart)] : 0; | |||||
| } | } | ||||
| int64 BufferedInputStream::getTotalLength() | int64 BufferedInputStream::getTotalLength() | ||||
| @@ -84,7 +86,7 @@ bool BufferedInputStream::isExhausted() | |||||
| return position >= lastReadPos && source->isExhausted(); | return position >= lastReadPos && source->isExhausted(); | ||||
| } | } | ||||
| void BufferedInputStream::ensureBuffered() | |||||
| bool BufferedInputStream::ensureBuffered() | |||||
| { | { | ||||
| auto bufferEndOverlap = lastReadPos - bufferOverlap; | auto bufferEndOverlap = lastReadPos - bufferOverlap; | ||||
| @@ -100,24 +102,35 @@ void BufferedInputStream::ensureBuffered() | |||||
| memmove (buffer, buffer + (int) (position - bufferStart), (size_t) bytesToKeep); | memmove (buffer, buffer + (int) (position - bufferStart), (size_t) bytesToKeep); | ||||
| bufferStart = position; | bufferStart = position; | ||||
| bytesRead = source->read (buffer + bytesToKeep, | bytesRead = source->read (buffer + bytesToKeep, | ||||
| (int) (bufferSize - bytesToKeep)); | (int) (bufferSize - bytesToKeep)); | ||||
| if (bytesRead < 0) | |||||
| return false; | |||||
| lastReadPos += bytesRead; | lastReadPos += bytesRead; | ||||
| bytesRead += bytesToKeep; | bytesRead += bytesToKeep; | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| bufferStart = position; | bufferStart = position; | ||||
| source->setPosition (bufferStart); | |||||
| if (! source->setPosition (bufferStart)) | |||||
| return false; | |||||
| bytesRead = source->read (buffer, bufferSize); | bytesRead = source->read (buffer, bufferSize); | ||||
| if (bytesRead < 0) | |||||
| return false; | |||||
| lastReadPos = bufferStart + bytesRead; | lastReadPos = bufferStart + bytesRead; | ||||
| } | } | ||||
| while (bytesRead < bufferSize) | while (bytesRead < bufferSize) | ||||
| buffer [bytesRead++] = 0; | |||||
| buffer[bytesRead++] = 0; | |||||
| } | } | ||||
| return true; | |||||
| } | } | ||||
| int BufferedInputStream::read (void* destBuffer, int maxBytesToRead) | int BufferedInputStream::read (void* destBuffer, int maxBytesToRead) | ||||
| @@ -133,7 +146,8 @@ int BufferedInputStream::read (void* destBuffer, int maxBytesToRead) | |||||
| } | } | ||||
| if (position < bufferStart || position >= lastReadPos) | if (position < bufferStart || position >= lastReadPos) | ||||
| ensureBuffered(); | |||||
| if (! ensureBuffered()) | |||||
| return 0; | |||||
| int bytesRead = 0; | int bytesRead = 0; | ||||
| @@ -151,12 +165,10 @@ int BufferedInputStream::read (void* destBuffer, int maxBytesToRead) | |||||
| } | } | ||||
| auto oldLastReadPos = lastReadPos; | auto oldLastReadPos = lastReadPos; | ||||
| ensureBuffered(); | |||||
| if (oldLastReadPos == lastReadPos) | |||||
| break; // if ensureBuffered() failed to read any more data, bail out | |||||
| if (isExhausted()) | |||||
| if (! ensureBuffered() | |||||
| || oldLastReadPos == lastReadPos | |||||
| || isExhausted()) | |||||
| break; | break; | ||||
| } | } | ||||
| @@ -80,7 +80,7 @@ private: | |||||
| int bufferSize; | int bufferSize; | ||||
| int64 position, lastReadPos = 0, bufferStart, bufferOverlap = 128; | int64 position, lastReadPos = 0, bufferStart, bufferOverlap = 128; | ||||
| HeapBlock<char> buffer; | HeapBlock<char> buffer; | ||||
| void ensureBuffered(); | |||||
| bool ensureBuffered(); | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferedInputStream) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferedInputStream) | ||||
| }; | }; | ||||
| @@ -23,24 +23,19 @@ | |||||
| namespace juce | namespace juce | ||||
| { | { | ||||
| MemoryInputStream::MemoryInputStream (const void* const sourceData, | |||||
| const size_t sourceDataSize, | |||||
| const bool keepInternalCopy) | |||||
| MemoryInputStream::MemoryInputStream (const void* sourceData, size_t sourceDataSize, bool keepCopy) | |||||
| : data (sourceData), | : data (sourceData), | ||||
| dataSize (sourceDataSize), | |||||
| position (0) | |||||
| dataSize (sourceDataSize) | |||||
| { | { | ||||
| if (keepInternalCopy) | |||||
| if (keepCopy) | |||||
| createInternalCopy(); | createInternalCopy(); | ||||
| } | } | ||||
| MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData, | |||||
| const bool keepInternalCopy) | |||||
| MemoryInputStream::MemoryInputStream (const MemoryBlock& sourceData, bool keepCopy) | |||||
| : data (sourceData.getData()), | : data (sourceData.getData()), | ||||
| dataSize (sourceData.getSize()), | |||||
| position (0) | |||||
| dataSize (sourceData.getSize()) | |||||
| { | { | ||||
| if (keepInternalCopy) | |||||
| if (keepCopy) | |||||
| createInternalCopy(); | createInternalCopy(); | ||||
| } | } | ||||
| @@ -60,14 +55,14 @@ int64 MemoryInputStream::getTotalLength() | |||||
| return (int64) dataSize; | return (int64) dataSize; | ||||
| } | } | ||||
| int MemoryInputStream::read (void* const buffer, const int howMany) | |||||
| int MemoryInputStream::read (void* buffer, int howMany) | |||||
| { | { | ||||
| jassert (buffer != nullptr && howMany >= 0); | jassert (buffer != nullptr && howMany >= 0); | ||||
| if (howMany <= 0 || position >= dataSize) | if (howMany <= 0 || position >= dataSize) | ||||
| return 0; | return 0; | ||||
| const size_t num = jmin ((size_t) howMany, dataSize - position); | |||||
| auto num = jmin ((size_t) howMany, dataSize - position); | |||||
| if (num > 0) | if (num > 0) | ||||
| { | { | ||||
| @@ -71,7 +71,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| int64 getPosition() override; | int64 getPosition() override; | ||||
| bool setPosition (int64 pos) override; | |||||
| bool setPosition (int64) override; | |||||
| int64 getTotalLength() override; | int64 getTotalLength() override; | ||||
| bool isExhausted() override; | bool isExhausted() override; | ||||
| int read (void* destBuffer, int maxBytesToRead) override; | int read (void* destBuffer, int maxBytesToRead) override; | ||||
| @@ -79,7 +79,7 @@ public: | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| const void* data; | const void* data; | ||||
| size_t dataSize, position; | |||||
| size_t dataSize, position = 0; | |||||
| HeapBlock<char> internalCopy; | HeapBlock<char> internalCopy; | ||||
| void createInternalCopy(); | void createInternalCopy(); | ||||
| @@ -23,9 +23,9 @@ | |||||
| namespace juce | namespace juce | ||||
| { | { | ||||
| SubregionStream::SubregionStream (InputStream* const sourceStream, | |||||
| const int64 start, const int64 length, | |||||
| const bool deleteSourceWhenDestroyed) | |||||
| SubregionStream::SubregionStream (InputStream* sourceStream, | |||||
| int64 start, int64 length, | |||||
| bool deleteSourceWhenDestroyed) | |||||
| : source (sourceStream, deleteSourceWhenDestroyed), | : source (sourceStream, deleteSourceWhenDestroyed), | ||||
| startPositionInSourceStream (start), | startPositionInSourceStream (start), | ||||
| lengthOfSourceStream (length) | lengthOfSourceStream (length) | ||||
| @@ -39,7 +39,7 @@ SubregionStream::~SubregionStream() | |||||
| int64 SubregionStream::getTotalLength() | int64 SubregionStream::getTotalLength() | ||||
| { | { | ||||
| const int64 srcLen = source->getTotalLength() - startPositionInSourceStream; | |||||
| auto srcLen = source->getTotalLength() - startPositionInSourceStream; | |||||
| return lengthOfSourceStream >= 0 ? jmin (lengthOfSourceStream, srcLen) | return lengthOfSourceStream >= 0 ? jmin (lengthOfSourceStream, srcLen) | ||||
| : srcLen; | : srcLen; | ||||
| @@ -191,10 +191,7 @@ GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream* source, b | |||||
| : sourceStream (source, deleteSourceWhenDestroyed), | : sourceStream (source, deleteSourceWhenDestroyed), | ||||
| uncompressedStreamLength (uncompressedLength), | uncompressedStreamLength (uncompressedLength), | ||||
| format (f), | format (f), | ||||
| isEof (false), | |||||
| activeBufferSize (0), | |||||
| originalSourcePos (source->getPosition()), | originalSourcePos (source->getPosition()), | ||||
| currentPos (0), | |||||
| buffer ((size_t) GZIPDecompressHelper::gzipDecompBufferSize), | buffer ((size_t) GZIPDecompressHelper::gzipDecompBufferSize), | ||||
| helper (new GZIPDecompressHelper (f)) | helper (new GZIPDecompressHelper (f)) | ||||
| { | { | ||||
| @@ -204,10 +201,7 @@ GZIPDecompressorInputStream::GZIPDecompressorInputStream (InputStream& source) | |||||
| : sourceStream (&source, false), | : sourceStream (&source, false), | ||||
| uncompressedStreamLength (-1), | uncompressedStreamLength (-1), | ||||
| format (zlibFormat), | format (zlibFormat), | ||||
| isEof (false), | |||||
| activeBufferSize (0), | |||||
| originalSourcePos (source.getPosition()), | originalSourcePos (source.getPosition()), | ||||
| currentPos (0), | |||||
| buffer ((size_t) GZIPDecompressHelper::gzipDecompBufferSize), | buffer ((size_t) GZIPDecompressHelper::gzipDecompBufferSize), | ||||
| helper (new GZIPDecompressHelper (zlibFormat)) | helper (new GZIPDecompressHelper (zlibFormat)) | ||||
| { | { | ||||
| @@ -229,11 +223,11 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany) | |||||
| if (howMany > 0 && ! isEof) | if (howMany > 0 && ! isEof) | ||||
| { | { | ||||
| int numRead = 0; | int numRead = 0; | ||||
| uint8* d = static_cast<uint8*> (destBuffer); | |||||
| auto d = static_cast<uint8*> (destBuffer); | |||||
| while (! helper->error) | while (! helper->error) | ||||
| { | { | ||||
| const int n = helper->doNextBlock (d, (unsigned int) howMany); | |||||
| auto n = helper->doNextBlock (d, (unsigned int) howMany); | |||||
| currentPos += n; | currentPos += n; | ||||
| if (n == 0) | if (n == 0) | ||||
| @@ -82,9 +82,9 @@ private: | |||||
| OptionalScopedPointer<InputStream> sourceStream; | OptionalScopedPointer<InputStream> sourceStream; | ||||
| const int64 uncompressedStreamLength; | const int64 uncompressedStreamLength; | ||||
| const Format format; | const Format format; | ||||
| bool isEof; | |||||
| int activeBufferSize; | |||||
| int64 originalSourcePos, currentPos; | |||||
| bool isEof = false; | |||||
| int activeBufferSize = 0; | |||||
| int64 originalSourcePos, currentPos = 0; | |||||
| HeapBlock<uint8> buffer; | HeapBlock<uint8> buffer; | ||||
| class GZIPDecompressHelper; | class GZIPDecompressHelper; | ||||