mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 01:15:00 -06:00
4.56 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
b67ffe691b
commit
acd742622d
@@ -195,7 +195,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
0,
|
||||
#endif
|
||||
startIndex,
|
||||
&efi.ExtractStatuses, extractCallback, testMode);
|
||||
&efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
|
||||
|
||||
RINOK(result);
|
||||
|
||||
|
||||
@@ -113,13 +113,14 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
|
||||
STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
|
||||
{
|
||||
*value = 0;
|
||||
if (subStream < Sizes.Size())
|
||||
int subStreamIndex = (int)subStream;
|
||||
if (subStreamIndex < 0 || subStream > Sizes.Size())
|
||||
return E_FAIL;
|
||||
if (subStreamIndex < Sizes.Size())
|
||||
{
|
||||
*value= Sizes[(int)(size_t)subStream];
|
||||
*value= Sizes[subStreamIndex];
|
||||
return S_OK;
|
||||
}
|
||||
if (subStream > Sizes.Size())
|
||||
return E_FAIL;
|
||||
if (!_currentSizeIsDefined)
|
||||
return S_FALSE;
|
||||
*value = _currentSize;
|
||||
|
||||
@@ -19,7 +19,8 @@ HRESULT CFolderOutStream::Init(
|
||||
UInt32 startIndex,
|
||||
const CBoolVector *extractStatuses,
|
||||
IArchiveExtractCallback *extractCallback,
|
||||
bool testMode)
|
||||
bool testMode,
|
||||
bool checkCrc)
|
||||
{
|
||||
_archiveDatabase = archiveDatabase;
|
||||
_ref2Offset = ref2Offset;
|
||||
@@ -29,6 +30,8 @@ HRESULT CFolderOutStream::Init(
|
||||
_extractCallback = extractCallback;
|
||||
_testMode = testMode;
|
||||
|
||||
_checkCrc = checkCrc;
|
||||
|
||||
_currentIndex = 0;
|
||||
_fileIsOpen = false;
|
||||
return WriteEmptyFiles();
|
||||
@@ -49,7 +52,7 @@ HRESULT CFolderOutStream::OpenFile()
|
||||
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
|
||||
|
||||
_outStreamWithHashSpec->SetStream(realOutStream);
|
||||
_outStreamWithHashSpec->Init();
|
||||
_outStreamWithHashSpec->Init(_checkCrc);
|
||||
if (askMode == NArchive::NExtract::NAskMode::kExtract &&
|
||||
(!realOutStream))
|
||||
{
|
||||
@@ -100,7 +103,7 @@ STDMETHODIMP CFolderOutStream::Write(const void *data,
|
||||
if (_filePos == fileSize)
|
||||
{
|
||||
bool digestsAreEqual;
|
||||
if (fileInfo.IsFileCRCDefined)
|
||||
if (fileInfo.IsFileCRCDefined && _checkCrc)
|
||||
digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC();
|
||||
else
|
||||
digestsAreEqual = true;
|
||||
|
||||
@@ -36,6 +36,8 @@ private:
|
||||
bool _testMode;
|
||||
|
||||
bool _fileIsOpen;
|
||||
|
||||
bool _checkCrc;
|
||||
UInt64 _filePos;
|
||||
|
||||
HRESULT OpenFile();
|
||||
@@ -47,7 +49,8 @@ public:
|
||||
UInt32 startIndex,
|
||||
const CBoolVector *extractStatuses,
|
||||
IArchiveExtractCallback *extractCallback,
|
||||
bool testMode);
|
||||
bool testMode,
|
||||
bool checkCrc);
|
||||
HRESULT FlushCorrupted(Int32 resultEOperationResult);
|
||||
HRESULT WasWritingFinished();
|
||||
};
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace N7z {
|
||||
|
||||
CHandler::CHandler()
|
||||
{
|
||||
_crcSize = 4;
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
|
||||
@@ -110,7 +110,9 @@ private:
|
||||
#ifdef COMPRESS_MT
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
|
||||
UInt32 _crcSize;
|
||||
|
||||
#else
|
||||
|
||||
CRecordVector<CBind> _binds;
|
||||
|
||||
@@ -6,3 +6,4 @@ EXPORTS
|
||||
CreateObject PRIVATE
|
||||
GetNumberOfMethods PRIVATE
|
||||
GetMethodProperty PRIVATE
|
||||
SetLargePageMode PRIVATE
|
||||
|
||||
@@ -759,9 +759,23 @@ HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database)
|
||||
li.ResetInterval = ReadUInt32();
|
||||
li.WindowSize = ReadUInt32();
|
||||
li.CacheSize = ReadUInt32();
|
||||
if (li.ResetInterval != 2 && li.ResetInterval != 4)
|
||||
if (
|
||||
li.ResetInterval != 1 &&
|
||||
li.ResetInterval != 2 &&
|
||||
li.ResetInterval != 4 &&
|
||||
li.ResetInterval != 8 &&
|
||||
li.ResetInterval != 16 &&
|
||||
li.ResetInterval != 32 &&
|
||||
li.ResetInterval != 64)
|
||||
return S_FALSE;
|
||||
if (li.WindowSize != 2 && li.WindowSize != 4)
|
||||
if (
|
||||
li.WindowSize != 1 &&
|
||||
li.WindowSize != 2 &&
|
||||
li.WindowSize != 4 &&
|
||||
li.WindowSize != 8 &&
|
||||
li.WindowSize != 16 &&
|
||||
li.WindowSize != 32 &&
|
||||
li.WindowSize != 64)
|
||||
return S_FALSE;
|
||||
numDWORDS -= 5;
|
||||
while (numDWORDS-- != 0)
|
||||
|
||||
@@ -468,6 +468,7 @@ void COutHandler::Init()
|
||||
_level = 5;
|
||||
_autoFilter = true;
|
||||
_volumeMode = false;
|
||||
_crcSize = 4;
|
||||
InitSolid();
|
||||
}
|
||||
|
||||
@@ -481,6 +482,7 @@ void COutHandler::BeforeSetProperty()
|
||||
mainDicSize = 0xFFFFFFFF;
|
||||
mainDicMethodIndex = 0xFFFFFFFF;
|
||||
minNumber = 0;
|
||||
_crcSize = 4;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
|
||||
@@ -507,6 +509,13 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
return SetSolidSettings(name);
|
||||
}
|
||||
|
||||
if (name == L"CRC")
|
||||
{
|
||||
_crcSize = 4;
|
||||
name.Delete(0, 3);
|
||||
return ParsePropValue(name, value, _crcSize);
|
||||
}
|
||||
|
||||
UInt32 number;
|
||||
int index = ParseStringToUInt32(name, number);
|
||||
UString realName = name.Mid(index);
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
UInt32 _crcSize;
|
||||
|
||||
CObjectVector<COneMethodInfo> _methods;
|
||||
bool _removeSfxBlock;
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
#ifndef _UNICODE
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -50,3 +47,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
||||
return CreateArchiver(clsid, iid, outObject);
|
||||
}
|
||||
|
||||
STDAPI SetLargePageMode()
|
||||
{
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -76,3 +73,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
||||
// COM_TRY_END
|
||||
}
|
||||
|
||||
STDAPI SetLargePageMode()
|
||||
{
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,10 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResul
|
||||
}
|
||||
}
|
||||
if(_outFileStream != NULL)
|
||||
{
|
||||
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
||||
RINOK(_outFileStreamSpec->Close());
|
||||
}
|
||||
_outFileStream.Release();
|
||||
if (_extractMode)
|
||||
NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
||||
|
||||
@@ -145,6 +145,11 @@ STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
|
||||
//////////////////////////
|
||||
// COutFileStream
|
||||
|
||||
HRESULT COutFileStream::Close()
|
||||
{
|
||||
return ConvertBoolToHRESULT(File.Close());
|
||||
}
|
||||
|
||||
STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
#ifdef USE_WIN_FILE
|
||||
|
||||
@@ -103,6 +103,8 @@ public:
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
HRESULT Close();
|
||||
|
||||
UInt64 ProcessedSize;
|
||||
|
||||
|
||||
@@ -282,10 +282,10 @@ NO_INLINE void CCoder::GetMatches()
|
||||
{
|
||||
UInt32 numAvail = Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) + 1;
|
||||
const Byte *pby = Inline_MatchFinder_GetPointerToCurrentPos(&_lzInWindow) - 1;
|
||||
UInt32 distance = distanceTmp[numPairs - 1] + 1;
|
||||
const Byte *pby2 = pby - (distanceTmp[numPairs - 1] + 1);
|
||||
if (numAvail > m_MatchMaxLen)
|
||||
numAvail = m_MatchMaxLen;
|
||||
for (; len < numAvail && pby[len] == pby[(size_t)len - distance]; len++);
|
||||
for (; len < numAvail && pby[len] == pby2[len]; len++);
|
||||
m_MatchDistances[i - 1] = (UInt16)len;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,15 +610,14 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
for(i = 0; i < kNumRepDistances; i++)
|
||||
{
|
||||
reps[i] = _repDistances[i];
|
||||
UInt32 backOffset = reps[i] + 1;
|
||||
if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset])
|
||||
const Byte *data2 = data - (reps[i] + 1);
|
||||
if (data[0] != data2[0] || data[1] != data2[1])
|
||||
{
|
||||
repLens[i] = 0;
|
||||
continue;
|
||||
}
|
||||
UInt32 lenTest;
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
||||
for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
|
||||
repLens[i] = lenTest;
|
||||
if (lenTest > repLens[repMaxIndex])
|
||||
repMaxIndex = i;
|
||||
@@ -639,7 +638,7 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
return lenMain;
|
||||
}
|
||||
Byte currentByte = *data;
|
||||
Byte matchByte = data[(size_t)0 - reps[0] - 1];
|
||||
Byte matchByte = *(data - (reps[0] + 1));
|
||||
|
||||
if(lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
|
||||
{
|
||||
@@ -821,13 +820,13 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
UInt32 curPrice = curOptimum.Price;
|
||||
const Byte *data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
||||
const Byte currentByte = *data;
|
||||
const Byte matchByte = data[(size_t)0 - reps[0] - 1];
|
||||
const Byte matchByte = *(data - (reps[0] + 1));
|
||||
|
||||
UInt32 posState = (position & _posStateMask);
|
||||
|
||||
UInt32 curAnd1Price = curPrice +
|
||||
_isMatch[state.Index][posState].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position, data[(size_t)0 - 1])->GetPrice(!state.IsCharState(), matchByte, currentByte);
|
||||
_literalEncoder.GetSubCoder(position, *(data - 1))->GetPrice(!state.IsCharState(), matchByte, currentByte);
|
||||
|
||||
COptimal &nextOptimum = _optimum[cur + 1];
|
||||
|
||||
@@ -870,11 +869,10 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
if (!nextIsChar && matchByte != currentByte) // speed optimization
|
||||
{
|
||||
// try Literal + rep0
|
||||
UInt32 backOffset = reps[0] + 1;
|
||||
const Byte *data2 = data - (reps[0] + 1);
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, _numFastBytes + 1);
|
||||
UInt32 temp;
|
||||
for (temp = 1; temp < limit &&
|
||||
data[temp] == data[(size_t)temp - backOffset]; temp++);
|
||||
for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
|
||||
UInt32 lenTest2 = temp - 1;
|
||||
if (lenTest2 >= 2)
|
||||
{
|
||||
@@ -908,13 +906,11 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
for(UInt32 repIndex = 0; repIndex < kNumRepDistances; repIndex++)
|
||||
{
|
||||
// UInt32 repLen = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], newLen); // test it;
|
||||
UInt32 backOffset = reps[repIndex] + 1;
|
||||
if (data[0] != data[(size_t)0 - backOffset] ||
|
||||
data[1] != data[(size_t)1 - backOffset])
|
||||
const Byte *data2 = data - (reps[repIndex] + 1);
|
||||
if (data[0] != data2[0] || data[1] != data2[1])
|
||||
continue;
|
||||
UInt32 lenTest;
|
||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
||||
for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
|
||||
while(lenEnd < cur + lenTest)
|
||||
_optimum[++lenEnd].Price = kIfinityPrice;
|
||||
UInt32 lenTestTemp = lenTest;
|
||||
@@ -941,8 +937,7 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
{
|
||||
UInt32 lenTest2 = lenTest + 1;
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||
for (; lenTest2 < limit &&
|
||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
||||
for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
|
||||
lenTest2 -= lenTest + 1;
|
||||
if (lenTest2 >= 2)
|
||||
{
|
||||
@@ -952,8 +947,8 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
UInt32 curAndLenCharPrice =
|
||||
price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[lenTest - 1])->GetPrice(
|
||||
true, data2[lenTest], data[lenTest]);
|
||||
state2.UpdateChar();
|
||||
posStateNext = (position + lenTest + 1) & _posStateMask;
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
@@ -1025,11 +1020,10 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
if (/*_maxMode && */lenTest == matchDistances[offs])
|
||||
{
|
||||
// Try Match + Literal + Rep0
|
||||
UInt32 backOffset = curBack + 1;
|
||||
const Byte *data2 = data - (curBack + 1);
|
||||
UInt32 lenTest2 = lenTest + 1;
|
||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||
for (; lenTest2 < limit &&
|
||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
||||
for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
|
||||
lenTest2 -= lenTest + 1;
|
||||
if (lenTest2 >= 2)
|
||||
{
|
||||
@@ -1038,8 +1032,8 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
||||
UInt32 posStateNext = (position + lenTest) & _posStateMask;
|
||||
UInt32 curAndLenCharPrice = curAndLenPrice +
|
||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
||||
_literalEncoder.GetSubCoder(position + lenTest, data[lenTest - 1])->GetPrice(
|
||||
true, data2[lenTest], data[lenTest]);
|
||||
state2.UpdateChar();
|
||||
posStateNext = (posStateNext + 1) & _posStateMask;
|
||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||
@@ -1105,7 +1099,9 @@ UInt32 CEncoder::ReadMatchDistances(UInt32 &numDistancePairs)
|
||||
UInt32 distance = _matchDistances[numDistancePairs - 1] + 1;
|
||||
if (numAvail > kMatchMaxLen)
|
||||
numAvail = kMatchMaxLen;
|
||||
for (; lenRes < numAvail && pby[lenRes] == pby[(size_t)lenRes - distance]; lenRes++);
|
||||
|
||||
const Byte *pby2 = pby - distance;
|
||||
for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
|
||||
}
|
||||
}
|
||||
_additionalOffset++;
|
||||
@@ -1141,14 +1137,14 @@ UInt32 CEncoder::GetOptimumFast(UInt32 &backRes)
|
||||
|
||||
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
||||
{
|
||||
UInt32 backOffset = _repDistances[i] + 1;
|
||||
if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset])
|
||||
const Byte *data2 = data - (_repDistances[i] + 1);
|
||||
if (data[0] != data2[0] || data[1] != data2[1])
|
||||
{
|
||||
repLens[i] = 0;
|
||||
continue;
|
||||
}
|
||||
UInt32 len;
|
||||
for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++);
|
||||
for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
|
||||
if(len >= _numFastBytes)
|
||||
{
|
||||
backRes = i;
|
||||
@@ -1216,14 +1212,14 @@ UInt32 CEncoder::GetOptimumFast(UInt32 &backRes)
|
||||
data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
||||
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
||||
{
|
||||
UInt32 backOffset = _repDistances[i] + 1;
|
||||
if (data[1] != data[(size_t)1 - backOffset] || data[2] != data[(size_t)2 - backOffset])
|
||||
const Byte *data2 = data - (_repDistances[i] + 1);
|
||||
if (data[1] != data2[1] || data[2] != data2[2])
|
||||
{
|
||||
repLens[i] = 0;
|
||||
continue;
|
||||
}
|
||||
UInt32 len;
|
||||
for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++);
|
||||
for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
|
||||
if (len + 1 >= lenMain)
|
||||
{
|
||||
_longestMatchWasFound = true;
|
||||
|
||||
@@ -159,7 +159,7 @@ int main2(int n, const char *args[])
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "\nLZMA 4.54 Copyright (c) 1999-2007 Igor Pavlov 2007-09-04\n");
|
||||
fprintf(stderr, "\nLZMA 4.56 Copyright (c) 1999-2007 Igor Pavlov 2007-10-19\n");
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
@@ -276,6 +276,7 @@ int main2(int n, const char *args[])
|
||||
}
|
||||
|
||||
CMyComPtr<ISequentialOutStream> outStream;
|
||||
COutFileStream *outStreamSpec = NULL;
|
||||
if (stdOutMode)
|
||||
{
|
||||
outStream = new CStdOutFileStream;
|
||||
@@ -286,7 +287,7 @@ int main2(int n, const char *args[])
|
||||
if (paramIndex >= nonSwitchStrings.Size())
|
||||
IncorrectCommand();
|
||||
const UString &outputName = nonSwitchStrings[paramIndex++];
|
||||
COutFileStream *outStreamSpec = new COutFileStream;
|
||||
outStreamSpec = new COutFileStream;
|
||||
outStream = outStreamSpec;
|
||||
if (!outStreamSpec->Create(GetSystemString(outputName), true))
|
||||
{
|
||||
@@ -368,8 +369,7 @@ int main2(int n, const char *args[])
|
||||
UInt64 fileSize;
|
||||
if (encodeMode)
|
||||
{
|
||||
NCompress::NLZMA::CEncoder *encoderSpec =
|
||||
new NCompress::NLZMA::CEncoder;
|
||||
NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
|
||||
CMyComPtr<ICompressCoder> encoder = encoderSpec;
|
||||
|
||||
if (!dictionaryIsDefined)
|
||||
@@ -483,8 +483,7 @@ int main2(int n, const char *args[])
|
||||
}
|
||||
else
|
||||
{
|
||||
NCompress::NLZMA::CDecoder *decoderSpec =
|
||||
new NCompress::NLZMA::CDecoder;
|
||||
NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder;
|
||||
CMyComPtr<ICompressCoder> decoder = decoderSpec;
|
||||
const UInt32 kPropertiesSize = 5;
|
||||
Byte properties[kPropertiesSize];
|
||||
@@ -526,6 +525,14 @@ int main2(int n, const char *args[])
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (outStreamSpec != NULL)
|
||||
{
|
||||
if (outStreamSpec->Close() != S_OK)
|
||||
{
|
||||
fprintf(stderr, "File closing error");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#define MY_VER_MAJOR 4
|
||||
#define MY_VER_MINOR 55
|
||||
#define MY_VER_MINOR 56
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION "4.55 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.55 beta"
|
||||
#define MY_DATE "2007-09-05"
|
||||
#define MY_VERSION "4.56 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.56 beta"
|
||||
#define MY_DATE "2007-10-24"
|
||||
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
|
||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||
|
||||
@@ -299,7 +299,8 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
RINOK(CopyBlock(sfxStream, outStream));
|
||||
}
|
||||
|
||||
return outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback);
|
||||
RINOK(outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback));
|
||||
return outStreamSpec->Close();
|
||||
}
|
||||
|
||||
STDMETHODIMP CAgent::DoOperation2(
|
||||
@@ -362,7 +363,8 @@ HRESULT CAgent::CommonUpdate(
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return outArchive->UpdateItems(outStream, numUpdateItems, updateCallback);
|
||||
RINOK(outArchive->UpdateItems(outStream, numUpdateItems, updateCallback));
|
||||
return outStreamSpec->Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,13 @@ void PrintStringLn(const AString &s)
|
||||
PrintNewLine();
|
||||
}
|
||||
|
||||
void PrintError(const AString &s)
|
||||
{
|
||||
PrintNewLine();
|
||||
PrintString(s);
|
||||
PrintNewLine();
|
||||
}
|
||||
|
||||
static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
@@ -141,7 +148,7 @@ STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
|
||||
// You can ask real password here from user
|
||||
// Password = GetPassword(OutStream);
|
||||
// PasswordIsDefined = true;
|
||||
PrintStringLn("Password is not defined");
|
||||
PrintError("Password is not defined");
|
||||
return E_ABORT;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
@@ -396,8 +403,12 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
||||
}
|
||||
}
|
||||
|
||||
if(_outFileStream != NULL && _processedFileInfo.UTCLastWriteTimeIsDefined)
|
||||
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
||||
if (_outFileStream != NULL)
|
||||
{
|
||||
if (_processedFileInfo.UTCLastWriteTimeIsDefined)
|
||||
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
||||
RINOK(_outFileStreamSpec->Close());
|
||||
}
|
||||
_outFileStream.Release();
|
||||
if (_extractMode && _processedFileInfo.AttributesAreDefined)
|
||||
NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
||||
@@ -413,7 +424,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
||||
// You can ask real password here from user
|
||||
// Password = GetPassword(OutStream);
|
||||
// PasswordIsDefined = true;
|
||||
PrintStringLn("Password is not defined");
|
||||
PrintError("Password is not defined");
|
||||
return E_ABORT;
|
||||
}
|
||||
CMyComBSTR tempName(Password);
|
||||
@@ -603,7 +614,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream
|
||||
// if (systemError == ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
PrintNewLine();
|
||||
PrintStringLn("WARNING: can't open file");
|
||||
PrintError("WARNING: can't open file");
|
||||
// PrintString(NError::MyFormatMessageW(systemError));
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -658,7 +669,7 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef
|
||||
// You can ask real password here from user
|
||||
// Password = GetPassword(OutStream);
|
||||
// PasswordIsDefined = true;
|
||||
PrintStringLn("Password is not defined");
|
||||
PrintError("Password is not defined");
|
||||
return E_ABORT;
|
||||
}
|
||||
}
|
||||
@@ -695,13 +706,13 @@ main(int argc, char* argv[])
|
||||
NWindows::NDLL::CLibrary library;
|
||||
if (!library.Load(TEXT(kDllName)))
|
||||
{
|
||||
PrintStringLn("Can not load library");
|
||||
PrintError("Can not load library");
|
||||
return 1;
|
||||
}
|
||||
CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
|
||||
if (createObjectFunc == 0)
|
||||
{
|
||||
PrintStringLn("Can not get CreateObject");
|
||||
PrintError("Can not get CreateObject");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -742,14 +753,14 @@ main(int argc, char* argv[])
|
||||
CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
|
||||
if (!outFileStreamSpec->Create(archiveName, false))
|
||||
{
|
||||
PrintStringLn("can't create archive file");
|
||||
PrintError("can't create archive file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMyComPtr<IOutArchive> outArchive;
|
||||
if (createObjectFunc(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive) != S_OK)
|
||||
{
|
||||
PrintStringLn("Can not get class object");
|
||||
PrintError("Can not get class object");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -763,7 +774,7 @@ main(int argc, char* argv[])
|
||||
updateCallbackSpec->Finilize();
|
||||
if (result != S_OK)
|
||||
{
|
||||
PrintStringLn("Update Error");
|
||||
PrintError("Update Error");
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < updateCallbackSpec->FailedFiles.Size(); i++)
|
||||
@@ -789,14 +800,14 @@ main(int argc, char* argv[])
|
||||
listCommand = false;
|
||||
else
|
||||
{
|
||||
PrintStringLn("incorrect command");
|
||||
PrintError("incorrect command");
|
||||
return 1;
|
||||
}
|
||||
|
||||
CMyComPtr<IInArchive> archive;
|
||||
if (createObjectFunc(&CLSID_CFormat7z, &IID_IInArchive, (void **)&archive) != S_OK)
|
||||
{
|
||||
PrintStringLn("Can not get class object");
|
||||
PrintError("Can not get class object");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -805,7 +816,7 @@ main(int argc, char* argv[])
|
||||
|
||||
if (!fileSpec->Open(archiveName))
|
||||
{
|
||||
PrintStringLn("Can not open archive file");
|
||||
PrintError("Can not open archive file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -818,7 +829,7 @@ main(int argc, char* argv[])
|
||||
|
||||
if (archive->Open(file, 0, openCallback) != S_OK)
|
||||
{
|
||||
PrintStringLn("Can not open archive");
|
||||
PrintError("Can not open archive");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -857,7 +868,12 @@ main(int argc, char* argv[])
|
||||
extractCallbackSpec->PasswordIsDefined = false;
|
||||
// extractCallbackSpec->PasswordIsDefined = true;
|
||||
// extractCallbackSpec->Password = L"1";
|
||||
archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
|
||||
HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
|
||||
if (result != S_OK)
|
||||
{
|
||||
PrintError("Extract Error");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -434,6 +434,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
||||
(WriteAccessed && _processedFileInfo.IsLastAccessTimeDefined) ? &_processedFileInfo.LastAccessTime : NULL,
|
||||
(WriteModified && _processedFileInfo.IsLastWriteTimeDefined) ? &_processedFileInfo.LastWriteTime : &_utcLastWriteTimeDefault);
|
||||
_curSize = _outFileStreamSpec->ProcessedSize;
|
||||
RINOK(_outFileStreamSpec->Close());
|
||||
_outFileStream.Release();
|
||||
}
|
||||
UnpackSize += _curSize;
|
||||
|
||||
@@ -93,7 +93,8 @@ typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
|
||||
typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
|
||||
typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
|
||||
typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||
typedef UINT32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
|
||||
typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
|
||||
typedef UInt32 (WINAPI *SetLargePageModeFunc)();
|
||||
|
||||
|
||||
static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
|
||||
@@ -332,6 +333,13 @@ int CCodecLib::FindIconIndex(const UString &ext) const
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
extern "C"
|
||||
{
|
||||
extern SIZE_T g_LargePageSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
||||
{
|
||||
{
|
||||
@@ -351,6 +359,16 @@ HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
||||
#ifdef NEW_FOLDER_INTERFACE
|
||||
lib.LoadIcons();
|
||||
#endif
|
||||
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
if (g_LargePageSize != 0)
|
||||
{
|
||||
SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProcAddress("SetLargePageMode");
|
||||
if (setLargePageMode != 0)
|
||||
setLargePageMode();
|
||||
}
|
||||
#endif
|
||||
|
||||
lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
|
||||
if (lib.CreateObject != 0)
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@ class COutMultiVolStream:
|
||||
|
||||
struct CSubStreamInfo
|
||||
{
|
||||
COutFileStream *StreamSpec;
|
||||
CMyComPtr<IOutStream> Stream;
|
||||
UString Name;
|
||||
UInt64 Pos;
|
||||
@@ -87,6 +88,8 @@ public:
|
||||
_length = 0;
|
||||
}
|
||||
|
||||
HRESULT Close();
|
||||
|
||||
MY_UNKNOWN_IMP1(IOutStream)
|
||||
|
||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||
@@ -96,6 +99,22 @@ public:
|
||||
|
||||
// static NSynchronization::CCriticalSection g_TempPathsCS;
|
||||
|
||||
HRESULT COutMultiVolStream::Close()
|
||||
{
|
||||
HRESULT res = S_OK;
|
||||
for (int i = 0; i < Streams.Size(); i++)
|
||||
{
|
||||
CSubStreamInfo &s = Streams[i];
|
||||
if (s.StreamSpec)
|
||||
{
|
||||
HRESULT res2 = s.StreamSpec->Close();
|
||||
if (res2 != S_OK)
|
||||
res = res2;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
if(processedSize != NULL)
|
||||
@@ -112,9 +131,9 @@ STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *pr
|
||||
while (res.Length() < 3)
|
||||
res = UString(L'0') + res;
|
||||
UString name = Prefix + res;
|
||||
COutFileStream *streamSpec = new COutFileStream;
|
||||
subStream.Stream = streamSpec;
|
||||
if(!streamSpec->Create(name, false))
|
||||
subStream.StreamSpec = new COutFileStream;
|
||||
subStream.Stream = subStream.StreamSpec;
|
||||
if(!subStream.StreamSpec->Create(name, false))
|
||||
return ::GetLastError();
|
||||
{
|
||||
// NSynchronization::CCriticalSectionLock lock(g_TempPathsCS);
|
||||
@@ -362,13 +381,17 @@ static HRESULT Compress(
|
||||
throw 1417161;
|
||||
NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
|
||||
}
|
||||
|
||||
COutFileStream *outStreamSpec = NULL;
|
||||
COutMultiVolStream *volStreamSpec = NULL;
|
||||
|
||||
if (volumesSizes.Size() == 0)
|
||||
{
|
||||
if (stdOutMode)
|
||||
outStream = new CStdOutFileStream;
|
||||
else
|
||||
{
|
||||
COutFileStream *outStreamSpec = new COutFileStream;
|
||||
outStreamSpec = new COutFileStream;
|
||||
outStream = outStreamSpec;
|
||||
bool isOK = false;
|
||||
UString realPath;
|
||||
@@ -410,7 +433,7 @@ static HRESULT Compress(
|
||||
{
|
||||
if (stdOutMode)
|
||||
return E_FAIL;
|
||||
COutMultiVolStream *volStreamSpec = new COutMultiVolStream;
|
||||
volStreamSpec = new COutMultiVolStream;
|
||||
outStream = volStreamSpec;
|
||||
volStreamSpec->Sizes = volumesSizes;
|
||||
volStreamSpec->Prefix = archivePath.GetFinalPath() + UString(L".");
|
||||
@@ -440,11 +463,12 @@ static HRESULT Compress(
|
||||
}
|
||||
|
||||
CMyComPtr<ISequentialOutStream> sfxOutStream;
|
||||
COutFileStream *outStreamSpec = NULL;
|
||||
if (volumesSizes.Size() == 0)
|
||||
sfxOutStream = outStream;
|
||||
else
|
||||
{
|
||||
COutFileStream *outStreamSpec = new COutFileStream;
|
||||
outStreamSpec = new COutFileStream;
|
||||
sfxOutStream = outStreamSpec;
|
||||
UString realPath = archivePath.GetFinalPath();
|
||||
if (!outStreamSpec->Create(realPath, false))
|
||||
@@ -456,10 +480,19 @@ static HRESULT Compress(
|
||||
}
|
||||
}
|
||||
RINOK(CopyBlock(sfxStream, sfxOutStream));
|
||||
if (outStreamSpec)
|
||||
{
|
||||
RINOK(outStreamSpec->Close());
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
|
||||
callback->Finilize();
|
||||
RINOK(result);
|
||||
if (outStreamSpec)
|
||||
result = outStreamSpec->Close();
|
||||
else if (volStreamSpec)
|
||||
result = volStreamSpec->Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -407,15 +407,9 @@ int Main2(
|
||||
result = E_FAIL;
|
||||
}
|
||||
|
||||
stdStream << endl << endl << "Total:" << endl;
|
||||
stdStream << endl;
|
||||
if (ecs->NumArchives > 1)
|
||||
stdStream << "Archives: " << ecs->NumArchives << endl;
|
||||
{
|
||||
stdStream << "Folders: " << stat.NumFolders << endl;
|
||||
stdStream << "Files: " << stat.NumFiles << endl;
|
||||
stdStream << "Size: " << stat.UnpackSize << endl;
|
||||
stdStream << "Compressed: " << stat.PackSize << endl;
|
||||
}
|
||||
if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
|
||||
{
|
||||
if (ecs->NumArchives > 1)
|
||||
@@ -432,6 +426,13 @@ int Main2(
|
||||
}
|
||||
if (result != S_OK)
|
||||
throw CSystemException(result);
|
||||
if (stat.NumFolders != 0)
|
||||
stdStream << "Folders: " << stat.NumFolders << endl;
|
||||
if (stat.NumFiles != 1 || stat.NumFolders != 0)
|
||||
stdStream << "Files: " << stat.NumFiles << endl;
|
||||
stdStream
|
||||
<< "Size: " << stat.UnpackSize << endl
|
||||
<< "Compressed: " << stat.PackSize << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -185,7 +185,6 @@ bool CFSFolder::LoadComments()
|
||||
file.Read(p, (UInt32)length, processedSize);
|
||||
p[length] = 0;
|
||||
s.ReleaseBuffer();
|
||||
s.Replace("\r\n", "\n");
|
||||
if (processedSize != length)
|
||||
return false;
|
||||
file.Close();
|
||||
@@ -218,7 +217,6 @@ bool CFSFolder::SaveComments()
|
||||
Byte bom [] = { 0xEF, 0xBB, 0xBF, 0x0D, 0x0A };
|
||||
file.Write(bom , sizeof(bom), processedSize);
|
||||
}
|
||||
utfString.Replace("\n", "\r\n");
|
||||
file.Write(utfString, utfString.Length(), processedSize);
|
||||
_commentsAreLoaded = false;
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ProgressDialog2Res.h"
|
||||
#include "../../GuiCommon.rc"
|
||||
|
||||
#define xSize2 300
|
||||
#define xSize2 320
|
||||
#define ySize2 98
|
||||
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#define x0Size 90
|
||||
#define x1 (marg + x0Size)
|
||||
#define x1Size 40
|
||||
#define x1Size 70
|
||||
|
||||
#define x3Size 40
|
||||
#define x3 (xSize - marg - x3Size)
|
||||
|
||||
@@ -22,6 +22,11 @@ static bool IsSeparatorChar(wchar_t c)
|
||||
return (c == kSpaceChar || c == kTabChar);
|
||||
}
|
||||
|
||||
void RemoveCr(UString &s)
|
||||
{
|
||||
s.Replace(L"\x0D", L"");
|
||||
}
|
||||
|
||||
static UString GetIDString(const wchar_t *srcString, int &finishPos)
|
||||
{
|
||||
UString result;
|
||||
@@ -42,6 +47,7 @@ static UString GetIDString(const wchar_t *srcString, int &finishPos)
|
||||
result += c;
|
||||
}
|
||||
result.Trim();
|
||||
RemoveCr(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -59,34 +65,28 @@ static UString GetValueString(const wchar_t *srcString, int &finishPos)
|
||||
result += c;
|
||||
}
|
||||
result.Trim();
|
||||
RemoveCr(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pairs)
|
||||
{
|
||||
pairs.Clear();
|
||||
UString srcString2 = srcString;
|
||||
srcString2.Replace(L"\x0D", L"");
|
||||
|
||||
pairs.Clear();
|
||||
int pos = 0;
|
||||
|
||||
/////////////////////
|
||||
// read strings
|
||||
|
||||
if (srcString2.Length() > 0)
|
||||
if (srcString.Length() > 0)
|
||||
{
|
||||
if (srcString2[0] == kBOM)
|
||||
if (srcString[0] == kBOM)
|
||||
pos++;
|
||||
}
|
||||
while (pos < srcString2.Length())
|
||||
while (pos < srcString.Length())
|
||||
{
|
||||
int finishPos;
|
||||
UString id = GetIDString((const wchar_t *)srcString2 + pos, finishPos);
|
||||
UString id = GetIDString((const wchar_t *)srcString + pos, finishPos);
|
||||
pos += finishPos;
|
||||
if (id.IsEmpty())
|
||||
continue;
|
||||
UString value = GetValueString((const wchar_t *)srcString2 + pos, finishPos);
|
||||
UString value = GetValueString((const wchar_t *)srcString + pos, finishPos);
|
||||
pos += finishPos;
|
||||
if (!id.IsEmpty())
|
||||
{
|
||||
@@ -195,7 +195,7 @@ bool CPairsStorage::ReadFromString(const UString &text)
|
||||
Sort();
|
||||
else
|
||||
Pairs.Clear();
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void CPairsStorage::SaveToString(UString &text)
|
||||
@@ -211,6 +211,7 @@ void CPairsStorage::SaveToString(UString &text)
|
||||
text += L'\"';
|
||||
text += L' ';
|
||||
text += pair.Value;
|
||||
text += L'\x0D';
|
||||
text += L'\n';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,11 @@ bool COutFile::Create(const char *name, bool createAlways)
|
||||
return OpenBinary(name, O_CREAT | O_EXCL | O_WRONLY);
|
||||
}
|
||||
|
||||
bool COutFile::Open(const char *name, DWORD creationDisposition)
|
||||
{
|
||||
return Create(name, false);
|
||||
}
|
||||
|
||||
ssize_t COutFile::Write(const void *data, size_t size)
|
||||
{
|
||||
return write(_handle, data, size);
|
||||
|
||||
@@ -38,6 +38,7 @@ class COutFile: public CFileBase
|
||||
{
|
||||
public:
|
||||
bool Create(const char *name, bool createAlways);
|
||||
bool Open(const char *name, DWORD creationDisposition);
|
||||
ssize_t Write(const void *data, size_t size);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user