diff --git a/pstsdk/disk/disk.h b/pstsdk/disk/disk.h index b3058d7..60c08b1 100644 --- a/pstsdk/disk/disk.h +++ b/pstsdk/disk/disk.h @@ -1341,12 +1341,14 @@ struct bth_header template struct bth_nonleaf_entry { - K key; //!< Key of the lower level page - heap_id page; //!< Heap id of the lower level page -} PSTSDK_MS_STRUCT; + K key; //!< Key of the lower level page + heap_id page PSTSDK_PACK_2; //!< Heap id of the lower level page +}; #pragma pack() //! \cond static_asserts static_assert(sizeof(bth_nonleaf_entry) == 6, "bth_nonleaf_entry incorrect size"); +static_assert(offsetof(bth_nonleaf_entry, key) == 0, "bth_nonleaf_entry key at incorrect offset"); +static_assert(offsetof(bth_nonleaf_entry, page) == 2, "bth_nonleaf_entry page at incorrect offset"); //! \endcond //! \brief Entries which make up a "leaf" BTH allocation diff --git a/pstsdk/ltp/heap.h b/pstsdk/ltp/heap.h index 6d3128e..9d6512a 100644 --- a/pstsdk/ltp/heap.h +++ b/pstsdk/ltp/heap.h @@ -468,7 +468,8 @@ inline std::tr1::shared_ptr > pstsdk::bth_nodeentries[i].key, pbth_nonleaf_node->entries[i].page)); + heap_id page = pbth_nonleaf_node->entries[i].page; + child_nodes.push_back(std::make_pair(pbth_nonleaf_node->entries[i].key, page)); } #ifndef BOOST_NO_RVALUE_REFERENCES diff --git a/pstsdk/util/primitives.h b/pstsdk/util/primitives.h index 0fad923..6121ccd 100644 --- a/pstsdk/util/primitives.h +++ b/pstsdk/util/primitives.h @@ -53,8 +53,10 @@ // '#pragma ms_struct on', but it fails on at least some Linux systems. #ifdef __GNUC__ #define PSTSDK_MS_STRUCT __attribute__((ms_struct)) +#define PSTSDK_PACK_2 __attribute__((packed, aligned(2))) #else #define PSTSDK_MS_STRUCT +#define PSTSDK_PACK_2 #endif namespace pstsdk