You wrote it was an optimization, but it rather looks like a functional
change ("+ sizeof(WCHAR)"). is that intended?
wdm:8428
#define RtlAnsiStringToUnicodeSize(String) ( \
NLS_MB_CODE_PAGE_TAG ? \
RtlxAnsiStringToUnicodeSize(String) : \
((String)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
)
wdm:8916
#define RtlUnicodeStringToAnsiSize(String) ( \
NLS_MB_CODE_PAGE_TAG ? \
RtlxUnicodeStringToAnsiSize(String) : \
((String)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
)
Am 08.02.2011 00:23, schrieb pschweitzer(a)svn.reactos.org:
Author: pschweitzer
Date: Mon Feb 7 23:23:33 2011
New Revision: 50616
URL:
http://svn.reactos.org/svn/reactos?rev=50616&view=rev
Log:
[RTL]
Minor code changes to RTL (one would call them "optimisation"). Added some
missing paged code.
Plus added useful asserts (used to catch r50615 bug!)
...
- Length = RtlAnsiStringToUnicodeSize(AnsiSource);
+ if (NlsMbCodePageTag == FALSE)
+ {
+ Length = AnsiSource->Length * 2 + sizeof(WCHAR);
+ }
+ else
+ {
+ Length = RtlxAnsiStringToUnicodeSize(AnsiSource);
+ }
...
- Length = RtlUnicodeStringToAnsiSize(UniSource);
+ ASSERT(!(UniSource->Length& 1));
+
+ if (NlsMbCodePageTag == FALSE)
+ {
+ Length = (UniSource->Length + sizeof(WCHAR)) / sizeof(WCHAR);
+ }
+ else
+ {
+ Length = RtlxUnicodeStringToAnsiSize(UniSource);
+ }
if (Length> MAXUSHORT) return STATUS_INVALID_PARAMETER_2;