From bc5b9f6b53e5af170440e5b47f77ceffa5d95133 Mon Sep 17 00:00:00 2001 From: John Stiles Date: Wed, 8 Dec 2021 17:11:22 -0500 Subject: [PATCH] Migrate SK_strcasecmp to SkStringUtils.h. This will let us use it elsewhere. Change-Id: I39a5dc0651bee8fbd5fa7302e34a3a79f7efbd3d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481736 Commit-Queue: John Stiles Auto-Submit: John Stiles Reviewed-by: Brian Osman Commit-Queue: Brian Osman --- gn/core.gni | 1 + src/core/SkStringUtils.h | 6 ++++++ tools/sk_app/CommandSet.cpp | 7 +------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gn/core.gni b/gn/core.gni index 54873b3bdc..6833c43028 100644 --- a/gn/core.gni +++ b/gn/core.gni @@ -367,6 +367,7 @@ skia_core_sources = [ "$_src/core/SkStrikeSpec.h", "$_src/core/SkString.cpp", "$_src/core/SkStringUtils.cpp", + "$_src/core/SkStringUtils.h", "$_src/core/SkStringView.cpp", "$_src/core/SkStroke.cpp", "$_src/core/SkStroke.h", diff --git a/src/core/SkStringUtils.h b/src/core/SkStringUtils.h index 184ca6e2d5..cdc4c47dc6 100644 --- a/src/core/SkStringUtils.h +++ b/src/core/SkStringUtils.h @@ -32,4 +32,10 @@ SkString SkTabString(const SkString& string, int tabCnt); SkString SkStringFromUTF16(const uint16_t* src, size_t count); +#if defined(SK_BUILD_FOR_WIN) + #define SK_strcasecmp _stricmp +#else + #define SK_strcasecmp strcasecmp +#endif + #endif diff --git a/tools/sk_app/CommandSet.cpp b/tools/sk_app/CommandSet.cpp index 1098576016..d814a6bc5f 100644 --- a/tools/sk_app/CommandSet.cpp +++ b/tools/sk_app/CommandSet.cpp @@ -9,6 +9,7 @@ #include "include/core/SkCanvas.h" #include "include/core/SkFont.h" +#include "src/core/SkStringUtils.h" namespace sk_app { @@ -78,12 +79,6 @@ void CommandSet::addCommand(skui::Key k, const char* keyName, const char* group, fCommands.push_back(Command(k, keyName, group, description, function)); } -#if defined(SK_BUILD_FOR_WIN) - #define SK_strcasecmp _stricmp -#else - #define SK_strcasecmp strcasecmp -#endif - bool CommandSet::compareCommandKey(const Command& first, const Command& second) { return SK_strcasecmp(first.fKeyName.c_str(), second.fKeyName.c_str()) < 0; }