| 253 | } |
| 254 | |
| 255 | int32_t ODPacket::readPacket(std::ifstream& is) |
| 256 | { |
| 257 | int32_t timestamp; |
| 258 | int32_t packetSize; |
| 259 | |
| 260 | is.read(reinterpret_cast<char*>(×tamp), sizeof(int32_t)); |
| 261 | if(is.eof()) |
| 262 | return -1; |
| 263 | |
| 264 | is.read(reinterpret_cast<char*>(&packetSize), sizeof(int32_t)); |
| 265 | if(is.eof()) |
| 266 | return -1; |
| 267 | |
| 268 | mPacket.clear(); |
| 269 | char buffer[BUFFER_SIZE]; |
| 270 | while(packetSize > 0) |
| 271 | { |
| 272 | int32_t sizeToRead = std::min(packetSize, BUFFER_SIZE); |
| 273 | is.read(buffer, sizeToRead); |
| 274 | mPacket.append(buffer, sizeToRead); |
| 275 | packetSize -= sizeToRead; |
| 276 | } |
| 277 | |
| 278 | return timestamp; |
| 279 | } |
no test coverage detected