Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cscore/src/main/native/cpp/c_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
namespace cs {

inline void ConvertToC(struct WPI_String* output, std::string_view str) {
char* write = WPI_AllocateString(output, str.size());
std::memcpy(write, str.data(), str.size());
size_t n = str.size();
char* write = WPI_AllocateString(output, n);
if (n>0)
Copy link
Member

@calcmogul calcmogul Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our style guide requires curly braces on control flow statements.

std::memcpy(write, str.data(), n);
}

} // namespace cs
Expand Down
Loading