4.59 beta

This commit is contained in:
Igor Pavlov
2008-08-13 00:00:00 +00:00
committed by Kornel Lesiński
parent 3901bf0ab8
commit 173c07e166
781 changed files with 22124 additions and 13650 deletions

View File

@@ -22,7 +22,7 @@ namespace NGZip {
static const CMethodId kMethodId_Deflate = 0x040108;
const wchar_t *kHostOS[] =
const wchar_t *kHostOS[] =
{
L"FAT",
L"AMIGA",
@@ -34,14 +34,14 @@ const wchar_t *kHostOS[] =
L"Mac",
L"Z_System",
L"CPM",
L"TOPS20", // pkzip 2.50 NTFS
L"NTFS", // filesystem used by Windows NT
L"TOPS20", // pkzip 2.50 NTFS
L"NTFS", // filesystem used by Windows NT
L"QDOS ", // SMS/QDOS
L"Acorn", // Archimedes Acorn RISC OS
L"VFAT", // filesystem used by Windows 95, NT
L"MVS",
L"BeOS", // hybrid POSIX/database filesystem
// BeBOX or PowerMac
// BeBOX or PowerMac
L"Tandem",
L"THEOS"
};
@@ -59,16 +59,14 @@ enum // PropID
};
*/
STATPROPSTG kProps[] =
STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackedSize, VT_UI8},
{ NULL, kpidLastWriteTime, VT_FILETIME},
{ NULL, kpidPackSize, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
// { NULL, kpidMethod, VT_UI1},
{ NULL, kpidHostOS, VT_BSTR},
{ NULL, kpidCRC, VT_UI4}
// { L"Extra", kpidExtraIsPresent, VT_BOOL}
// { L"Extra flags", kpidExtraFlags, VT_UI1},
@@ -94,7 +92,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA
if (m_Item.NameIsPresent())
prop = MultiByteToUnicodeString(m_Item.Name, CP_ACP);
break;
case kpidLastWriteTime:
case kpidMTime:
{
FILETIME utcTime;
if (m_Item.Time != 0)
@@ -109,35 +107,19 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA
}
break;
}
case kpidSize:
prop = UInt64(m_Item.UnPackSize32);
break;
case kpidPackedSize:
prop = m_PackSize;
break;
case kpidCommented:
prop = m_Item.CommentIsPresent();
break;
case kpidSize: prop = UInt64(m_Item.UnPackSize32); break;
case kpidPackSize: prop = m_PackSize; break;
case kpidCommented: prop = m_Item.CommentIsPresent(); break;
case kpidHostOS:
prop = (m_Item.HostOS < kNumHostOSes) ?
kHostOS[m_Item.HostOS] : kUnknownOS;
break;
case kpidMethod:
prop = m_Item.CompressionMethod;
break;
case kpidCRC:
prop = m_Item.FileCRC;
break;
case kpidMethod: prop = m_Item.CompressionMethod; break;
case kpidCRC: prop = m_Item.FileCRC; break;
/*
case kpidExtraFlags:
prop = m_Item.ExtraFlags;
break;
case kpidIsText:
prop = m_Item.IsText();
break;
case kpidExtraIsPresent:
prop = m_Item.ExtraFieldIsPresent();
break;
case kpidExtraFlags: prop = m_Item.ExtraFlags; break;
case kpidIsText: prop = m_Item.IsText(); break;
case kpidExtraIsPresent: prop = m_Item.ExtraFieldIsPresent(); break;
*/
}
prop.Detach(value);
@@ -145,7 +127,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA
COM_TRY_END
}
STDMETHODIMP CHandler::Open(IInStream *inStream,
STDMETHODIMP CHandler::Open(IInStream *inStream,
const UInt64 * /* maxCheckStartPosition */,
IArchiveOpenCallback * /* openArchiveCallback */)
{
@@ -155,7 +137,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
CInArchive archive;
RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition));
RINOK(archive.ReadHeader(inStream, m_Item));
m_DataOffset = archive.GetOffset();
m_DataOffset = archive.GetOffset();
UInt64 newPosition;
RINOK(inStream->Seek(-8, STREAM_SEEK_END, &newPosition));
m_PackSize = newPosition - (m_StreamStartPosition + m_DataOffset);
@@ -274,7 +256,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
}
CMyComPtr<ICompressGetInStreamProcessedSize> getInStreamProcessedSize;
RINOK(deflateDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize,
RINOK(deflateDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize,
&getInStreamProcessedSize));
UInt64 packSize;
RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(&packSize));

View File

@@ -15,7 +15,7 @@
namespace NArchive {
namespace NGZip {
class CHandler:
class CHandler:
public IInArchive,
public IOutArchive,
public ISetProperties,
@@ -53,7 +53,7 @@ private:
void InitMethodProperties()
{
m_Method.NumMatchFinderCyclesDefined = false;
m_Level = m_Method.NumPasses = m_Method.NumFastBytes =
m_Level = m_Method.NumPasses = m_Method.NumFastBytes =
m_Method.NumMatchFinderCycles = m_Method.Algo = 0xFFFFFFFF;
}
};

View File

@@ -9,7 +9,6 @@
#include "Common/StringToInt.h"
#include "Windows/Time.h"
#include "Windows/FileFind.h"
#include "Windows/PropVariant.h"
#include "../../Compress/Copy/CopyCoder.h"
@@ -65,23 +64,11 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
newItem.Flags = 0;
if (IntToBool(newProperties))
{
UInt32 attributes;
FILETIME utcTime;
UString name;
bool isDirectory;
{
NCOM::CPropVariant prop;
RINOK(updateCallback->GetProperty(itemIndex, kpidAttributes, &prop));
if (prop.vt == VT_EMPTY)
attributes = 0;
else if (prop.vt != VT_UI4)
return E_INVALIDARG;
else
attributes = prop.ulVal;
}
{
NCOM::CPropVariant prop;
RINOK(updateCallback->GetProperty(itemIndex, kpidLastWriteTime, &prop));
RINOK(updateCallback->GetProperty(itemIndex, kpidMTime, &prop));
if (prop.vt != VT_FILETIME)
return E_INVALIDARG;
utcTime = prop.filetime;
@@ -98,16 +85,15 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
}
{
NCOM::CPropVariant prop;
RINOK(updateCallback->GetProperty(itemIndex, kpidIsFolder, &prop));
if (prop.vt == VT_EMPTY)
isDirectory = false;
else if (prop.vt != VT_BOOL)
RINOK(updateCallback->GetProperty(itemIndex, kpidIsDir, &prop));
if (prop.vt == VT_BOOL)
{
if (prop.boolVal != VARIANT_FALSE)
return E_INVALIDARG;
}
else if (prop.vt != VT_EMPTY)
return E_INVALIDARG;
else
isDirectory = (prop.boolVal != VARIANT_FALSE);
}
if (isDirectory || NFile::NFind::NAttributes::IsDirectory(attributes))
return E_INVALIDARG;
if(!FileTimeToUnixTime(utcTime, newItem.Time))
return E_INVALIDARG;
newItem.Name = UnicodeStringToMultiByte(name, CP_ACP);
@@ -133,17 +119,17 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if (level == 0xFFFFFFFF)
level = 5;
if (m_Method.NumPasses == 0xFFFFFFFF)
m_Method.NumPasses = (level >= 9 ? kNumPassesX9 :
(level >= 7 ? kNumPassesX7 :
m_Method.NumPasses = (level >= 9 ? kNumPassesX9 :
(level >= 7 ? kNumPassesX7 :
kNumPassesX1));
if (m_Method.NumFastBytes == 0xFFFFFFFF)
m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 :
(level >= 7 ? kNumFastBytesX7 :
m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 :
(level >= 7 ? kNumFastBytesX7 :
kNumFastBytesX1));
if (m_Method.Algo == 0xFFFFFFFF)
m_Method.Algo =
(level >= 5 ? kAlgoX5 :
kAlgoX1);
m_Method.Algo =
(level >= 5 ? kAlgoX5 :
kAlgoX1);
return UpdateArchive(
EXTERNAL_CODECS_VARS
@@ -210,6 +196,6 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
return E_INVALIDARG;
}
return S_OK;
}
}
}}

View File

@@ -12,7 +12,7 @@ extern UInt16 kSignature = 0x8B1F + 1;
static class CMarkersInitializer
{
public:
CMarkersInitializer()
CMarkersInitializer()
{ kSignature--; }
} g_MarkerInitializer;

View File

@@ -25,7 +25,7 @@ namespace NFileHeader
};
*/
namespace NFlags
namespace NFlags
{
const int kDataIsText = 1 << 0;
const int kHeaderCRCIsPresent = 1 << 1;
@@ -34,7 +34,7 @@ namespace NFileHeader
const int kComentIsPresent = 1 << 4;
}
namespace NExtraFlags
namespace NExtraFlags
{
enum EEnum
{
@@ -52,7 +52,7 @@ namespace NFileHeader
{
enum EEnum
{
kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32
kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32
// pkzip 2.50 (FAT / VFAT / FAT32 file systems)
kAMIGA = 1,
kVMS = 2, // VAX/VMS
@@ -63,14 +63,14 @@ namespace NFileHeader
kMac = 7,
kZ_System = 8,
kCPM = 9,
kTOPS20 = 10, // pkzip 2.50 NTFS
kNTFS = 11, // filesystem used by Windows NT
kTOPS20 = 10, // pkzip 2.50 NTFS
kNTFS = 11, // filesystem used by Windows NT
kQDOS = 12, // SMS/QDOS
kAcorn = 13, // Archimedes Acorn RISC OS
kVFAT = 14, // filesystem used by Windows 95, NT
kMVS = 15,
kBeOS = 16, // hybrid POSIX/database filesystem
// BeBOX or PowerMac
// BeBOX or PowerMac
kTandem = 17,
kTHEOS = 18,

View File

@@ -10,9 +10,9 @@
#include "../../Common/StreamUtils.h"
extern "C"
{
#include "../../../../C/7zCrc.h"
extern "C"
{
#include "../../../../C/7zCrc.h"
}
namespace NArchive {

View File

@@ -39,7 +39,7 @@ public:
{ return TestFlag(NFileHeader::NFlags::kComentIsPresent); }
void SetNameIsPresentFlag(bool nameIsPresent)
{
{
if (nameIsPresent)
Flags |= NFileHeader::NFlags::kNameIsPresent;
else

View File

@@ -13,6 +13,6 @@ static IOutArchive *CreateArcOut() { return new NArchive::NGZip::CHandler; }
#endif
static CArcInfo g_ArcInfo =
{ L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B }, 2, true, CreateArc, CreateArcOut };
{ L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B, 8 }, 3, true, CreateArc, CreateArcOut };
REGISTER_ARC(GZip)

View File

@@ -22,11 +22,16 @@ namespace NGZip {
static const CMethodId kMethodId_Deflate = 0x040108;
static const Byte kHostOS = NFileHeader::NHostOS::kFAT;
static const Byte kHostOS =
#ifdef _WIN32
NFileHeader::NHostOS::kFAT;
#else
NFileHeader::NHostOS::kUnix;
#endif
HRESULT UpdateArchive(
DECL_EXTERNAL_CODECS_LOC_VARS
IInStream * /* inStream */,
IInStream * /* inStream */,
UInt64 unpackSize,
ISequentialOutStream *outStream,
const CItem &newItem,
@@ -73,17 +78,17 @@ HRESULT UpdateArchive(
if (!deflateEncoder)
return E_NOTIMPL;
NWindows::NCOM::CPropVariant properties[] =
{
compressionMethod.Algo,
compressionMethod.NumPasses,
NWindows::NCOM::CPropVariant properties[] =
{
compressionMethod.Algo,
compressionMethod.NumPasses,
compressionMethod.NumFastBytes,
compressionMethod.NumMatchFinderCycles
};
PROPID propIDs[] =
{
PROPID propIDs[] =
{
NCoderPropID::kAlgorithm,
NCoderPropID::kNumPasses,
NCoderPropID::kNumPasses,
NCoderPropID::kNumFastBytes,
NCoderPropID::kMatchFinderCycles
};

View File

@@ -24,7 +24,7 @@ struct CCompressionMethodMode
HRESULT UpdateArchive(
DECL_EXTERNAL_CODECS_LOC_VARS
IInStream *inStream,
IInStream *inStream,
UInt64 unpackSize,
ISequentialOutStream *outStream,
const CItem &newItem,

View File

@@ -1,3 +0,0 @@
// StdAfx.cpp
#include "StdAfx.h"

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB