From 630de2ee1925d1d1b9bf1404e189a5a319ee3c1e Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Mon, 2 Jun 2025 20:28:39 +0200 Subject: Fixed bug in test program that caused bad cosmetic effects during log print --- src/SFileOpenArchive.cpp | 2 +- src/SMemUtf8.cpp | 4 ++-- src/StormCommon.h | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/SFileOpenArchive.cpp b/src/SFileOpenArchive.cpp index 7b55a8c..17fc7c9 100644 --- a/src/SFileOpenArchive.cpp +++ b/src/SFileOpenArchive.cpp @@ -30,7 +30,7 @@ typedef struct _IMAGE_DOS_HEADER { USHORT e_magic; - USHORT dummy[0x1B]; + USHORT dummy[0x1D]; DWORD e_lfanew; } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; diff --git a/src/SMemUtf8.cpp b/src/SMemUtf8.cpp index 5832422..7f03e77 100644 --- a/src/SMemUtf8.cpp +++ b/src/SMemUtf8.cpp @@ -92,7 +92,7 @@ static DWORD UTF8_DecodeSequence(const BYTE * pbString, BYTE BitsMask, size_t cc } // https://en.wikipedia.org/wiki/UTF-8 -static DWORD UTF8_DecodeCodePoint(const BYTE * pbString, const BYTE * pbStringEnd, DWORD & dwCodePoint, size_t & ccBytesEaten) +DWORD UTF8_DecodeCodePoint(const BYTE * pbString, const BYTE * pbStringEnd, DWORD & dwCodePoint, size_t & ccBytesEaten) { // Reset the number of bytes eaten dwCodePoint = SFILE_UTF8_INVALID_CHARACTER; @@ -165,7 +165,7 @@ static size_t UTF8_EncodeSequence(DWORD dwCodePoint, BYTE LeadingByte, DWORD dwF return dwFollowByteCount + 1; } -static size_t UTF8_EncodeCodePoint(DWORD dwCodePoint, LPBYTE Utf8Buffer) +size_t UTF8_EncodeCodePoint(DWORD dwCodePoint, LPBYTE Utf8Buffer) { // 0x00 - 0x7F, 1 byte if(dwCodePoint < 0x80) diff --git a/src/StormCommon.h b/src/StormCommon.h index bf82039..52f5cd0 100644 --- a/src/StormCommon.h +++ b/src/StormCommon.h @@ -276,6 +276,12 @@ void StringCat(TCHAR * szTarget, size_t cchTargetMax, const TCHAR * szSource); void StringCat(TCHAR * szTarget, size_t cchTargetMax, const char * szSource); #endif +//----------------------------------------------------------------------------- +// UTF-8 support + +DWORD UTF8_DecodeCodePoint(const BYTE * pbString, const BYTE * pbStringEnd, DWORD & dwCodePoint, size_t & ccBytesEaten); +size_t UTF8_EncodeCodePoint(DWORD dwCodePoint, LPBYTE Utf8Buffer); + //----------------------------------------------------------------------------- // Encryption and decryption functions -- cgit v1.2.3