Skip to content

Commit

Permalink
COMP: ReadVtkStructuredPoints-Fix compiler warning about over flow in…
Browse files Browse the repository at this point in the history
… memset

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Apr 29, 2024
1 parent 3de11c6 commit e58d71c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ int32 skipVolume(std::istream& in, bool binary, usize numElements)
{
const usize BUFFER_SIZE = 16384;
usize foundItems = 0;
std::vector<char> buffer(BUFFER_SIZE, 0);
std::vector<char> buffer(BUFFER_SIZE + 1, 0);
while(foundItems < numElements)
{
memset(buffer.data(), 0, BUFFER_SIZE + 1);
err = CsvParser::ReadLine(in, buffer.data(), buffer.size());
foundItems += count_tokens(buffer.data(), ' ', false, BUFFER_SIZE);
memset(buffer.data(), 0, BUFFER_SIZE + 1); // Splat Zeros across everything
err = CsvParser::ReadLine(in, buffer.data(), BUFFER_SIZE); // Read BUFFER_SIZE worth of data.
foundItems += count_tokens(buffer.data(), ' ', false, BUFFER_SIZE + 1);
}
}
return err;
Expand All @@ -221,10 +221,9 @@ int32 vtkReadBinaryData(std::istream& in, DataArray<T>& data)
DataStoreType& dataStore = data.getDataStoreRef();

usize numBytesToRead = static_cast<usize>(numTuples) * static_cast<usize>(numComp) * sizeof(T);
usize numRead = 0;
// Cast our pointer to a pointer that std::istream will take

numRead = 0;
usize numRead = 0;
// Now start reading the data in chunks if needed.
usize chunkSize = DEFAULT_BLOCKSIZE;

Expand Down

0 comments on commit e58d71c

Please sign in to comment.