Remove leading/trailing whitespace from extra_data values by bstoeger · Pull Request #4708 · subsurface/subsurface

mikeller

@bstoeger bstoeger marked this pull request as ready for review

February 10, 2026 06:03

dirkhh

By passing a string_view, the function can take std::string and
C-style strings (or obviously string_views).

Most callers had an std::string, with known length, then passed
the C-style string, which has no length information, and the function
then would redetermine the length.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Turns out some libdivecomputer devices add spurious whitespace
to the firmware.

Remove any spurious leading/trailing whitespace when importing
the dive computer extra_data to struct divecomputer.

For now, the sanitized string is not written back to the logs.
When (if) libdivecomputer removes that whitespace it might be a
good idea to write the sanitized string back to the log, for
consistency.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>

mikeller added a commit to mikeller/subsurface that referenced this pull request

Feb 13, 2026
Trim extra whitespace from the firmware version reported by
libdivecomputer.

This is to fix display problems in subsurface#4699.

It is an alternative to
subsurface#4708 that minimises the
amount of new C++ constructs that are introduced.

Signed-off-by: Michael Keller <github@ike.ch>

mikeller added a commit to mikeller/subsurface that referenced this pull request

Feb 13, 2026
Trim extra whitespace from the firmware version reported by
libdivecomputer.

This is to fix display problems in subsurface#4699.

It is an alternative to
subsurface#4708 that minimises the
amount of new C++ constructs that are introduced.

Signed-off-by: Michael Keller <github@ike.ch>

mikeller added a commit to mikeller/subsurface that referenced this pull request

Feb 14, 2026
Trim extra whitespace from the firmware version reported by
libdivecomputer.

This is to fix display problems in subsurface#4699.

It is an alternative to
subsurface#4708 that minimises the
amount of new C++ constructs that are introduced.

Signed-off-by: Michael Keller <github@ike.ch>