| 95 | } |
| 96 | |
| 97 | std::unique_ptr<OGRFeature> Load(std::size_t i) override |
| 98 | { |
| 99 | auto loc = m_locs[i]; |
| 100 | m_buf.resize(loc.size); |
| 101 | if (VSIFSeekL(m_file, loc.offset, SEEK_SET) == -1) |
| 102 | { |
| 103 | return nullptr; |
| 104 | } |
| 105 | auto nBytesRead = VSIFReadL(m_buf.data(), 1, loc.size, m_file); |
| 106 | if (nBytesRead != loc.size) |
| 107 | { |
| 108 | return nullptr; |
| 109 | } |
| 110 | |
| 111 | auto poFeature = std::make_unique<OGRFeature>(m_defn.get()); |
| 112 | if (!poFeature->DeserializeFromBinary(m_buf.data(), m_buf.size())) |
| 113 | { |
| 114 | return nullptr; |
| 115 | } |
| 116 | |
| 117 | return poFeature; |
| 118 | } |
| 119 | |
| 120 | size_t Size() const override |
| 121 | { |
no test coverage detected