Fixed a bug where the new line count when truncating a column would not

be computed correctly when dealing with high numbers (bad automatic type
for intermediate result)
This commit is contained in:
Celine Mercier
2017-09-25 10:52:19 +02:00
parent 41dec03448
commit 5ed6835e0e

View File

@ -1466,7 +1466,7 @@ int obi_truncate_column(OBIDMS_column_p column) // TODO is it necessary to unmap
// 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)->stored_data_type)) / (double) getpagesize());
new_line_count = floor((((int) multiple) * getpagesize()) / ((column->header)->nb_elements_per_line * obi_sizeof((column->header)->stored_data_type)));
new_line_count = floor((((int64_t) multiple) * ((int64_t) getpagesize())) / ((column->header)->nb_elements_per_line * obi_sizeof((column->header)->stored_data_type)));
data_size = obi_array_sizeof((column->header)->stored_data_type, new_line_count, (column->header)->nb_elements_per_line);