Fixed a critical bug in the computation of the new number of lines of a
column when truncating
This commit is contained in:
@ -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
|
// 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());
|
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
|
// 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)
|
if ((column->header)->line_count == new_line_count)
|
||||||
|
Reference in New Issue
Block a user