Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/C/Archive
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2008-08-13 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:56 +0300
commit173c07e166fdf6fcd20f18ea73008f1b628945df (patch)
tree13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /C/Archive
parent3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff)
4.59 beta
Diffstat (limited to 'C/Archive')
-rwxr-xr-xC/Archive/7z/7zDecode.c24
-rwxr-xr-xC/Archive/7z/7zExtract.c38
-rwxr-xr-xC/Archive/7z/7zExtract.h16
-rwxr-xr-xC/Archive/7z/7zHeader.h17
-rwxr-xr-xC/Archive/7z/7zIn.c226
-rwxr-xr-xC/Archive/7z/7zIn.h6
-rwxr-xr-xC/Archive/7z/7zItem.c24
-rwxr-xr-xC/Archive/7z/7zItem.h37
-rwxr-xr-xC/Archive/7z/7zMain.c56
-rwxr-xr-xC/Archive/7z/makefile.gcc2
10 files changed, 213 insertions, 233 deletions
diff --git a/C/Archive/7z/7zDecode.c b/C/Archive/7z/7zDecode.c
index 02a3c008..aad7daf8 100755
--- a/C/Archive/7z/7zDecode.c
+++ b/C/Archive/7z/7zDecode.c
@@ -1,5 +1,5 @@
/* 7zDecode.c Decoding from 7z folder
-2008-04-09
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zDecode.h for license options */
@@ -60,13 +60,13 @@ static SRes SzDecodeLzma(CSzCoderInfo *coder, CFileSize inSize, ISzInStream *inS
if (state.dicPos == state.dicBufSize || (inProcessed == 0 && dicPos == state.dicPos))
{
if (state.dicBufSize != outSize || _inSize != 0 ||
- (status != LZMA_STATUS_FINISHED_WITH_MARK &&
+ (status != LZMA_STATUS_FINISHED_WITH_MARK &&
status != LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK))
res = SZ_ERROR_DATA;
break;
}
}
- }
+ }
LzmaDec_FreeProbs(&state, allocMain);
@@ -126,7 +126,7 @@ SRes CheckSupportedFolder(const CSzFolder *f)
IS_UNSUPPORTED_CODER(f->Coders[2]) ||
IS_NO_BCJ2(f->Coders[3]))
return SZ_ERROR_UNSUPPORTED;
- if (f->NumPackStreams != 4 ||
+ if (f->NumPackStreams != 4 ||
f->PackStreams[0] != 2 ||
f->PackStreams[1] != 6 ||
f->PackStreams[2] != 1 ||
@@ -184,7 +184,7 @@ SRes SzDecode2(const CFileSize *packSizes, const CSzFolder *folder,
if (folder->NumCoders == 4)
{
UInt32 indices[] = { 3, 2, 0 };
- CFileSize unpackSize = folder->UnPackSizes[ci];
+ CFileSize unpackSize = folder->UnpackSizes[ci];
si = indices[ci];
if (ci < 2)
{
@@ -287,22 +287,22 @@ SRes SzDecode2(const CFileSize *packSizes, const CSzFolder *folder,
*/
res = Bcj2_Decode(
- tempBuf3, tempSize3,
- tempBuf[0], tempSizes[0],
- tempBuf[1], tempSizes[1],
+ tempBuf3, tempSize3,
+ tempBuf[0], tempSizes[0],
+ tempBuf[1], tempSizes[1],
/*
#ifdef _LZMA_IN_CB
*/
- tempBuf[2], tempSizes[2],
- /*
+ tempBuf[2], tempSizes[2],
+ /*
#else
- inBuffer + (size_t)offset, (size_t)s3Size,
+ inBuffer + (size_t)offset, (size_t)s3Size,
#endif
*/
outBuffer, outSize);
RINOK(res)
}
- else
+ else
return SZ_ERROR_UNSUPPORTED;
}
return SZ_OK;
diff --git a/C/Archive/7z/7zExtract.c b/C/Archive/7z/7zExtract.c
index 40b592aa..da5b57c7 100755
--- a/C/Archive/7z/7zExtract.c
+++ b/C/Archive/7z/7zExtract.c
@@ -1,5 +1,5 @@
/* 7zExtract.c -- Extracting from 7z archive
-2008-04-09
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zExtract.h for license options */
@@ -10,13 +10,13 @@ Read 7zExtract.h for license options */
SRes SzAr_Extract(
const CSzArEx *p,
- ISzInStream *inStream,
+ ISzInStream *inStream,
UInt32 fileIndex,
UInt32 *blockIndex,
- Byte **outBuffer,
+ Byte **outBuffer,
size_t *outBufferSize,
- size_t *offset,
- size_t *outSizeProcessed,
+ size_t *offset,
+ size_t *outSizeProcessed,
ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
@@ -36,11 +36,11 @@ SRes SzAr_Extract(
if (*outBuffer == 0 || *blockIndex != folderIndex)
{
CSzFolder *folder = p->db.Folders + folderIndex;
- CFileSize unPackSizeSpec = SzFolder_GetUnPackSize(folder);
- size_t unPackSize = (size_t)unPackSizeSpec;
+ CFileSize unpackSizeSpec = SzFolder_GetUnpackSize(folder);
+ size_t unpackSize = (size_t)unpackSizeSpec;
CFileSize startOffset = SzArEx_GetFolderStreamPos(p, folderIndex, 0);
- if (unPackSize != unPackSizeSpec)
+ if (unpackSize != unpackSizeSpec)
return SZ_ERROR_MEM;
*blockIndex = folderIndex;
IAlloc_Free(allocMain, *outBuffer);
@@ -50,24 +50,24 @@ SRes SzAr_Extract(
if (res == SZ_OK)
{
- *outBufferSize = unPackSize;
- if (unPackSize != 0)
+ *outBufferSize = unpackSize;
+ if (unpackSize != 0)
{
- *outBuffer = (Byte *)IAlloc_Alloc(allocMain, unPackSize);
+ *outBuffer = (Byte *)IAlloc_Alloc(allocMain, unpackSize);
if (*outBuffer == 0)
res = SZ_ERROR_MEM;
}
if (res == SZ_OK)
{
- res = SzDecode(p->db.PackSizes +
- p->FolderStartPackStreamIndex[folderIndex], folder,
- inStream, startOffset,
- *outBuffer, unPackSize, allocTemp);
+ res = SzDecode(p->db.PackSizes +
+ p->FolderStartPackStreamIndex[folderIndex], folder,
+ inStream, startOffset,
+ *outBuffer, unpackSize, allocTemp);
if (res == SZ_OK)
{
- if (folder->UnPackCRCDefined)
+ if (folder->UnpackCRCDefined)
{
- if (CrcCalc(*outBuffer, unPackSize) != folder->UnPackCRC)
+ if (CrcCalc(*outBuffer, unpackSize) != folder->UnpackCRC)
res = SZ_ERROR_CRC;
}
}
@@ -76,7 +76,7 @@ SRes SzAr_Extract(
}
if (res == SZ_OK)
{
- UInt32 i;
+ UInt32 i;
CSzFileItem *fileItem = p->db.Files + fileIndex;
*offset = 0;
for(i = p->FolderStartFileIndex[folderIndex]; i < fileIndex; i++)
@@ -85,7 +85,7 @@ SRes SzAr_Extract(
if (*offset + *outSizeProcessed > *outBufferSize)
return SZ_ERROR_FAIL;
{
- if (fileItem->IsFileCRCDefined)
+ if (fileItem->FileCRCDefined)
{
if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
res = SZ_ERROR_CRC;
diff --git a/C/Archive/7z/7zExtract.h b/C/Archive/7z/7zExtract.h
index cd0e4f03..4aa197a6 100755
--- a/C/Archive/7z/7zExtract.h
+++ b/C/Archive/7z/7zExtract.h
@@ -1,5 +1,5 @@
/* 7zExtract.h -- Extracting from 7z archive
-2008-04-09
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zItem.h for license options */
@@ -12,18 +12,18 @@ Read 7zItem.h for license options */
/*
SzExtract extracts file from archive
- *outBuffer must be 0 before first call for each new archive.
+ *outBuffer must be 0 before first call for each new archive.
Extracting cache:
- If you need to decompress more than one file, you can send
+ If you need to decompress more than one file, you can send
these values from previous call:
- *blockIndex,
- *outBuffer,
+ *blockIndex,
+ *outBuffer,
*outBufferSize
- You can consider "*outBuffer" as cache of solid block. If your archive is solid,
+ You can consider "*outBuffer" as cache of solid block. If your archive is solid,
it will increase decompression speed.
- If you use external function, you can declare these 3 cache variables
+ If you use external function, you can declare these 3 cache variables
(blockIndex, outBuffer, outBufferSize) as static in that external function.
Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
@@ -31,7 +31,7 @@ Read 7zItem.h for license options */
SRes SzAr_Extract(
const CSzArEx *db,
- ISzInStream *inStream,
+ ISzInStream *inStream,
UInt32 fileIndex, /* index of file */
UInt32 *blockIndex, /* index of solid block */
Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
diff --git a/C/Archive/7z/7zHeader.h b/C/Archive/7z/7zHeader.h
index 9cd3e3dc..325fe4c6 100755
--- a/C/Archive/7z/7zHeader.h
+++ b/C/Archive/7z/7zHeader.h
@@ -1,5 +1,5 @@
/* 7zHeader.h -- 7z Headers
-2008-03-17
+2008-07-14
Copyright (c) 1999-2008 Igor Pavlov
Read LzmaDec.h for license options */
@@ -28,7 +28,7 @@ enum EIdEnum
k7zIdFilesInfo,
k7zIdPackInfo,
- k7zIdUnPackInfo,
+ k7zIdUnpackInfo,
k7zIdSubStreamsInfo,
k7zIdSize,
@@ -36,23 +36,24 @@ enum EIdEnum
k7zIdFolder,
- k7zIdCodersUnPackSize,
- k7zIdNumUnPackStream,
+ k7zIdCodersUnpackSize,
+ k7zIdNumUnpackStream,
k7zIdEmptyStream,
k7zIdEmptyFile,
k7zIdAnti,
k7zIdName,
- k7zIdCreationTime,
- k7zIdLastAccessTime,
- k7zIdLastWriteTime,
+ k7zIdCTime,
+ k7zIdATime,
+ k7zIdMTime,
k7zIdWinAttributes,
k7zIdComment,
k7zIdEncodedHeader,
- k7zIdStartPos
+ k7zIdStartPos,
+ k7zIdDummy
};
#endif
diff --git a/C/Archive/7z/7zIn.c b/C/Archive/7z/7zIn.c
index b99a6ac7..9a4d6dd1 100755
--- a/C/Archive/7z/7zIn.c
+++ b/C/Archive/7z/7zIn.c
@@ -1,5 +1,5 @@
/* 7zIn.c -- 7z Input functions
-2008-04-09
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zIn.h for license options */
@@ -30,7 +30,7 @@ void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc)
}
/*
-CFileSize GetFolderPackStreamSize(int folderIndex, int streamIndex) const
+CFileSize GetFolderPackStreamSize(int folderIndex, int streamIndex) const
{
return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
}
@@ -96,7 +96,7 @@ static SRes SzArEx_Fill(CSzArEx *p, ISzAlloc *alloc)
if (folderIndex >= p->db.NumFolders)
return SZ_ERROR_ARCHIVE;
p->FolderStartFileIndex[folderIndex] = i;
- if (p->db.Folders[folderIndex].NumUnPackStreams != 0)
+ if (p->db.Folders[folderIndex].NumUnpackStreams != 0)
break;
folderIndex++;
}
@@ -105,7 +105,7 @@ static SRes SzArEx_Fill(CSzArEx *p, ISzAlloc *alloc)
if (emptyStream)
continue;
indexInFolder++;
- if (indexInFolder >= p->db.Folders[folderIndex].NumUnPackStreams)
+ if (indexInFolder >= p->db.Folders[folderIndex].NumUnpackStreams)
{
folderIndex++;
indexInFolder = 0;
@@ -117,7 +117,7 @@ static SRes SzArEx_Fill(CSzArEx *p, ISzAlloc *alloc)
CFileSize SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder)
{
- return p->ArchiveInfo.DataStartPosition +
+ return p->ArchiveInfo.DataStartPosition +
p->PackStreamStartPositions[p->FolderStartPackStreamIndex[folderIndex] + indexInFolder];
}
@@ -164,21 +164,9 @@ SRes SzReadTime(const CObjectVector<CBuf> &dataVector,
}
switch(type)
{
- case k7zIdCreationTime:
- file.IsCreationTimeDefined = defined;
- if (defined)
- file.CreationTime = fileTime;
- break;
- case k7zIdLastWriteTime:
- file.IsLastWriteTimeDefined = defined;
- if (defined)
- file.LastWriteTime = fileTime;
- break;
- case k7zIdLastAccessTime:
- file.IsLastAccessTimeDefined = defined;
- if (defined)
- file.LastAccessTime = fileTime;
- break;
+ case k7zIdCTime: file.IsCTimeDefined = defined; if (defined) file.CTime = fileTime; break;
+ case k7zIdATime: file.IsATimeDefined = defined; if (defined) file.ATime = fileTime; break;
+ case k7zIdMTime: file.IsMTimeDefined = defined; if (defined) file.MTime = fileTime; break;
}
}
return SZ_OK;
@@ -327,9 +315,9 @@ static SRes SzReadNumber32(CSzData *sd, UInt32 *value)
return SZ_OK;
}
-static SRes SzReadID(CSzData *sd, UInt64 *value)
-{
- return SzReadNumber(sd, value);
+static SRes SzReadID(CSzData *sd, UInt64 *value)
+{
+ return SzReadNumber(sd, value);
}
static SRes SzSkeepDataSize(CSzData *sd, UInt64 size)
@@ -408,10 +396,10 @@ static SRes SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, ISzAlloc *
}
static SRes SzReadHashDigests(
- CSzData *sd,
+ CSzData *sd,
size_t numItems,
- Byte **digestsDefined,
- UInt32 **digests,
+ Byte **digestsDefined,
+ UInt32 **digests,
ISzAlloc *alloc)
{
size_t i;
@@ -426,7 +414,7 @@ static SRes SzReadHashDigests(
}
static SRes SzReadPackInfo(
- CSzData *sd,
+ CSzData *sd,
CFileSize *dataOffset,
UInt32 *numPackStreams,
CFileSize **packSizes,
@@ -455,7 +443,7 @@ static SRes SzReadPackInfo(
break;
if (type == k7zIdCRC)
{
- RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, alloc));
+ RINOK(SzReadHashDigests(sd, (size_t)*numPackStreams, packCRCsDefined, packCRCs, alloc));
continue;
}
RINOK(SzSkeepData(sd));
@@ -562,7 +550,7 @@ static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc)
{
CBindPair *bindPair = folder->BindPairs + i;;
RINOK(SzReadNumber32(sd, &bindPair->InIndex));
- RINOK(SzReadNumber32(sd, &bindPair->OutIndex));
+ RINOK(SzReadNumber32(sd, &bindPair->OutIndex));
}
numPackedStreams = numInStreams - (UInt32)numBindPairs;
@@ -589,8 +577,8 @@ static SRes SzGetNextFolderItem(CSzData *sd, CSzFolder *folder, ISzAlloc *alloc)
return SZ_OK;
}
-static SRes SzReadUnPackInfo(
- CSzData *sd,
+static SRes SzReadUnpackInfo(
+ CSzData *sd,
UInt32 *numFolders,
CSzFolder **folders, /* for alloc */
ISzAlloc *alloc,
@@ -613,7 +601,7 @@ static SRes SzReadUnPackInfo(
}
}
- RINOK(SzWaitAttribute(sd, k7zIdCodersUnPackSize));
+ RINOK(SzWaitAttribute(sd, k7zIdCodersUnpackSize));
for (i = 0; i < *numFolders; i++)
{
@@ -621,11 +609,11 @@ static SRes SzReadUnPackInfo(
CSzFolder *folder = (*folders) + i;
UInt32 numOutStreams = SzFolder_GetNumOutStreams(folder);
- MY_ALLOC(CFileSize, folder->UnPackSizes, (size_t)numOutStreams, alloc);
+ MY_ALLOC(CFileSize, folder->UnpackSizes, (size_t)numOutStreams, alloc);
for (j = 0; j < numOutStreams; j++)
{
- RINOK(SzReadSize(sd, folder->UnPackSizes + j));
+ RINOK(SzReadSize(sd, folder->UnpackSizes + j));
}
}
@@ -640,14 +628,14 @@ static SRes SzReadUnPackInfo(
SRes res;
Byte *crcsDefined = 0;
UInt32 *crcs = 0;
- res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp);
+ res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp);
if (res == SZ_OK)
{
for (i = 0; i < *numFolders; i++)
{
CSzFolder *folder = (*folders) + i;
- folder->UnPackCRCDefined = crcsDefined[i];
- folder->UnPackCRC = crcs[i];
+ folder->UnpackCRCDefined = crcsDefined[i];
+ folder->UnpackCRC = crcs[i];
}
}
IAlloc_Free(allocTemp, crcs);
@@ -660,11 +648,11 @@ static SRes SzReadUnPackInfo(
}
static SRes SzReadSubStreamsInfo(
- CSzData *sd,
+ CSzData *sd,
UInt32 numFolders,
CSzFolder *folders,
- UInt32 *numUnPackStreams,
- CFileSize **unPackSizes,
+ UInt32 *numUnpackStreams,
+ CFileSize **unpackSizes,
Byte **digestsDefined,
UInt32 **digests,
ISzAlloc *allocTemp)
@@ -675,21 +663,21 @@ static SRes SzReadSubStreamsInfo(
UInt32 numDigests = 0;
for (i = 0; i < numFolders; i++)
- folders[i].NumUnPackStreams = 1;
- *numUnPackStreams = numFolders;
+ folders[i].NumUnpackStreams = 1;
+ *numUnpackStreams = numFolders;
for (;;)
{
RINOK(SzReadID(sd, &type));
- if (type == k7zIdNumUnPackStream)
+ if (type == k7zIdNumUnpackStream)
{
- *numUnPackStreams = 0;
+ *numUnpackStreams = 0;
for (i = 0; i < numFolders; i++)
{
UInt32 numStreams;
RINOK(SzReadNumber32(sd, &numStreams));
- folders[i].NumUnPackStreams = numStreams;
- *numUnPackStreams += numStreams;
+ folders[i].NumUnpackStreams = numStreams;
+ *numUnpackStreams += numStreams;
}
continue;
}
@@ -700,19 +688,19 @@ static SRes SzReadSubStreamsInfo(
RINOK(SzSkeepData(sd));
}
- if (*numUnPackStreams == 0)
+ if (*numUnpackStreams == 0)
{
- *unPackSizes = 0;
+ *unpackSizes = 0;
*digestsDefined = 0;
*digests = 0;
}
else
{
- *unPackSizes = (CFileSize *)IAlloc_Alloc(allocTemp, (size_t)*numUnPackStreams * sizeof(CFileSize));
- RINOM(*unPackSizes);
- *digestsDefined = (Byte *)IAlloc_Alloc(allocTemp, (size_t)*numUnPackStreams * sizeof(Byte));
+ *unpackSizes = (CFileSize *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(CFileSize));
+ RINOM(*unpackSizes);
+ *digestsDefined = (Byte *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(Byte));
RINOM(*digestsDefined);
- *digests = (UInt32 *)IAlloc_Alloc(allocTemp, (size_t)*numUnPackStreams * sizeof(UInt32));
+ *digests = (UInt32 *)IAlloc_Alloc(allocTemp, (size_t)*numUnpackStreams * sizeof(UInt32));
RINOM(*digests);
}
@@ -724,7 +712,7 @@ static SRes SzReadSubStreamsInfo(
*/
CFileSize sum = 0;
UInt32 j;
- UInt32 numSubstreams = folders[i].NumUnPackStreams;
+ UInt32 numSubstreams = folders[i].NumUnpackStreams;
if (numSubstreams == 0)
continue;
if (type == k7zIdSize)
@@ -732,17 +720,17 @@ static SRes SzReadSubStreamsInfo(
{
CFileSize size;
RINOK(SzReadSize(sd, &size));
- (*unPackSizes)[si++] = size;
+ (*unpackSizes)[si++] = size;
sum += size;
}
- (*unPackSizes)[si++] = SzFolder_GetUnPackSize(folders + i) - sum;
+ (*unpackSizes)[si++] = SzFolder_GetUnpackSize(folders + i) - sum;
}
if (type == k7zIdSize)
{
RINOK(SzReadID(sd, &type));
}
- for (i = 0; i < *numUnPackStreams; i++)
+ for (i = 0; i < *numUnpackStreams; i++)
{
(*digestsDefined)[i] = 0;
(*digests)[i] = 0;
@@ -751,8 +739,8 @@ static SRes SzReadSubStreamsInfo(
for (i = 0; i < numFolders; i++)
{
- UInt32 numSubstreams = folders[i].NumUnPackStreams;
- if (numSubstreams != 1 || !folders[i].UnPackCRCDefined)
+ UInt32 numSubstreams = folders[i].NumUnpackStreams;
+ if (numSubstreams != 1 || !folders[i].UnpackCRCDefined)
numDigests += numSubstreams;
}
@@ -763,7 +751,7 @@ static SRes SzReadSubStreamsInfo(
if (type == k7zIdCRC)
{
int digestIndex = 0;
- Byte *digestsDefined2 = 0;
+ Byte *digestsDefined2 = 0;
UInt32 *digests2 = 0;
SRes res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp);
if (res == SZ_OK)
@@ -771,11 +759,11 @@ static SRes SzReadSubStreamsInfo(
for (i = 0; i < numFolders; i++)
{
CSzFolder *folder = folders + i;
- UInt32 numSubstreams = folder->NumUnPackStreams;
- if (numSubstreams == 1 && folder->UnPackCRCDefined)
+ UInt32 numSubstreams = folder->NumUnpackStreams;
+ if (numSubstreams == 1 && folder->UnpackCRCDefined)
{
(*digestsDefined)[si] = 1;
- (*digests)[si] = folder->UnPackCRC;
+ (*digests)[si] = folder->UnpackCRC;
si++;
}
else
@@ -806,11 +794,11 @@ static SRes SzReadSubStreamsInfo(
static SRes SzReadStreamsInfo(
- CSzData *sd,
+ CSzData *sd,
CFileSize *dataOffset,
CSzAr *p,
- UInt32 *numUnPackStreams,
- CFileSize **unPackSizes, /* allocTemp */
+ UInt32 *numUnpackStreams,
+ CFileSize **unpackSizes, /* allocTemp */
Byte **digestsDefined, /* allocTemp */
UInt32 **digests, /* allocTemp */
ISzAlloc *alloc,
@@ -828,19 +816,19 @@ static SRes SzReadStreamsInfo(
return SZ_OK;
case k7zIdPackInfo:
{
- RINOK(SzReadPackInfo(sd, dataOffset, &p->NumPackStreams,
+ RINOK(SzReadPackInfo(sd, dataOffset, &p->NumPackStreams,
&p->PackSizes, &p->PackCRCsDefined, &p->PackCRCs, alloc));
break;
}
- case k7zIdUnPackInfo:
+ case k7zIdUnpackInfo:
{
- RINOK(SzReadUnPackInfo(sd, &p->NumFolders, &p->Folders, alloc, allocTemp));
+ RINOK(SzReadUnpackInfo(sd, &p->NumFolders, &p->Folders, alloc, allocTemp));
break;
}
case k7zIdSubStreamsInfo:
{
- RINOK(SzReadSubStreamsInfo(sd, p->NumFolders, p->Folders,
- numUnPackStreams, unPackSizes, digestsDefined, digests, allocTemp));
+ RINOK(SzReadSubStreamsInfo(sd, p->NumFolders, p->Folders,
+ numUnpackStreams, unpackSizes, digestsDefined, digests, allocTemp));
break;
}
default:
@@ -928,18 +916,18 @@ static SRes SzReadFileNames(CSzData *sd, UInt32 numFiles, CSzFileItem *files, IS
static SRes SzReadHeader2(
CSzArEx *p, /* allocMain */
- CSzData *sd,
- CFileSize **unPackSizes, /* allocTemp */
+ CSzData *sd,
+ CFileSize **unpackSizes, /* allocTemp */
Byte **digestsDefined, /* allocTemp */
UInt32 **digests, /* allocTemp */
Byte **emptyStreamVector, /* allocTemp */
Byte **emptyFileVector, /* allocTemp */
Byte **lwtVector, /* allocTemp */
- ISzAlloc *allocMain,
+ ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
UInt64 type;
- UInt32 numUnPackStreams = 0;
+ UInt32 numUnpackStreams = 0;
UInt32 numFiles = 0;
CSzFileItem *files = 0;
UInt32 numEmptyStreams = 0;
@@ -958,9 +946,9 @@ static SRes SzReadHeader2(
{
RINOK(SzReadStreamsInfo(sd,
&p->ArchiveInfo.DataStartPosition,
- &p->db,
- &numUnPackStreams,
- unPackSizes,
+ &p->db,
+ &numUnpackStreams,
+ unpackSizes,
digestsDefined,
digests, allocMain, allocTemp));
p->ArchiveInfo.DataStartPosition += p->ArchiveInfo.StartPositionAfterHeader;
@@ -1017,7 +1005,7 @@ static SRes SzReadHeader2(
RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp));
break;
}
- case k7zIdLastWriteTime:
+ case k7zIdMTime:
{
RINOK(SzReadBoolVector2(sd, numFiles, lwtVector, allocTemp));
RINOK(SzReadSwitch(sd));
@@ -1025,12 +1013,12 @@ static SRes SzReadHeader2(
{
CSzFileItem *f = &files[i];
Byte defined = (*lwtVector)[i];
- f->IsLastWriteTimeDefined = defined;
- f->LastWriteTime.Low = f->LastWriteTime.High = 0;
+ f->MTimeDefined = defined;
+ f->MTime.Low = f->MTime.High = 0;
if (defined)
{
- RINOK(SzReadUInt32(sd, &f->LastWriteTime.Low));
- RINOK(SzReadUInt32(sd, &f->LastWriteTime.High));
+ RINOK(SzReadUInt32(sd, &f->MTime.Low));
+ RINOK(SzReadUInt32(sd, &f->MTime.High));
}
}
break;
@@ -1055,21 +1043,21 @@ static SRes SzReadHeader2(
file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1);
if(file->HasStream)
{
- file->IsDirectory = 0;
- file->Size = (*unPackSizes)[sizeIndex];
+ file->IsDir = 0;
+ file->Size = (*unpackSizes)[sizeIndex];
file->FileCRC = (*digests)[sizeIndex];
- file->IsFileCRCDefined = (Byte)(*digestsDefined)[sizeIndex];
+ file->FileCRCDefined = (Byte)(*digestsDefined)[sizeIndex];
sizeIndex++;
}
else
{
if (*emptyFileVector == 0)
- file->IsDirectory = 1;
+ file->IsDir = 1;
else
- file->IsDirectory = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1);
+ file->IsDir = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1);
emptyFileIndex++;
file->Size = 0;
- file->IsFileCRCDefined = 0;
+ file->FileCRCDefined = 0;
}
}
}
@@ -1077,50 +1065,50 @@ static SRes SzReadHeader2(
}
static SRes SzReadHeader(
- CSzArEx *p,
- CSzData *sd,
- ISzAlloc *allocMain,
+ CSzArEx *p,
+ CSzData *sd,
+ ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
- CFileSize *unPackSizes = 0;
+ CFileSize *unpackSizes = 0;
Byte *digestsDefined = 0;
UInt32 *digests = 0;
Byte *emptyStreamVector = 0;
Byte *emptyFileVector = 0;
Byte *lwtVector = 0;
SRes res = SzReadHeader2(p, sd,
- &unPackSizes, &digestsDefined, &digests,
- &emptyStreamVector, &emptyFileVector, &lwtVector,
+ &unpackSizes, &digestsDefined, &digests,
+ &emptyStreamVector, &emptyFileVector, &lwtVector,
allocMain, allocTemp);
- IAlloc_Free(allocTemp, unPackSizes);
+ IAlloc_Free(allocTemp, unpackSizes);
IAlloc_Free(allocTemp, digestsDefined);
IAlloc_Free(allocTemp, digests);
IAlloc_Free(allocTemp, emptyStreamVector);
IAlloc_Free(allocTemp, emptyFileVector);
IAlloc_Free(allocTemp, lwtVector);
return res;
-}
+}
static SRes SzReadAndDecodePackedStreams2(
- ISzInStream *inStream,
+ ISzInStream *inStream,
CSzData *sd,
CBuf *outBuffer,
- CFileSize baseOffset,
+ CFileSize baseOffset,
CSzAr *p,
- CFileSize **unPackSizes,
+ CFileSize **unpackSizes,
Byte **digestsDefined,
UInt32 **digests,
ISzAlloc *allocTemp)
{
- UInt32 numUnPackStreams = 0;
+ UInt32 numUnpackStreams = 0;
CFileSize dataStartPos;
CSzFolder *folder;
- CFileSize unPackSize;
+ CFileSize unpackSize;
SRes res;
RINOK(SzReadStreamsInfo(sd, &dataStartPos, p,
- &numUnPackStreams, unPackSizes, digestsDefined, digests,
+ &numUnpackStreams, unpackSizes, digestsDefined, digests,
allocTemp, allocTemp));
dataStartPos += baseOffset;
@@ -1128,41 +1116,41 @@ static SRes SzReadAndDecodePackedStreams2(
return SZ_ERROR_ARCHIVE;
folder = p->Folders;
- unPackSize = SzFolder_GetUnPackSize(folder);
+ unpackSize = SzFolder_GetUnpackSize(folder);
RINOK(inStream->Seek(inStream, dataStartPos, SZ_SEEK_SET));
- if (!Buf_Create(outBuffer, (size_t)unPackSize, allocTemp))
+ if (!Buf_Create(outBuffer, (size_t)unpackSize, allocTemp))
return SZ_ERROR_MEM;
- res = SzDecode(p->PackSizes, folder,
- inStream, dataStartPos,
- outBuffer->data, (size_t)unPackSize, allocTemp);
+ res = SzDecode(p->PackSizes, folder,
+ inStream, dataStartPos,
+ outBuffer->data, (size_t)unpackSize, allocTemp);
RINOK(res);
- if (folder->UnPackCRCDefined)
- if (CrcCalc(outBuffer->data, (size_t)unPackSize) != folder->UnPackCRC)
+ if (folder->UnpackCRCDefined)
+ if (CrcCalc(outBuffer->data, (size_t)unpackSize) != folder->UnpackCRC)
return SZ_ERROR_CRC;
return SZ_OK;
}
static SRes SzReadAndDecodePackedStreams(
- ISzInStream *inStream,
+ ISzInStream *inStream,
CSzData *sd,
CBuf *outBuffer,
- CFileSize baseOffset,
+ CFileSize baseOffset,
ISzAlloc *allocTemp)
{
CSzAr p;
- CFileSize *unPackSizes = 0;
+ CFileSize *unpackSizes = 0;
Byte *digestsDefined = 0;
UInt32 *digests = 0;
SRes res;
SzAr_Init(&p);
- res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset,
- &p, &unPackSizes, &digestsDefined, &digests,
+ res = SzReadAndDecodePackedStreams2(inStream, sd, outBuffer, baseOffset,
+ &p, &unpackSizes, &digestsDefined, &digests,
allocTemp);
SzAr_Free(&p, allocTemp);
- IAlloc_Free(allocTemp, unPackSizes);
+ IAlloc_Free(allocTemp, unpackSizes);
IAlloc_Free(allocTemp, digestsDefined);
IAlloc_Free(allocTemp, digests);
return res;
@@ -1170,8 +1158,8 @@ static SRes SzReadAndDecodePackedStreams(
static SRes SzArEx_Open2(
CSzArEx *p,
- ISzInStream *inStream,
- ISzAlloc *allocMain,
+ ISzInStream *inStream,
+ ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
Byte signature[k7zSignatureSize];
@@ -1249,8 +1237,8 @@ static SRes SzArEx_Open2(
{
CBuf outBuffer;
Buf_Init(&outBuffer);
- res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer,
- p->ArchiveInfo.StartPositionAfterHeader,
+ res = SzReadAndDecodePackedStreams(inStream, &sd, &outBuffer,
+ p->ArchiveInfo.StartPositionAfterHeader,
allocTemp);
if (res != SZ_OK)
{
diff --git a/C/Archive/7z/7zIn.h b/C/Archive/7z/7zIn.h
index 811bbb66..ba8a84f9 100755
--- a/C/Archive/7z/7zIn.h
+++ b/C/Archive/7z/7zIn.h
@@ -1,5 +1,5 @@
/* 7zIn.h -- 7z Input functions
-2008-05-05
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zItem.h for license options */
@@ -12,7 +12,7 @@ Read 7zItem.h for license options */
typedef struct
{
- CFileSize StartPositionAfterHeader;
+ CFileSize StartPositionAfterHeader;
CFileSize DataStartPosition;
} CInArchiveInfo;
@@ -31,7 +31,7 @@ void SzArEx_Free(CSzArEx *p, ISzAlloc *alloc);
CFileSize SzArEx_GetFolderStreamPos(const CSzArEx *p, UInt32 folderIndex, UInt32 indexInFolder);
int SzArEx_GetFolderFullPackSize(const CSzArEx *p, UInt32 folderIndex, CFileSize *resSize);
-typedef enum
+typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
diff --git a/C/Archive/7z/7zItem.c b/C/Archive/7z/7zItem.c
index 7a5ad427..2ebcf64c 100755
--- a/C/Archive/7z/7zItem.c
+++ b/C/Archive/7z/7zItem.c
@@ -1,5 +1,5 @@
/* 7zItem.c -- 7z Items
-2008-04-09
+2008-08-05
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read 7zItem.h for license options */
@@ -22,13 +22,13 @@ void SzFolder_Init(CSzFolder *p)
p->Coders = 0;
p->BindPairs = 0;
p->PackStreams = 0;
- p->UnPackSizes = 0;
+ p->UnpackSizes = 0;
p->NumCoders = 0;
p->NumBindPairs = 0;
p->NumPackStreams = 0;
- p->UnPackCRCDefined = 0;
- p->UnPackCRC = 0;
- p->NumUnPackStreams = 0;
+ p->UnpackCRCDefined = 0;
+ p->UnpackCRC = 0;
+ p->NumUnpackStreams = 0;
}
void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc)
@@ -40,7 +40,7 @@ void SzFolder_Free(CSzFolder *p, ISzAlloc *alloc)
IAlloc_Free(alloc, p->Coders);
IAlloc_Free(alloc, p->BindPairs);
IAlloc_Free(alloc, p->PackStreams);
- IAlloc_Free(alloc, p->UnPackSizes);
+ IAlloc_Free(alloc, p->UnpackSizes);
SzFolder_Init(p);
}
@@ -72,25 +72,25 @@ int SzFolder_FindBindPairForOutStream(CSzFolder *p, UInt32 outStreamIndex)
return -1;
}
-CFileSize SzFolder_GetUnPackSize(CSzFolder *p)
-{
+CFileSize SzFolder_GetUnpackSize(CSzFolder *p)
+{
int i = (int)SzFolder_GetNumOutStreams(p);
if (i == 0)
return 0;
for (i--; i >= 0; i--)
if (SzFolder_FindBindPairForOutStream(p, i) < 0)
- return p->UnPackSizes[i];
+ return p->UnpackSizes[i];
/* throw 1; */
return 0;
}
void SzFile_Init(CSzFileItem *p)
{
- p->IsFileCRCDefined = 0;
p->HasStream = 1;
- p->IsDirectory = 0;
+ p->IsDir = 0;
p->IsAnti = 0;
- p->IsLastWriteTimeDefined = 0;
+ p->FileCRCDefined = 0;
+ p->MTimeDefined = 0;
p->Name = 0;
}
diff --git a/C/Archive/7z/7zItem.h b/C/Archive/7z/7zItem.h
index 074a3a99..ede1a8c3 100755
--- a/C/Archive/7z/7zItem.h
+++ b/C/Archive/7z/7zItem.h
@@ -1,5 +1,5 @@
/* 7zItem.h -- 7z Items
-2008-05-01
+2008-07-09
Igor Pavlov
Copyright (c) 1999-2008 Igor Pavlov
Read LzmaDec.h for license options */
@@ -13,9 +13,9 @@ Read LzmaDec.h for license options */
/* You can define _SZ_FILE_SIZE_32, if you don't need support for files larger than 4 GB*/
#ifdef _SZ_FILE_SIZE_32
-typedef UInt32 CFileSize;
+typedef UInt32 CFileSize;
#else
-typedef UInt64 CFileSize;
+typedef UInt64 CFileSize;
#endif
typedef UInt64 CMethodID;
@@ -42,21 +42,21 @@ typedef struct
CSzCoderInfo *Coders;
CBindPair *BindPairs;
UInt32 *PackStreams;
- CFileSize *UnPackSizes;
+ CFileSize *UnpackSizes;
UInt32 NumCoders;
UInt32 NumBindPairs;
- UInt32 NumPackStreams;
- int UnPackCRCDefined;
- UInt32 UnPackCRC;
+ UInt32 NumPackStreams;
+ int UnpackCRCDefined;
+ UInt32 UnpackCRC;
- UInt32 NumUnPackStreams;
+ UInt32 NumUnpackStreams;
} CSzFolder;
void SzFolder_Init(CSzFolder *p);
-CFileSize SzFolder_GetUnPackSize(CSzFolder *p);
+CFileSize SzFolder_GetUnpackSize(CSzFolder *p);
int SzFolder_FindBindPairForInStream(CSzFolder *p, UInt32 inStreamIndex);
UInt32 SzFolder_GetNumOutStreams(CSzFolder *p);
-CFileSize SzFolder_GetUnPackSize(CSzFolder *p);
+CFileSize SzFolder_GetUnpackSize(CSzFolder *p);
typedef struct
{
@@ -66,25 +66,16 @@ typedef struct
typedef struct
{
- CNtfsFileTime LastWriteTime;
- /*
- CFileSize StartPos;
- UInt32 Attributes;
- */
+ CNtfsFileTime MTime;
CFileSize Size;
char *Name;
UInt32 FileCRC;
- Byte IsFileCRCDefined;
Byte HasStream;
- Byte IsDirectory;
+ Byte IsDir;
Byte IsAnti;
- Byte IsLastWriteTimeDefined;
- /*
- int AreAttributesDefined;
- int IsLastWriteTimeDefined;
- int IsStartPosDefined;
- */
+ Byte FileCRCDefined;
+ Byte MTimeDefined;
} CSzFileItem;
void SzFile_Init(CSzFileItem *p);
diff --git a/C/Archive/7z/7zMain.c b/C/Archive/7z/7zMain.c
index 62f50689..082a2ebd 100755
--- a/C/Archive/7z/7zMain.c
+++ b/C/Archive/7z/7zMain.c
@@ -1,5 +1,5 @@
/* 7zMain.c - Test application for 7z Decoder
-2008-04-09
+2008-08-05
Igor Pavlov
Public domain */
@@ -32,7 +32,7 @@ void ConvertNumberToString(CFileSize value, char *s)
{
char temp[32];
int pos = 0;
- do
+ do
{
temp[pos++] = (char)('0' + (int)(value % 10));
value /= 10;
@@ -54,7 +54,7 @@ void ConvertFileTimeToString(CNtfsFileTime *ft, char *s)
UInt64 v64 = ft->Low | ((UInt64)ft->High << 32);
Byte ms[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
unsigned temp;
- UInt32 v;
+ UInt32 v;
v64 /= 10000000;
sec = (unsigned)(v64 % 60);
v64 /= 60;
@@ -103,15 +103,15 @@ void ConvertFileTimeToString(CNtfsFileTime *ft, char *s)
#ifdef USE_WINDOWS_FUNCTIONS
/*
ReadFile and WriteFile functions in Windows have BUG:
- If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
- from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
+ If you Read or Write 64MB or more (probably min_failure_size = 64MB - 32KB + 1)
+ from/to Network file, it returns ERROR_NO_SYSTEM_RESOURCES
(Insufficient system resources exist to complete the requested service).
*/
#define kChunkSizeMax (1 << 24)
#endif
size_t MyReadFile(MY_FILE_HANDLE file, void *data, size_t size)
-{
+{
if (size == 0)
return 0;
#ifdef USE_WINDOWS_FUNCTIONS
@@ -132,12 +132,12 @@ size_t MyReadFile(MY_FILE_HANDLE file, void *data, size_t size)
return processedSize;
}
#else
- return fread(data, 1, size, file);
+ return fread(data, 1, size, file);
#endif
}
size_t MyWriteFile(MY_FILE_HANDLE file, void *data, size_t size)
-{
+{
if (size == 0)
return 0;
#ifdef USE_WINDOWS_FUNCTIONS
@@ -158,16 +158,16 @@ size_t MyWriteFile(MY_FILE_HANDLE file, void *data, size_t size)
return processedSize;
}
#else
- return fwrite(data, 1, size, file);
+ return fwrite(data, 1, size, file);
#endif
}
int MyCloseFile(MY_FILE_HANDLE file)
-{
+{
#ifdef USE_WINDOWS_FUNCTIONS
return (CloseHandle(file) != FALSE) ? 0 : 1;
#else
- return fclose(file);
+ return fclose(file);
#endif
}
@@ -205,7 +205,7 @@ SRes SzFileSeekImp(void *object, CFileSize pos, ESzSeek origin)
/* VC 6.0 has bug with >> 32 shifts. */
value.HighPart = 0;
#endif
- switch (origin)
+ switch (origin)
{
case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
@@ -214,14 +214,14 @@ SRes SzFileSeekImp(void *object, CFileSize pos, ESzSeek origin)
}
value.LowPart = SetFilePointer(s->File, value.LowPart, &value.HighPart, moveMethod);
if (value.LowPart == 0xFFFFFFFF)
- if (GetLastError() != NO_ERROR)
+ if (GetLastError() != NO_ERROR)
return SZ_ERROR_FAIL;
return SZ_OK;
}
#else
int moveMethod;
int res;
- switch (origin)
+ switch (origin)
{
case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
@@ -246,7 +246,7 @@ int MY_CDECL main(int numargs, char *args[])
ISzAlloc allocImp;
ISzAlloc allocTempImp;
- printf("\n7z ANSI-C Decoder 4.58 Copyright (c) 1999-2008 Igor Pavlov 2008-04-09\n");
+ printf("\n7z ANSI-C Decoder 4.59 Copyright (c) 1999-2008 Igor Pavlov 2008-07-09\n");
if (numargs == 1)
{
printf(
@@ -263,9 +263,9 @@ int MY_CDECL main(int numargs, char *args[])
return 1;
}
- archiveStream.File =
+ archiveStream.File =
#ifdef USE_WINDOWS_FUNCTIONS
- CreateFileA(args[2], GENERIC_READ, FILE_SHARE_READ,
+ CreateFileA(args[2], GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (archiveStream.File == INVALID_HANDLE_VALUE)
#else
@@ -311,8 +311,8 @@ int MY_CDECL main(int numargs, char *args[])
CSzFileItem *f = db.db.Files + i;
char s[32], t[32];
ConvertNumberToString(f->Size, s);
- if (f->IsLastWriteTimeDefined)
- ConvertFileTimeToString(&f->LastWriteTime, t);
+ if (f->MTimeDefined)
+ ConvertFileTimeToString(&f->MTime, t);
else
strcpy(t, " ");
@@ -337,21 +337,21 @@ int MY_CDECL main(int numargs, char *args[])
size_t offset;
size_t outSizeProcessed;
CSzFileItem *f = db.db.Files + i;
- if (f->IsDirectory)
+ if (f->IsDir)
printf("Directory ");
else
- printf(testCommand ?
+ printf(testCommand ?
"Testing ":
"Extracting");
printf(" %s", f->Name);
- if (f->IsDirectory)
+ if (f->IsDir)
{
printf("\n");
continue;
}
- res = SzAr_Extract(&db, &archiveStream.InStream, i,
- &blockIndex, &outBuffer, &outBufferSize,
- &offset, &outSizeProcessed,
+ res = SzAr_Extract(&db, &archiveStream.InStream, i,
+ &blockIndex, &outBuffer, &outBufferSize,
+ &offset, &outSizeProcessed,
&allocImp, &allocTempImp);
if (res != SZ_OK)
break;
@@ -368,9 +368,9 @@ int MY_CDECL main(int numargs, char *args[])
break;
}
- outputHandle =
+ outputHandle =
#ifdef USE_WINDOWS_FUNCTIONS
- CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_READ,
+ CreateFileA(fileName, GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (outputHandle == INVALID_HANDLE_VALUE)
#else
@@ -420,7 +420,7 @@ int MY_CDECL main(int numargs, char *args[])
PrintError("can not allocate memory");
else if (res == SZ_ERROR_CRC)
PrintError("CRC error");
- else
+ else
printf("\nERROR #%d\n", res);
return 1;
}
diff --git a/C/Archive/7z/makefile.gcc b/C/Archive/7z/makefile.gcc
index 796412a1..6d3da99c 100755
--- a/C/Archive/7z/makefile.gcc
+++ b/C/Archive/7z/makefile.gcc
@@ -1,6 +1,6 @@
PROG = 7zDec
CXX = g++
-LIB =
+LIB =
RM = rm -f
CFLAGS = -c -O2 -Wall