Bug 1214782, r=ehsan

--HG--
extra : rebase_source : f1dec852aa864b681b4417467992c7431f9103bf
This commit is contained in:
Andrea Marchesini 2015-10-20 13:32:47 +02:00
parent 7e6f1c0dce
commit 51d11d89ea
2 changed files with 39 additions and 20 deletions

View File

@ -873,6 +873,8 @@ int64_t nsZipArchive::SizeOfMapping()
nsZipArchive::nsZipArchive()
: mRefCnt(0)
, mCommentPtr(nullptr)
, mCommentLen(0)
, mBuiltSynthetics(false)
{
zipLog.AddRef();
@ -900,12 +902,12 @@ nsZipArchive::~nsZipArchive()
// nsZipFind constructor and destructor
//------------------------------------------
nsZipFind::nsZipFind(nsZipArchive* aZip, char* aPattern, bool aRegExp) :
mArchive(aZip),
mPattern(aPattern),
mItem(0),
mSlot(0),
mRegExp(aRegExp)
nsZipFind::nsZipFind(nsZipArchive* aZip, char* aPattern, bool aRegExp)
: mArchive(aZip)
, mPattern(aPattern)
, mItem(nullptr)
, mSlot(0)
, mRegExp(aRegExp)
{
MOZ_COUNT_CTOR(nsZipFind);
}
@ -997,6 +999,13 @@ static PRTime GetModTime(uint16_t aDate, uint16_t aTime)
return PR_ImplodeTime(&time);
}
nsZipItem::nsZipItem()
: next(nullptr)
, central(nullptr)
, nameLength(0)
, isSynthetic(false)
{}
uint32_t nsZipItem::LocalOffset()
{
return xtolong(central->localhdr_offset);
@ -1092,11 +1101,13 @@ bool nsZipItem::IsSymlink()
}
#endif
nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, uint8_t* aBuf, uint32_t aBufSize, bool doCRC) :
mItem(item),
mBuf(aBuf),
mBufSize(aBufSize),
mDoCRC(doCRC)
nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, uint8_t* aBuf,
uint32_t aBufSize, bool doCRC)
: mItem(item)
, mBuf(aBuf)
, mBufSize(aBufSize)
, mCRC(0)
, mDoCRC(doCRC)
{
if (mItem->Compression() == DEFLATED) {
#ifdef DEBUG
@ -1168,8 +1179,10 @@ MOZ_WIN_MEM_TRY_CATCH(return nullptr)
return buf;
}
nsZipItemPtr_base::nsZipItemPtr_base(nsZipArchive *aZip, const char * aEntryName, bool doCRC) :
mReturnBuf(nullptr)
nsZipItemPtr_base::nsZipItemPtr_base(nsZipArchive *aZip,
const char * aEntryName, bool doCRC)
: mReturnBuf(nullptr)
, mReadlen(0)
{
// make sure the ziparchive hangs around
mZipHandle = aZip->GetFD();

View File

@ -58,9 +58,11 @@ struct PRFileDesc;
* each nsZipItem represents one file in the archive and all the
* information needed to manipulate it.
*/
class nsZipItem
class nsZipItem final
{
public:
nsZipItem();
const char* Name() { return ((const char*)central) + ZIPCENTRAL_SIZE; }
uint32_t LocalOffset();
@ -91,7 +93,7 @@ class nsZipHandle;
* nsZipArchive -- a class for reading the PKZIP file format.
*
*/
class nsZipArchive
class nsZipArchive final
{
friend class nsZipFind;
@ -241,7 +243,7 @@ private:
*
* a helper class for nsZipArchive, representing a search
*/
class nsZipFind
class nsZipFind final
{
public:
nsZipFind(nsZipArchive* aZip, char* aPattern, bool regExp);
@ -263,7 +265,8 @@ private:
/**
* nsZipCursor -- a low-level class for reading the individual items in a zip.
*/
class nsZipCursor {
class nsZipCursor final
{
public:
/**
* Initializes the cursor
@ -318,7 +321,8 @@ private:
* for decompression.
* Do not use when the file may be very large.
*/
class nsZipItemPtr_base {
class nsZipItemPtr_base
{
public:
/**
* Initializes the reader
@ -341,7 +345,8 @@ protected:
};
template <class T>
class nsZipItemPtr : public nsZipItemPtr_base {
class nsZipItemPtr final : public nsZipItemPtr_base
{
public:
nsZipItemPtr(nsZipArchive *aZip, const char *aEntryName, bool doCRC = false) : nsZipItemPtr_base(aZip, aEntryName, doCRC) { }
/**
@ -376,7 +381,8 @@ public:
}
};
class nsZipHandle {
class nsZipHandle final
{
friend class nsZipArchive;
friend class mozilla::FileLocation;
public: