diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2021-11-29 06:03:01 +0300 |
---|---|---|
committer | fn ⌃ ⌥ <70830482+FnControlOption@users.noreply.github.com> | 2021-11-29 06:03:01 +0300 |
commit | 1194dc935382931bbfdd4e49004bd755e6165df1 (patch) | |
tree | 60354d8832278528f74c48ca3b5e446175747409 /CPP/7zip/UI/Far/Plugin.cpp | |
parent | d789d4137d8a7c16696c5bc1b13f24bb887eb7ea (diff) |
21.0421.04
Diffstat (limited to 'CPP/7zip/UI/Far/Plugin.cpp')
-rw-r--r-- | CPP/7zip/UI/Far/Plugin.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp index 92b62369..8dc1375a 100644 --- a/CPP/7zip/UI/Far/Plugin.cpp +++ b/CPP/7zip/UI/Far/Plugin.cpp @@ -686,9 +686,14 @@ struct CArchiveItemProperty VARTYPE Type; }; -static inline char GetHex(Byte value) +static inline char GetHex_Upper(unsigned v) { - return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10))); + return (char)((v < 10) ? ('0' + v) : ('A' + (v - 10))); +} + +static inline char GetHex_Lower(unsigned v) +{ + return (char)((v < 10) ? ('0' + v) : ('a' + (v - 10))); } HRESULT CPlugin::ShowAttributesWindow() @@ -810,11 +815,21 @@ HRESULT CPlugin::ShowAttributesWindow() } else { + const bool needUpper = (dataSize <= 8) + && (property.ID == kpidCRC || property.ID == kpidChecksum); for (UInt32 k = 0; k < dataSize; k++) { - Byte b = ((const Byte *)data)[k]; - s += GetHex((Byte)((b >> 4) & 0xF)); - s += GetHex((Byte)(b & 0xF)); + unsigned b = ((const Byte *)data)[k]; + if (needUpper) + { + s += GetHex_Upper((b >> 4) & 0xF); + s += GetHex_Upper(b & 0xF); + } + else + { + s += GetHex_Lower((b >> 4) & 0xF); + s += GetHex_Lower(b & 0xF); + } } } } |