From 64501a659875a86232cae68291673a860a22128c Mon Sep 17 00:00:00 2001 From: "SND\\EreTIk_cp" Date: Mon, 27 Jan 2014 14:18:56 +0000 Subject: [PATCH] [0.2.x] fixed : cistom type padding git-svn-id: https://pykd.svn.codeplex.com/svn@87171 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/customtypes.cpp | 13 ++++++++++++- pykd/customtypes.h | 8 +------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pykd/customtypes.cpp b/pykd/customtypes.cpp index 32d9351..ee3cb36 100644 --- a/pykd/customtypes.cpp +++ b/pykd/customtypes.cpp @@ -23,9 +23,20 @@ TypeInfoPtr TypeBuilder::createUnion( const std::string &name, ULONG align ) //////////////////////////////////////////////////////////////////////////////// +CustomBase::CustomBase( const std::string &name, ULONG pointerSize, ULONG align ) : + UdtTypeInfoBase( name ) +{ + m_ptrSize = pointerSize; + m_align = align ? align : m_ptrSize; + m_size = 0; +} + +//////////////////////////////////////////////////////////////////////////////// + ULONG CustomBase::getSize() { - return alignUp( m_size, getAlignReq() ); + const ULONG alignReq = getAlignReq(); + return alignUp( m_size, alignReq < m_align ? alignReq : m_align ); } //////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/customtypes.h b/pykd/customtypes.h index 75344fc..879ffea 100644 --- a/pykd/customtypes.h +++ b/pykd/customtypes.h @@ -59,13 +59,7 @@ public: protected: - CustomBase( const std::string &name, ULONG pointerSize, ULONG align ) : - UdtTypeInfoBase( name ) - { - m_ptrSize = pointerSize; - m_align = align ? align : m_ptrSize; - m_size = 0; - } + CustomBase( const std::string &name, ULONG pointerSize, ULONG align ); static ULONG alignUp(ULONG val, ULONG align);