https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3074ad7159f830ed5184e0a6627b3d8a5ab9b1a3
commit 3074ad7159f830ed5184e0a6627b3d8a5ab9b1a3 Author: Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org> AuthorDate: Mon May 22 17:55:16 2017 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org> CommitDate: Thu May 31 18:01:00 2018 +0200 [USETUP] Some fixes/improvements suggested by Thomas (1/2). - 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. svn path=/branches/setup_improvements/; revision=74629 --- base/setup/lib/arcname.c | 5 ++--- base/setup/lib/ntverrsrc.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/base/setup/lib/arcname.c b/base/setup/lib/arcname.c index d2ea9d927a..60af00dbb1 100644 --- a/base/setup/lib/arcname.c +++ b/base/setup/lib/arcname.c @@ -142,7 +142,7 @@ ArcGetNextTokenA( 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 != ')') @@ -202,10 +202,9 @@ ArcGetNextTokenU( */ // 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')') diff --git a/base/setup/lib/ntverrsrc.c b/base/setup/lib/ntverrsrc.c index e788e12b12..d8c1c64fc6 100644 --- a/base/setup/lib/ntverrsrc.c +++ b/base/setup/lib/ntverrsrc.c @@ -104,13 +104,13 @@ static PCVS_VERSION_INFO_STRUCT32 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;