Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/Far/Plugin.cpp')
-rw-r--r--CPP/7zip/UI/Far/Plugin.cpp25
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);
+ }
}
}
}