Skip to content

Commit

Permalink
fix filename not getting truncated properly
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Jun 18, 2024
1 parent 93cea95 commit 6b4908f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/string_piece.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct StringPiece {

void printTo(Print& p);
void paste(char* to) const { memcpy(to, str, len); }
void pasteZ(char* to) const { paste(to); to[len] = 0; }

bool contains(char c) const {
for (size_t i = 0; i < len; i++) {
Expand Down
2 changes: 1 addition & 1 deletion sound/playwav.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PlayWav : StateMachine, public ProffieOSAudioStream {
PlayWav() : run_(false), effect_(nullptr), sample_bytes_(0) {}
void Play(StringPiece filename, float start = 0.0) {
if (!filename) return;
filename.paste(filename_);
filename.pasteZ(filename_);
new_file_id_ = Effect::FileID();
start_ = start;
run_.set(true);
Expand Down

0 comments on commit 6b4908f

Please sign in to comment.