mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Start handling dive events
Parse them, save them, take them from libdivecomputer. This doesn't merge them or show them in the profile yet, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
50c2bb7c71
commit
3a77eb8510
5 changed files with 112 additions and 8 deletions
23
dive.c
23
dive.c
|
@ -5,6 +5,29 @@
|
|||
|
||||
#include "dive.h"
|
||||
|
||||
void add_event(struct dive *dive, int time, int type, int flags, int value, const char *name)
|
||||
{
|
||||
struct event *ev, **p;
|
||||
unsigned int size, len = strlen(name);
|
||||
|
||||
size = sizeof(*ev) + len + 1;
|
||||
ev = malloc(size);
|
||||
if (!ev)
|
||||
return;
|
||||
memset(ev, 0, size);
|
||||
memcpy(ev->name, name, len);
|
||||
ev->time.seconds = time;
|
||||
ev->type = type;
|
||||
ev->flags = flags;
|
||||
ev->value = value;
|
||||
ev->next = NULL;
|
||||
|
||||
p = &dive->events;
|
||||
while (*p)
|
||||
p = &(*p)->next;
|
||||
*p = ev;
|
||||
}
|
||||
|
||||
double get_depth_units(unsigned int mm, int *frac, const char **units)
|
||||
{
|
||||
int decimals;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue