本文整理汇总了C++中CIntVector::DeleteFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ CIntVector::DeleteFrom方法的具体用法?C++ CIntVector::DeleteFrom怎么用?C++ CIntVector::DeleteFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntVector
的用法示例。
在下文中一共展示了CIntVector::DeleteFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenStream
HRESULT CArc::OpenStream(
CCodecs *codecs,
int formatIndex,
IInStream *stream,
ISequentialInStream *seqStream,
IArchiveOpenCallback *callback)
{
Archive.Release();
ErrorMessage.Empty();
const UString fileName = ExtractFileNameFromPath(Path);
UString extension;
{
int dotPos = fileName.ReverseFind(L'.');
if (dotPos >= 0)
extension = fileName.Mid(dotPos + 1);
}
CIntVector orderIndices;
if (formatIndex >= 0)
orderIndices.Add(formatIndex);
else
{
int i;
int numFinded = 0;
for (i = 0; i < codecs->Formats.Size(); i++)
if (codecs->Formats[i].FindExtension(extension) >= 0)
orderIndices.Insert(numFinded++, i);
else
orderIndices.Add(i);
if (!stream)
{
if (numFinded != 1)
return E_NOTIMPL;
orderIndices.DeleteFrom(1);
}
#ifndef _SFX
if (orderIndices.Size() >= 2 && (numFinded == 0 || extension.CompareNoCase(L"exe") == 0))
{
CIntVector orderIndices2;
CByteBuffer byteBuffer;
const size_t kBufferSize = (1 << 21);
byteBuffer.SetCapacity(kBufferSize);
RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
size_t processedSize = kBufferSize;
RINOK(ReadStream(stream, byteBuffer, &processedSize));
if (processedSize == 0)
return S_FALSE;
const Byte *buf = byteBuffer;
CByteBuffer hashBuffer;
const UInt32 kNumVals = 1 << (kNumHashBytes * 8);
hashBuffer.SetCapacity(kNumVals);
Byte *hash = hashBuffer;
memset(hash, 0xFF, kNumVals);
Byte prevs[256];
if (orderIndices.Size() >= 256)
return S_FALSE;
int i;
for (i = 0; i < orderIndices.Size(); i++)
{
const CArcInfoEx &ai = codecs->Formats[orderIndices[i]];
const CByteBuffer &sig = ai.StartSignature;
if (sig.GetCapacity() < kNumHashBytes)
continue;
UInt32 v = HASH_VAL(sig, 0);
prevs[i] = hash[v];
hash[v] = (Byte)i;
}
processedSize -= (kNumHashBytes - 1);
for (UInt32 pos = 0; pos < processedSize; pos++)
{
for (; pos < processedSize && hash[HASH_VAL(buf, pos)] == 0xFF; pos++);
if (pos == processedSize)
break;
UInt32 v = HASH_VAL(buf, pos);
Byte *ptr = &hash[v];
int i = *ptr;
do
{
int index = orderIndices[i];
const CArcInfoEx &ai = codecs->Formats[index];
const CByteBuffer &sig = ai.StartSignature;
if (sig.GetCapacity() != 0 && pos + sig.GetCapacity() <= processedSize + (kNumHashBytes - 1) &&
TestSignature(buf + pos, sig, sig.GetCapacity()))
{
orderIndices2.Add(index);
orderIndices[i] = 0xFF;
*ptr = prevs[i];
}
else
ptr = &prevs[i];
i = *ptr;
}
while (i != 0xFF);
}
for (i = 0; i < orderIndices.Size(); i++)
//.........这里部分代码省略.........