Skip to content

Commit 94d8ac1

Browse files
victor-pavlychkojoto
authored andcommitted
Report progress when reading PBF files
1 parent 2801245 commit 94d8ac1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/osmium/io/detail/pbf_input_format.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ namespace osmium {
124124
if (!osmium::io::detail::read_exactly(m_fd, buffer.data(), static_cast<unsigned int>(buffer.size()))) {
125125
return 0; // EOF
126126
}
127+
128+
if (m_offset_ptr) {
129+
*m_offset_ptr += buffer.size();
130+
}
131+
127132
return check_size(get_size_in_network_byte_order(buffer.data()));
128133
}
129134

@@ -210,6 +215,10 @@ namespace osmium {
210215
if (!osmium::io::detail::read_exactly(m_fd, &*buffer.begin(), static_cast<unsigned int>(size))) {
211216
throw osmium::pbf_error{"unexpected EOF"};
212217
}
218+
219+
if (m_offset_ptr) {
220+
*m_offset_ptr += buffer.size();
221+
}
213222
} else {
214223
ensure_available_in_input_queue(size);
215224
buffer.append(m_input_buffer, 0, size);

0 commit comments

Comments
 (0)