Author: hbelusca
Date: Mon May 22 15:55:16 2017
New Revision: 74629
URL:
http://svn.reactos.org/svn/reactos?rev=74629&view=rev
Log:
[USETUP]: Some fixes/improvements suggested by Thomas:
- isspace('\0') returns FALSE anyways so no need to separately test for a NULL
character;
- The (str/wcs)toul function cannot return a NULL pointer from its second paramter;
- VersionInfo32_FindChild(): the third argument is indeed a number of characters (not
bytes), so rename the parameter to make this fact clear. The function is however correctly
used within this module.
- In the partlist.c disk getters: Remove useless
"IsListEmpty(&List->DiskListHead)" checks, because this is actually the
kind of check the while() loop does just after...
- Fix few DPRINTs.
Modified:
branches/setup_improvements/base/setup/lib/arcname.c
branches/setup_improvements/base/setup/lib/ntverrsrc.c
branches/setup_improvements/base/setup/lib/partlist.c
branches/setup_improvements/base/setup/usetup/filesup.c
Modified: branches/setup_improvements/base/setup/lib/arcname.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/arcname.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/arcname.c [iso-8859-1] Mon May 22 15:55:16
2017
@@ -143,7 +143,7 @@
KeyValue = strtoul(p, (PSTR*)&p, 10);
/* Skip any trailing whitespace */
- while (*p && isspace(*p)) ++p;
+ while (isspace(*p)) ++p;
/* The token must terminate with ')' */
if (*p != ')')
@@ -203,10 +203,9 @@
*/
// KeyValue = _wtoi(p);
KeyValue = wcstoul(p, (PWSTR*)&p, 10);
- ASSERT(p);
/* Skip any trailing whitespace */
- while (*p && iswspace(*p)) ++p;
+ while (iswspace(*p)) ++p;
/* The token must terminate with ')' */
if (*p != L')')
Modified: branches/setup_improvements/base/setup/lib/ntverrsrc.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/ntverrsrc.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/ntverrsrc.c [iso-8859-1] Mon May 22
15:55:16 2017
@@ -105,13 +105,13 @@
VersionInfo32_FindChild(
IN PCVS_VERSION_INFO_STRUCT32 info,
IN PCWSTR szKey,
- IN UINT cbKey)
+ IN UINT cchKey)
{
PCVS_VERSION_INFO_STRUCT32 child = VersionInfo32_Children(info);
while ((ULONG_PTR)child < (ULONG_PTR)info + info->wLength)
{
- if (!_wcsnicmp(child->szKey, szKey, cbKey) &&
!child->szKey[cbKey])
+ if (!_wcsnicmp(child->szKey, szKey, cchKey) &&
!child->szKey[cchKey])
return child;
if (child->wLength == 0) return NULL;
Modified: branches/setup_improvements/base/setup/lib/partlist.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/partlist.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/partlist.c [iso-8859-1] Mon May 22 15:55:16
2017
@@ -1356,10 +1356,6 @@
PDISKENTRY DiskEntry;
PLIST_ENTRY Entry;
- /* Check for empty disks */
- if (IsListEmpty(&List->DiskListHead))
- return NULL;
-
/* Loop over the disks and find the correct one */
Entry = List->DiskListHead.Flink;
while (Entry != &List->DiskListHead)
@@ -1385,10 +1381,6 @@
{
PDISKENTRY DiskEntry;
PLIST_ENTRY Entry;
-
- /* Check for empty disks */
- if (IsListEmpty(&List->DiskListHead))
- return NULL;
/* Loop over the disks and find the correct one */
Entry = List->DiskListHead.Flink;
@@ -1418,10 +1410,6 @@
PDISKENTRY DiskEntry;
PLIST_ENTRY Entry;
- /* Check for empty disks */
- if (IsListEmpty(&List->DiskListHead))
- return NULL;
-
/* Loop over the disks and find the correct one */
Entry = List->DiskListHead.Flink;
while (Entry != &List->DiskListHead)
@@ -1449,10 +1437,6 @@
{
PDISKENTRY DiskEntry;
PLIST_ENTRY Entry;
-
- /* Check for empty disks */
- if (IsListEmpty(&List->DiskListHead))
- return NULL;
/* Loop over the disks and find the correct one */
Entry = List->DiskListHead.Flink;
Modified: branches/setup_improvements/base/setup/usetup/filesup.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] Mon May 22
15:55:16 2017
@@ -594,12 +594,7 @@
DiskNumber = wcstoul(Path, (PWSTR*)&Path, 10);
/* Either NULL termination, or a path separator must be present now */
- if (!Path)
- {
- DPRINT1("An error happened!\n");
- return FALSE;
- }
- else if (*Path && *Path != OBJ_NAME_PATH_SEPARATOR)
+ if (*Path && *Path != OBJ_NAME_PATH_SEPARATOR)
{
DPRINT1("'%S' : expected a path separator!\n", Path);
return FALSE;
@@ -632,13 +627,7 @@
PartNumber = wcstoul(Path, (PWSTR*)&Path, 10);
/* Either NULL termination, or a path separator must be present now */
- if (!Path)
- {
- /* We fail here because wcstoul failed for whatever reason */
- DPRINT1("An error happened!\n");
- return FALSE;
- }
- else if (*Path && *Path != OBJ_NAME_PATH_SEPARATOR)
+ if (*Path && *Path != OBJ_NAME_PATH_SEPARATOR)
{
/* We shouldn't fail here because it just means this part of path is actually
not a partition specifier. Or should we? */
DPRINT1("'%S' : expected a path separator!\n", Path);
@@ -703,7 +692,7 @@
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Failed to open file %wZ, Status 0x%08lx\n", &Name,
Status);
+ DPRINT1("Failed to open file '%wZ', Status 0x%08lx\n",
&Name, Status);
return Status;
}
@@ -725,7 +714,7 @@
}
if (FileInfo.EndOfFile.HighPart != 0)
- DPRINT1("WARNING!! The file %wZ is too large!\n", Name);
+ DPRINT1("WARNING!! The file '%wZ' is too large!\n",
&Name);
*FileSize = FileInfo.EndOfFile.LowPart;
@@ -744,7 +733,7 @@
*FileHandle);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Failed to create a memory section for file %wZ, Status
0x%08lx\n", &Name, Status);
+ DPRINT1("Failed to create a memory section for file '%wZ', Status
0x%08lx\n", &Name, Status);
NtClose(*FileHandle);
*FileHandle = NULL;
return Status;