This series was triggered by some gasmix cleanups I started doing, and a trac entry about confusing handling of gas switch events
http://trac.subsurface-divelog.org/ticket/796 and while the series may not *fix* the mess that longjohnsilver encountered, it should at least make things more straightforward. In particular, when starting to use the cylinder index as the primary key for a gas switch event, you can now edit cylinder gas mixes and the gas switch event will automatically reflect those edits. The first patch in the series is a simple robustification, and the function it cleans up ends up getting removed entirely later in the series, but that initial cleanup might be a good idea even as a fix in the current series, so I left it that way. The second patch is a trivial infrastructure change to update a helper function for the third patch. The third patch is the meat of the series - it makes the dive data fixup look up the cylinder number, so that we always have it subsequently. We do that fixup for all dives we load from xml of from git/cloud, or import from other formats - and from libdivecomputer downloads, so this covers all models of generating dives. The fourth patch is then a smaller patch that actually starts following the gas change index to get the gas mix data - at that point the mix we carry in the event itself becomes purely used for the initial loading of the dive, and is no longer used after the index has been looked up. Linus Torvalds (4): Make "is_gasmix_redundant()" more robust Make cylinder_nodata() take a const cylinder pointer Make gas change events always have a cylinder index Start using the actual cylinder data for gas switch events desktop-widgets/maintab.cpp | 4 +- profile-widget/diveeventitem.cpp | 25 +++---- subsurface-core/dive.c | 139 ++++++++++++++++++++++++++++----------- subsurface-core/dive.h | 8 +-- subsurface-core/equipment.c | 2 +- subsurface-core/planner.c | 9 +-- subsurface-core/profile.c | 37 +++-------- subsurface-core/save-git.c | 24 ++++--- subsurface-core/save-xml.c | 24 ++++--- 9 files changed, 160 insertions(+), 112 deletions(-) -- 2.8.0.rc4.303.g3931579 _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
