summaryrefslogtreecommitdiffstats
path: root/core/save-profiledata.c
AgeCommit message (Collapse)Author
2020-04-18Fix CSV for profile exportGravatar Robert C. Helling
The function to print a double did not print a comma while the lines ended in a comma. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-02-09Cleanup: remove const bool parameters and return typesGravatar Berthold Stoeger
These just make no sense. Since the value is copied, it has no meaning to the caller whether the function can change the value (and vice versa for return types). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-16Use the actual error numberGravatar Robert C. Helling
According to the man page, fopen and fclose return the error number in the global variable errno. Fixes CID 350115 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-09Core: remove MAX_CYLINDERS restrictionGravatar Berthold Stoeger
Instead of using fixed size arrays, use a new cylinder_table structure. The code copies the weightsystem code, but is significantly more complex because cylinders are such an integral part of the core. Two functions to access the cylinders were added: get_cylinder() and get_or_create_cylinder() The former does a simple array access and supposes that the cylinder exists. The latter is used by the parser(s) and if a cylinder with the given id does not exist, cylinders up to that id are generated. One point will make C programmers cringe: the cylinder structure is passed by value. This is due to the way the table-macros work. A refactoring of the table macros is planned. It has to be noted that the size of a cylinder_t is 64 bytes, i.e. 8 long words on a 64-bit architecture, so passing on the stack is probably not even significantly slower than passing as reference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Profile: use pressure data functions in save_profiles_bufferGravatar Berthold Stoeger
The save_profiles_buffer() function was accessing the pressure data directly. Instead, use the already existing funcions to make transition to dynamically allocated pressure data more seamless. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-28Profile: properly initialize plot_info structuresGravatar Berthold Stoeger
The create_plot_info_new() function releases old plot data. This can only work if the plot_info structure was initialized previously. The ProfileWidget2 did that by a memset, but other parts of the code did not. Therefore, introduce a init_plot_info() function and call that when generating a plot_info struct. Constructors would make this so much easier - but since this is called from C, we can't use them. Fixes #2251 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move file-related function declarations to file.hGravatar Berthold Stoeger
A number of architecture-dependent functions were declared in dive.h. Move them to file.h so that not all file-manipulating translation units have to include dive.h. This is a small step in avoiding mass-recompilation on every change to dive.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move error reporting function declarations to errorhelper.hGravatar Berthold Stoeger
Move the declarations of the "report_error()" and "set_error_cb()" functions and the "verbose" variable to errorhelper.h. Thus, error-reporting translation units don't have to import the big dive.h header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: call calculate_max_limits_new() in create_plot_info_new()Gravatar Berthold Stoeger
All callers of create_plot_info_new() called calculate_max_limits_new() a line before. Thus, simply call the latter in the former. This allows us to automatically free the plot data in create_plot_info_new(). The old code overwrote the corresponding field with NULL. As a side-effect, this removes a bogus static variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-06Cleanup: fix memory management of the plot dataGravatar Berthold Stoeger
There was a global variable last_pi_entry_new, which stored the recently allocated plot data. This was freed when new plot data was generated. A very scary proposition: You can never have two plot datas at the same time! But exactly that happens when you export for example subtitles. The only reason why this didn't lead to very crazy behavior is that at least on my Linux machine, the calloc() call would just return the previously freed memory. Fix this mess by removing the global variable and freeing the data in the callers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Write dive data as video subtitlesGravatar Robert C. Helling
This commit adds an entry to the dive media context menu which offers to write a subtitle file. This creates an .ass file for the selected videos. In an attempt to to clutter the screen too much, don't show irrelevant entries (zero temperature or NDL and show TTS only for dives with stops). VLC is able to show these subtitles directly, they can be integrated into the video file with ffmpeg. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-04-04Export profile dataGravatar Robert C. Helling
This introduces a csv file that contains the data from the structs defined in profile.c, in particular all deco information computed for the dive profle (including NDL, TTS, ceilings, surface GFs etc). Signed-off-by: Robert C. Helling <helling@atdotde.de>