From 0fc0d16e85c2bb29fdef2482faf756bfb97f5448 Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 6 Feb 2018 18:02:58 +0000 Subject: [PATCH] Remove unused String::Substring --- src/openrct2/core/String.cpp | 40 ------------------------------------ src/openrct2/core/String.hpp | 10 --------- 2 files changed, 50 deletions(-) diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index 15b5c366c1..a78582b9e0 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -342,46 +342,6 @@ namespace String return DiscardUse(ptr, String::Duplicate(replacement)); } - utf8 * Substring(const utf8 * buffer, size_t index) - { - size_t bufferSize = String::SizeOf(buffer); - bool goodSubstring = index <= bufferSize; - Guard::Assert(goodSubstring, "Substring past end of input string."); - - // If assertion continues, return empty string to avoid crash - if (!goodSubstring) - { - return String::Duplicate(""); - } - - return String::Duplicate(buffer + index); - } - - utf8 * Substring(const utf8 * buffer, size_t index, size_t size) - { - size_t bufferSize = String::SizeOf(buffer); - bool goodSubstring = index + size <= bufferSize; - Guard::Assert(goodSubstring, "Substring past end of input string."); - - // If assertion continues, cap the substring to avoid crash - if (!goodSubstring) - { - if (index >= bufferSize) - { - size = 0; - } - else - { - size = bufferSize - index; - } - } - - utf8 * result = Memory::Allocate(size + 1); - std::copy_n(buffer + index, size, result); - result[size] = '\0'; - return result; - } - std::vector Split(const std::string &s, const std::string &delimiter) { if (delimiter.empty()) diff --git a/src/openrct2/core/String.hpp b/src/openrct2/core/String.hpp index 84f2ac1989..aec7df9490 100644 --- a/src/openrct2/core/String.hpp +++ b/src/openrct2/core/String.hpp @@ -70,16 +70,6 @@ namespace String */ utf8 * DiscardDuplicate(utf8 * * ptr, const utf8 * replacement); - /** - * Creates a new string containing the characters between index and the end of the input string. - */ - utf8 * Substring(const utf8 * buffer, size_t index); - - /** - * Creates a new string containing the characters between index and index + size of the input string. - */ - utf8 * Substring(const utf8 * buffer, size_t index, size_t size); - /** * Splits the given string by a delimiter and returns the values as a new string array. * @returns the number of values.