From 67d41ce2237e39ea3be7932659fe04f263c82b24 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Sat, 3 Jul 2021 14:47:54 +1000 Subject: Feature [feature-requests:#1408] Avoid sprintf for hexadecimal character blobs. --- src/Editor.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index 71aaeae53..d01eb0cdf 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -247,8 +247,8 @@ void Editor::SetRepresentations() { if (IsUnicodeMode()) { for (int k=0x80; k < 0x100; k++) { const char hiByte[2] = { static_cast(k), 0 }; - char hexits[5]; // Really only needs 4 but that causes warning from gcc 7.1 - sprintf(hexits, "x%2X", k); + char hexits[4]; + Hexits(hexits, k); reprs.SetRepresentation(hiByte, hexits); } } else if (pdoc->dbcsCodePage) { @@ -257,8 +257,8 @@ void Editor::SetRepresentations() { const char ch = static_cast(k); if (pdoc->IsDBCSLeadByteNoExcept(ch) || pdoc->IsDBCSLeadByteInvalid(ch)) { const char hiByte[2] = { ch, 0 }; - char hexits[5]; // Really only needs 4 but that causes warning from gcc 7.1 - sprintf(hexits, "x%2X", k); + char hexits[4]; + Hexits(hexits, k); reprs.SetRepresentation(hiByte, hexits); } } -- cgit v1.2.3