This commit is contained in:
Igor Pavlov
2005-12-09 00:00:00 +00:00
committed by Kornel Lesiński
parent acac987575
commit e8d0636d7a
13 changed files with 138 additions and 94 deletions

View File

@@ -192,7 +192,7 @@ SZ_RESULT SafeReadDirect(ISzInStream *inStream, Byte *data, size_t size)
{
Byte *inBuffer;
size_t processedSize;
RINOK(inStream->Read(inStream, &inBuffer, size, &processedSize));
RINOK(inStream->Read(inStream, (void **)&inBuffer, size, &processedSize));
if (processedSize == 0 || processedSize > size)
return SZE_FAIL;
size -= processedSize;

View File

@@ -105,8 +105,8 @@ static void PrintHelp()
" -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,\n"
" pat2h, pat3h, pat4h, hc3, hc4], default: bt4\n"
" -eos: write End Of Stream marker\n"
" -si: Read data from stdin\n"
" -so: Write data to stdout\n"
" -si: read data from stdin\n"
" -so: write data to stdout\n"
);
}
@@ -150,7 +150,7 @@ int main2(int n, const char *args[])
g_IsNT = IsItWindowsNT();
#endif
fprintf(stderr, "\nLZMA 4.30 Copyright (c) 1999-2005 Igor Pavlov 2005-11-20\n");
fprintf(stderr, "\nLZMA 4.32 Copyright (c) 1999-2005 Igor Pavlov 2005-12-09\n");
if (n == 1)
{

View File

@@ -14,7 +14,7 @@ const UInt32 kTopValue = (1 << kNumTopBits);
class CEncoder
{
UInt32 _ffNum;
UInt32 _cacheSize;
Byte _cache;
public:
UInt64 Low;
@@ -28,7 +28,7 @@ public:
Stream.Init();
Low = 0;
Range = 0xFFFFFFFF;
_ffNum = 0;
_cacheSize = 1;
_cache = 0;
}
@@ -54,36 +54,21 @@ public:
}
}
/*
void EncodeDirectBitsDiv(UInt32 value, UInt32 numTotalBits)
{
Low += value * (Range >>= numTotalBits);
Normalize();
}
void EncodeDirectBitsDiv2(UInt32 value, UInt32 numTotalBits)
{
if (numTotalBits <= kNumBottomBits)
EncodeDirectBitsDiv(value, numTotalBits);
else
{
EncodeDirectBitsDiv(value >> kNumBottomBits, (numTotalBits - kNumBottomBits));
EncodeDirectBitsDiv(value & ((1 << kBottomValueBits) - 1), kNumBottomBits);
}
}
*/
void ShiftLow()
{
if (Low < (UInt32)0xFF000000 || UInt32(Low >> 32) == 1)
if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0)
{
Stream.WriteByte(Byte(_cache + Byte(Low >> 32)));
for (;_ffNum != 0; _ffNum--)
Stream.WriteByte(Byte(0xFF + Byte(Low >> 32)));
_cache = Byte(UInt32(Low) >> 24);
Byte temp = _cache;
do
{
Stream.WriteByte((Byte)(temp + (Byte)(Low >> 32)));
temp = 0xFF;
}
while(--_cacheSize != 0);
_cache = (Byte)((UInt32)Low >> 24);
}
else
_ffNum++;
Low = UInt32(Low) << 8;
_cacheSize++;
Low = (UInt32)Low << 8;
}
void EncodeDirectBits(UInt32 value, int numTotalBits)
@@ -118,7 +103,7 @@ public:
}
}
UInt64 GetProcessedSize() { return Stream.GetProcessedSize() + _ffNum; }
UInt64 GetProcessedSize() { return Stream.GetProcessedSize() + _cacheSize + 4; }
};
class CDecoder
@@ -162,26 +147,6 @@ public:
Normalize();
}
/*
UInt32 DecodeDirectBitsDiv(UInt32 numTotalBits)
{
Range >>= numTotalBits;
UInt32 threshold = Code / Range;
Code -= threshold * Range;
Normalize();
return threshold;
}
UInt32 DecodeDirectBitsDiv2(UInt32 numTotalBits)
{
if (numTotalBits <= kNumBottomBits)
return DecodeDirectBitsDiv(numTotalBits);
UInt32 result = DecodeDirectBitsDiv(numTotalBits - kNumBottomBits) << kNumBottomBits;
return (result | DecodeDirectBitsDiv(kNumBottomBits));
}
*/
UInt32 DecodeDirectBits(int numTotalBits)
{
UInt32 range = Range;

View File

@@ -211,6 +211,10 @@ static HANDLE StartEditApplication(const UString &path, HWND window)
return 0;
}
#ifndef _UNICODE
typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
#endif
static HANDLE StartApplication(const UString &path, HWND window)
{
UINT32 result;
@@ -228,7 +232,11 @@ static HANDLE StartApplication(const UString &path, HWND window)
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteExW(&execInfo);
ShellExecuteExWP shellExecuteExW = (ShellExecuteExWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "ShellExecuteExW");
if (shellExecuteExW == 0)
return 0;
shellExecuteExW(&execInfo);
result = (UINT32)execInfo.hInstApp;
hProcess = execInfo.hProcess;
}

View File

@@ -51,6 +51,10 @@ struct CThreadDelete
}
};
#ifndef _UNICODE
typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp);
#endif
void CPanel::DeleteItems(bool toRecycleBin)
{
CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
@@ -118,7 +122,16 @@ void CPanel::DeleteItems(bool toRecycleBin)
fo.fAnyOperationsAborted = FALSE;
fo.hNameMappings = 0;
fo.lpszProgressTitle = 0;
int res = ::SHFileOperationW(&fo);
int res;
#ifdef _UNICODE
res = ::SHFileOperationW(&fo);
#else
SHFileOperationWP shFileOperationW = (SHFileOperationWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
if (shFileOperationW == 0)
return;
res = shFileOperationW(&fo);
#endif
}
/*
if (fo.fAnyOperationsAborted)

View File

@@ -27,10 +27,10 @@ BEGIN
LTEXT "Destination folder already contains processed file.", IDC_STATIC_OVERWRITE_HEADER, marg, 7, xSize2, 8
LTEXT "Would you like to replace the existing file", IDC_STATIC_OVERWRITE_QUESTION_BEGIN, marg, 28, xSize2, 8
ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize
LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize, SS_NOPREFIX
LTEXT "with this one?",IDC_STATIC_OVERWRITE_QUESTION_END, marg, 98, xSize2, 8
ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize
LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize, SS_NOPREFIX
PUSHBUTTON "&Yes", IDYES, 78, b2YPos, bXSize, bYSize
PUSHBUTTON "Yes to &All", IDC_BUTTON_OVERWRITE_YES_TO_ALL, 152, b2YPos, bXSize, bYSize
PUSHBUTTON "&No", IDNO, 226, b2YPos, bXSize, bYSize

View File

@@ -42,7 +42,7 @@ BEGIN
RTEXT "", IDC_PROGRESS_REMAINING_VALUE, valPos1, yPos, valSize, 8
RTEXT "", IDC_PROGRESS_SPEED_TOTAL_VALUE, valPos2, marg, valSize, 8
RTEXT "", IDC_PROGRESS_SPEED_VALUE, valPos2, yPos, valSize, 8
LTEXT "", IDC_PROGRESS_FILE_NAME, marg, yPos + 16, xSize2, 8
LTEXT "", IDC_PROGRESS_FILE_NAME, marg, yPos + 16, xSize2, 8, SS_NOPREFIX
CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER,
marg, bYPos - 20, xSize2, 13
END

View File

@@ -42,6 +42,33 @@ DWORD_PTR GetRealIconIndex(LPCTSTR path, UINT32 attributes, int &iconIndex)
return res;
}
#ifndef _UNICODE
typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
struct CSHGetFileInfoInit
{
SHGetFileInfoWP shGetFileInfoW;
CSHGetFileInfoInit()
{
shGetFileInfoW = (SHGetFileInfoWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
}
} g_SHGetFileInfoInit;
#endif
DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
{
#ifdef _UNICODE
return SHGetFileInfoW(
#else
if (g_SHGetFileInfoInit.shGetFileInfoW == 0)
return 0;
return g_SHGetFileInfoInit.shGetFileInfoW(
#endif
pszPath, dwFileAttributes, psfi, cbFileInfo, uFlags);
}
#ifndef _UNICODE
// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
@@ -49,7 +76,7 @@ DWORD_PTR GetRealIconIndex(LPCWSTR path, UINT32 attributes, int &iconIndex)
if(g_IsNT)
{
SHFILEINFOW shellInfo;
DWORD_PTR res = ::SHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
DWORD_PTR res = ::MySHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -79,7 +106,7 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, UINT32 attributes,
{
SHFILEINFOW shellInfo;
shellInfo.szTypeName[0] = 0;
DWORD_PTR res = ::SHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
| SHGFI_TYPENAME);
typeName = shellInfo.szTypeName;

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 4
#define MY_VER_MINOR 31
#define MY_VERSION "4.31"
#define MY_7ZIP_VERSION "7-Zip 4.31"
#define MY_DATE "2005-12-04"
#define MY_VER_MINOR 32
#define MY_VERSION "4.32"
#define MY_7ZIP_VERSION "7-Zip 4.32"
#define MY_DATE "2005-12-09"
#define MY_COPYRIGHT "Copyright (c) 1999-2005 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE