| 162 | } |
| 163 | |
| 164 | std::string BundleReader::readString() |
| 165 | { |
| 166 | unsigned int length; |
| 167 | if (read(&length, 4, 1) != 1) |
| 168 | { |
| 169 | return std::string(); |
| 170 | } |
| 171 | |
| 172 | std::string str; |
| 173 | |
| 174 | ssize_t validLength = _length - _position; |
| 175 | if (length > 0 && static_cast<ssize_t>(length) <= validLength) |
| 176 | { |
| 177 | str.resize(length); |
| 178 | if (read(&str[0], 1, length) != length) |
| 179 | { |
| 180 | return std::string(); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | return str; |
| 185 | } |
| 186 | |
| 187 | bool BundleReader::readMatrix(float* m) |
| 188 | { |
no test coverage detected