//This functions move tags to local hex and text ctrls. void HexEditorCtrl::PushTAGToControls( TagElement* TAG){ int64_t start_byte = TAG->start; int64_t end_byte = TAG->end; if(start_byte > end_byte){ // swap if start > end int64_t temp = start_byte; start_byte = end_byte; end_byte = temp; } if( start_byte >= page_offset + GetByteCount() ) // ...[..].TAG... return; else if( end_byte < page_offset ) // ..TAG..[...]... return; if( start_byte <= page_offset ) // ...TA[G..].... start_byte = page_offset; if( end_byte >= page_offset + GetByteCount() ) //...[..T]AG... end_byte = GetByteCount() + page_offset; start_byte -= page_offset; end_byte -= page_offset; TagElement *TAX;//For debugging TAX = new TagElement( start_byte/(GetCharToHexSize()/2), end_byte/(GetCharToHexSize()/2)+1, TAG->tag, TAG->FontClrData, TAG->NoteClrData ); text_ctrl->TagArray.Add( TAX ); TAX = new TagElement( start_byte*2, (end_byte+1)*2, TAG->tag, TAG->FontClrData, TAG->NoteClrData ); hex_ctrl->TagArray.Add( TAX ); }
void HexEditorCtrl::PaintSelection( void ){ PreparePaintTAGs(); if( select->GetState() ){ int64_t start_byte = select->StartOffset; int64_t end_byte = select->EndOffset; if(start_byte > end_byte){ // swap if start > end int64_t temp = start_byte; start_byte = end_byte; end_byte = temp; } if( start_byte >= page_offset + GetByteCount() ){ // ...[..].TAG... ClearPaint(); return; } else if( start_byte <= page_offset ) // ...TA[G..].... start_byte = page_offset; if( end_byte < page_offset ){ // ..TAG..[...]... ClearPaint(); return; } else if( end_byte >= page_offset + GetByteCount() ) //...[..T]AG... end_byte = GetByteCount() + page_offset; start_byte -= page_offset; end_byte -= page_offset; text_ctrl->SetSelection(start_byte/(GetCharToHexSize()/2), end_byte/(GetCharToHexSize()/2)+1); hex_ctrl ->SetSelection(start_byte*2, (end_byte+1)*2); } else ClearPaint(); }
void ezMemoryStreamWriter::SetWritePosition(ezUInt32 uiWritePosition) { EZ_ASSERT_API(m_pStreamStorage != nullptr, "The memory stream writer needs a valid memory storage object!"); EZ_ASSERT_API(uiWritePosition <= GetByteCount(), "Write position must be between 0 and GetByteCount()!"); m_uiWritePosition = uiWritePosition; }
/// \brief /// Assignment operator. Deep copies the buffer. inline IVConstantBuffer &operator = (const IVConstantBuffer &other) { AllocateBuffer(other.m_iFirstRegister,other.m_iAllocatedEntries); if (m_iAllocatedEntries>0) memcpy(m_pBuffer,other.m_pBuffer,GetByteCount()); m_spTable = ((IVConstantBuffer &)other).m_spTable; ///< no assignment operator! return *this; }
PacketStatisticDescriptor PacketStatistic::GetPacketStatistic() { PacketStatisticDescriptor tStat; tStat.Outgoing = IsOutgoingStream(); tStat.MinPacketSize = GetMinPacketSize(); tStat.MaxPacketSize = GetMaxPacketSize(); tStat.PacketCount = GetPacketCount(); tStat.ByteCount = GetByteCount(); tStat.LostPacketCount = GetLostPacketCount(); tStat.AvgPacketSize = GetAvgPacketSize(); tStat.AvgDataRate = GetAvgDataRate(); tStat.MomentAvgDataRate = GetMomentAvgDataRate(); return tStat; }
void HexEditorCtrl::PaintTAGsPrefilter( ArrayOfTAG& Arr ){ unsigned c = Arr.Count(); if( c==0 ) return; unsigned s = 0; if (c>0) for( ; static_cast<uint64_t>( page_offset ) > (Arr.Item(s))->end && s<c-1; s++ ); unsigned e=s; if (c>0) for( ; page_offset + GetByteCount() > static_cast<int>( Arr.Item(e)->start ) && e<c-1 ; e++ ); //#ifdef _DEBUG_ std::cout << "Tags needed between : " << s << " - " << e << std::endl; //#endif //_DEBUG_ for( unsigned i=s; i<=e ;i++) PushTAGToControls( Arr.Item(i) ); }
// // Write encoded information to its final destination and frees temporary buffers. // The encoder shouldn't be used anymore after calling this method. // BYTE* GcInfoEncoder::Emit(BYTE* destBuffer) { size_t cbGcInfoSize = GetByteCount(); _ASSERTE( destBuffer ); m_HeaderInfoWriter.CopyTo( destBuffer ); destBuffer += m_HeaderInfoWriter.GetByteCount(); m_HeaderInfoWriter.Dispose(); #if 0 #ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED m_PartiallyInterruptibleInfoWriter.CopyTo( destBuffer ); destBuffer += m_PartiallyInterruptibleInfoWriter.GetByteCount(); m_PartiallyInterruptibleInfoWriter.Dispose(); #endif // PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED #endif m_FullyInterruptibleInfoWriter.CopyTo( destBuffer ); m_FullyInterruptibleInfoWriter.Dispose(); return destBuffer; }
void ezMemoryStreamReader::SetReadPosition(ezUInt32 uiReadPosition) { EZ_ASSERT_API(uiReadPosition < GetByteCount(), "Read position must be between 0 and GetByteCount()!"); m_uiReadPosition = uiReadPosition; }
/// \brief /// Comparison operator. true if both buffers contain the exact same data inline bool operator == (const IVConstantBuffer &other) const { if (m_iFirstRegister!=other.m_iFirstRegister) return false; if (m_iAllocatedEntries!=other.m_iAllocatedEntries) return false; return memcmp(m_pBuffer,other.m_pBuffer,GetByteCount())==0; }