Author: dchapyshev
Date: Thu Sep 15 19:17:47 2016
New Revision: 72686
URL:
http://svn.reactos.org/svn/reactos?rev=72686&view=rev
Log:
[RTL] Formatting only
Modified:
trunk/reactos/sdk/lib/rtl/nls.c
Modified: trunk/reactos/sdk/lib/rtl/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/nls.c?rev=7268…
==============================================================================
--- trunk/reactos/sdk/lib/rtl/nls.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/rtl/nls.c [iso-8859-1] Thu Sep 15 19:17:47 2016
@@ -49,78 +49,76 @@
PCHAR CustomString,
ULONG CustomSize)
{
- ULONG Size = 0;
- ULONG i;
-
- if (CustomCP->DBCSCodePage == 0)
- {
- /* single-byte code page */
- if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
- Size = UnicodeSize / sizeof(WCHAR);
- else
- Size = CustomSize;
-
- if (ResultSize != NULL)
- *ResultSize = Size * sizeof(WCHAR);
-
- for (i = 0; i < Size; i++)
- {
- *UnicodeString = CustomCP->MultiByteTable[(UCHAR)*CustomString];
- UnicodeString++;
- CustomString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
- ASSERT(FALSE);
- }
-
- return(STATUS_SUCCESS);
-}
-
-
-
+ ULONG Size = 0;
+ ULONG i;
+
+ if (CustomCP->DBCSCodePage == 0)
+ {
+ /* single-byte code page */
+ if (CustomSize > (UnicodeSize / sizeof(WCHAR)))
+ Size = UnicodeSize / sizeof(WCHAR);
+ else
+ Size = CustomSize;
+
+ if (ResultSize != NULL)
+ *ResultSize = Size * sizeof(WCHAR);
+
+ for (i = 0; i < Size; i++)
+ {
+ *UnicodeString = CustomCP->MultiByteTable[(UCHAR)*CustomString];
+ UnicodeString++;
+ CustomString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+ ASSERT(FALSE);
+ }
+
+ return STATUS_SUCCESS;
+}
+
+/*
+ * @implemented
+ */
WCHAR NTAPI
-RtlDowncaseUnicodeChar (IN WCHAR Source)
-{
- USHORT Offset;
-
- if (Source < L'A')
- return Source;
-
- if (Source <= L'Z')
- return Source + (L'a' - L'A');
-
- if (Source < 0x80)
- return Source;
-
- Offset = ((USHORT)Source >> 8);
- DPRINT("Offset: %hx\n", Offset);
-
- Offset = NlsUnicodeLowercaseTable[Offset];
- DPRINT("Offset: %hx\n", Offset);
-
- Offset += (((USHORT)Source & 0x00F0) >> 4);
- DPRINT("Offset: %hx\n", Offset);
-
- Offset = NlsUnicodeLowercaseTable[Offset];
- DPRINT("Offset: %hx\n", Offset);
-
- Offset += ((USHORT)Source & 0x000F);
- DPRINT("Offset: %hx\n", Offset);
-
- Offset = NlsUnicodeLowercaseTable[Offset];
- DPRINT("Offset: %hx\n", Offset);
-
- DPRINT("Result: %hx\n", Source + (SHORT)Offset);
-
- return Source + (SHORT)Offset;
-}
-
-
-
+RtlDowncaseUnicodeChar(IN WCHAR Source)
+{
+ USHORT Offset;
+
+ if (Source < L'A')
+ return Source;
+
+ if (Source <= L'Z')
+ return Source + (L'a' - L'A');
+
+ if (Source < 0x80)
+ return Source;
+
+ Offset = ((USHORT)Source >> 8);
+ DPRINT("Offset: %hx\n", Offset);
+
+ Offset = NlsUnicodeLowercaseTable[Offset];
+ DPRINT("Offset: %hx\n", Offset);
+
+ Offset += (((USHORT)Source & 0x00F0) >> 4);
+ DPRINT("Offset: %hx\n", Offset);
+
+ Offset = NlsUnicodeLowercaseTable[Offset];
+ DPRINT("Offset: %hx\n", Offset);
+
+ Offset += ((USHORT)Source & 0x000F);
+ DPRINT("Offset: %hx\n", Offset);
+
+ Offset = NlsUnicodeLowercaseTable[Offset];
+ DPRINT("Offset: %hx\n", Offset);
+
+ DPRINT("Result: %hx\n", Source + (SHORT)Offset);
+
+ return Source + (SHORT)Offset;
+}
/*
* @implemented
@@ -129,12 +127,9 @@
RtlGetDefaultCodePage(OUT PUSHORT AnsiCodePage,
OUT PUSHORT OemCodePage)
{
- *AnsiCodePage = NlsAnsiCodePage;
- *OemCodePage = NlsOemCodePage;
-}
-
-
-
+ *AnsiCodePage = NlsAnsiCodePage;
+ *OemCodePage = NlsOemCodePage;
+}
/*
* @implemented
@@ -143,52 +138,49 @@
RtlInitCodePageTable(IN PUSHORT TableBase,
OUT PCPTABLEINFO CodePageTable)
{
- PNLS_FILE_HEADER NlsFileHeader;
-
- DPRINT("RtlInitCodePageTable() called\n");
-
- NlsFileHeader = (PNLS_FILE_HEADER)TableBase;
-
- /* Copy header fields first */
- CodePageTable->CodePage = NlsFileHeader->CodePage;
- CodePageTable->MaximumCharacterSize = NlsFileHeader->MaximumCharacterSize;
- CodePageTable->DefaultChar = NlsFileHeader->DefaultChar;
- CodePageTable->UniDefaultChar = NlsFileHeader->UniDefaultChar;
- CodePageTable->TransDefaultChar = NlsFileHeader->TransDefaultChar;
- CodePageTable->TransUniDefaultChar = NlsFileHeader->TransUniDefaultChar;
-
- RtlCopyMemory(&CodePageTable->LeadByte,
- &NlsFileHeader->LeadByte,
- MAXIMUM_LEADBYTES);
-
- /* Offset to wide char table is after the header */
- CodePageTable->WideCharTable = TableBase + NlsFileHeader->HeaderSize + 1 +
- TableBase[NlsFileHeader->HeaderSize];
-
- /* Then multibyte table (256 wchars) follows */
- CodePageTable->MultiByteTable = TableBase + NlsFileHeader->HeaderSize + 1;
-
- /* Check the presence of glyph table (256 wchars) */
- if (!CodePageTable->MultiByteTable[256])
- CodePageTable->DBCSRanges = CodePageTable->MultiByteTable + 256 + 1;
- else
- CodePageTable->DBCSRanges = CodePageTable->MultiByteTable + 256 + 1 + 256;
-
- /* Is this double-byte code page? */
- if (*CodePageTable->DBCSRanges)
- {
- CodePageTable->DBCSCodePage = 1;
- CodePageTable->DBCSOffsets = CodePageTable->DBCSRanges + 1;
- }
- else
- {
- CodePageTable->DBCSCodePage = 0;
- CodePageTable->DBCSOffsets = NULL;
- }
-}
-
-
-
+ PNLS_FILE_HEADER NlsFileHeader;
+
+ DPRINT("RtlInitCodePageTable() called\n");
+
+ NlsFileHeader = (PNLS_FILE_HEADER)TableBase;
+
+ /* Copy header fields first */
+ CodePageTable->CodePage = NlsFileHeader->CodePage;
+ CodePageTable->MaximumCharacterSize = NlsFileHeader->MaximumCharacterSize;
+ CodePageTable->DefaultChar = NlsFileHeader->DefaultChar;
+ CodePageTable->UniDefaultChar = NlsFileHeader->UniDefaultChar;
+ CodePageTable->TransDefaultChar = NlsFileHeader->TransDefaultChar;
+ CodePageTable->TransUniDefaultChar = NlsFileHeader->TransUniDefaultChar;
+
+ RtlCopyMemory(&CodePageTable->LeadByte,
+ &NlsFileHeader->LeadByte,
+ MAXIMUM_LEADBYTES);
+
+ /* Offset to wide char table is after the header */
+ CodePageTable->WideCharTable =
+ TableBase + NlsFileHeader->HeaderSize + 1 +
TableBase[NlsFileHeader->HeaderSize];
+
+ /* Then multibyte table (256 wchars) follows */
+ CodePageTable->MultiByteTable = TableBase + NlsFileHeader->HeaderSize + 1;
+
+ /* Check the presence of glyph table (256 wchars) */
+ if (!CodePageTable->MultiByteTable[256])
+ CodePageTable->DBCSRanges = CodePageTable->MultiByteTable + 256 + 1;
+ else
+ CodePageTable->DBCSRanges = CodePageTable->MultiByteTable + 256 + 1 + 256;
+
+ /* Is this double-byte code page? */
+ if (*CodePageTable->DBCSRanges)
+ {
+ CodePageTable->DBCSCodePage = 1;
+ CodePageTable->DBCSOffsets = CodePageTable->DBCSRanges + 1;
+ }
+ else
+ {
+ CodePageTable->DBCSCodePage = 0;
+ CodePageTable->DBCSOffsets = NULL;
+ }
+}
/*
* @implemented
@@ -199,103 +191,97 @@
IN PUSHORT CaseTableBase,
OUT PNLSTABLEINFO NlsTable)
{
- DPRINT("RtlInitNlsTables()called\n");
-
- if (AnsiTableBase == NULL ||
- OemTableBase == NULL ||
- CaseTableBase == NULL)
- return;
-
- RtlInitCodePageTable(AnsiTableBase, &NlsTable->AnsiTableInfo);
-
- RtlInitCodePageTable(OemTableBase, &NlsTable->OemTableInfo);
-
- NlsTable->UpperCaseTable = (PUSHORT)CaseTableBase + 2;
- NlsTable->LowerCaseTable = (PUSHORT)CaseTableBase + *((PUSHORT)CaseTableBase + 1) +
2;
-}
-
+ DPRINT("RtlInitNlsTables()called\n");
+
+ if (AnsiTableBase && OemTableBase && CaseTableBase)
+ {
+ RtlInitCodePageTable(AnsiTableBase, &NlsTable->AnsiTableInfo);
+
+ RtlInitCodePageTable(OemTableBase, &NlsTable->OemTableInfo);
+
+ NlsTable->UpperCaseTable = (PUSHORT)CaseTableBase + 2;
+ NlsTable->LowerCaseTable = (PUSHORT)CaseTableBase + *((PUSHORT)CaseTableBase +
1) + 2;
+ }
+}
/*
* @unimplemented
*/
NTSTATUS NTAPI
-RtlMultiByteToUnicodeN(
- OUT PWCHAR UnicodeString,
- IN ULONG UnicodeSize,
- OUT PULONG ResultSize,
- IN PCSTR MbString,
- IN ULONG MbSize)
-{
- ULONG Size = 0;
- ULONG i;
-
- PAGED_CODE_RTL();
-
- if (NlsMbCodePageTag == FALSE)
- {
- /* single-byte code page */
- if (MbSize > (UnicodeSize / sizeof(WCHAR)))
- Size = UnicodeSize / sizeof(WCHAR);
- else
- Size = MbSize;
-
- if (ResultSize != NULL)
- *ResultSize = Size * sizeof(WCHAR);
-
- for (i = 0; i < Size; i++)
- UnicodeString[i] = NlsAnsiToUnicodeTable[(UCHAR)MbString[i]];
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
-
- UCHAR Char;
- USHORT LeadByteInfo;
- PCSTR MbEnd = MbString + MbSize;
-
- for (i = 0; i < UnicodeSize / sizeof(WCHAR) && MbString < MbEnd;
i++)
- {
- Char = *(PUCHAR)MbString++;
-
- if (Char < 0x80)
- {
- *UnicodeString++ = Char;
- continue;
- }
-
- LeadByteInfo = NlsLeadByteInfo[Char];
-
- if (!LeadByteInfo)
- {
- *UnicodeString++ = NlsAnsiToUnicodeTable[Char];
- continue;
- }
-
- if (MbString < MbEnd)
- *UnicodeString++ = NlsLeadByteInfo[LeadByteInfo + *(PUCHAR)MbString++];
- }
-
- if (ResultSize != NULL)
- *ResultSize = i * sizeof(WCHAR);
- }
-
- return STATUS_SUCCESS;
-}
-
+RtlMultiByteToUnicodeN(OUT PWCHAR UnicodeString,
+ IN ULONG UnicodeSize,
+ OUT PULONG ResultSize,
+ IN PCSTR MbString,
+ IN ULONG MbSize)
+{
+ ULONG Size = 0;
+ ULONG i;
+
+ PAGED_CODE_RTL();
+
+ if (NlsMbCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ if (MbSize > (UnicodeSize / sizeof(WCHAR)))
+ Size = UnicodeSize / sizeof(WCHAR);
+ else
+ Size = MbSize;
+
+ if (ResultSize != NULL)
+ *ResultSize = Size * sizeof(WCHAR);
+
+ for (i = 0; i < Size; i++)
+ UnicodeString[i] = NlsAnsiToUnicodeTable[(UCHAR)MbString[i]];
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+
+ UCHAR Char;
+ USHORT LeadByteInfo;
+ PCSTR MbEnd = MbString + MbSize;
+
+ for (i = 0; i < UnicodeSize / sizeof(WCHAR) && MbString < MbEnd;
i++)
+ {
+ Char = *(PUCHAR)MbString++;
+
+ if (Char < 0x80)
+ {
+ *UnicodeString++ = Char;
+ continue;
+ }
+
+ LeadByteInfo = NlsLeadByteInfo[Char];
+
+ if (!LeadByteInfo)
+ {
+ *UnicodeString++ = NlsAnsiToUnicodeTable[Char];
+ continue;
+ }
+
+ if (MbString < MbEnd)
+ *UnicodeString++ = NlsLeadByteInfo[LeadByteInfo + *(PUCHAR)MbString++];
+ }
+
+ if (ResultSize != NULL)
+ *ResultSize = i * sizeof(WCHAR);
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @unimplemented
*/
NTSTATUS
NTAPI
-RtlConsoleMultiByteToUnicodeN(
- OUT PWCHAR UnicodeString,
- IN ULONG UnicodeSize,
- OUT PULONG ResultSize,
- IN PCSTR MbString,
- IN ULONG MbSize,
- OUT PULONG Unknown)
+RtlConsoleMultiByteToUnicodeN(OUT PWCHAR UnicodeString,
+ IN ULONG UnicodeSize,
+ OUT PULONG ResultSize,
+ IN PCSTR MbString,
+ IN ULONG MbSize,
+ OUT PULONG Unknown)
{
PAGED_CODE_RTL();
@@ -309,8 +295,6 @@
MbSize);
}
-
-
/*
* @implemented
*/
@@ -360,79 +344,75 @@
return STATUS_SUCCESS;
}
-
-
/*
* @unimplemented
*/
NTSTATUS NTAPI
-RtlOemToUnicodeN (PWCHAR UnicodeString,
- ULONG UnicodeSize,
- PULONG ResultSize,
- PCCH OemString,
- ULONG OemSize)
-{
- ULONG Size = 0;
- ULONG i;
-
- if (NlsMbOemCodePageTag == FALSE)
- {
- /* single-byte code page */
- if (OemSize > (UnicodeSize / sizeof(WCHAR)))
- Size = UnicodeSize / sizeof(WCHAR);
- else
- Size = OemSize;
-
- if (ResultSize != NULL)
- *ResultSize = Size * sizeof(WCHAR);
-
- for (i = 0; i < Size; i++)
- {
- *UnicodeString = NlsOemToUnicodeTable[(UCHAR)*OemString];
- UnicodeString++;
- OemString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
-
- UCHAR Char;
- USHORT OemLeadByteInfo;
- PCCH OemEnd = OemString + OemSize;
-
- for (i = 0; i < UnicodeSize / sizeof(WCHAR) && OemString < OemEnd;
i++)
- {
- Char = *(PUCHAR)OemString++;
-
- if (Char < 0x80)
- {
- *UnicodeString++ = Char;
- continue;
- }
-
- OemLeadByteInfo = NlsOemLeadByteInfo[Char];
-
- if (!OemLeadByteInfo)
- {
- *UnicodeString++ = NlsOemToUnicodeTable[Char];
- continue;
- }
-
- if (OemString < OemEnd)
- *UnicodeString++ =
- NlsOemLeadByteInfo[OemLeadByteInfo + *(PUCHAR)OemString++];
- }
-
- if (ResultSize != NULL)
- *ResultSize = i * sizeof(WCHAR);
- }
-
- return STATUS_SUCCESS;
-}
-
-
+RtlOemToUnicodeN(PWCHAR UnicodeString,
+ ULONG UnicodeSize,
+ PULONG ResultSize,
+ PCCH OemString,
+ ULONG OemSize)
+{
+ ULONG Size = 0;
+ ULONG i;
+
+ if (NlsMbOemCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ if (OemSize > (UnicodeSize / sizeof(WCHAR)))
+ Size = UnicodeSize / sizeof(WCHAR);
+ else
+ Size = OemSize;
+
+ if (ResultSize != NULL)
+ *ResultSize = Size * sizeof(WCHAR);
+
+ for (i = 0; i < Size; i++)
+ {
+ *UnicodeString = NlsOemToUnicodeTable[(UCHAR)*OemString];
+ UnicodeString++;
+ OemString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+
+ UCHAR Char;
+ USHORT OemLeadByteInfo;
+ PCCH OemEnd = OemString + OemSize;
+
+ for (i = 0; i < UnicodeSize / sizeof(WCHAR) && OemString < OemEnd;
i++)
+ {
+ Char = *(PUCHAR)OemString++;
+
+ if (Char < 0x80)
+ {
+ *UnicodeString++ = Char;
+ continue;
+ }
+
+ OemLeadByteInfo = NlsOemLeadByteInfo[Char];
+
+ if (!OemLeadByteInfo)
+ {
+ *UnicodeString++ = NlsOemToUnicodeTable[Char];
+ continue;
+ }
+
+ if (OemString < OemEnd)
+ *UnicodeString++ =
+ NlsOemLeadByteInfo[OemLeadByteInfo + *(PUCHAR)OemString++];
+ }
+
+ if (ResultSize != NULL)
+ *ResultSize = i * sizeof(WCHAR);
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @implemented
@@ -440,36 +420,34 @@
VOID NTAPI
RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
{
- DPRINT("RtlResetRtlTranslations() called\n");
-
- /* Set ANSI data */
- NlsAnsiToUnicodeTable = (PUSHORT)NlsTable->AnsiTableInfo.MultiByteTable;
- NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
- NlsUnicodeToMbAnsiTable = (PUSHORT)NlsTable->AnsiTableInfo.WideCharTable;
- NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
- NlsLeadByteInfo = NlsTable->AnsiTableInfo.DBCSOffsets;
- NlsAnsiCodePage = NlsTable->AnsiTableInfo.CodePage;
- DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
-
- /* Set OEM data */
- NlsOemToUnicodeTable = (PUSHORT)NlsTable->OemTableInfo.MultiByteTable;
- NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
- NlsUnicodeToMbOemTable = (PUSHORT)NlsTable->OemTableInfo.WideCharTable;
- NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
- NlsOemLeadByteInfo = NlsTable->OemTableInfo.DBCSOffsets;
- NlsOemCodePage = NlsTable->OemTableInfo.CodePage;
- DPRINT("Oem codepage %hu\n", NlsOemCodePage);
-
- /* Set Unicode case map data */
- NlsUnicodeUpcaseTable = NlsTable->UpperCaseTable;
- NlsUnicodeLowercaseTable = NlsTable->LowerCaseTable;
-
- /* set the default characters for RtlpDidUnicodeToOemWork */
- NlsOemDefaultChar = NlsTable->OemTableInfo.DefaultChar;
- NlsUnicodeDefaultChar = NlsTable->OemTableInfo.TransDefaultChar;
-}
-
-
+ DPRINT("RtlResetRtlTranslations() called\n");
+
+ /* Set ANSI data */
+ NlsAnsiToUnicodeTable = (PUSHORT)NlsTable->AnsiTableInfo.MultiByteTable;
+ NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
+ NlsUnicodeToMbAnsiTable = (PUSHORT)NlsTable->AnsiTableInfo.WideCharTable;
+ NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
+ NlsLeadByteInfo = NlsTable->AnsiTableInfo.DBCSOffsets;
+ NlsAnsiCodePage = NlsTable->AnsiTableInfo.CodePage;
+ DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
+
+ /* Set OEM data */
+ NlsOemToUnicodeTable = (PUSHORT)NlsTable->OemTableInfo.MultiByteTable;
+ NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
+ NlsUnicodeToMbOemTable = (PUSHORT)NlsTable->OemTableInfo.WideCharTable;
+ NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
+ NlsOemLeadByteInfo = NlsTable->OemTableInfo.DBCSOffsets;
+ NlsOemCodePage = NlsTable->OemTableInfo.CodePage;
+ DPRINT("Oem codepage %hu\n", NlsOemCodePage);
+
+ /* Set Unicode case map data */
+ NlsUnicodeUpcaseTable = NlsTable->UpperCaseTable;
+ NlsUnicodeLowercaseTable = NlsTable->LowerCaseTable;
+
+ /* set the default characters for RtlpDidUnicodeToOemWork */
+ NlsOemDefaultChar = NlsTable->OemTableInfo.DefaultChar;
+ NlsUnicodeDefaultChar = NlsTable->OemTableInfo.TransDefaultChar;
+}
/*
* @unimplemented
@@ -482,111 +460,108 @@
PWCHAR UnicodeString,
ULONG UnicodeSize)
{
- ULONG Size = 0;
- ULONG i;
-
- if (CustomCP->DBCSCodePage == 0)
- {
- /* single-byte code page */
- if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
- Size = CustomSize;
- else
- Size = UnicodeSize / sizeof(WCHAR);
-
- if (ResultSize != NULL)
- *ResultSize = Size;
-
- for (i = 0; i < Size; i++)
- {
- *CustomString = ((PCHAR)CustomCP->WideCharTable)[*UnicodeString];
- CustomString++;
- UnicodeString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
- ASSERT(FALSE);
- }
-
- return STATUS_SUCCESS;
-}
-
-
+ ULONG Size = 0;
+ ULONG i;
+
+ if (CustomCP->DBCSCodePage == 0)
+ {
+ /* single-byte code page */
+ if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
+ Size = CustomSize;
+ else
+ Size = UnicodeSize / sizeof(WCHAR);
+
+ if (ResultSize != NULL)
+ *ResultSize = Size;
+
+ for (i = 0; i < Size; i++)
+ {
+ *CustomString = ((PCHAR)CustomCP->WideCharTable)[*UnicodeString];
+ CustomString++;
+ UnicodeString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+ ASSERT(FALSE);
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @unimplemented
*/
NTSTATUS NTAPI
-RtlUnicodeToMultiByteN (PCHAR MbString,
- ULONG MbSize,
- PULONG ResultSize,
- PCWCH UnicodeString,
- ULONG UnicodeSize)
-{
- ULONG Size = 0;
- ULONG i;
-
- PAGED_CODE_RTL();
-
- if (NlsMbCodePageTag == FALSE)
- {
- /* single-byte code page */
- Size = (UnicodeSize > (MbSize * sizeof (WCHAR)))
- ? MbSize
- : (UnicodeSize / sizeof (WCHAR));
-
- if (ResultSize != NULL)
- {
- *ResultSize = Size;
- }
-
- for (i = 0; i < Size; i++)
- {
- *MbString++ = NlsUnicodeToAnsiTable[*UnicodeString++];
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
-
- USHORT WideChar;
- USHORT MbChar;
-
- for (i = MbSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
- {
- WideChar = *UnicodeString++;
-
- if (WideChar < 0x80)
- {
- *MbString++ = LOBYTE(WideChar);
- continue;
- }
-
- MbChar = NlsUnicodeToMbAnsiTable[WideChar];
-
- if (!HIBYTE(MbChar))
- {
- *MbString++ = LOBYTE(MbChar);
- continue;
- }
-
- if (i >= 2)
- {
- *MbString++ = HIBYTE(MbChar);
- *MbString++ = LOBYTE(MbChar);
- i--;
- }
- else break;
- }
-
- if (ResultSize != NULL)
- *ResultSize = MbSize - i;
- }
-
- return STATUS_SUCCESS;
+RtlUnicodeToMultiByteN(PCHAR MbString,
+ ULONG MbSize,
+ PULONG ResultSize,
+ PCWCH UnicodeString,
+ ULONG UnicodeSize)
+{
+ ULONG Size = 0;
+ ULONG i;
+
+ PAGED_CODE_RTL();
+
+ if (NlsMbCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ Size = (UnicodeSize > (MbSize * sizeof (WCHAR)))
+ ? MbSize : (UnicodeSize / sizeof (WCHAR));
+
+ if (ResultSize != NULL)
+ {
+ *ResultSize = Size;
+ }
+
+ for (i = 0; i < Size; i++)
+ {
+ *MbString++ = NlsUnicodeToAnsiTable[*UnicodeString++];
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+
+ USHORT WideChar;
+ USHORT MbChar;
+
+ for (i = MbSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
+ {
+ WideChar = *UnicodeString++;
+
+ if (WideChar < 0x80)
+ {
+ *MbString++ = LOBYTE(WideChar);
+ continue;
+ }
+
+ MbChar = NlsUnicodeToMbAnsiTable[WideChar];
+
+ if (!HIBYTE(MbChar))
+ {
+ *MbString++ = LOBYTE(MbChar);
+ continue;
+ }
+
+ if (i >= 2)
+ {
+ *MbString++ = HIBYTE(MbChar);
+ *MbString++ = LOBYTE(MbChar);
+ i--;
+ }
+ else break;
+ }
+
+ if (ResultSize != NULL)
+ *ResultSize = MbSize - i;
+ }
+
+ return STATUS_SUCCESS;
}
/*
@@ -636,77 +611,74 @@
* @unimplemented
*/
NTSTATUS NTAPI
-RtlUnicodeToOemN (PCHAR OemString,
- ULONG OemSize,
- PULONG ResultSize,
- PCWCH UnicodeString,
- ULONG UnicodeSize)
-{
- ULONG Size = 0;
- ULONG i;
-
- if (NlsMbOemCodePageTag == FALSE)
- {
- /* single-byte code page */
- if (UnicodeSize > (OemSize * sizeof(WCHAR)))
- Size = OemSize;
- else
- Size = UnicodeSize / sizeof(WCHAR);
-
- if (ResultSize != NULL)
- *ResultSize = Size;
-
- for (i = 0; i < Size; i++)
- {
- *OemString = NlsUnicodeToOemTable[*UnicodeString];
- OemString++;
- UnicodeString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
-
- USHORT WideChar;
- USHORT OemChar;
-
- for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
- {
- WideChar = *UnicodeString++;
-
- if (WideChar < 0x80)
- {
- *OemString++ = LOBYTE(WideChar);
- continue;
- }
-
- OemChar = NlsUnicodeToMbOemTable[WideChar];
-
- if (!HIBYTE(OemChar))
- {
- *OemString++ = LOBYTE(OemChar);
- continue;
- }
-
- if (i >= 2)
- {
- *OemString++ = HIBYTE(OemChar);
- *OemString++ = LOBYTE(OemChar);
- i--;
- }
- else break;
- }
-
- if (ResultSize != NULL)
- *ResultSize = OemSize - i;
- }
-
- return STATUS_SUCCESS;
-}
-
-
-
+RtlUnicodeToOemN(PCHAR OemString,
+ ULONG OemSize,
+ PULONG ResultSize,
+ PCWCH UnicodeString,
+ ULONG UnicodeSize)
+{
+ ULONG Size = 0;
+ ULONG i;
+
+ if (NlsMbOemCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ if (UnicodeSize > (OemSize * sizeof(WCHAR)))
+ Size = OemSize;
+ else
+ Size = UnicodeSize / sizeof(WCHAR);
+
+ if (ResultSize != NULL)
+ *ResultSize = Size;
+
+ for (i = 0; i < Size; i++)
+ {
+ *OemString = NlsUnicodeToOemTable[*UnicodeString];
+ OemString++;
+ UnicodeString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+
+ USHORT WideChar;
+ USHORT OemChar;
+
+ for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
+ {
+ WideChar = *UnicodeString++;
+
+ if (WideChar < 0x80)
+ {
+ *OemString++ = LOBYTE(WideChar);
+ continue;
+ }
+
+ OemChar = NlsUnicodeToMbOemTable[WideChar];
+
+ if (!HIBYTE(OemChar))
+ {
+ *OemString++ = LOBYTE(OemChar);
+ continue;
+ }
+
+ if (i >= 2)
+ {
+ *OemString++ = HIBYTE(OemChar);
+ *OemString++ = LOBYTE(OemChar);
+ i--;
+ }
+ else break;
+ }
+
+ if (ResultSize != NULL)
+ *ResultSize = OemSize - i;
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @implemented
@@ -714,222 +686,216 @@
WCHAR NTAPI
RtlUpcaseUnicodeChar(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;
-}
-
-
+ 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;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS NTAPI
+RtlUpcaseUnicodeToCustomCPN(IN PCPTABLEINFO CustomCP,
+ OUT PCHAR CustomString,
+ IN ULONG CustomSize,
+ OUT PULONG ResultSize OPTIONAL,
+ IN PWCHAR UnicodeString,
+ IN ULONG UnicodeSize)
+{
+ WCHAR UpcaseChar;
+ ULONG Size = 0;
+ ULONG i;
+
+ if (!CustomCP->DBCSCodePage)
+ {
+ /* single-byte code page */
+ if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
+ Size = CustomSize;
+ else
+ Size = UnicodeSize / sizeof(WCHAR);
+
+ if (ResultSize)
+ *ResultSize = Size;
+
+ for (i = 0; i < Size; i++)
+ {
+ UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ *CustomString = ((PCHAR)CustomCP->WideCharTable)[UpcaseChar];
+ ++CustomString;
+ ++UnicodeString;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+ ASSERT(FALSE);
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @unimplemented
*/
NTSTATUS NTAPI
-RtlUpcaseUnicodeToCustomCPN (IN PCPTABLEINFO CustomCP,
- PCHAR CustomString,
- ULONG CustomSize,
+RtlUpcaseUnicodeToMultiByteN(PCHAR MbString,
+ ULONG MbSize,
PULONG ResultSize,
- PWCHAR UnicodeString,
+ PCWCH UnicodeString,
ULONG UnicodeSize)
{
- WCHAR UpcaseChar;
- ULONG Size = 0;
- ULONG i;
-
- if (CustomCP->DBCSCodePage == 0)
- {
- /* single-byte code page */
- if (UnicodeSize > (CustomSize * sizeof(WCHAR)))
- Size = CustomSize;
- else
- Size = UnicodeSize / sizeof(WCHAR);
-
- if (ResultSize != NULL)
- *ResultSize = Size;
-
- for (i = 0; i < Size; i++)
- {
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
- *CustomString = ((PCHAR)CustomCP->WideCharTable)[UpcaseChar];
- CustomString++;
- UnicodeString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
- ASSERT(FALSE);
- }
-
- return STATUS_SUCCESS;
-}
-
+ WCHAR UpcaseChar;
+ ULONG Size = 0;
+ ULONG i;
+
+ if (NlsMbCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ if (UnicodeSize > (MbSize * sizeof(WCHAR)))
+ Size = MbSize;
+ else
+ Size = UnicodeSize / sizeof(WCHAR);
+
+ if (ResultSize != NULL)
+ *ResultSize = Size;
+
+ for (i = 0; i < Size; i++)
+ {
+ UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ *MbString = NlsUnicodeToAnsiTable[UpcaseChar];
+ MbString++;
+ UnicodeString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+ ASSERT(FALSE);
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @unimplemented
*/
NTSTATUS NTAPI
-RtlUpcaseUnicodeToMultiByteN (PCHAR MbString,
- ULONG MbSize,
- PULONG ResultSize,
- PCWCH UnicodeString,
- ULONG UnicodeSize)
-{
- WCHAR UpcaseChar;
- ULONG Size = 0;
- ULONG i;
-
- if (NlsMbCodePageTag == FALSE)
- {
- /* single-byte code page */
- if (UnicodeSize > (MbSize * sizeof(WCHAR)))
- Size = MbSize;
- else
- Size = UnicodeSize / sizeof(WCHAR);
-
- if (ResultSize != NULL)
- *ResultSize = Size;
-
- for (i = 0; i < Size; i++)
- {
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
- *MbString = NlsUnicodeToAnsiTable[UpcaseChar];
- MbString++;
- UnicodeString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
- ASSERT(FALSE);
- }
-
- return STATUS_SUCCESS;
-}
-
+RtlUpcaseUnicodeToOemN(PCHAR OemString,
+ ULONG OemSize,
+ PULONG ResultSize,
+ PCWCH UnicodeString,
+ ULONG UnicodeSize)
+{
+ WCHAR UpcaseChar;
+ ULONG Size = 0;
+ ULONG i;
+
+ ASSERT(NlsUnicodeToOemTable != NULL);
+
+ if (NlsMbOemCodePageTag == FALSE)
+ {
+ /* single-byte code page */
+ if (UnicodeSize > (OemSize * sizeof(WCHAR)))
+ Size = OemSize;
+ else
+ Size = UnicodeSize / sizeof(WCHAR);
+
+ if (ResultSize != NULL)
+ *ResultSize = Size;
+
+ for (i = 0; i < Size; i++)
+ {
+ UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
+ *OemString = NlsUnicodeToOemTable[UpcaseChar];
+ OemString++;
+ UnicodeString++;
+ }
+ }
+ else
+ {
+ /* multi-byte code page */
+ /* FIXME */
+
+ USHORT WideChar;
+ USHORT OemChar;
+
+ for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
+ {
+ WideChar = RtlUpcaseUnicodeChar(*UnicodeString++);
+
+ if (WideChar < 0x80)
+ {
+ *OemString++ = LOBYTE(WideChar);
+ continue;
+ }
+
+ OemChar = NlsUnicodeToMbOemTable[WideChar];
+
+ if (!HIBYTE(OemChar))
+ {
+ *OemString++ = LOBYTE(OemChar);
+ continue;
+ }
+
+ if (i >= 2)
+ {
+ *OemString++ = HIBYTE(OemChar);
+ *OemString++ = LOBYTE(OemChar);
+ i--;
+ }
+ else break;
+ }
+
+ if (ResultSize != NULL)
+ *ResultSize = OemSize - i;
+ }
+
+ return STATUS_SUCCESS;
+}
/*
* @unimplemented
*/
-NTSTATUS NTAPI
-RtlUpcaseUnicodeToOemN (PCHAR OemString,
- ULONG OemSize,
- PULONG ResultSize,
- PCWCH UnicodeString,
- ULONG UnicodeSize)
-{
- WCHAR UpcaseChar;
- ULONG Size = 0;
- ULONG i;
-
- ASSERT(NlsUnicodeToOemTable != NULL);
-
- if (NlsMbOemCodePageTag == FALSE)
- {
- /* single-byte code page */
- if (UnicodeSize > (OemSize * sizeof(WCHAR)))
- Size = OemSize;
- else
- Size = UnicodeSize / sizeof(WCHAR);
-
- if (ResultSize != NULL)
- *ResultSize = Size;
-
- for (i = 0; i < Size; i++)
- {
- UpcaseChar = RtlUpcaseUnicodeChar(*UnicodeString);
- *OemString = NlsUnicodeToOemTable[UpcaseChar];
- OemString++;
- UnicodeString++;
- }
- }
- else
- {
- /* multi-byte code page */
- /* FIXME */
-
- USHORT WideChar;
- USHORT OemChar;
-
- for (i = OemSize, Size = UnicodeSize / sizeof(WCHAR); i && Size; i--,
Size--)
- {
- WideChar = RtlUpcaseUnicodeChar(*UnicodeString++);
-
- if (WideChar < 0x80)
- {
- *OemString++ = LOBYTE(WideChar);
- continue;
- }
-
- OemChar = NlsUnicodeToMbOemTable[WideChar];
-
- if (!HIBYTE(OemChar))
- {
- *OemString++ = LOBYTE(OemChar);
- continue;
- }
-
- if (i >= 2)
- {
- *OemString++ = HIBYTE(OemChar);
- *OemString++ = LOBYTE(OemChar);
- i--;
- }
- else break;
- }
-
- if (ResultSize != NULL)
- *ResultSize = OemSize - i;
- }
-
- return STATUS_SUCCESS;
-}
-
-
-
-/*
- * @unimplemented
- */
CHAR NTAPI
-RtlUpperChar (IN CHAR Source)
-{
- WCHAR Unicode;
- CHAR Destination;
-
- /* Check for simple ANSI case */
- if (Source <= 'z')
- {
- /* Check for simple downcase a-z case */
- if (Source >= 'a')
- {
- /* Just XOR with the difference */
- return Source ^ ('a' - 'A');
- }
- else
- {
- /* Otherwise return the same char, it's already upcase */
- return Source;
- }
- }
- else
- {
+RtlUpperChar(IN CHAR Source)
+{
+ WCHAR Unicode;
+ CHAR Destination;
+
+ /* Check for simple ANSI case */
+ if (Source <= 'z')
+ {
+ /* Check for simple downcase a-z case */
+ if (Source >= 'a')
+ {
+ /* Just XOR with the difference */
+ return Source ^ ('a' - 'A');
+ }
+ else
+ {
+ /* Otherwise return the same char, it's already upcase */
+ return Source;
+ }
+ }
+ else
+ {
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
@@ -949,9 +915,9 @@
/* FIXME */
Destination = Source;
}
- }
-
- return Destination;
+ }
+
+ return Destination;
}
/* EOF */