From 5ed6835e0e786900ef1ddf3c4f843bdb21d0c239 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Mon, 25 Sep 2017 10:52:19 +0200 Subject: [PATCH] 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) --- src/obidmscolumn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/obidmscolumn.c b/src/obidmscolumn.c index 085c335..d01c1ce 100644 --- a/src/obidmscolumn.c +++ b/src/obidmscolumn.c @@ -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);