From 212ae6062255e4f5403232da338bffdf56f99d41 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 6 Jul 2017 21:17:04 -0400 Subject: [PATCH] Typer fixes: the recipient no longer releases the caller, and a duplicate call to strlen and piece of arithmetic is corrected. --- Machines/Typer.cpp | 2 +- Machines/Typer.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Machines/Typer.cpp b/Machines/Typer.cpp index 5fed58a28..241dc3810 100644 --- a/Machines/Typer.cpp +++ b/Machines/Typer.cpp @@ -15,7 +15,7 @@ Typer::Typer(const char *string, int delay, int frequency, Delegate *delegate) : counter_(-delay), frequency_(frequency), string_pointer_(0), delegate_(delegate), phase_(0) { size_t string_size = strlen(string) + 3; string_ = (char *)malloc(string_size); - snprintf(string_, strlen(string) + 3, "%c%s%c", Typer::BeginString, string, Typer::EndString); + snprintf(string_, string_size, "%c%s%c", Typer::BeginString, string, Typer::EndString); } void Typer::update(int duration) { diff --git a/Machines/Typer.hpp b/Machines/Typer.hpp index a94de9438..dc089d4c4 100644 --- a/Machines/Typer.hpp +++ b/Machines/Typer.hpp @@ -51,7 +51,6 @@ class TypeRecipient: public Typer::Delegate { void typer_reset(Typer *typer) { clear_all_keys(); - typer_.reset(); } protected: