1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added some comments to ZipFile

This commit is contained in:
jules 2015-06-26 17:13:56 +01:00
parent 09730a890d
commit 0c714770c1
2 changed files with 18 additions and 12 deletions

View file

@ -328,7 +328,7 @@ void ZipFile::sortEntriesByFilename()
//==============================================================================
void ZipFile::init()
{
ScopedPointer <InputStream> toDelete;
ScopedPointer<InputStream> toDelete;
InputStream* in = inputStream;
if (inputSource != nullptr)
@ -358,7 +358,7 @@ void ZipFile::init()
if (pos + 46 > size)
break;
const char* const buffer = static_cast <const char*> (headerData.getData()) + pos;
const char* const buffer = static_cast<const char*> (headerData.getData()) + pos;
const int fileNameLen = ByteOrder::littleEndianShort (buffer + 28);

View file

@ -40,7 +40,7 @@
class JUCE_API ZipFile
{
public:
/** Creates a ZipFile based for a file. */
/** Creates a ZipFile to read a specific file. */
explicit ZipFile (const File& file);
//==============================================================================
@ -91,15 +91,12 @@ public:
int getNumEntries() const noexcept;
/** Returns a structure that describes one of the entries in the zip file.
This may return zero if the index is out of range.
@see ZipFile::ZipEntry
*/
const ZipEntry* getEntry (int index) const noexcept;
/** Returns the index of the first entry with a given filename.
This uses a case-sensitive comparison to look for a filename in the
list of entries. It might return -1 if no match is found.
@ -116,8 +113,7 @@ public:
*/
const ZipEntry* getEntry (const String& fileName) const noexcept;
/** Sorts the list of entries, based on the filename.
*/
/** Sorts the list of entries, based on the filename. */
void sortEntriesByFilename();
//==============================================================================
@ -128,6 +124,11 @@ public:
The stream must not be used after the ZipFile object that created
has been deleted.
Note that if the ZipFile was created with a user-supplied InputStream object,
then all the streams which are created by this method will by trying to share
the same source stream, so cannot be safely used on multiple threads! (But if
you create the ZipFile from a File or InputSource, then it is safe to do this).
*/
InputStream* createStreamForEntry (int index);
@ -138,6 +139,11 @@ public:
The stream must not be used after the ZipFile object that created
has been deleted.
Note that if the ZipFile was created with a user-supplied InputStream object,
then all the streams which are created by this method will by trying to share
the same source stream, so cannot be safely used on multiple threads! (But if
you create the ZipFile from a File or InputSource, then it is safe to do this).
*/
InputStream* createStreamForEntry (const ZipEntry& entry);
@ -194,7 +200,7 @@ public:
will be stored for this file.
*/
void addFile (const File& fileToAdd, int compressionLevel,
const String& storedPathName = String::empty);
const String& storedPathName = String());
/** Adds a file while should be added to the archive.
@ -233,11 +239,11 @@ private:
friend class ZipInputStream;
friend class ZipEntryHolder;
OwnedArray <ZipEntryHolder> entries;
OwnedArray<ZipEntryHolder> entries;
CriticalSection lock;
InputStream* inputStream;
ScopedPointer <InputStream> streamToDelete;
ScopedPointer <InputSource> inputSource;
ScopedPointer<InputStream> streamToDelete;
ScopedPointer<InputSource> inputSource;
#if JUCE_DEBUG
struct OpenStreamCounter