From f78e3632e501bdc97479f20550bcddf5dad70217 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Fri, 27 Oct 2023 22:47:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=8C=E5=96=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/strCoding.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Common/strCoding.cpp b/src/Common/strCoding.cpp index b3a5cdbf..4f6c4e53 100644 --- a/src/Common/strCoding.cpp +++ b/src/Common/strCoding.cpp @@ -36,7 +36,7 @@ void UnicodeToUTF8(char *pOut, const wchar_t *pText) { return; } -char HexStrToBin(char ch) { +char HexCharToBin(char ch) { if (ch >= '0' && ch <= '9') return (char)(ch - '0'); if (ch >= 'a' && ch <= 'f') return (char)(ch - 'a' + 10); if (ch >= 'A' && ch <= 'F') return (char)(ch - 'A' + 10); @@ -44,9 +44,9 @@ char HexStrToBin(char ch) { } char HexStrToBin(const char *str) { - auto high = HexStrToBin(str[0]); - auto low = HexStrToBin(str[1]); - if (high < 0 || low < 0) { + auto high = HexCharToBin(str[0]); + auto low = HexCharToBin(str[1]); + if (high == -1 || low == -1) { // 无法把16进制字符串转换为二进制 return -1; }