本文整理汇总了C++中CByteBuffer::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ CByteBuffer::Size方法的具体用法?C++ CByteBuffer::Size怎么用?C++ CByteBuffer::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CByteBuffer
的用法示例。
在下文中一共展示了CByteBuffer::Size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadStream
static bool ReadStream(CMyComPtr<IInStream> & inStream, Int64 offset, UINT32 seekOrigin, CByteBuffer & signature)
{
UInt64 savedPosition = 0;
UInt64 newPosition = 0;
#if MY_VER_MAJOR >= 15
UInt32 readCount = signature.Size();
#else
UInt32 readCount = signature.GetCapacity();
#endif
unsigned char * buf = signature;
if (S_OK != inStream->Seek(0, FILE_CURRENT, &savedPosition))
return false;
if (S_OK != inStream->Seek(offset, seekOrigin, &newPosition)) {
inStream->Seek(savedPosition, FILE_BEGIN, &newPosition); //restore pos
return false;
}
while (readCount > 0) {
UInt32 processedCount = 0;
if (S_OK != inStream->Read(buf, readCount, &processedCount)) {
inStream->Seek(savedPosition, FILE_BEGIN, &newPosition); //restore pos
return false;
}
if (processedCount == 0)
break;
readCount -= processedCount;
buf += processedCount;
}
inStream->Seek(savedPosition, FILE_BEGIN, &newPosition); //restore pos
return readCount == 0;
}
示例2: OnButton_Link
void CLinkDialog::OnButton_Link()
{
UString from, to;
_pathFromCombo.GetText(from);
_pathToCombo.GetText(to);
if (from.IsEmpty())
return;
if (!NName::IsAbsolutePath(from))
from.Insert(0, CurDirPrefix);
int idb = -1;
for (unsigned i = 0;; i++)
{
if (i >= ARRAY_SIZE(k_LinkType_Buttons))
return;
idb = k_LinkType_Buttons[i];
if (IsButtonCheckedBool(idb))
break;
}
NFind::CFileInfo info1, info2;
bool finded1 = info1.Find(us2fs(from));
bool finded2 = info2.Find(us2fs(to));
bool isDirLink = (
idb == IDR_LINK_TYPE_SYM_DIR ||
idb == IDR_LINK_TYPE_JUNCTION);
if (finded1 && info1.IsDir() != isDirLink ||
finded2 && info2.IsDir() != isDirLink)
{
ShowError(L"Incorrect link type");
return;
}
if (idb == IDR_LINK_TYPE_HARD)
{
if (!NDir::MyCreateHardLink(us2fs(from), us2fs(to)))
{
ShowLastErrorMessage();
return;
}
}
else
{
bool isSymLink = (idb != IDR_LINK_TYPE_JUNCTION);
CByteBuffer data;
if (!FillLinkData(data, to, isSymLink))
{
ShowError(L"Incorrect link");
return;
}
CReparseAttr attr;
if (!attr.Parse(data, data.Size()))
{
ShowError(L"Internal conversion error");
return;
}
if (!NIO::SetReparseData(us2fs(from), isDirLink, data, (DWORD)data.Size()))
{
ShowLastErrorMessage();
return;
}
}
End(IDOK);
}
示例3: Set
void CStreamSwitch::Set(CInArchive *archive, const CByteBuffer &byteBuffer)
{
Set(archive, byteBuffer, byteBuffer.Size(), false);
}