From 7e08b334fe418324ef13284b5d5b8310cf9a4de7 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Sun, 29 Oct 2023 16:17:12 -0400
Subject: DRTVWR-589: Unify hexdump.h headers from different branches.

---
 indra/llcommon/tests/llsdserialize_test.cpp |  8 +--
 indra/test/hexdump.h                        | 97 -----------------------------
 2 files changed, 4 insertions(+), 101 deletions(-)
 delete mode 100644 indra/test/hexdump.h

diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index ac40125f75..ae3a94c55d 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -52,7 +52,7 @@ typedef U32 uint32_t;
 #include "llformat.h"
 #include "llmemorystream.h"
 
-#include "../test/hexdump.h"
+#include "hexdump.h"
 #include "../test/lltut.h"
 #include "../test/namedtempfile.h"
 #include "stringize.h"
@@ -1921,12 +1921,12 @@ namespace tut
             int bufflen{ static_cast<int>(buffstr.length()) };
             out.write(reinterpret_cast<const char*>(&bufflen), sizeof(bufflen));
             LL_DEBUGS() << "Wrote length: "
-                        << hexdump(reinterpret_cast<const char*>(&bufflen),
-                                   sizeof(bufflen))
+                        << LL::hexdump(reinterpret_cast<const char*>(&bufflen),
+                                       sizeof(bufflen))
                         << LL_ENDL;
             out.write(buffstr.c_str(), buffstr.length());
             LL_DEBUGS() << "Wrote data:   "
-                        << hexmix(buffstr.c_str(), buffstr.length())
+                        << LL::hexmix(buffstr.c_str(), buffstr.length())
                         << LL_ENDL;
         }
     }
diff --git a/indra/test/hexdump.h b/indra/test/hexdump.h
deleted file mode 100644
index dd7cbaaa3c..0000000000
--- a/indra/test/hexdump.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @file   hexdump.h
- * @author Nat Goodspeed
- * @date   2023-09-08
- * @brief  Provide hexdump() and hexmix() ostream formatters
- * 
- * $LicenseInfo:firstyear=2023&license=viewerlgpl$
- * Copyright (c) 2023, Linden Research, Inc.
- * $/LicenseInfo$
- */
-
-#if ! defined(LL_HEXDUMP_H)
-#define LL_HEXDUMP_H
-
-#include <cctype>
-#include <iomanip>
-#include <iostream>
-#include <string_view>
-
-// Format a given byte string as 2-digit hex values, no separators
-// Usage: std::cout << hexdump(somestring) << ...
-class hexdump
-{
-public:
-    hexdump(const std::string_view& data):
-        hexdump(data.data(), data.length())
-    {}
-
-    hexdump(const char* data, size_t len):
-        hexdump(reinterpret_cast<const unsigned char*>(data), len)
-    {}
-
-    hexdump(const unsigned char* data, size_t len):
-        mData(data, data + len)
-    {}
-
-    friend std::ostream& operator<<(std::ostream& out, const hexdump& self)
-    {
-        auto oldfmt{ out.flags() };
-        auto oldfill{ out.fill() };
-        out.setf(std::ios_base::hex, std::ios_base::basefield);
-        out.fill('0');
-        for (auto c : self.mData)
-        {
-            out << std::setw(2) << unsigned(c);
-        }
-        out.setf(oldfmt, std::ios_base::basefield);
-        out.fill(oldfill);
-        return out;
-    }
-
-private:
-    std::vector<unsigned char> mData;
-};
-
-// Format a given byte string as a mix of printable characters and, for each
-// non-printable character, "\xnn"
-// Usage: std::cout << hexmix(somestring) << ...
-class hexmix
-{
-public:
-    hexmix(const std::string_view& data):
-        mData(data)
-    {}
-
-    hexmix(const char* data, size_t len):
-        mData(data, len)
-    {}
-
-    friend std::ostream& operator<<(std::ostream& out, const hexmix& self)
-    {
-        auto oldfmt{ out.flags() };
-        auto oldfill{ out.fill() };
-        out.setf(std::ios_base::hex, std::ios_base::basefield);
-        out.fill('0');
-        for (auto c : self.mData)
-        {
-            // std::isprint() must be passed an unsigned char!
-            if (std::isprint(static_cast<unsigned char>(c)))
-            {
-                out << c;
-            }
-            else
-            {
-                out << "\\x" << std::setw(2) << unsigned(c);
-            }
-        }
-        out.setf(oldfmt, std::ios_base::basefield);
-        out.fill(oldfill);
-        return out;
-    }
-
-private:
-    std::string mData;
-};
-
-#endif /* ! defined(LL_HEXDUMP_H) */
-- 
cgit v1.2.3