Author: dchapyshev
Date: Thu Sep 15 20:05:26 2016
New Revision: 72691
URL:
http://svn.reactos.org/svn/reactos?rev=72691&view=rev
Log:
[RTL] Add internal RtlpUpcaseUnicodeChar function and use instead RtlUpcaseUnicodeChar
internally in RTL
Modified:
trunk/reactos/sdk/lib/rtl/dos8dot3.c
trunk/reactos/sdk/lib/rtl/nls.c
trunk/reactos/sdk/lib/rtl/path.c
trunk/reactos/sdk/lib/rtl/rtlp.h
trunk/reactos/sdk/lib/rtl/unicode.c
trunk/reactos/sdk/lib/rtl/unicodeprefix.c
Modified: trunk/reactos/sdk/lib/rtl/dos8dot3.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/dos8dot3.c?rev…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/dos8dot3.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/dos8dot3.c [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -113,7 +113,7 @@
if (RtlpIsShortIllegal(Char))
Char = L'_';
else if (Char >= L'a' && Char <= L'z')
- Char = RtlUpcaseUnicodeChar(Char);
+ Char = RtlpUpcaseUnicodeChar(Char);
Context->NameBuffer[Context->NameLength] = Char;
++Context->NameLength;
@@ -137,7 +137,7 @@
if (RtlpIsShortIllegal(Char))
Char = L'_';
else if (Char >= L'a' && Char <= L'z')
- Char = RtlUpcaseUnicodeChar(Char);
+ Char = RtlpUpcaseUnicodeChar(Char);
Context->ExtensionBuffer[Context->ExtensionLength++] = Char;
}
Modified: trunk/reactos/sdk/lib/rtl/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/nls.c?rev=7269…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/nls.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/nls.c [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -54,7 +54,7 @@
PAGED_CODE_RTL();
- if (CustomCP->DBCSCodePage == 0)
+ if (!CustomCP->DBCSCodePage)
{
/* single-byte code page */
if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
@@ -62,7 +62,7 @@
else
Size = CustomSize;
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
@@ -206,7 +206,6 @@
if (AnsiTableBase && OemTableBase && CaseTableBase)
{
RtlInitCodePageTable(AnsiTableBase, &NlsTable->AnsiTableInfo);
-
RtlInitCodePageTable(OemTableBase, &NlsTable->OemTableInfo);
NlsTable->UpperCaseTable = (PUSHORT)CaseTableBase + 2;
@@ -229,7 +228,7 @@
PAGED_CODE_RTL();
- if (NlsMbCodePageTag == FALSE)
+ if (!NlsMbCodePageTag)
{
/* single-byte code page */
if (MbSize > (UnicodeSize / sizeof(WCHAR)))
@@ -237,7 +236,7 @@
else
Size = MbSize;
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
@@ -274,7 +273,7 @@
*UnicodeString++ = NlsLeadByteInfo[LeadByteInfo + *(PUCHAR)MbString++];
}
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = i * sizeof(WCHAR);
}
@@ -369,7 +368,7 @@
PAGED_CODE_RTL();
- if (NlsMbOemCodePageTag == FALSE)
+ if (!NlsMbOemCodePageTag)
{
/* single-byte code page */
if (OemSize > (UnicodeSize / sizeof(WCHAR)))
@@ -377,7 +376,7 @@
else
Size = OemSize;
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
@@ -419,7 +418,7 @@
NlsOemLeadByteInfo[OemLeadByteInfo + *(PUCHAR)OemString++];
}
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = i * sizeof(WCHAR);
}
@@ -479,7 +478,7 @@
PAGED_CODE_RTL();
- if (CustomCP->DBCSCodePage == 0)
+ if (!CustomCP->DBCSCodePage)
{
/* single-byte code page */
if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
@@ -487,7 +486,7 @@
else
Size = UnicodeSize / sizeof(WCHAR);
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size;
for (i = 0; i < Size; i++)
@@ -522,16 +521,14 @@
PAGED_CODE_RTL();
- if (NlsMbCodePageTag == FALSE)
+ if (!NlsMbCodePageTag)
{
/* single-byte code page */
Size = (UnicodeSize > (MbSize * sizeof (WCHAR)))
? MbSize : (UnicodeSize / sizeof (WCHAR));
- if (ResultSize != NULL)
- {
+ if (ResultSize)
*ResultSize = Size;
- }
for (i = 0; i < Size; i++)
{
@@ -573,7 +570,7 @@
else break;
}
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = MbSize - i;
}
@@ -640,7 +637,7 @@
PAGED_CODE_RTL();
- if (NlsMbOemCodePageTag == FALSE)
+ if (!NlsMbOemCodePageTag)
{
/* single-byte code page */
if (UnicodeSize > (OemSize * sizeof(WCHAR)))
@@ -648,7 +645,7 @@
else
Size = UnicodeSize / sizeof(WCHAR);
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size;
for (i = 0; i < Size; i++)
@@ -693,11 +690,37 @@
else break;
}
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = OemSize - i;
}
return STATUS_SUCCESS;
+}
+
+/*
+ * @implemented
+ */
+WCHAR NTAPI
+RtlpUpcaseUnicodeChar(IN WCHAR Source)
+{
+ USHORT Offset;
+
+ if (Source < 'a')
+ return Source;
+
+ if (Source <= 'z')
+ return (Source - ('a' - 'A'));
+
+ Offset = ((USHORT)Source >> 8) & 0xFF;
+ Offset = NlsUnicodeUpcaseTable[Offset];
+
+ Offset += ((USHORT)Source >> 4) & 0xF;
+ Offset = NlsUnicodeUpcaseTable[Offset];
+
+ Offset += ((USHORT)Source & 0xF);
+ Offset = NlsUnicodeUpcaseTable[Offset];
+
+ return Source + (SHORT)Offset;
}
/*
@@ -706,26 +729,9 @@
WCHAR NTAPI
RtlUpcaseUnicodeChar(IN WCHAR Source)
{
- USHORT Offset;
-
- PAGED_CODE_RTL();
-
- if (Source < 'a')
- return Source;
-
- if (Source <= 'z')
- return (Source - ('a' - 'A'));
-
- Offset = ((USHORT)Source >> 8) & 0xFF;
- Offset = NlsUnicodeUpcaseTable[Offset];
-
- Offset += ((USHORT)Source >> 4) & 0xF;
- Offset = NlsUnicodeUpcaseTable[Offset];
-
- Offset += ((USHORT)Source & 0xF);
- Offset = NlsUnicodeUpcaseTable[Offset];
-
- return Source + (SHORT)Offset;
+ PAGED_CODE_RTL();
+
+ return RtlpUpcaseUnicodeChar(Source);
}
/*
@@ -758,7 +764,7 @@
for (i = 0; i < Size; i++)
{
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
*CustomString = ((PCHAR)CustomCP->WideCharTable)[UpcaseChar];
++CustomString;
++UnicodeString;
@@ -790,7 +796,7 @@
PAGED_CODE_RTL();
- if (NlsMbCodePageTag == FALSE)
+ if (!NlsMbCodePageTag)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
@@ -798,12 +804,12 @@
else
Size = UnicodeSize / sizeof(WCHAR);
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
*MbString = NlsUnicodeToAnsiTable[UpcaseChar];
MbString++;
UnicodeString++;
@@ -837,7 +843,7 @@
ASSERT(NlsUnicodeToOemTable != NULL);
- if (NlsMbOemCodePageTag == FALSE)
+ if (!NlsMbOemCodePageTag)
{
/* single-byte code page */
if (UnicodeSize > (OemSize * sizeof(WCHAR)))
@@ -845,12 +851,12 @@
else
Size = UnicodeSize / sizeof(WCHAR);
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ UpcaseChar = RtlpUpcaseUnicodeChar(*UnicodeString);
*OemString = NlsUnicodeToOemTable[UpcaseChar];
OemString++;
UnicodeString++;
@@ -866,7 +872,7 @@
for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
{
- WideChar = RtlUpcaseUnicodeChar(*UnicodeString++);
+ WideChar = RtlpUpcaseUnicodeChar(*UnicodeString++);
if (WideChar < 0x80)
{
@@ -891,7 +897,7 @@
else break;
}
- if (ResultSize != NULL)
+ if (ResultSize)
*ResultSize = OemSize - i;
}
@@ -926,7 +932,7 @@
}
else
{
- if (NlsMbCodePageTag == FALSE)
+ if (!NlsMbCodePageTag)
{
/* single-byte code page */
@@ -934,7 +940,7 @@
Unicode = NlsAnsiToUnicodeTable[(UCHAR)Source];
/* upcase conversion */
- Unicode = RtlUpcaseUnicodeChar (Unicode);
+ Unicode = RtlpUpcaseUnicodeChar (Unicode);
/* unicode -> ansi */
Destination = NlsUnicodeToAnsiTable[(USHORT)Unicode];
Modified: trunk/reactos/sdk/lib/rtl/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/path.c?rev=726…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -614,7 +614,7 @@
ASSERT(FileNameBuffer[1] == L':');
ASSERT(IS_PATH_SEPARATOR(FileNameBuffer[2]));
- // FileNameBuffer[0] = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
+ // FileNameBuffer[0] = RtlpUpcaseUnicodeChar(FileNameBuffer[0]);
Prefix = FileNameBuffer;
PrefixLength = 3 * sizeof(WCHAR);
Source += 3;
@@ -631,8 +631,8 @@
Source += 2;
SourceLength -= 2 * sizeof(WCHAR);
- CurDrive = RtlUpcaseUnicodeChar(CurDirName->Buffer[0]);
- NewDrive = RtlUpcaseUnicodeChar(FileNameBuffer[0]);
+ CurDrive = RtlpUpcaseUnicodeChar(CurDirName->Buffer[0]);
+ NewDrive = RtlpUpcaseUnicodeChar(FileNameBuffer[0]);
if ((NewDrive != CurDrive) || CurDirName->Buffer[1] != L':')
{
Modified: trunk/reactos/sdk/lib/rtl/rtlp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/rtlp.h?rev=726…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/rtlp.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/rtlp.h [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -230,4 +230,9 @@
ULONG64 NumberOfBits;
} RTL_BITMAP_RUN64, *PRTL_BITMAP_RUN64;
+/* nls.c */
+WCHAR
+NTAPI
+RtlpUpcaseUnicodeChar(IN WCHAR Source);
+
/* EOF */
Modified: trunk/reactos/sdk/lib/rtl/unicode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/unicode.c?rev=…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/unicode.c [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -528,7 +528,7 @@
Offset = NlsOemLeadByteInfo[HIBYTE(OemChar)];
/* Receive Unicode character from the table */
- UnicodeChar = RtlUpcaseUnicodeChar(NlsOemToUnicodeTable[LOBYTE(OemChar) +
Offset]);
+ UnicodeChar = RtlpUpcaseUnicodeChar(NlsOemToUnicodeTable[LOBYTE(OemChar) +
Offset]);
/* Receive OEM character from the table */
OemChar = NlsUnicodeToMbOemTable[UnicodeChar];
@@ -536,7 +536,7 @@
else
{
/* Receive Unicode character from the table */
- UnicodeChar =
RtlUpcaseUnicodeChar(NlsOemToUnicodeTable[(UCHAR)NlsUnicodeToOemTable[*Char]]);
+ UnicodeChar =
RtlpUpcaseUnicodeChar(NlsOemToUnicodeTable[(UCHAR)NlsUnicodeToOemTable[*Char]]);
/* Receive OEM character from the table */
OemChar = NlsUnicodeToOemTable[UnicodeChar];
@@ -742,11 +742,11 @@
}
else if (len == length)
{
- memcpy(str, pos, len);
+ RtlCopyMemory(str, pos, len);
}
else
{
- memcpy(str, pos, len + 1);
+ RtlCopyMemory(str, pos, len + 1);
}
return STATUS_SUCCESS;
@@ -943,8 +943,8 @@
{
while (NumChars--)
{
- if (RtlUpcaseUnicodeChar(*pc1++) !=
- RtlUpcaseUnicodeChar(*pc2++))
+ if (RtlpUpcaseUnicodeChar(*pc1++) !=
+ RtlpUpcaseUnicodeChar(*pc2++))
return FALSE;
}
}
@@ -1924,7 +1924,7 @@
for (i = 0; i < j; i++)
{
- UniDest->Buffer[i] = RtlUpcaseUnicodeChar(UniSource->Buffer[i]);
+ UniDest->Buffer[i] = RtlpUpcaseUnicodeChar(UniSource->Buffer[i]);
}
UniDest->Length = UniSource->Length;
@@ -2196,7 +2196,7 @@
if (CaseInsensitive)
{
- while (!ret && len--) ret = RtlUpcaseUnicodeChar(*p1++) -
RtlUpcaseUnicodeChar(*p2++);
+ while (!ret && len--) ret = RtlpUpcaseUnicodeChar(*p1++) -
RtlpUpcaseUnicodeChar(*p2++);
}
else
{
@@ -2586,13 +2586,13 @@
USHORT i;
if (CaseInSensitive)
- Char = RtlUpcaseUnicodeChar(Char);
+ Char = RtlpUpcaseUnicodeChar(Char);
for (i = 0; i < MatchString->Length / sizeof(WCHAR); i++)
{
WCHAR OtherChar = MatchString->Buffer[i];
if (CaseInSensitive)
- OtherChar = RtlUpcaseUnicodeChar(OtherChar);
+ OtherChar = RtlpUpcaseUnicodeChar(OtherChar);
if (Char == OtherChar)
return TRUE;
Modified: trunk/reactos/sdk/lib/rtl/unicodeprefix.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/unicodeprefix.…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/unicodeprefix.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/unicodeprefix.c [iso-8859-1] Thu Sep 15 20:05:26 2016
@@ -96,8 +96,8 @@
if (FoundPrefix != FoundString)
{
/* Upcase the characters */
- FoundPrefix = RtlUpcaseUnicodeChar(FoundPrefix);
- FoundString = RtlUpcaseUnicodeChar(FoundString);
+ FoundPrefix = RtlpUpcaseUnicodeChar(FoundPrefix);
+ FoundString = RtlpUpcaseUnicodeChar(FoundString);
/* Compare them again */
if (FoundPrefix != FoundString) break;