summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-19 16:01:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-19 16:01:57 (GMT)
commit7475d4cff9f37fae1bf039d0b1207c444c8bed0f (patch)
treee6175d62bd114ffaba5dc413ecdedb67bc4d4a47 /win
parentdab36e26b1277cde6a97e5c6943a9b51fda5e28b (diff)
parent65c315a27d0aa38c5fd0397b72e946e6eb3bf908 (diff)
downloadtk-7475d4cff9f37fae1bf039d0b1207c444c8bed0f.zip
tk-7475d4cff9f37fae1bf039d0b1207c444c8bed0f.tar.gz
tk-7475d4cff9f37fae1bf039d0b1207c444c8bed0f.tar.bz2
Merge 8.7
Diffstat (limited to 'win')
-rw-r--r--win/nmakehlp.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 36708c9..4fc9f7a 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -19,7 +19,6 @@
#pragma comment (lib, "kernel32.lib")
#endif
#include <stdio.h>
-#include <math.h>
/*
* This library is required for x64 builds with _some_ versions of MSVC
@@ -601,9 +600,9 @@ list_free(list_item_t **listPtrPtr)
*
* Usage is something like:
* nmakehlp -S << $** > $@
- * @PACKAGE_NAME@ $(PACKAGE_NAME)
- * @PACKAGE_VERSION@ $(PACKAGE_VERSION)
- * <<
+ * @PACKAGE_NAME@ $(PACKAGE_NAME)
+ * @PACKAGE_VERSION@ $(PACKAGE_VERSION)
+ * <<
*/
static int
@@ -727,11 +726,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
int keylen, ret;
WIN32_FIND_DATA finfo;
- if (dir == NULL || keypath == NULL)
+ if (dir == NULL || keypath == NULL) {
return 2; /* Have no real error reporting mechanism into nmake */
+ }
dirlen = strlen(dir);
- if ((dirlen + 3) > sizeof(path))
+ if ((dirlen + 3) > sizeof(path)) {
return 2;
+ }
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
@@ -746,8 +747,9 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
#else
hSearch = FindFirstFile(path, &finfo);
#endif
- if (hSearch == INVALID_HANDLE_VALUE)
+ if (hSearch == INVALID_HANDLE_VALUE) {
return 1; /* Not found */
+ }
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
@@ -757,11 +759,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
- if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+ if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
continue;
+ }
sublen = strlen(finfo.cFileName);
- if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
+ if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) {
continue; /* Path does not fit, assume not matched */
+ }
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
@@ -781,13 +785,13 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
* LocateDependency --
*
* Locates a dependency for a package.
- * keypath - a relative path within the package directory
- * that is used to confirm it is the correct directory.
+ * keypath - a relative path within the package directory
+ * that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
- * the parent and grandparent of the current working directory.
- * If found, the command prints
- * name_DIRPATH=<full path of located directory>
- * and returns 0. If not found, does not print anything and returns 1.
+ * the parent and grandparent of the current working directory.
+ * If found, the command prints
+ * name_DIRPATH=<full path of located directory>
+ * and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
@@ -797,8 +801,9 @@ static int LocateDependency(const char *keypath)
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
- if (ret == 0)
+ if (ret == 0) {
return ret;
+ }
}
return ret;
}