This commit is contained in:
Igor Pavlov
2010-06-20 00:00:00 +00:00
committed by Kornel Lesiński
parent 708873490e
commit e279500d76
23 changed files with 130 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 14 #define MY_VER_MINOR 15
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.14 beta" #define MY_VERSION "9.15 beta"
#define MY_DATE "2010-06-04" #define MY_DATE "2010-06-20"
#define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_COPYRIGHT ": Igor Pavlov : Public domain"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE

View File

@@ -1,9 +1,9 @@
/* Crypto/Sha256.c -- SHA-256 Hash function /* Crypto/Sha256.c -- SHA-256 Hash
2008-11-06 : Igor Pavlov : Public domain 2010-06-11 : Igor Pavlov : Public domain
This code is based on public domain code from Wei Dai's Crypto++ library. */ This code is based on public domain code from Wei Dai's Crypto++ library. */
#include "Sha256.h"
#include "RotateDefs.h" #include "RotateDefs.h"
#include "Sha256.h"
/* define it for speed optimization */ /* define it for speed optimization */
/* #define _SHA256_UNROLL */ /* #define _SHA256_UNROLL */
@@ -71,7 +71,7 @@ void Sha256_Init(CSha256 *p)
#endif #endif
const UInt32 K[64] = { static const UInt32 K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,

View File

@@ -1,14 +1,12 @@
/* Sha256.h -- SHA-256 Hash /* Sha256.h -- SHA-256 Hash
2009-02-07 : Igor Pavlov : Public domain */ 2010-06-11 : Igor Pavlov : Public domain */
#ifndef __CRYPTO_SHA256_H #ifndef __CRYPTO_SHA256_H
#define __CRYPTO_SHA256_H #define __CRYPTO_SHA256_H
#include "Types.h" #include "Types.h"
#ifdef __cplusplus EXTERN_C_BEGIN
extern "C" {
#endif
#define SHA256_DIGEST_SIZE 32 #define SHA256_DIGEST_SIZE 32
@@ -23,8 +21,6 @@ void Sha256_Init(CSha256 *p);
void Sha256_Update(CSha256 *p, const Byte *data, size_t size); void Sha256_Update(CSha256 *p, const Byte *data, size_t size);
void Sha256_Final(CSha256 *p, Byte *digest); void Sha256_Final(CSha256 *p, Byte *digest);
#ifdef __cplusplus EXTERN_C_END
}
#endif
#endif #endif

View File

@@ -2,15 +2,14 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "7zHandler.h" #include "../../../Common/ComTry.h"
#include "7zFolderOutStream.h"
#include "../../Common/ProgressUtils.h"
#include "7zDecode.h" #include "7zDecode.h"
// #include "7z1Decode.h" // #include "7z1Decode.h"
#include "7zFolderOutStream.h"
#include "../../../Common/ComTry.h" #include "7zHandler.h"
#include "../../Common/StreamObjects.h"
#include "../../Common/ProgressUtils.h"
#include "../../Common/LimitedStreams.h"
namespace NArchive { namespace NArchive {
namespace N7z { namespace N7z {
@@ -73,13 +72,13 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
*/ */
CObjectVector<CExtractFolderInfo> extractFolderInfoVector; CObjectVector<CExtractFolderInfo> extractFolderInfoVector;
for(UInt32 ii = 0; ii < numItems; ii++) for (UInt32 ii = 0; ii < numItems; ii++)
{ {
// UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex]; // UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex];
UInt32 ref2Index = allFilesMode ? ii : indices[ii]; UInt32 ref2Index = allFilesMode ? ii : indices[ii];
// const CRef2 &ref2 = _refs[ref2Index]; // const CRef2 &ref2 = _refs[ref2Index];
// for(UInt32 ri = 0; ri < ref2.Refs.Size(); ri++) // for (UInt32 ri = 0; ri < ref2.Refs.Size(); ri++)
{ {
#ifdef _7Z_VOL #ifdef _7Z_VOL
// const CRef &ref = ref2.Refs[ri]; // const CRef &ref = ref2.Refs[ri];
@@ -149,27 +148,26 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
); );
// CDecoder1 decoder; // CDecoder1 decoder;
UInt64 currentTotalPacked = 0; UInt64 totalPacked = 0;
UInt64 currentTotalUnpacked = 0; UInt64 totalUnpacked = 0;
UInt64 totalFolderUnpacked; UInt64 curPacked, curUnpacked;
UInt64 totalFolderPacked;
CLocalProgress *lps = new CLocalProgress; CLocalProgress *lps = new CLocalProgress;
CMyComPtr<ICompressProgressInfo> progress = lps; CMyComPtr<ICompressProgressInfo> progress = lps;
lps->Init(extractCallback, false); lps->Init(extractCallback, false);
for(int i = 0; i < extractFolderInfoVector.Size(); i++, for (int i = 0;; i++, totalUnpacked += curUnpacked, totalPacked += curPacked)
currentTotalUnpacked += totalFolderUnpacked,
currentTotalPacked += totalFolderPacked)
{ {
lps->OutSize = currentTotalUnpacked; lps->OutSize = totalUnpacked;
lps->InSize = currentTotalPacked; lps->InSize = totalPacked;
RINOK(lps->SetCur()); RINOK(lps->SetCur());
const CExtractFolderInfo &efi = extractFolderInfoVector[i]; if (i >= extractFolderInfoVector.Size())
totalFolderUnpacked = efi.UnpackSize; break;
totalFolderPacked = 0; const CExtractFolderInfo &efi = extractFolderInfoVector[i];
curUnpacked = efi.UnpackSize;
curPacked = 0;
CFolderOutStream *folderOutStream = new CFolderOutStream; CFolderOutStream *folderOutStream = new CFolderOutStream;
CMyComPtr<ISequentialOutStream> outStream(folderOutStream); CMyComPtr<ISequentialOutStream> outStream(folderOutStream);
@@ -187,7 +185,6 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
else else
startIndex = db.FolderStartFileIndex[efi.FolderIndex]; startIndex = db.FolderStartFileIndex[efi.FolderIndex];
HRESULT result = folderOutStream->Init(&db, HRESULT result = folderOutStream->Init(&db,
#ifdef _7Z_VOL #ifdef _7Z_VOL
volume.StartRef2Index, volume.StartRef2Index,
@@ -205,7 +202,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
CNum folderIndex = efi.FolderIndex; CNum folderIndex = efi.FolderIndex;
const CFolder &folderInfo = db.Folders[folderIndex]; const CFolder &folderInfo = db.Folders[folderIndex];
totalFolderPacked = _db.GetFolderFullPackSize(folderIndex); curPacked = _db.GetFolderFullPackSize(folderIndex);
CNum packStreamIndex = db.FolderStartPackStreamIndex[folderIndex]; CNum packStreamIndex = db.FolderStartPackStreamIndex[folderIndex];
UInt64 folderStartPackPos = db.GetFolderStreamPos(folderIndex, 0); UInt64 folderStartPackPos = db.GetFolderStreamPos(folderIndex, 0);

View File

@@ -85,6 +85,7 @@ STDAPI CreateArchiver(const GUID *clsid, const GUID *iid, void **outObject)
STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value) STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value)
{ {
COM_TRY_BEGIN
if (formatIndex >= g_NumArcs) if (formatIndex >= g_NumArcs)
return E_INVALIDARG; return E_INVALIDARG;
const CArcInfo &arc = *g_Arcs[formatIndex]; const CArcInfo &arc = *g_Arcs[formatIndex];
@@ -119,6 +120,7 @@ STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value
} }
prop.Detach(value); prop.Detach(value);
return S_OK; return S_OK;
COM_TRY_END
} }
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)

View File

@@ -41,7 +41,7 @@ enum
}; };
#endif #endif
STATPROPSTG kProps[] = static STATPROPSTG kProps[] =
{ {
{ NULL, kpidPath, VT_BSTR}, { NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8}, { NULL, kpidSize, VT_UI8},
@@ -57,18 +57,18 @@ STATPROPSTG kProps[] =
#endif #endif
}; };
static const wchar_t *kMethods[] = static const char *kMethods[] =
{ {
L"None", "None",
L"MSZip", "MSZip",
L"Quantum", "Quantum",
L"LZX" "LZX"
}; };
static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]); static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
static const wchar_t *kUnknownMethod = L"Unknown"; static const char *kUnknownMethod = "Unknown";
STATPROPSTG kArcProps[] = static STATPROPSTG kArcProps[] =
{ {
{ NULL, kpidMethod, VT_BSTR}, { NULL, kpidMethod, VT_BSTR},
// { NULL, kpidSolid, VT_BOOL}, // { NULL, kpidSolid, VT_BOOL},
@@ -87,7 +87,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{ {
case kpidMethod: case kpidMethod:
{ {
UString resString; AString resString;
CRecordVector<Byte> ids; CRecordVector<Byte> ids;
int i; int i;
for (int v = 0; v < m_Database.Volumes.Size(); v++) for (int v = 0; v < m_Database.Volumes.Size(); v++)
@@ -99,9 +99,9 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
for (i = 0; i < ids.Size(); i++) for (i = 0; i < ids.Size(); i++)
{ {
Byte id = ids[i]; Byte id = ids[i];
UString method = (id < kNumMethods) ? kMethods[id] : kUnknownMethod; AString method = (id < kNumMethods) ? kMethods[id] : kUnknownMethod;
if (!resString.IsEmpty()) if (!resString.IsEmpty())
resString += L' '; resString += ' ';
resString += method; resString += method;
} }
prop = resString; prop = resString;
@@ -171,12 +171,12 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
UInt32 realFolderIndex = item.GetFolderIndex(db.Folders.Size()); UInt32 realFolderIndex = item.GetFolderIndex(db.Folders.Size());
const CFolder &folder = db.Folders[realFolderIndex]; const CFolder &folder = db.Folders[realFolderIndex];
int methodIndex = folder.GetCompressionMethod(); int methodIndex = folder.GetCompressionMethod();
UString method = (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod; AString method = (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod;
if (methodIndex == NHeader::NCompressionMethodMajor::kLZX || if (methodIndex == NHeader::NCompressionMethodMajor::kLZX ||
methodIndex == NHeader::NCompressionMethodMajor::kQuantum) methodIndex == NHeader::NCompressionMethodMajor::kQuantum)
{ {
method += L":"; method += ':';
wchar_t temp[32]; char temp[32];
ConvertUInt64ToString(folder.CompressionTypeMinor, temp); ConvertUInt64ToString(folder.CompressionTypeMinor, temp);
method += temp; method += temp;
} }

View File

@@ -578,8 +578,12 @@ HRESULT CDatabase::Open()
return S_FALSE; return S_FALSE;
UInt64 fileSize; UInt64 fileSize;
RINOK(InStream->Seek(0, STREAM_SEEK_END, &fileSize)); RINOK(InStream->Seek(0, STREAM_SEEK_END, &fileSize));
/* we comment that check to support truncated images */
/*
if (fileSize < Header.GetPhySize()) if (fileSize < Header.GetPhySize())
return S_FALSE; return S_FALSE;
*/
if (Header.IsFat32()) if (Header.IsFat32())
{ {

View File

@@ -391,7 +391,6 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
{ {
COM_TRY_BEGIN COM_TRY_BEGIN
Close(); Close();
try
{ {
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback; CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
@@ -488,10 +487,6 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
_xmlInComments = (_xmls.Size() == 1 && !_db.ShowImageNumber); _xmlInComments = (_xmls.Size() == 1 && !_db.ShowImageNumber);
} }
catch(...)
{
return S_FALSE;
}
return S_OK; return S_OK;
COM_TRY_END COM_TRY_END
} }

View File

@@ -258,7 +258,7 @@ static size_t WriteItem(const CUpdateItem &item, Byte *p, const Byte *hash)
return totalLen; return totalLen;
} }
void WriteTree(const CDir &tree, CRecordVector<CSha1Hash> &digests, static void WriteTree(const CDir &tree, CRecordVector<CSha1Hash> &digests,
CUpdateItem &defaultDirItem, CUpdateItem &defaultDirItem,
CObjectVector<CUpdateItem> &updateItems, Byte *dest, size_t &pos) CObjectVector<CUpdateItem> &updateItems, Byte *dest, size_t &pos)
{ {
@@ -488,11 +488,15 @@ static HRESULT UpdateArchive(ISequentialOutStream *seqOutStream,
const UInt32 kSecuritySize = 8; const UInt32 kSecuritySize = 8;
size_t pos = kSecuritySize; size_t pos = kSecuritySize;
WriteTree(rootFolder, hashes.Digests, ri, updateItems, NULL, pos); WriteTree(rootFolder, hashes.Digests, ri, updateItems, NULL, pos);
CByteBuffer meta; CByteBuffer meta;
meta.SetCapacity(pos); meta.SetCapacity(pos);
// memset(meta, 0, kSecuritySize);
Set32((Byte *)meta, 0); // only if there is no security data, we can use 0 here. // we can write 0 here only if there is no security data, imageX does it,
// but some programs expect size = 8
Set32((Byte *)meta, 8); // size of security data
Set32((Byte *)meta + 4, 0); // num security entries Set32((Byte *)meta + 4, 0); // num security entries
pos = kSecuritySize; pos = kSecuritySize;
WriteTree(rootFolder, hashes.Digests, ri, updateItems, (Byte *)meta, pos); WriteTree(rootFolder, hashes.Digests, ri, updateItems, (Byte *)meta, pos);

View File

@@ -384,7 +384,12 @@ HRESULT CDatabase::ParseDirItem(size_t pos, int parent)
return S_FALSE; return S_FALSE;
UInt32 fileNameLen = Get16(p + 0x24); UInt32 fileNameLen = Get16(p + 0x24);
if ((fileNameLen & 1) != 0 || ((0x26 + fileNameLen + 6) & ~7) != len) if ((fileNameLen & 1) != 0)
return S_FALSE;
/* Probably different versions of ImageX can use different number of
additional ZEROs. So we don't use exact check. */
UInt32 fileNameLen2 = (fileNameLen == 0 ? fileNameLen : fileNameLen + 2);
if (((0x26 + fileNameLen2 + 6) & ~7) > len)
return S_FALSE; return S_FALSE;
UString name; UString name;

View File

@@ -1,3 +1,3 @@
#include "../../MyVersionInfo.rc" #include "../../MyVersionInfo.rc"
MY_VERSION_INFO_APP("7-Zip Standalone Console", "7za") MY_VERSION_INFO_APP("7-Zip Standalone Console", "7zr")

View File

@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 14 #define MY_VER_MINOR 15
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.14 beta" #define MY_VERSION "9.15 beta"
#define MY_7ZIP_VERSION "7-Zip 9.14 beta" #define MY_7ZIP_VERSION "7-Zip 9.15 beta"
#define MY_DATE "2010-06-04" #define MY_DATE "2010-06-20"
#define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -514,11 +514,9 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
CMyComBSTR name; CMyComBSTR name;
PROPID propID; PROPID propID;
VARTYPE vt; VARTYPE vt;
if (archive->GetArchivePropertyInfo(j, &name, &propID, &vt) != S_OK) RINOK(archive->GetArchivePropertyInfo(j, &name, &propID, &vt));
continue;
NCOM::CPropVariant prop; NCOM::CPropVariant prop;
if (archive->GetArchiveProperty(propID, &prop) != S_OK) RINOK(archive->GetArchiveProperty(propID, &prop));
continue;
UString s = ConvertPropertyToString(prop, propID); UString s = ConvertPropertyToString(prop, propID);
if (!s.IsEmpty()) if (!s.IsEmpty())
PrintPropPair(GetPropName(propID, name), s); PrintPropPair(GetPropName(propID, name), s);
@@ -536,11 +534,9 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
CMyComBSTR name; CMyComBSTR name;
PROPID propID; PROPID propID;
VARTYPE vt; VARTYPE vt;
if (archive->GetPropertyInfo(j, &name, &propID, &vt) != S_OK) RINOK(archive->GetPropertyInfo(j, &name, &propID, &vt));
continue;
NCOM::CPropVariant prop; NCOM::CPropVariant prop;
if (archive->GetProperty(mainIndex, propID, &prop) != S_OK) RINOK(archive->GetProperty(mainIndex, propID, &prop));
continue;
UString s = ConvertPropertyToString(prop, propID); UString s = ConvertPropertyToString(prop, propID);
if (!s.IsEmpty()) if (!s.IsEmpty())
PrintPropPair(GetPropName(propID, name), s); PrintPropPair(GetPropName(propID, name), s);

View File

@@ -21,6 +21,6 @@ CAPTION "About 7-Zip"
ICON IDI_LOGO, -1, m, m, 32, 32, SS_REALSIZEIMAGE ICON IDI_LOGO, -1, m, m, 32, 32, SS_REALSIZEIMAGE
LTEXT MY_7ZIP_VERSION, -1, m, 54, xc, 8 LTEXT MY_7ZIP_VERSION, -1, m, 54, xc, 8
LTEXT MY_COPYRIGHT, -1, m, 67, xc, 8 LTEXT MY_COPYRIGHT, -1, m, 67, xc, 8
LTEXT "7-Zip is free software. However, you can support development of 7-Zip by registering.", LTEXT "7-Zip is free software",
IDC_ABOUT_STATIC_REGISTER_INFO, m, y, xc, (by - y - 1) IDC_ABOUT_STATIC_REGISTER_INFO, m, y, xc, (by - y - 1)
} }

View File

@@ -236,12 +236,12 @@ private:
void ChangeWindowSize(int xSize, int ySize); void ChangeWindowSize(int xSize, int ySize);
void InitColumns(); HRESULT InitColumns();
// void InitColumns2(PROPID sortID); // void InitColumns2(PROPID sortID);
void InsertColumn(int index); void InsertColumn(int index);
void SetFocusedSelectedItem(int index, bool select); void SetFocusedSelectedItem(int index, bool select);
void RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused, HRESULT RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
const UStringVector &selectedNames); const UStringVector &selectedNames);
void OnShiftSelectMessage(); void OnShiftSelectMessage();
@@ -335,8 +335,8 @@ public:
void GetSelectedNames(UStringVector &selectedNames); void GetSelectedNames(UStringVector &selectedNames);
void SaveSelectedState(CSelectedState &s); void SaveSelectedState(CSelectedState &s);
void RefreshListCtrl(const CSelectedState &s); HRESULT RefreshListCtrl(const CSelectedState &s);
void RefreshListCtrlSaveFocused(); HRESULT RefreshListCtrlSaveFocused();
UString GetItemName(int itemIndex) const; UString GetItemName(int itemIndex) const;
UString GetItemPrefix(int itemIndex) const; UString GetItemPrefix(int itemIndex) const;
@@ -517,7 +517,7 @@ public:
// bool _passwordIsDefined; // bool _passwordIsDefined;
// UString _password; // UString _password;
void RefreshListCtrl(); HRESULT RefreshListCtrl();
void MessageBoxInfo(LPCWSTR message, LPCWSTR caption); void MessageBoxInfo(LPCWSTR message, LPCWSTR caption);
void MessageBox(LPCWSTR message); void MessageBox(LPCWSTR message);

View File

@@ -55,7 +55,7 @@ static int GetColumnAlign(PROPID propID, VARTYPE varType)
} }
} }
void CPanel::InitColumns() HRESULT CPanel::InitColumns()
{ {
if (_needSaveInfo) if (_needSaveInfo)
SaveListViewInfo(); SaveListViewInfo();
@@ -88,8 +88,7 @@ void CPanel::InitColumns()
PROPID propID; PROPID propID;
VARTYPE varType; VARTYPE varType;
if (_folder->GetPropertyInfo(i, &name, &propID, &varType) != S_OK) RINOK(_folder->GetPropertyInfo(i, &name, &propID, &varType));
throw 1;
if (propID == kpidIsDir) if (propID == kpidIsDir)
continue; continue;
@@ -110,7 +109,7 @@ void CPanel::InitColumns()
break; break;
int order = 0; int order = 0;
for(i = 0; i < _listViewInfo.Columns.Size(); i++) for (i = 0; i < _listViewInfo.Columns.Size(); i++)
{ {
const CColumnInfo &columnInfo = _listViewInfo.Columns[i]; const CColumnInfo &columnInfo = _listViewInfo.Columns[i];
int index = _properties.FindItemWithID(columnInfo.PropID); int index = _properties.FindItemWithID(columnInfo.PropID);
@@ -124,7 +123,7 @@ void CPanel::InitColumns()
continue; continue;
} }
} }
for(i = 0; i < _properties.Size(); i++) for (i = 0; i < _properties.Size(); i++)
{ {
CItemProperty &item = _properties[i]; CItemProperty &item = _properties[i];
if (item.Order < 0) if (item.Order < 0)
@@ -155,6 +154,7 @@ void CPanel::InitColumns()
{ {
InsertColumn(i); InsertColumn(i);
} }
return S_OK;
} }
void CPanel::InsertColumn(int index) void CPanel::InsertColumn(int index)
@@ -170,9 +170,9 @@ void CPanel::InsertColumn(int index)
_listView.InsertColumn(index, &column); _listView.InsertColumn(index, &column);
} }
void CPanel::RefreshListCtrl() HRESULT CPanel::RefreshListCtrl()
{ {
RefreshListCtrl(UString(), -1, true, UStringVector()); return RefreshListCtrl(UString(), -1, true, UStringVector());
} }
int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData); int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
@@ -239,19 +239,19 @@ void CPanel::SaveSelectedState(CSelectedState &s)
GetSelectedNames(s.SelectedNames); GetSelectedNames(s.SelectedNames);
} }
void CPanel::RefreshListCtrl(const CSelectedState &s) HRESULT CPanel::RefreshListCtrl(const CSelectedState &s)
{ {
bool selectFocused = s.SelectFocused; bool selectFocused = s.SelectFocused;
if (_mySelectMode) if (_mySelectMode)
selectFocused = true; selectFocused = true;
RefreshListCtrl(s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames); return RefreshListCtrl(s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames);
} }
void CPanel::RefreshListCtrlSaveFocused() HRESULT CPanel::RefreshListCtrlSaveFocused()
{ {
CSelectedState state; CSelectedState state;
SaveSelectedState(state); SaveSelectedState(state);
RefreshListCtrl(state); return RefreshListCtrl(state);
} }
void CPanel::SetFocusedSelectedItem(int index, bool select) void CPanel::SetFocusedSelectedItem(int index, bool select)
@@ -268,7 +268,7 @@ void CPanel::SetFocusedSelectedItem(int index, bool select)
} }
} }
void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused, HRESULT CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
const UStringVector &selectedNames) const UStringVector &selectedNames)
{ {
_dontShowMode = false; _dontShowMode = false;
@@ -309,11 +309,8 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
if (folderSetFlatMode) if (folderSetFlatMode)
folderSetFlatMode->SetFlatMode(BoolToInt(_flatMode)); folderSetFlatMode->SetFlatMode(BoolToInt(_flatMode));
if (_folder->LoadItems() != S_OK) RINOK(_folder->LoadItems());
return; RINOK(InitColumns());
InitColumns();
// OutputDebugString(TEXT("Start Dir\n")); // OutputDebugString(TEXT("Start Dir\n"));
UInt32 numItems; UInt32 numItems;
@@ -345,13 +342,13 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
item.iImage = _extToIconMap.GetIconIndex(attrib, itemName); item.iImage = _extToIconMap.GetIconIndex(attrib, itemName);
if (item.iImage < 0) if (item.iImage < 0)
item.iImage = 0; item.iImage = 0;
if(_listView.InsertItem(&item) == -1) if (_listView.InsertItem(&item) == -1)
return; return E_FAIL;
} }
// OutputDebugStringA("S1\n"); // OutputDebugStringA("S1\n");
for(UInt32 i = 0; i < numItems; i++) for (UInt32 i = 0; i < numItems; i++)
{ {
UString itemName = GetItemName(i); UString itemName = GetItemName(i);
const UString relPath = GetItemRelPath(i); const UString relPath = GetItemRelPath(i);
@@ -400,7 +397,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
item.pszText = (wchar_t *)(const wchar_t *)itemName; item.pszText = (wchar_t *)(const wchar_t *)itemName;
NCOM::CPropVariant prop; NCOM::CPropVariant prop;
_folder->GetProperty(i, kpidAttrib, &prop); RINOK(_folder->GetProperty(i, kpidAttrib, &prop));
UInt32 attrib = 0; UInt32 attrib = 0;
if (prop.vt == VT_UI4) if (prop.vt == VT_UI4)
attrib = prop.ulVal; attrib = prop.ulVal;
@@ -430,12 +427,12 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
if (item.iImage < 0) if (item.iImage < 0)
item.iImage = 0; item.iImage = 0;
if(_listView.InsertItem(&item) == -1) if (_listView.InsertItem(&item) == -1)
return; // error return E_FAIL; // error
} }
// OutputDebugStringA("End2\n"); // OutputDebugStringA("End2\n");
if(_listView.GetItemCount() > 0 && cursorIndex >= 0) if (_listView.GetItemCount() > 0 && cursorIndex >= 0)
SetFocusedSelectedItem(cursorIndex, selectFocused); SetFocusedSelectedItem(cursorIndex, selectFocused);
_listView.SortItems(CompareItems, (LPARAM)this); _listView.SortItems(CompareItems, (LPARAM)this);
if (cursorIndex < 0 && _listView.GetItemCount() > 0) if (cursorIndex < 0 && _listView.GetItemCount() > 0)
@@ -452,6 +449,7 @@ void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool se
/* /*
_listView.UpdateWindow(); _listView.UpdateWindow();
*/ */
return S_OK;
} }
void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const
@@ -482,7 +480,7 @@ void CPanel::GetOperatedItemIndices(CRecordVector<UInt32> &indices) const
int focusedItem = _listView.GetFocusedItem(); int focusedItem = _listView.GetFocusedItem();
if (focusedItem >= 0) if (focusedItem >= 0)
{ {
if(_listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED) if (_listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED)
{ {
int realIndex = GetRealItemIndex(focusedItem); int realIndex = GetRealItemIndex(focusedItem);
if (realIndex != kParentIndex) if (realIndex != kParentIndex)
@@ -572,7 +570,7 @@ void CPanel::OpenSelectedItems(bool tryInternal)
} }
bool dirIsStarted = false; bool dirIsStarted = false;
for(int i = 0; i < indices.Size(); i++) for (int i = 0; i < indices.Size(); i++)
{ {
UInt32 index = indices[i]; UInt32 index = indices[i];
// CFileInfo &aFile = m_Files[index]; // CFileInfo &aFile = m_Files[index];
@@ -666,7 +664,7 @@ void CPanel::ReadListViewInfo()
void CPanel::SaveListViewInfo() void CPanel::SaveListViewInfo()
{ {
int i; int i;
for(i = 0; i < _visibleProperties.Size(); i++) for (i = 0; i < _visibleProperties.Size(); i++)
{ {
CItemProperty &prop = _visibleProperties[i]; CItemProperty &prop = _visibleProperties[i];
LVCOLUMN winColumnInfo; LVCOLUMN winColumnInfo;
@@ -683,7 +681,7 @@ void CPanel::SaveListViewInfo()
PROPID sortPropID = _sortID; PROPID sortPropID = _sortID;
_visibleProperties.Sort(); _visibleProperties.Sort();
for(i = 0; i < _visibleProperties.Size(); i++) for (i = 0; i < _visibleProperties.Size(); i++)
{ {
const CItemProperty &prop = _visibleProperties[i]; const CItemProperty &prop = _visibleProperties[i];
CColumnInfo columnInfo; CColumnInfo columnInfo;
@@ -692,7 +690,7 @@ void CPanel::SaveListViewInfo()
columnInfo.Width = prop.Width; columnInfo.Width = prop.Width;
viewInfo.Columns.Add(columnInfo); viewInfo.Columns.Add(columnInfo);
} }
for(i = 0; i < _properties.Size(); i++) for (i = 0; i < _properties.Size(); i++)
{ {
const CItemProperty &prop = _properties[i]; const CItemProperty &prop = _properties[i];
if (!prop.IsVisible) if (!prop.IsVisible)
@@ -719,7 +717,7 @@ void CPanel::SaveListViewInfo()
bool CPanel::OnRightClick(MY_NMLISTVIEW_NMITEMACTIVATE *itemActiveate, LRESULT &result) bool CPanel::OnRightClick(MY_NMLISTVIEW_NMITEMACTIVATE *itemActiveate, LRESULT &result)
{ {
if(itemActiveate->hdr.hwndFrom == HWND(_listView)) if (itemActiveate->hdr.hwndFrom == HWND(_listView))
return false; return false;
POINT point; POINT point;
::GetCursorPos(&point); ::GetCursorPos(&point);
@@ -737,7 +735,7 @@ void CPanel::ShowColumnsContextMenu(int x, int y)
menu.CreatePopup(); menu.CreatePopup();
const int kCommandStart = 100; const int kCommandStart = 100;
for(int i = 0; i < _properties.Size(); i++) for (int i = 0; i < _properties.Size(); i++)
{ {
const CItemProperty &prop = _properties[i]; const CItemProperty &prop = _properties[i];
UINT flags = MF_STRING; UINT flags = MF_STRING;
@@ -785,7 +783,9 @@ void CPanel::ShowColumnsContextMenu(int x, int y)
void CPanel::OnReload() void CPanel::OnReload()
{ {
RefreshListCtrlSaveFocused(); HRESULT res = RefreshListCtrlSaveFocused();
if (res != S_OK)
MessageBoxError(res);
OnRefreshStatusBar(); OnRefreshStatusBar();
} }

View File

@@ -149,9 +149,10 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
if (needRead) if (needRead)
*/ */
if (_folder->GetProperty(realIndex, propID, &prop) != S_OK) HRESULT res = _folder->GetProperty(realIndex, propID, &prop);
throw 2723407; if (res != S_OK)
s = UString(L"Error: ") + HResultToMessage(res);
else
if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && ( if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && (
propID == kpidSize || propID == kpidSize ||
propID == kpidPackSize || propID == kpidPackSize ||

View File

@@ -50,6 +50,8 @@ CPropVariant& CPropVariant::operator=(BSTR bstrSrc)
return *this; return *this;
} }
static const char *kMemException = "out of memory";
CPropVariant& CPropVariant::operator=(LPCOLESTR lpszSrc) CPropVariant& CPropVariant::operator=(LPCOLESTR lpszSrc)
{ {
InternalClear(); InternalClear();
@@ -58,8 +60,9 @@ CPropVariant& CPropVariant::operator=(LPCOLESTR lpszSrc)
bstrVal = ::SysAllocString(lpszSrc); bstrVal = ::SysAllocString(lpszSrc);
if (bstrVal == NULL && lpszSrc != NULL) if (bstrVal == NULL && lpszSrc != NULL)
{ {
vt = VT_ERROR; throw kMemException;
scode = E_OUTOFMEMORY; // vt = VT_ERROR;
// scode = E_OUTOFMEMORY;
} }
return *this; return *this;
} }
@@ -74,8 +77,9 @@ CPropVariant& CPropVariant::operator=(const char *s)
bstrVal = ::SysAllocStringByteLen(0, (UINT)len * sizeof(OLECHAR)); bstrVal = ::SysAllocStringByteLen(0, (UINT)len * sizeof(OLECHAR));
if (bstrVal == NULL) if (bstrVal == NULL)
{ {
vt = VT_ERROR; throw kMemException;
scode = E_OUTOFMEMORY; // vt = VT_ERROR;
// scode = E_OUTOFMEMORY;
} }
else else
{ {
@@ -204,6 +208,8 @@ void CPropVariant::InternalCopy(const PROPVARIANT *pSrc)
HRESULT hr = Copy(pSrc); HRESULT hr = Copy(pSrc);
if (FAILED(hr)) if (FAILED(hr))
{ {
if (hr == E_OUTOFMEMORY)
throw kMemException;
vt = VT_ERROR; vt = VT_ERROR;
scode = hr; scode = hr;
} }

View File

@@ -10,8 +10,8 @@ AppName = "7-Zip"
InstallDir = %CE1%\%AppName% InstallDir = %CE1%\%AppName%
[Strings] [Strings]
AppVer = "9.14" AppVer = "9.15"
AppDate = "2010-06-04" AppDate = "2010-06-20"
[CEDevice] [CEDevice]
; ProcessorType = 2577 ; ARM ; ProcessorType = 2577 ; ARM

View File

@@ -2,7 +2,7 @@
;Defines ;Defines
!define VERSION_MAJOR 9 !define VERSION_MAJOR 9
!define VERSION_MINOR 14 !define VERSION_MINOR 15
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?define VerMajor = "9" ?> <?define VerMajor = "9" ?>
<?define VerMinor = "14" ?> <?define VerMinor = "15" ?>
<?define VerBuild = "00" ?> <?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>

View File

@@ -1,4 +1,4 @@
LZMA SDK 9.14 LZMA SDK 9.15
------------- -------------
LZMA SDK provides the documentation, samples, header files, libraries, LZMA SDK provides the documentation, samples, header files, libraries,

View File

@@ -1,4 +1,4 @@
7-Zip 9.13 Sources 7-Zip 9.15 Sources
------------------ ------------------
7-Zip is a file archiver for Windows. 7-Zip is a file archiver for Windows.