|
From: | Vincent Caron <address@hidden> |
Subject: | [ngl-commits] nglZipFS: maintenance fixes and autoconf support |
Date: | Mon, 17 Nov 2003 21:12:24 -0500 |
Commit from zerodeux | 2003-11-17 21:12 EST |
nglZipFS: maintenance fixes and autoconf support
Module | File name | Revision | |||
---|---|---|---|---|---|
ngl | README | 1.13 | >>> | 1.14 | |
ngl | bootstrap | 1.2 | >>> | 1.3 | |
ngl | configure.in | 1.10 | >>> | 1.11 | |
ngl | ChangeLog | 1.350 | >>> | 1.351 | |
ngl | include/nglIZip.h | 1.1 | >>> | 1.2 | |
ngl | include/nglPath.h | 1.32 | >>> | 1.33 | |
ngl | include/nglZipFS.h | 1.1 | >>> | 1.2 | |
ngl | src/Makefile.am | 1.14 | >>> | 1.15 | |
- | ngl | src/stream/nglIZip.cpp | 1.1 | ||
+ | ngl | src/stream/nglIZip_shr.cpp | 1.1 | ||
- | ngl | src/stream/nglZipFS.cpp | 1.1 | ||
ngl | src/zip/crypt.h | 1.1 | >>> | 1.2 | |
ngl | src/zip/unzip.c | 1.1 | >>> | 1.2 | |
ngl | src/zip/zip.c | 1.1 | >>> | 1.2 |
ngl/ChangeLog 1.350 >>> 1.351 |
---|
Line 1 |
+ 2003/11/18 03:13 zerodeux + - README + * dumber but safer anonymous CVS usage instructions + - bootstrap + * needs better support for rule 'autoconf > 2.57' + - configure.in + * added C support (for src/zip/) + - include/nglPath.h + * cosmetics + - include/nglZipFS.h + * \Zip doxygen tag replaced with proper \File + * added include guard + * cosmetics + - include/nglIZip.h + * cosmetics + - src/stream/nglZipFS.cpp + * moved to src/zip/nglZipFS_shr.cpp + - src/stream/nglIZip.cpp + * renamed as nglIZip_shr.cpp + - src/zip/*.c + * de-antiquated ugly C code + |
2003/11/17 16:50 meeloo - Added nglZipFS and nglIZip classes that permits to use zip archives as a stream source. |
ngl/include/nglIZip.h 1.1 >>> 1.2 |
---|
Line 65 |
//@} private: |
- |
friend class nglZipFS; |
+ nglZipFS* mpZip; + void* mpUnzip; + nglSize mSize; + int mNumOfFile; + int mPosInZipDirectory; + |
nglIZip(nglZipFS* pZip, void* pUnzip, nglSize size, int NumOfFile,int PosInZipDirectory); |
- void SetRef(void* pUnzip); |
|
- nglZipFS* mpZip; - void* mpUnzip; - nglSize mSize; - int mNumOfFile; - int mPosInZipDirectory; |
+ void SetRef(void* pUnzip); |
}; #endif // __nglIZip_h__ |
ngl/include/nglPath.h 1.32 >>> 1.33 |
---|
Line 184 |
nglString GetPathName() const; ///< Returns the path name as a string (same information as GetChar()) nglString GetNodeName() const; ///< Returns the last path component (node name) nglString GetExtension() const; ///< Returns the file extension (without the dot), or an empty string if the path is a folder or a file without extension |
- nglString GetParentName() const; ///< Returns the parent path as a string (remove the last node) - nglPath GetParent() const; ///< Returns the parent path (remove the last node) - virtual int GetChildren(std::list<nglPath>* pChildren) const; |
+ nglString GetParentName() const; ///< Returns the parent path as a string (remove the last node) + nglPath GetParent() const; ///< Returns the parent path (remove the last node) + virtual int GetChildren(std::list<nglPath>* pChildren) const; |
/*!< Get node's children \param pChildren if non-null, children will be appended to this list \return Number of children. Zero usually means the node was a leaf, check errors with GetError() |
Line 207 |
virtual bool Exists() const; ///< Check existence of the current node virtual bool CanRead() const; ///< Check read/traverse access on current node virtual bool CanWrite() const; ///< Check write access on current node |
- bool IsLeaf() const; ///< Test wether the node is a leaf (file and assimilated) or not (folder). Calls GetInfo() internally. - nglTime GetLastAccess() const; ///< Returns last (read) access time stamp. Calls GetInfo() internally. - nglTime GetLastMod() const; ///< Returns last modification (write) time stamp. Calls GetInfo() internally. - nglSize GetSize() const; ///< Returns node size in bytes (folders always return zero). Calls GetInfo() internally. - nglString GetMimeType() const; |
+ bool IsLeaf() const; ///< Test wether the node is a leaf (file and assimilated) or not (folder). Calls GetInfo() internally. + nglTime GetLastAccess() const; ///< Returns last (read) access time stamp. Calls GetInfo() internally. + nglTime GetLastMod() const; ///< Returns last modification (write) time stamp. Calls GetInfo() internally. + nglSize GetSize() const; ///< Returns node size in bytes (folders always return zero). Calls GetInfo() internally. + nglString GetMimeType() const; |
/*!< Returns the standard MIME type description from file extension. If the path is not a file or the type is unknown, returns an empty string */ |
ngl/include/nglZipFS.h 1.1 >>> 1.2 |
---|
Line 18 |
*/ /*! |
- \Zip nglZipFS.h |
+ \File nglZipFS.h |
\brief Zip as a virtual file system. */ |
+ #ifndef __nglZipFS_h__ + #define __nglZipFS_h__ + |
#include "nglStream.h" #include "nglIStream.h" #include "nglPath.h" #include "nglString.h" |
+ |
class nglIZip; class nglZipFS; class nglZipPath; |
Line 42 |
virtual bool Create(bool Recurse = true); virtual int GetChildren(std::list<nglPath>* pChildren) const; virtual int GetChildren(std::list<nglZipPath>* pChildren) const; |
- virtual bool GetInfo (nglPathInfo& rInfo) const; ///< Returns node info, see nglPathInfo - virtual bool Exists() const; ///< Check existence of the current node - virtual bool CanRead() const; ///< Check read/traverse access on current node - virtual bool CanWrite() const; ///< Check write access on current node - - static bool Decompose(const nglPath& rPath, std::list<nglPath>& rList); ///< Create a list of recursive node path from the given complete path: If you give /truc/machin/prout.zip you will get a list with three elements: truc, machin and prout.zip. |
+ virtual bool GetInfo (nglPathInfo& rInfo) const; + virtual bool Exists() const; + virtual bool CanRead() const; + virtual bool CanWrite() const; + + static bool Decompose(const nglPath& rPath, std::list<nglPath>& rList); + /*!< Create a list of recursive node path from the given complete path + If you give /truc/machin/prout.zip you will get a list with three elements : + truc, machin and prout.zip. + */ |
private: const nglZipFS* mpZipFS; |
Line 57 |
{ public: nglZipFS(nglIStream* pStream, bool Own = true); ///< Create a Zip FS from a stream. |
- nglZipFS(const nglPath& rPath); ///< Create a Zip FS from a file. - |
+ nglZipFS(const nglPath& rPath); ///< Create a Zip FS from a file. |
virtual ~nglZipFS(); bool Open(); bool CanWrite() const; bool CanRead() const; |
- - bool GetInfo (const nglZipPath& rPath, nglPathInfo& rInfo) const; ///< Returns node info, see nglPathInfo |
+ bool GetInfo (const nglZipPath& rPath, nglPathInfo& rInfo) const; |
int GetChildren(const nglZipPath& rPath, std::list<nglZipPath>& rList) const; ///< Populate the list with the children of the given path node in the zip. nglIZip* GetStream(const nglZipPath& rPath); ///< Return a stream that can read the file pointed to by rPath in the Zip FS. |
- private: - // Direct File Operations: - bool Close(void* pUnzip); - nglStreamState GetState(void* pUnzip) const; - uint GetError(void* pUnzip) const; - - nglSize GetPos(void* pUnzip) const; - nglSize SetPos (void* pUnzip, nglSize Where, nglIZip* pFile); ///< Set the pos in the zip file from start - nglSize Available (void* pUnzip, uint WordSize = 1); - - nglSize Read (void* pUnzip, void* pData, nglSize WordCount, uint WordSize, nglEndian Endian); - - // Data: - - nglIStream* mpStream; - bool mOwnStream; - - friend class nglZipPath; - friend class nglIZip; - - nglZipPrivate* mpPrivate; |
|
+ private: |
// Needed to build an index of the zip: class Node { public: Node(const nglString& rPath, uint Size, uint Pos, uint Num, bool IsLeaf); virtual ~Node(); |
- Node* Find(const nglPath& rPath) const; ///< Find the child node that correspond to the given path. - Node* Find(const nglString& rNodeName) const; ///< Find the child node that have the given node name |
+ Node* Find(const nglPath& rPath) const; + Node* Find(const nglString& rNodeName) const; |
bool AddChild(Node* pPath); |
+ |
private: std::list<Node*> mpChildren; |
- uint mSize; - uint mPosInZipDirectory; /* offset in zip file directory */ - uint mNumOfFile; /* # of file */ - bool mIsLeaf; |
+ uint mSize; + uint mPosInZipDirectory; /* offset in zip file directory */ + uint mNumOfFile; /* # of file */ + bool mIsLeaf; |
nglString mName; friend class nglZipFS; }; |
- Node mRoot; ///< The zip file's root directory... |
+ nglIStream* mpStream; + bool mOwnStream; + nglZipPrivate* mpPrivate; + Node mRoot; ///< The zip file's root directory + + // Direct File Operations: + bool Close(void* pUnzip); + nglStreamState GetState(void* pUnzip) const; + uint GetError(void* pUnzip) const; + + nglSize GetPos(void* pUnzip) const; + nglSize SetPos (void* pUnzip, nglSize Where, nglIZip* pFile); + nglSize Available (void* pUnzip, uint WordSize = 1); |
|
- bool BuildIndex(); ///< Build the internal ZIP directory |
+ nglSize Read (void* pUnzip, void* pData, nglSize WordCount, uint WordSize, nglEndian Endian); + + bool BuildIndex(); // Build the internal ZIP directory + + friend class nglZipPath; + friend class nglIZip; |
}; |
+ #endif // __nglZipFS_h__ |
ngl/src/zip/crypt.h 1.1 >>> 1.2 |
---|
Line 103 |
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ # endif |
- static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) - const char *passwd; /* password string */ - unsigned char *buf; /* where to write header */ - int bufSize; - unsigned long* pkeys; - const unsigned long* pcrc_32_tab; - unsigned long crcForCrypting; |
+ static int crypthead(const char *passwd, /* password string */ + unsigned char *buf, /* where to write header */ + int bufSize, + unsigned long* pkeys, + const unsigned long* pcrc_32_tab, + unsigned long crcForCrypting) |
{ int n; /* index in random header */ int t; /* temporary */ |
[Prev in Thread] | Current Thread | [Next in Thread] |