Author: tkreuzer
Date: Sat Feb 16 17:21:34 2013
New Revision: 58318
URL:
http://svn.reactos.org/svn/reactos?rev=58318&view=rev
Log:
[RTL]
Fix a number of warnings found with VS /analyze
Modified:
trunk/reactos/lib/rtl/actctx.c
trunk/reactos/lib/rtl/assert.c
trunk/reactos/lib/rtl/bootdata.c
trunk/reactos/lib/rtl/crc32.c
trunk/reactos/lib/rtl/dos8dot3.c
trunk/reactos/lib/rtl/generictable.c
trunk/reactos/lib/rtl/heappage.c
trunk/reactos/lib/rtl/image.c
trunk/reactos/lib/rtl/nls.c
trunk/reactos/lib/rtl/registry.c
trunk/reactos/lib/rtl/res.c
trunk/reactos/lib/rtl/resource.c
trunk/reactos/lib/rtl/security.c
trunk/reactos/lib/rtl/unicode.c
trunk/reactos/lib/rtl/unicodeprefix.c
trunk/reactos/lib/rtl/workitem.c
Modified: trunk/reactos/lib/rtl/actctx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=58318…
==============================================================================
--- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -387,7 +387,7 @@
RtlFreeHeap(RtlGetProcessHeap(), 0, entity->u.clrsurrogate.clsid);
break;
default:
- DPRINT1("Unknown entity kind %d\n", entity->kind);
+ DPRINT1("Unknown entity kind %u\n", entity->kind);
}
}
RtlFreeHeap( RtlGetProcessHeap(), 0, array->base );
@@ -788,7 +788,7 @@
{
attr_nameU = xmlstr2unicode(&attr_name);
attr_valueU = xmlstr2unicode(&attr_name);
- DPRINT1( "unexpected attr %S=%S\n", &attr_nameU,
+ DPRINT1( "unexpected attr %wZ=%wZ\n", &attr_nameU,
&attr_valueU);
}
return !error;
@@ -2275,7 +2275,8 @@
if (pActCtx->dwFlags & ACTCTX_FLAG_HMODULE_VALID) module =
pActCtx->hModule;
else module = NtCurrentTeb()->ProcessEnvironmentBlock->ImageBaseAddress;
- if ((status = get_module_filename( module, &dir, 0 ))) goto error;
+ status = get_module_filename(module, &dir, 0);
+ if (!NT_SUCCESS(status)) goto error;
if ((p = strrchrW( dir.Buffer, '\\' ))) p[1] = 0;
actctx->appdir.info = dir.Buffer;
}
@@ -2289,7 +2290,7 @@
goto error;
}
status = open_nt_file( &file, &nameW );
- if (status)
+ if (!NT_SUCCESS(status))
{
RtlFreeUnicodeString( &nameW );
goto error;
@@ -2334,10 +2335,11 @@
if (file) NtClose( file );
RtlFreeUnicodeString( &nameW );
- if (status == STATUS_SUCCESS) status = parse_depend_manifests(&acl);
+ if (NT_SUCCESS(status)) status = parse_depend_manifests(&acl);
free_depend_manifests( &acl );
- if (status == STATUS_SUCCESS) *handle = actctx;
+ if (NT_SUCCESS(status))
+ *handle = actctx;
else actctx_release( actctx );
return status;
@@ -2498,7 +2500,7 @@
ACTIVATION_CONTEXT *actctx;
NTSTATUS status;
- DPRINT("%08x %p %p %u %p %ld %p\n", flags, handle,
+ DPRINT("%08x %p %p %u %p %Iu %p\n", flags, handle,
subinst, class, buffer, bufsize, retlen);
if (retlen) *retlen = 0;
Modified: trunk/reactos/lib/rtl/assert.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/assert.c?rev=58318…
==============================================================================
--- trunk/reactos/lib/rtl/assert.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/assert.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -100,7 +100,7 @@
#else
if (NULL != Message)
{
- DbgPrint("Assertion \'%s\' failed at %s line %d: %s\n",
+ DbgPrint("Assertion \'%s\' failed at %s line %u: %s\n",
(PCHAR)FailedAssertion,
(PCHAR)FileName,
LineNumber,
@@ -108,7 +108,7 @@
}
else
{
- DbgPrint("Assertion \'%s\' failed at %s line %d\n",
+ DbgPrint("Assertion \'%s\' failed at %s line %u\n",
(PCHAR)FailedAssertion,
(PCHAR)FileName,
LineNumber);
Modified: trunk/reactos/lib/rtl/bootdata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bootdata.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/bootdata.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/bootdata.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -433,6 +433,7 @@
HANDLE hToken = NULL;
HANDLE hDirectory = NULL;
NTSTATUS Status;
+ ULONG ReturnLength;
Status = ZwOpenProcessToken(NtCurrentProcess(),
TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
@@ -452,7 +453,7 @@
&TokenPrivileges,
sizeof(TokenPrivileges),
&TokenPrivileges,
- NULL);
+ &ReturnLength);
if (!NT_SUCCESS(Status))
{
goto Cleanup;
@@ -757,7 +758,7 @@
LARGE_INTEGER ByteOffset;
NTSTATUS Status;
- DPRINT("RtlGetSetBootStatusData (%p %u %u %p %lu %p)\n",
+ DPRINT("RtlGetSetBootStatusData (%p %u %d %p %lu %p)\n",
FileHandle, WriteMode, DataClass, Buffer, BufferSize, ReturnLength);
if (DataClass >= RtlBsdItemMax)
Modified: trunk/reactos/lib/rtl/crc32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/crc32.c?rev=58318&…
==============================================================================
--- trunk/reactos/lib/rtl/crc32.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/crc32.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -91,7 +91,7 @@
{
ULONG CrcValue = ~Initial;
- DPRINT("(%d,%p,%d)\n", Initial, Data, Length);
+ DPRINT("(%u,%p,%u)\n", Initial, Data, Length);
while (Length > 0)
{
Modified: trunk/reactos/lib/rtl/dos8dot3.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/dos8dot3.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/dos8dot3.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/dos8dot3.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -238,6 +238,9 @@
char Buffer[12];
OEM_STRING OemString;
BOOLEAN GotSpace = FALSE;
+ NTSTATUS Status;
+
+ if (SpacesFound) *SpacesFound = FALSE;
if (!AnsiName)
{
@@ -246,7 +249,9 @@
OemString.Buffer = Buffer;
AnsiName = &OemString;
}
- if (RtlUpcaseUnicodeStringToCountedOemString( AnsiName, UnicodeName, FALSE ) !=
STATUS_SUCCESS)
+
+ Status = RtlUpcaseUnicodeStringToCountedOemString(AnsiName, UnicodeName, FALSE);
+ if (!NT_SUCCESS(Status))
return FALSE;
if ((AnsiName->Length > 12) || (AnsiName->Buffer == NULL)) return FALSE;
@@ -255,7 +260,6 @@
if (AnsiName->Buffer[0] == '.')
{
if (AnsiName->Length != 1 && (AnsiName->Length != 2 ||
AnsiName->Buffer[1] != '.')) return FALSE;
- if (SpacesFound) *SpacesFound = FALSE;
return TRUE;
}
Modified: trunk/reactos/lib/rtl/generictable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/generictable.c?rev…
==============================================================================
--- trunk/reactos/lib/rtl/generictable.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/generictable.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -345,6 +345,7 @@
} while(RtlLeftChild(FoundNode));
/* Splay it */
+ _Analysis_assume_(FoundNode != NULL);
Table->TableRoot = RtlSplay(FoundNode);
}
else
Modified: trunk/reactos/lib/rtl/heappage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -321,7 +321,7 @@
&Size,
Type,
Protection);
- DPRINT("Page heap: AllocVm (%p, %p, %x) status %x \n", Base, Size, Type,
Status);
+ DPRINT("Page heap: AllocVm (%p, %Ix, %lx) status %lx \n", Base, Size, Type,
Status);
/* Check for failures */
if (!NT_SUCCESS(Status))
{
@@ -330,7 +330,7 @@
_InterlockedIncrement(&RtlpDphCounter);
if (RtlpDphBreakOptions & DPH_BREAK_ON_RESERVE_FAIL)
{
- DPRINT1("Page heap: AllocVm (%p, %p, %x) failed with %x \n",
Base, Size, Type, Status);
+ DPRINT1("Page heap: AllocVm (%p, %Ix, %x) failed with %x \n",
Base, Size, Type, Status);
DbgBreakPoint();
return Status;
}
@@ -340,7 +340,7 @@
_InterlockedIncrement(&RtlpDphAllocFails);
if (RtlpDphBreakOptions & DPH_BREAK_ON_COMMIT_FAIL)
{
- DPRINT1("Page heap: AllocVm (%p, %p, %x) failed with %x \n",
Base, Size, Type, Status);
+ DPRINT1("Page heap: AllocVm (%p, %Ix, %x) failed with %x \n",
Base, Size, Type, Status);
DbgBreakPoint();
return Status;
}
@@ -357,7 +357,7 @@
/* Free the memory */
Status = RtlpSecMemFreeVirtualMemory(NtCurrentProcess(), &Base, &Size,
Type);
- DPRINT1("Page heap: FreeVm (%p, %p, %x) status %x \n", Base, Size, Type,
Status);
+ DPRINT1("Page heap: FreeVm (%p, %Ix, %x) status %x \n", Base, Size, Type,
Status);
/* Log/report failures */
if (!NT_SUCCESS(Status))
{
@@ -366,7 +366,7 @@
_InterlockedIncrement(&RtlpDphReleaseFails);
if (RtlpDphBreakOptions & DPH_BREAK_ON_RELEASE_FAIL)
{
- DPRINT1("Page heap: FreeVm (%p, %p, %x) failed with %x \n",
Base, Size, Type, Status);
+ DPRINT1("Page heap: FreeVm (%p, %Ix, %x) failed with %x \n",
Base, Size, Type, Status);
DbgBreakPoint();
return Status;
}
@@ -376,7 +376,7 @@
_InterlockedIncrement(&RtlpDphFreeFails);
if (RtlpDphBreakOptions & DPH_BREAK_ON_FREE_FAIL)
{
- DPRINT1("Page heap: FreeVm (%p, %p, %x) failed with %x \n",
Base, Size, Type, Status);
+ DPRINT1("Page heap: FreeVm (%p, %Ix, %x) failed with %x \n",
Base, Size, Type, Status);
DbgBreakPoint();
return Status;
}
@@ -401,7 +401,7 @@
_InterlockedIncrement(&RtlpDphProtectFails);
if (RtlpDphBreakOptions & DPH_BREAK_ON_PROTECT_FAIL)
{
- DPRINT1("Page heap: ProtectVm (%p, %p, %x) failed with %x \n",
Base, Size, Protection, Status);
+ DPRINT1("Page heap: ProtectVm (%p, %Ix, %x) failed with %x \n",
Base, Size, Protection, Status);
DbgBreakPoint();
return Status;
}
@@ -732,7 +732,7 @@
/* Make sure requested size is not too big */
ASSERT(FreeAllocations >= LeaveOnFreeList);
- DPRINT("RtlpDphCoalesceFreeIntoAvailable(%p %d)\n", DphRoot,
LeaveOnFreeList);
+ DPRINT("RtlpDphCoalesceFreeIntoAvailable(%p %lu)\n", DphRoot,
LeaveOnFreeList);
while (Node)
{
@@ -1411,7 +1411,8 @@
/* Per-process DPH init is done */
RtlpDphPageHeapListInitialized = TRUE;
- DPRINT1("Page heap: pid 0x%X: page heap enabled with flags 0x%X.\n",
Teb->ClientId.UniqueProcess, RtlpDphGlobalFlags);
+ DPRINT1("Page heap: pid 0x%p: page heap enabled with flags 0x%X.\n",
+ Teb->ClientId.UniqueProcess, RtlpDphGlobalFlags);
return Status;
}
@@ -1554,8 +1555,9 @@
if (RtlpDphDebugOptions & DPH_DEBUG_VERBOSE)
{
- DPRINT1("Page heap: process 0x%X created heap @ %p (%p, flags
0x%X)\n",
- NtCurrentTeb()->ClientId.UniqueProcess, (PUCHAR)DphRoot - PAGE_SIZE,
DphRoot->NormalHeap, DphRoot->ExtraFlags);
+ DPRINT1("Page heap: process 0x%p created heap @ %p (%p, flags
0x%X)\n",
+ NtCurrentTeb()->ClientId.UniqueProcess, (PUCHAR)DphRoot - PAGE_SIZE,
+ DphRoot->NormalHeap, DphRoot->ExtraFlags);
}
/* Perform internal validation if required */
@@ -1641,7 +1643,8 @@
/* Report success */
if (RtlpDphDebugOptions & DPH_DEBUG_VERBOSE)
- DPRINT1("Page heap: process 0x%X destroyed heap @ %p (%p)\n",
NtCurrentTeb()->ClientId.UniqueProcess, HeapPtr, NormalHeap);
+ DPRINT1("Page heap: process 0x%p destroyed heap @ %p (%p)\n",
+ NtCurrentTeb()->ClientId.UniqueProcess, HeapPtr, NormalHeap);
return NULL;
}
Modified: trunk/reactos/lib/rtl/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/image.c?rev=58318&…
==============================================================================
--- trunk/reactos/lib/rtl/image.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/image.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -274,8 +274,7 @@
MappedAsImage = FALSE;
}
-
- NtHeader = RtlImageNtHeader (BaseAddress);
+ NtHeader = RtlImageNtHeader(BaseAddress);
if (NtHeader == NULL)
return NULL;
@@ -292,7 +291,7 @@
return (PVOID)((ULONG_PTR)BaseAddress + Va);
/* image mapped as ordinary file, we must find raw pointer */
- return RtlImageRvaToVa (NtHeader, BaseAddress, Va, NULL);
+ return RtlImageRvaToVa(NtHeader, BaseAddress, Va, NULL);
}
@@ -341,13 +340,13 @@
if (SectionHeader)
Section = *SectionHeader;
- if (Section == NULL ||
- Rva < SWAPD(Section->VirtualAddress) ||
- Rva >= SWAPD(Section->VirtualAddress) +
SWAPD(Section->Misc.VirtualSize))
+ if ((Section == NULL) ||
+ (Rva < SWAPD(Section->VirtualAddress)) ||
+ (Rva >= SWAPD(Section->VirtualAddress) +
SWAPD(Section->Misc.VirtualSize)))
{
Section = RtlImageRvaToSection (NtHeader, BaseAddress, Rva);
if (Section == NULL)
- return 0;
+ return NULL;
if (SectionHeader)
*SectionHeader = Section;
@@ -418,7 +417,7 @@
case IMAGE_REL_BASED_MIPS_JMPADDR:
default:
DPRINT1("Unknown/unsupported fixup type %hu.\n", Type);
- DPRINT1("Address %x, Current %d, Count %d, *TypeOffset %x\n",
Address, i, Count, SWAPW(*TypeOffset));
+ DPRINT1("Address %x, Current %u, Count %u, *TypeOffset %x\n",
Address, i, Count, SWAPW(*TypeOffset));
return (PIMAGE_BASE_RELOCATION)NULL;
}
Modified: trunk/reactos/lib/rtl/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/nls.c?rev=58318&am…
==============================================================================
--- trunk/reactos/lib/rtl/nls.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/nls.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -210,11 +210,9 @@
CaseTableBase == NULL)
return;
- RtlInitCodePageTable (AnsiTableBase,
- &NlsTable->AnsiTableInfo);
-
- RtlInitCodePageTable (OemTableBase,
- &NlsTable->OemTableInfo);
+ RtlInitCodePageTable(AnsiTableBase, &NlsTable->AnsiTableInfo);
+
+ RtlInitCodePageTable(OemTableBase, &NlsTable->OemTableInfo);
NlsTable->UpperCaseTable = (PUSHORT)CaseTableBase + 2;
NlsTable->LowerCaseTable = (PUSHORT)CaseTableBase + *((PUSHORT)CaseTableBase + 1) +
2;
Modified: trunk/reactos/lib/rtl/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/registry.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/registry.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/registry.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -409,12 +409,15 @@
return (Status == STATUS_BUFFER_TOO_SMALL) ? STATUS_SUCCESS : Status;
}
+_Success_(return!=NULL || BufferSize==0)
+_When_(BufferSize!=NULL,__drv_allocatesMem(Mem))
PVOID
NTAPI
-RtlpAllocDeallocQueryBuffer(IN OUT PSIZE_T BufferSize,
- IN PVOID OldBuffer,
- IN SIZE_T OldBufferSize,
- OUT PNTSTATUS Status)
+RtlpAllocDeallocQueryBuffer(
+ _In_opt_ PSIZE_T BufferSize,
+ _In_opt_ __drv_freesMem(Mem) PVOID OldBuffer,
+ _In_ SIZE_T OldBufferSize,
+ _Out_opt_ _On_failure_(_Post_satisfies_(*Status < 0)) PNTSTATUS Status)
{
PVOID Buffer = NULL;
Modified: trunk/reactos/lib/rtl/res.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/res.c?rev=58318&am…
==============================================================================
--- trunk/reactos/lib/rtl/res.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/res.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -216,16 +216,17 @@
_SEH2_TRY
{
- if (ResourceInfo)
- {
- DPRINT( "module %p type %ws name %ws lang %04lx level %ld\n",
+ if (ResourceInfo)
+ {
+ DPRINT( "module %p type %ws name %ws lang %04lx level %lu\n",
BaseAddress, (LPCWSTR)ResourceInfo->Type,
Level > 1 ? (LPCWSTR)ResourceInfo->Name : L"",
Level > 2 ? ResourceInfo->Language : 0, Level );
}
status = find_entry( BaseAddress, ResourceInfo, Level, &res, FALSE );
- if (status == STATUS_SUCCESS) *ResourceDataEntry = res;
+ if (NT_SUCCESS(status))
+ *ResourceDataEntry = res;
}
_SEH2_EXCEPT(page_fault(_SEH2_GetExceptionCode()))
{
@@ -263,16 +264,17 @@
_SEH2_TRY
{
- if (info)
- {
- DPRINT( "module %p type %ws name %ws lang %04lx level %ld\n",
+ if (info)
+ {
+ DPRINT( "module %p type %ws name %ws lang %04lx level %lu\n",
BaseAddress, (LPCWSTR)info->Type,
level > 1 ? (LPCWSTR)info->Name : L"",
level > 2 ? info->Language : 0, level );
}
status = find_entry( BaseAddress, info, level, &res, TRUE );
- if (status == STATUS_SUCCESS) *addr = res;
+ if (NT_SUCCESS(status))
+ *addr = res;
}
_SEH2_EXCEPT(page_fault(_SEH2_GetExceptionCode()))
{
@@ -346,7 +348,7 @@
_In_ PLDR_RESOURCE_INFO ResourceInfo,
_In_ ULONG Level,
_Inout_ ULONG *ResourceCount,
- _Out_opt_ LDR_ENUM_RESOURCE_INFO *Resources)
+ _Out_writes_to_(*ResourceCount,*ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources)
{
PUCHAR ResourceData;
NTSTATUS Status;
Modified: trunk/reactos/lib/rtl/resource.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/resource.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/resource.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/resource.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -310,7 +310,7 @@
NTAPI
RtlDumpResource(PRTL_RESOURCE Resource)
{
- DbgPrint("RtlDumpResource(%p):\n\tactive count = %i\n\twaiting readers =
%i\n\twaiting writers = %i\n",
+ DbgPrint("RtlDumpResource(%p):\n\tactive count = %d\n\twaiting readers =
%u\n\twaiting writers = %u\n",
Resource,
Resource->NumberActive,
Resource->SharedWaiters,
@@ -318,7 +318,7 @@
if (Resource->NumberActive != 0)
{
- DbgPrint("\towner thread = %08x\n",
+ DbgPrint("\towner thread = %p\n",
Resource->OwningThread);
}
}
Modified: trunk/reactos/lib/rtl/security.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/security.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/security.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/security.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -57,7 +57,7 @@
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
-
+
/* PUBLIC FUNCTIONS ***********************************************************/
/*
@@ -288,7 +288,7 @@
BOOLEAN Granted, CallerToken;
TOKEN_STATISTICS TokenStats;
ULONG Size;
- DPRINT1("RtlNewSecurityGrantedAccess(%p)\n", DesiredAccess);
+ DPRINT1("RtlNewSecurityGrantedAccess(%lx)\n", DesiredAccess);
/* Has the caller passed a token? */
if (!Token)
Modified: trunk/reactos/lib/rtl/unicode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=5831…
==============================================================================
--- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -584,14 +584,17 @@
IN PCWSTR SourceString)
{
SIZE_T Size;
- CONST SIZE_T MaxSize = (MAXUSHORT & ~1) - sizeof(WCHAR); // an even number
+ CONST SIZE_T MaxSize = (MAXUSHORT & ~1) - sizeof(UNICODE_NULL); // an even
number
if (SourceString)
{
Size = wcslen(SourceString) * sizeof(WCHAR);
- if (Size > MaxSize) Size = MaxSize;
+ __analysis_assume(Size <= MaxSize);
+
+ if (Size > MaxSize)
+ Size = MaxSize;
DestinationString->Length = (USHORT)Size;
- DestinationString->MaximumLength = (USHORT)Size + sizeof(WCHAR);
+ DestinationString->MaximumLength = (USHORT)Size + sizeof(UNICODE_NULL);
}
else
{
Modified: trunk/reactos/lib/rtl/unicodeprefix.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicodeprefix.c?re…
==============================================================================
--- trunk/reactos/lib/rtl/unicodeprefix.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicodeprefix.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -156,7 +156,7 @@
RTL_GENERIC_COMPARE_RESULTS Result;
DPRINT("RtlFindUnicodePrefix(): Table %p, FullName %wZ, "
- "CaseInsensitive %b\n", PrefixTable, FullName, CaseInsensitiveIndex);
+ "CaseInsensitive %lu\n", PrefixTable, FullName, CaseInsensitiveIndex);
/* Find out how many names there are */
NameCount = ComputeUnicodeNameLength(FullName);
@@ -467,7 +467,7 @@
PRTL_SPLAY_LINKS SplayLinks;
PUNICODE_PREFIX_TABLE_ENTRY Entry, CaseMatchEntry = NULL;
- DPRINT("RtlNextUnicodePrefix(): Table %p Restart %b\n",
+ DPRINT("RtlNextUnicodePrefix(): Table %p Restart %u\n",
PrefixTable, Restart);
/* We might need this entry 2/3rd of the time, so cache it now */
Modified: trunk/reactos/lib/rtl/workitem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/workitem.c?rev=583…
==============================================================================
--- trunk/reactos/lib/rtl/workitem.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/workitem.c [iso-8859-1] Sat Feb 16 17:21:34 2013
@@ -456,7 +456,7 @@
/* Couldn't find an appropriate thread, see if we can use the persistent
thread (if it exists) for now */
if (ThreadPoolIOWorkerThreads == 0)
{
- DPRINT1("Failed to find a worker thread for the work item
0x%p!\n");
+ DPRINT1("Failed to find a worker thread for the work item
0x%p!\n", WorkItem);
ASSERT(IsListEmpty(&ThreadPoolIOWorkerThreadsList));
return STATUS_NO_MEMORY;
}