diff --git a/apps/code/console_controller.cpp b/apps/code/console_controller.cpp index 0b7796273..bfd410986 100644 --- a/apps/code/console_controller.cpp +++ b/apps/code/console_controller.cpp @@ -77,7 +77,7 @@ void ConsoleController::autoImport() { } void ConsoleController::runAndPrintForCommand(const char * command) { - const char * storedCommand = m_consoleStore.pushCommand(command, strlen(command)); + const char * storedCommand = m_consoleStore.pushCommand(command); assert(m_outputAccumulationBuffer[0] == '\0'); // Draw the console before running the code @@ -449,7 +449,7 @@ void ConsoleController::autoImportScript(Script script, bool force) { } void ConsoleController::flushOutputAccumulationBufferToStore() { - m_consoleStore.pushResult(m_outputAccumulationBuffer, strlen(m_outputAccumulationBuffer)); + m_consoleStore.pushResult(m_outputAccumulationBuffer); emptyOutputAccumulationBuffer(); } diff --git a/apps/code/console_store.cpp b/apps/code/console_store.cpp index 8217ce638..390ba860e 100644 --- a/apps/code/console_store.cpp +++ b/apps/code/console_store.cpp @@ -55,12 +55,12 @@ int ConsoleStore::numberOfLines() const { return 0; } -const char * ConsoleStore::pushCommand(const char * text, size_t length) { - return push(CurrentSessionCommandMarker, text, length); +const char * ConsoleStore::pushCommand(const char * text) { + return push(CurrentSessionCommandMarker, text); } -void ConsoleStore::pushResult(const char * text, size_t length) { - push(CurrentSessionResultMarker, text, length); +void ConsoleStore::pushResult(const char * text) { + push(CurrentSessionResultMarker, text); } void ConsoleStore::deleteLastLineIfEmpty() { @@ -91,9 +91,9 @@ int ConsoleStore::deleteCommandAndResultsAtIndex(int index) { return indexOfLineToDelete; } -const char * ConsoleStore::push(const char marker, const char * text, size_t length) { - size_t textLength = length; - if (ConsoleLine::sizeOfConsoleLine(length) > k_historySize - 1) { +const char * ConsoleStore::push(const char marker, const char * text) { + size_t textLength = strlen(text); + if (ConsoleLine::sizeOfConsoleLine(textLength) > k_historySize - 1) { textLength = k_historySize - 1 - 1 - 1; // Marker, null termination and null marker. } int i = indexOfNullMarker(); diff --git a/apps/code/console_store.h b/apps/code/console_store.h index ef9bb0ca9..bc0e2fc75 100644 --- a/apps/code/console_store.h +++ b/apps/code/console_store.h @@ -14,8 +14,8 @@ public: void startNewSession(); ConsoleLine lineAtIndex(int i) const; int numberOfLines() const; - const char * pushCommand(const char * text, size_t length); - void pushResult(const char * text, size_t length); + const char * pushCommand(const char * text); + void pushResult(const char * text); void deleteLastLineIfEmpty(); int deleteCommandAndResultsAtIndex(int index); private: @@ -30,7 +30,7 @@ private: } return marker; } - const char * push(const char marker, const char * text, size_t length); + const char * push(const char marker, const char * text); ConsoleLine::Type lineTypeForMarker(char marker) const; int indexOfNullMarker() const; void deleteLineAtIndex(int index);