mirror of
https://github.com/reactos/reactos.git
synced 2024-11-04 22:00:55 +00:00
[NOTEPAD] Optimize AnalyzeEncoding
CORE-14641
This commit is contained in:
parent
361e0c72b8
commit
647b67c1ac
1 changed files with 1 additions and 3 deletions
|
@ -39,7 +39,7 @@ BOOL IsTextNonZeroASCII(const void *pText, DWORD dwSize)
|
||||||
|
|
||||||
ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||||
{
|
{
|
||||||
INT flags = IS_TEXT_UNICODE_STATISTICS;
|
INT flags = IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_REVERSE_STATISTICS;
|
||||||
|
|
||||||
if (dwSize <= 1 || IsTextNonZeroASCII(pBytes, dwSize))
|
if (dwSize <= 1 || IsTextNonZeroASCII(pBytes, dwSize))
|
||||||
return ENCODING_ANSI;
|
return ENCODING_ANSI;
|
||||||
|
@ -47,8 +47,6 @@ ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||||
if (IsTextUnicode(pBytes, dwSize, &flags))
|
if (IsTextUnicode(pBytes, dwSize, &flags))
|
||||||
return ENCODING_UTF16LE;
|
return ENCODING_UTF16LE;
|
||||||
|
|
||||||
flags = IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_REVERSE_STATISTICS;
|
|
||||||
IsTextUnicode(pBytes, dwSize, &flags);
|
|
||||||
if (((flags & IS_TEXT_UNICODE_REVERSE_MASK) == IS_TEXT_UNICODE_REVERSE_STATISTICS))
|
if (((flags & IS_TEXT_UNICODE_REVERSE_MASK) == IS_TEXT_UNICODE_REVERSE_STATISTICS))
|
||||||
return ENCODING_UTF16BE;
|
return ENCODING_UTF16BE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue