diff --git a/src/io/gpr/IprbReader.cpp b/src/io/gpr/IprbReader.cpp index a41541d..4441753 100644 --- a/src/io/gpr/IprbReader.cpp +++ b/src/io/gpr/IprbReader.cpp @@ -13,9 +13,9 @@ BScan readIprb(const std::string& path, const IprHeader& h) { } const std::streamsize fileSize = f.tellg(); - const long traces = h.lastTrace + 1; - const long count = static_cast(h.samples) * traces; - const std::streamsize expected = static_cast(count) * 2; + const std::int64_t traces = static_cast(h.lastTrace) + 1; + const std::int64_t count = static_cast(h.samples) * traces; + const std::int64_t expected = count * 2; if (fileSize != expected) { throw std::runtime_error("readIprb: 文件大小与 samples*traces*2 不符: " + path); } @@ -23,10 +23,10 @@ BScan readIprb(const std::string& path, const IprHeader& h) { BScan b; b.samples = h.samples; b.traces = traces; - b.data.resize(static_cast(count)); + b.data.resize(static_cast(h.samples) * traces); f.seekg(0, std::ios::beg); - f.read(reinterpret_cast(b.data.data()), expected); + f.read(reinterpret_cast(b.data.data()), static_cast(expected)); if (!f) { throw std::runtime_error("readIprb: 读取数据失败: " + path); } diff --git a/src/io/gpr/IprbReader.hpp b/src/io/gpr/IprbReader.hpp index 90aa5b5..c6edc29 100644 --- a/src/io/gpr/IprbReader.hpp +++ b/src/io/gpr/IprbReader.hpp @@ -12,7 +12,7 @@ namespace geopro::io::gpr { // 一个通道一条测线的雷达 B-scan 剖面(int16 存储,布局 [trace*samples + s],s 最快)。 struct BScan { int samples = 0; - long traces = 0; + std::int64_t traces = 0; std::vector data; // 大小 = samples*traces };