本文整理汇总了C++中CItemEx::HasDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemEx::HasDescriptor方法的具体用法?C++ CItemEx::HasDescriptor怎么用?C++ CItemEx::HasDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemEx
的用法示例。
在下文中一共展示了CItemEx::HasDescriptor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadLocalItemAfterCdItemFull
HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item)
{
if (item.FromLocal)
return S_OK;
try
{
RINOK(ReadLocalItemAfterCdItem(item));
if (item.HasDescriptor())
{
RINOK(Seek(ArcInfo.Base + item.GetDataPosition() + item.PackSize));
if (ReadUInt32() != NSignature::kDataDescriptor)
return S_FALSE;
UInt32 crc = ReadUInt32();
UInt64 packSize, unpackSize;
/*
if (IsZip64)
{
packSize = ReadUInt64();
unpackSize = ReadUInt64();
}
else
*/
{
packSize = ReadUInt32();
unpackSize = ReadUInt32();
}
if (crc != item.Crc || item.PackSize != packSize || item.Size != unpackSize)
return S_FALSE;
}
}
catch(...) { return S_FALSE; }
return S_OK;
}
示例2: AreItemsEqual
static bool AreItemsEqual(const CItemEx &localItem, const CItemEx &cdItem)
{
if (!FlagsAreSame(cdItem, localItem))
return false;
if (!localItem.HasDescriptor())
{
if (cdItem.Crc != localItem.Crc ||
cdItem.PackSize != localItem.PackSize ||
cdItem.Size != localItem.Size)
return false;
}
/* pkzip 2.50 creates incorrect archives. It uses
- WIN encoding for name in local header
- OEM encoding for name in central header
We don't support these strange items. */
/* if (cdItem.Name.Len() != localItem.Name.Len())
return false;
*/
if (cdItem.Name != localItem.Name)
return false;
return true;
}
示例3: ReadLocals
HRESULT CInArchive::ReadLocals(
CObjectVector<CItemEx> &items, CProgressVirt *progress)
{
items.Clear();
while (m_Signature == NSignature::kLocalFileHeader)
{
CItemEx item;
item.LocalHeaderPos = m_Position - 4 - ArcInfo.MarkerPos;
// we write ralative LocalHeaderPos here. Later we can correct it to real Base.
try
{
ReadLocalItem(item);
item.FromLocal = true;
if (item.HasDescriptor())
ReadLocalItemDescriptor(item);
else
{
RINOK(IncreaseRealPosition(item.PackSize));
}
items.Add(item);
m_Signature = ReadUInt32();
}
catch (CUnexpectEnd &)
{
if (items.IsEmpty() || items.Size() == 1 && IsStrangeItem(items[0]))
return S_FALSE;
throw;
}
if (progress && items.Size() % 1 == 0)
RINOK(progress->SetCompletedLocal(items.Size(), item.LocalHeaderPos));
}
if (items.Size() == 1 && m_Signature != NSignature::kCentralFileHeader)
if (IsStrangeItem(items[0]))
return S_FALSE;
return S_OK;
}