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

column when truncating
This commit is contained in:
Celine Mercier
2015-10-09 13:49:48 +02:00
parent e114a3c9cb
commit fc8bf16769

View File

@ -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)