mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Fix calculation of how many samples profile are in datatrack dive log file
This commit is contained in:
parent
499a792a03
commit
bf373f5083
1 changed files with 3 additions and 1 deletions
|
@ -639,7 +639,9 @@ bool dt_dive_parser(FILE *archivo, struct dive *dt_dive)
|
||||||
* 2bytes per sample plus another one each three samples. Also includes the
|
* 2bytes per sample plus another one each three samples. Also includes the
|
||||||
* bytes jumped over (22) and the nitrox (2) or O2 (3).
|
* bytes jumped over (22) and the nitrox (2) or O2 (3).
|
||||||
*/
|
*/
|
||||||
int samplenum = is_O2 ? (profile_length - 25) * 3 / 8 : (profile_length - 24) * 3 / 7;
|
int numerator = is_O2 ? (profile_length - 25) * 3 : (profile_length - 24) * 3;
|
||||||
|
int denominator = is_O2 ? 8 : 7;
|
||||||
|
int samplenum = (numerator / denominator) + (((numerator % denominator) != 0) ? 1 : 0);
|
||||||
|
|
||||||
dc->events = calloc(samplenum, sizeof(struct event));
|
dc->events = calloc(samplenum, sizeof(struct event));
|
||||||
dc->alloc_samples = samplenum;
|
dc->alloc_samples = samplenum;
|
||||||
|
|
Loading…
Reference in a new issue