From ef6b41ea1513f69e9a9d0f1becf5067ef236f2ea Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2019 23:47:56 -0400 Subject: [PATCH] hecl/hecl: Amend string functions operating on string views to use interface functions We don't really need to call out to the C functions to perform the comparison behavior when the views already have a comparison function as part of their interface. --- hecl/include/hecl/hecl.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index c6d768a86..6797252cd 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -1037,13 +1037,13 @@ public: static bool BeginsWith(SystemStringView str, SystemStringView test) { if (test.size() > str.size()) return false; - return !StrNCmp(str.data(), test.data(), test.size()); + return str.compare(0, test.size(), test) == 0; } static bool EndsWith(SystemStringView str, SystemStringView test) { if (test.size() > str.size()) return false; - return !StrNCmp(&*(str.end() - test.size()), test.data(), test.size()); + return str.compare(str.size() - test.size(), SystemStringView::npos, test) == 0; } static std::string TrimWhitespace(std::string_view str) { @@ -1060,13 +1060,13 @@ public: static bool BeginsWith(std::string_view str, std::string_view test) { if (test.size() > str.size()) return false; - return !strncmp(str.data(), test.data(), test.size()); + return str.compare(0, test.size(), test) == 0; } static bool EndsWith(std::string_view str, std::string_view test) { if (test.size() > str.size()) return false; - return !strncmp(&*(str.end() - test.size()), test.data(), test.size()); + return str.compare(str.size() - test.size(), std::string_view::npos, test) == 0; } static SystemString TrimWhitespace(SystemStringView str) {