- Use DDK macros to speed up size calculations on single-byte codepages.
Modified: trunk/reactos/include/ndk/rtlfuncs.h
Modified: trunk/reactos/lib/rtl/unicode.c
Modified: trunk/reactos/w32api/include/ddk/winddk.h
_____
Modified: trunk/reactos/include/ndk/rtlfuncs.h
--- trunk/reactos/include/ndk/rtlfuncs.h 2005-09-06 15:57:42 UTC
(rev 17699)
+++ trunk/reactos/include/ndk/rtlfuncs.h 2005-09-06 17:33:56 UTC
(rev 17700)
@@ -764,13 +764,19 @@
/*
* Unicode->Ansi String Functions
*/
-/* FIXME: Use macro */
-#undef RtlUnicodeStringToAnsiSize
NTSYSAPI
ULONG
NTAPI
-RtlUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString);
+RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
+#ifdef NTOS_MODE_USER
+#define RtlUnicodeStringToAnsiSize(STRING) ( \
+ NLS_MB_CODE_PAGE_TAG ? \
+ RtlxUnicodeStringToAnsiSize(STRING) : \
+ ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
+)
+#endif
+
NTSYSAPI
NTSTATUS
NTAPI
@@ -821,13 +827,22 @@
ULONG UnicodeSize
);
-/* FIXME: Use macro */
-#undef RtlUnicodeStringToOemSize
NTSYSAPI
ULONG
NTAPI
-RtlUnicodeStringToOemSize(IN PUNICODE_STRING UnicodeString);
+RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
+#ifdef NTOS_MODE_USER
+#define RtlUnicodeStringToOemSize(STRING) ( \
+ NLS_MB_OEM_CODE_PAGE_TAG ? \
+ RtlxUnicodeStringToOemSize(STRING) : \
+ ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
+)
+#define RtlUnicodeStringToCountedOemSize(STRING) ( \
+ (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(UNICODE_NULL)) \
+)
+#endif
+
NTSYSAPI
NTSTATUS
NTAPI
@@ -873,16 +888,25 @@
ULONG UnicodeSize
);
-/*
- * OEM to Unicode Functions
- */
-/* FIXME: Use macro */
-#undef RtlOemStringToUnicodeSize
NTSYSAPI
ULONG
NTAPI
-RtlOemStringToUnicodeSize(POEM_STRING AnsiString);
+RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
+/*
+ * OEM to Unicode Functions
+ */
+#ifdef NTOS_MODE_USER
+#define RtlOemStringToUnicodeSize(STRING) ( \
+ NLS_MB_OEM_CODE_PAGE_TAG ? \
+ RtlxOemStringToUnicodeSize(STRING) : \
+ ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
+)
+#define RtlOemStringToCountedUnicodeSize(STRING) ( \
+ (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
+)
+#endif
+
NTSYSAPI
NTSTATUS
NTAPI
@@ -915,14 +939,13 @@
BOOLEAN AllocateDestinationString
);
-/* FIXME: Use macro */
-#undef RtlAnsiStringToUnicodeSize
-NTSYSAPI
-ULONG
-NTAPI
-RtlAnsiStringToUnicodeSize(
- PANSI_STRING AnsiString
-);
+#ifdef NTOS_MODE_USER
+#define RtlAnsiStringToUnicodeSize(STRING) ( \
+ NLS_MB_CODE_PAGE_TAG ? \
+ RtlxAnsiStringToUnicodeSize(STRING) : \
+ ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
+)
+#endif
NTSYSAPI
BOOLEAN
_____
Modified: trunk/reactos/lib/rtl/unicode.c
--- trunk/reactos/lib/rtl/unicode.c 2005-09-06 15:57:42 UTC (rev
17699)
+++ trunk/reactos/lib/rtl/unicode.c 2005-09-06 17:33:56 UTC (rev
17700)
@@ -66,7 +66,7 @@
*/
ULONG
STDCALL
-RtlxAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString)
+RtlxAnsiStringToUnicodeSize(IN PCANSI_STRING AnsiString)
{
ULONG Size;
@@ -884,7 +884,7 @@
ULONG
STDCALL
RtlxUnicodeStringToOemSize(
- IN PUNICODE_STRING UnicodeString)
+ IN PCUNICODE_STRING UnicodeString)
{
ULONG Size;
@@ -1830,7 +1830,7 @@
*/
ULONG
STDCALL
-RtlxOemStringToUnicodeSize(IN POEM_STRING OemString)
+RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString)
{
ULONG Size;
@@ -1894,7 +1894,7 @@
ULONG
STDCALL
RtlxUnicodeStringToAnsiSize(
- IN PUNICODE_STRING UnicodeString)
+ IN PCUNICODE_STRING UnicodeString)
{
ULONG Size;
@@ -2256,49 +2256,8 @@
DestinationString->Length = SourceString->Length;
}
-
/*
* @implemented
- */
-ULONG STDCALL
-RtlAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString)
-{
- return RtlxAnsiStringToUnicodeSize(AnsiString);
-}
-
-
-/*
- * @implemented
- */
-ULONG STDCALL
-RtlOemStringToUnicodeSize(IN POEM_STRING OemString)
-{
- return RtlxOemStringToUnicodeSize(OemString);
-}
-
-
-
-/*
- * @implemented
- */
-ULONG STDCALL
-RtlUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString)
-{
- return RtlxUnicodeStringToAnsiSize(UnicodeString);
-}
-
-
-/*
- * @implemented
- */
-ULONG STDCALL
-RtlUnicodeStringToOemSize(IN PUNICODE_STRING UnicodeString)
-{
- return RtlxUnicodeStringToOemSize(UnicodeString);
-}
-
-/*
- * @implemented
*
* NOTES
* See RtlpDuplicateUnicodeString
_____
Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/w32api/include/ddk/winddk.h 2005-09-06 15:57:42 UTC
(rev 17699)
+++ trunk/reactos/w32api/include/ddk/winddk.h 2005-09-06 17:33:56 UTC
(rev 17700)
@@ -5099,9 +5099,15 @@
NTOSAPI
ULONG
DDKAPI
-RtlAnsiStringToUnicodeSize(
- IN PANSI_STRING AnsiString);
+RtlxAnsiStringToUnicodeSize(
+ IN PCANSI_STRING AnsiString);
+#define RtlAnsiStringToUnicodeSize(STRING) ( \
+ NLS_MB_CODE_PAGE_TAG ? \
+ RtlxAnsiStringToUnicodeSize(STRING) : \
+ ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
+)
+
NTOSAPI
NTSTATUS
DDKAPI
@@ -5720,11 +5726,11 @@
RtlUlonglongByteSwap(
IN ULONGLONG Source);
-NTOSAPI
-ULONG
-DDKAPI
-RtlUnicodeStringToAnsiSize(
- IN PUNICODE_STRING UnicodeString);
+#define RtlUnicodeStringToAnsiSize(STRING) ( \
+ NLS_MB_CODE_PAGE_TAG ? \
+ RtlxUnicodeStringToAnsiSize(STRING) : \
+ ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
+)
NTOSAPI
NTSTATUS