Skip to content

Commit 74b3304

Browse files
authored
Merge pull request #68 from vitcpp/fix-compilation
Fix compilation error (-Wstringop-overflow)
2 parents 7fc44d1 + f696b8a commit 74b3304

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: src/process_moc.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ char* data_as_char(Smoc* moc, size_t offset = 0)
122122
static
123123
char* detoasted_offset(Smoc* moc, size_t offset = 0)
124124
{
125-
return offset + reinterpret_cast<char*>(&(moc->version));
125+
return offset + reinterpret_cast<char*>(moc) + offsetof(Smoc, version);
126126
}
127127

128128
template<class X, class Y>
@@ -240,7 +240,7 @@ struct moc_tree_layout
240240
{
241241
rest_level = entries - rest_entries;
242242
this_page = page_rest;
243-
}
243+
}
244244
else // there is only a single page fragment at this level
245245
{
246246
rest_level = 0;
@@ -526,13 +526,13 @@ get_moc_size(void* moc_in_context, pgs_error_handler error_out)
526526
}
527527
if (check == b_tree_inf)
528528
throw std::logic_error("infinite loop for MOC B-tree depth");
529-
529+
530530
// layout: start with the section of the ends of each B+-tree level
531531
size_t depth = m.layout.size() - 1;
532532
moc_size += depth * MOC_INDEX_ALIGN;
533533
// layout: B+-tree layout, starting at root node
534534
for (unsigned k = depth; k >= 1; --k)
535-
{
535+
{
536536
m.layout[k].layout_level(moc_size, MOC_TREE_ENTRY_SIZE);
537537
}
538538
if (m.layout[depth].level_end > static_cast<size_t>(
@@ -568,7 +568,7 @@ create_moc_release_context(void* moc_in_context, Smoc* moc,
568568

569569
hpint64 area = 0;
570570

571-
// this guards against
571+
// this guards against
572572
char* moc_data = detoasted_offset(moc, 0);
573573

574574
// All levels will be filled out from end to beginning such that
@@ -726,7 +726,7 @@ order_break(output_map & outputs, const moc_interval & x, int max_order)
726726
void
727727
ascii_out(std::string & m_s, char* s, Smoc* moc, int32 begin, int32 end,
728728
int32 entry_size)
729-
{
729+
{
730730
// moc output fiddling:
731731
int order = moc->order;
732732
m_s.reserve(end); // rough guess
@@ -817,7 +817,7 @@ create_moc_out_context(Smoc* moc, int32 end, pgs_error_handler error_out)
817817
return ret;
818818
}
819819

820-
void
820+
void
821821
release_moc_out_context(moc_out_data out_context, pgs_error_handler error_out)
822822
{
823823
release_context<moc_output>(out_context.context, error_out);

0 commit comments

Comments
 (0)