Commit fc8bf167 authored by Celine Mercier's avatar Celine Mercier

Fixed a critical bug in the computation of the new number of lines of a

column when truncating
parent e114a3c9
......@@ -1046,7 +1046,7 @@ int obi_truncate_column_to_lines_used(OBIDMS_column_p column) // TODO is it nece
// Compute the new line count = the number of lines used rounded to the nearest greater multiple of page size greater than 0
multiple = ceil((double) (ONE_IF_ZERO((column->header)->lines_used) * (column->header)->nb_elements_per_line * obi_sizeof((column->header)->data_type)) / (double) getpagesize());
new_line_count = (int) multiple * getpagesize();
new_line_count = floor((((int) multiple) * getpagesize()) / ((column->header)->nb_elements_per_line * obi_sizeof((column->header)->data_type))); // TODO is it safe to cast like this?
// Check that it is actually greater than the current number of lines allocated in the file, otherwise no need to truncate
if ((column->header)->line_count == new_line_count)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment