diff options
author | Zufu Liu <unknown> | 2021-07-03 14:47:54 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2021-07-03 14:47:54 +1000 |
commit | 67d41ce2237e39ea3be7932659fe04f263c82b24 (patch) | |
tree | 5883fd367b299b34c0c65f0e4cba80353af28996 /src/EditView.cxx | |
parent | a2d23bd463e65f532301b682b64cd02b8a57716b (diff) | |
download | scintilla-mirror-67d41ce2237e39ea3be7932659fe04f263c82b24.tar.gz |
Feature [feature-requests:#1408] Avoid sprintf for hexadecimal character blobs.
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r-- | src/EditView.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index a71f385e7..e4b0fa5d9 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -170,6 +170,13 @@ void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRec } } +void Hexits(char *hexits, int ch) noexcept { + hexits[0] = 'x'; + hexits[1] = "0123456789ABCDEF"[ch / 0x10]; + hexits[2] = "0123456789ABCDEF"[ch % 0x10]; + hexits[3] = 0; +} + } EditView::EditView() { @@ -1040,7 +1047,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle if (UTF8IsAscii(chEOL)) { ctrlChar = ControlCharacterString(chEOL); } else { - sprintf(hexits, "x%2X", chEOL); + Hexits(hexits, chEOL); ctrlChar = hexits; } } |