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 28, 2024
1 parent d2b298f commit 684c14a
Showing 1 changed file with 7 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

Check failure on line 199 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ReadVtkStructuredPoints.cpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]
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 Expand Up @@ -356,6 +355,8 @@ Result<> readDataChunk(DataStructure* dataStructurePtr, std::istream& in, bool b
}
}

Check failure on line 356 in src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/ReadVtkStructuredPoints.cpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]



return {};
}

Expand Down

0 comments on commit 684c14a

Please sign in to comment.