SIGN IN SIGN UP

readers.mbio: fix init + zero-point read with MB-System >= 5.7.6 (#3791) (#5056)

MB-System 5.7.6 added strict date validation in mb_get_time(), which
mb_read_init() now calls on the begin/end times. readers.mbio passes invalid
hardcoded dates (year 0 / INT_MAX, month 0, day 0), so on MB-System >= 5.7.6:

1. Initialization aborts with the new MB_ERROR_BAD_TIME (17). That code is
   missing from MbError's table, so the message renders blank
   ("Can't initialize mb-system reader:").
2. Even past init, the read loop treated any mb_read() status == 0 as
   end-of-data and bailed on the first non-fatal record (the comment/header
   records that precede survey data) -> zero points read.

Fixes:
- Use MB-System's canonical default epoch (1962/2/21 .. 2062/2/21) for
  btime_i/etime_i; it spans any real survey and passes validation.
- Add error code 17 ("Bad time value.") to MbError.
- Stop the read loop only on a fatal error (error > 0, incl. EOF); skip
  non-fatal records; extract only successful survey pings
  (status == MB_SUCCESS && kind == MB_DATA_DATA).

Verified on Ubuntu 24.04 with MB-System master + PDAL: readers.mbio reads
bathymetry from MB-System's bundled mb24/mb43 test files and from real Reson
7k (.s7k, format 89) survey data. Closes #3791.

Co-authored-by: Massimo Di Stefano <massimodisasha@gmail.com>
M
Massimo Di Stefano committed
5a27874fbdf5bf9ceab676d2cdea89acedb164b2
Parent: cb6f75d
Committed by GitHub <noreply@github.com> on 6/22/2026, 1:08:05 AM