本文整理汇总了C++中ConstBufferPtr::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstBufferPtr::Size方法的具体用法?C++ ConstBufferPtr::Size怎么用?C++ ConstBufferPtr::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstBufferPtr
的用法示例。
在下文中一共展示了ConstBufferPtr::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyFrom
void BufferPtr::CopyFrom (const ConstBufferPtr &bufferPtr) const
{
if (bufferPtr.Size() > DataSize)
throw ParameterTooLarge (SRC_POS);
Memory::Copy (DataPtr, bufferPtr.Get(), bufferPtr.Size());
}
示例2: WriteAt
void File::WriteAt (const ConstBufferPtr &buffer, uint64 position) const
{
if_debug (ValidateState());
#ifdef TC_TRACE_FILE_OPERATIONS
TraceFileOperation (FileHandle, Path, true, buffer.Size(), position);
#endif
throw_sys_sub_if (pwrite (FileHandle, buffer, buffer.Size(), position) != (ssize_t) buffer.Size(), wstring (Path));
}
示例3: Read
uint64 MemoryStream::Read (const BufferPtr &buffer)
{
if (Data.size() == 0)
throw ParameterIncorrect (SRC_POS);
ConstBufferPtr streamBuf (*this);
size_t len = buffer.Size();
if (streamBuf.Size() - ReadPosition < len)
len = streamBuf.Size() - ReadPosition;
BufferPtr(buffer).CopyFrom (streamBuf.GetRange (ReadPosition, len));
ReadPosition += len;
return len;
}
示例4: DeserializeEntryAt
T VolumeHeader::DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const
{
if (offset > header.Size())
throw ParameterIncorrect (SRC_POS);
return Endian::Big (*reinterpret_cast<const T *> (header.Get() + offset));
}
示例5: EncryptNew
void VolumeHeader::EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf)
{
if (newHeaderBuffer.Size() != HeaderSize || newSalt.Size() != SaltSize)
throw ParameterIncorrect (SRC_POS);
shared_ptr <EncryptionMode> mode = EA->GetMode()->GetNew();
shared_ptr <EncryptionAlgorithm> ea = EA->GetNew();
if (typeid (*mode) == typeid (EncryptionModeXTS))
{
mode->SetKey (newHeaderKey.GetRange (EA->GetKeySize(), EA->GetKeySize()));
ea->SetKey (newHeaderKey.GetRange (0, ea->GetKeySize()));
}
else
{
mode->SetKey (newHeaderKey.GetRange (0, mode->GetKeySize()));
ea->SetKey (newHeaderKey.GetRange (LegacyEncryptionModeKeyAreaSize, ea->GetKeySize()));
}
ea->SetMode (mode);
newHeaderBuffer.CopyFrom (newSalt);
BufferPtr headerData = newHeaderBuffer.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize);
Serialize (headerData);
ea->Encrypt (headerData);
if (newPkcs5Kdf)
Pkcs5 = newPkcs5Kdf;
}
示例6: Serialize
void Serializer::Serialize (const string &name, const ConstBufferPtr &data)
{
SerializeString (name);
uint64 size = data.Size();
Serialize (size);
DataStream->Write (data);
}
示例7: SetKey
void Cipher::SetKey (const ConstBufferPtr &key)
{
if (key.Size() != GetKeySize ())
throw ParameterIncorrect (SRC_POS);
if (!Initialized)
ScheduledKey.Allocate (GetScheduledKeySize ());
SetCipherKey (key);
Key.CopyFrom (key);
Initialized = true;
}
示例8: SetKey
void EncryptionAlgorithm::SetKey (const ConstBufferPtr &key)
{
if (Ciphers.size() < 1)
throw NotInitialized (SRC_POS);
if (GetKeySize() != key.Size())
throw ParameterIncorrect (SRC_POS);
size_t keyOffset = 0;
foreach_ref (Cipher &c, Ciphers)
{
c.SetKey (key.GetRange (keyOffset, c.GetKeySize()));
keyOffset += c.GetKeySize();
}
示例9: SetKey
void EncryptionModeLRW::SetKey (const ConstBufferPtr &key)
{
if (key.Size() != 16)
throw ParameterIncorrect (SRC_POS);
if (!KeySet)
GfContext.Allocate (sizeof (GfCtx));
if (!Gf64TabInit ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
throw bad_alloc();
if (!Gf128Tab64Init ((unsigned char *) key.Get(), (GfCtx *) (GfContext.Ptr())))
throw bad_alloc();
Key.CopyFrom (key);
KeySet = true;
}
示例10: ShowBytes
void RandomPoolEnrichmentDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer)
{
wxString str;
for (size_t i = 0; i < buffer.Size(); ++i)
{
str += wxString::Format (L"%02X", buffer[i]);
}
str += L"..";
textCtrl->SetLabel (str.c_str());
for (size_t i = 0; i < str.size(); ++i)
{
str[i] = L'X';
}
}
示例11: ShowBytes
void VolumeCreationProgressWizardPage::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots)
{
wxString str;
for (size_t i = 0; i < MaxDisplayedKeyBytes && i < buffer.Size(); ++i)
{
str += wxString::Format (L"%02X", buffer[i]);
}
if (appendDots)
str += L"..";
textCtrl->SetLabel (str.c_str());
for (size_t i = 0; i < str.size(); ++i)
{
str[i] = L'X';
}
}
示例12: ShowBytes
void KeyfileGeneratorDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots)
{
wxString str;
for (size_t i = 0; i < buffer.Size(); ++i)
{
str += wxString::Format (L"%02X", buffer[i]);
}
if (appendDots)
str += L"..";
textCtrl->SetLabel (str.c_str());
for (size_t i = 0; i < str.size(); ++i)
{
str[i] = L'X';
}
}
示例13: lock
shared_ptr <Buffer> FuseService::GetVolumeInfo ()
{
shared_ptr <Stream> stream (new MemoryStream);
{
ScopeLock lock (OpenVolumeInfoMutex);
OpenVolumeInfo.Set (*MountedVolume);
OpenVolumeInfo.SlotNumber = SlotNumber;
OpenVolumeInfo.Serialize (stream);
}
ConstBufferPtr infoBuf = dynamic_cast <MemoryStream&> (*stream);
shared_ptr <Buffer> outBuf (new Buffer (infoBuf.Size()));
outBuf->CopyFrom (infoBuf);
return outBuf;
}
示例14: Write
void MemoryStream::Write (const ConstBufferPtr &data)
{
for (uint64 i = 0; i < data.Size(); i++)
Data.push_back (data[i]);
}
示例15: Set
void VolumePassword::Set (const ConstBufferPtr &password)
{
Set (password, password.Size());
}