Skip to content

Commit

Permalink
remove overzealous sizeof() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nmwsharp committed Mar 29, 2024
1 parent 8cd6179 commit 6b394f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/file_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ std::string promptForFilename(std::string initName) {
using namespace std::placeholders;

// Register the callback which creates the UI and does the hard work
char* textBuff = new char[2048];
snprintf(textBuff, sizeof(textBuff), "%s", initName.c_str());
auto func = std::bind(filenamePromptCallback, textBuff, 2048);
const size_t BUFF_LEN = 2048;
char* textBuff = new char[BUFF_LEN];
snprintf(textBuff, BUFF_LEN, "%s", initName.c_str());
auto func = std::bind(filenamePromptCallback, textBuff, BUFF_LEN);
pushContext(func);

std::string stringOut(textBuff);
Expand Down

0 comments on commit 6b394f2

Please sign in to comment.