From 7a569fdfde182c47585d448d2f4ccc65c7fed5e6 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Thu, 17 Dec 2020 15:12:22 -0500 Subject: [PATCH] Revert "Add a few tests for LLUUID and absl format support to lluuid" This reverts commit 32cf7894b7e4a339783b2b244d5896656253c9e6. --- indra/llcommon/CMakeLists.txt | 1 - indra/llcommon/lluuid.cpp | 21 ++------ indra/llcommon/lluuid.h | 13 ----- indra/llcommon/tests/lluuid_test.cpp | 76 ---------------------------- 4 files changed, 3 insertions(+), 108 deletions(-) delete mode 100644 indra/llcommon/tests/lluuid_test.cpp diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index afe1f9abb9b..6fe9996daa9 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -348,7 +348,6 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lluri "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llunits "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lluuid "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") ## llexception_test.cpp isn't a regression test, and doesn't need to be run diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 031093510cb..c6ddf575b9f 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -179,24 +179,9 @@ void LLUUID::toString(std::string& out) const // *TODO: deprecate void LLUUID::toString(char *out) const { - absl::SNPrintF(out,UUID_STR_SIZE, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - (U8)(mData[0]), - (U8)(mData[1]), - (U8)(mData[2]), - (U8)(mData[3]), - (U8)(mData[4]), - (U8)(mData[5]), - (U8)(mData[6]), - (U8)(mData[7]), - (U8)(mData[8]), - (U8)(mData[9]), - (U8)(mData[10]), - (U8)(mData[11]), - (U8)(mData[12]), - (U8)(mData[13]), - (U8)(mData[14]), - (U8)(mData[15])); + std::string buffer; + toString(buffer); + strcpy(out,buffer.c_str()); /* Flawfinder: ignore */ } void LLUUID::toCompressedString(std::string& out) const diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 702f72d2bce..2598f5af41c 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -36,7 +36,6 @@ #include <immintrin.h> #include "absl/hash/hash.h" -#include "absl/strings/str_format.h" class LLMutex; @@ -189,18 +188,6 @@ class LL_COMMON_API LLUUID return H::combine_contiguous(std::move(h), id.mData, UUID_BYTES); } - friend absl::FormatConvertResult<absl::FormatConversionCharSet::kString> - AbslFormatConvert(const LLUUID& id, - const absl::FormatConversionSpec& spec, - absl::FormatSink* s) { - if (spec.conversion_char() == absl::FormatConversionChar::s) { - char uuid_str[UUID_STR_SIZE]; - id.toString(uuid_str); - s->Append(uuid_str); - } - return { true }; - } - // xor functions. Useful since any two random uuids xored together // will yield a determinate third random unique id that can be // used as a key in a single uuid that represents 2. diff --git a/indra/llcommon/tests/lluuid_test.cpp b/indra/llcommon/tests/lluuid_test.cpp deleted file mode 100644 index 60381cc8f0f..00000000000 --- a/indra/llcommon/tests/lluuid_test.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file lluuid_test.cpp - * @author Rye Mutt <rye@alchemyviewer.org> - * @date 2020-10-08 - * - * $LicenseInfo:firstyear=2020&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2020, Alchemy Development Group - - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "../test/lltut.h" - -#include "../lluuid.h" - -const std::string TEST_ID_STR("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f"); -const LLUUID TEST_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f"); - -namespace tut -{ - struct uuid - { - }; - - typedef test_group<uuid> uuid_t; - typedef uuid_t::object uuid_object_t; - tut::uuid_t tut_uuid("LLUUID"); - - template<> template<> - void uuid_object_t::test<1>() - { - std::string out_str; - TEST_ID.toString(out_str); - ensure_equals(out_str, TEST_ID_STR); - } - - template<> template<> - void uuid_object_t::test<2>() - { - char out_cstr[UUID_STR_SIZE] = {}; - TEST_ID.toString(out_cstr); - ensure(strncmp(out_cstr, TEST_ID_STR.c_str(), UUID_STR_SIZE) == 0); - } - - template<> template<> - void uuid_object_t::test<3>() - { - auto str = absl::StrFormat("%s", TEST_ID); - ensure_equals(str, TEST_ID_STR); - } - - template<> template<> - void uuid_object_t::test<4>() - { - char out_cstr[UUID_STR_SIZE] = {}; - absl::SNPrintF(out_cstr, UUID_STR_SIZE, "%s", TEST_ID); - ensure_equals(out_cstr, TEST_ID_STR); - } -} -- GitLab