summaryrefslogtreecommitdiff
path: root/src/w32
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-09-25 17:11:12 +0300
committerEli Zaretskii <eliz@gnu.org>2022-09-25 17:11:12 +0300
commit387d349dc8211e3eb2955cc5e29a85f186af82ce (patch)
treeff9b0851484c63dcc20d33d2ea159c442cd60e32 /src/w32
parentcaad0e21819d14c8bdf0cf7cd75f275f0aa08876 (diff)
downloadmake-git-387d349dc8211e3eb2955cc5e29a85f186af82ce.tar.gz
Fix compiler warnings in the MS-Windows build.
* src/w32/w32os.c (osync_get_mutex, osync_parse_mutex): Cast to DWORD_PTR when converting integers to HANDLEs and vice versa. * src/w32/pathstuff.c (w32ify): Pacify compiler warnings about 'strncpy'. * src/makeint.h (PRId64) [!HAVE_INTTYPES_H]: Define if undefined. * src/function.c (func_wordlist): Use PRId64 instead of %lld.
Diffstat (limited to 'src/w32')
-rw-r--r--src/w32/pathstuff.c4
-rw-r--r--src/w32/w32os.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/w32/pathstuff.c b/src/w32/pathstuff.c
index afee0a4a..ae761ae6 100644
--- a/src/w32/pathstuff.c
+++ b/src/w32/pathstuff.c
@@ -102,11 +102,11 @@ w32ify(const char *filename, int resolve)
if (resolve)
{
char *fp = _fullpath (NULL, filename, sizeof (w32_path));
- strncpy (w32_path, fp, sizeof (w32_path));
+ strncpy (w32_path, fp, sizeof (w32_path) - 1);
free (fp);
}
else
- strncpy(w32_path, filename, sizeof (w32_path));
+ strncpy(w32_path, filename, sizeof (w32_path) - 1);
for (p = w32_path; p && *p; p++)
if (*p == '\\')
diff --git a/src/w32/w32os.c b/src/w32/w32os.c
index 528b5b70..23acccb9 100644
--- a/src/w32/w32os.c
+++ b/src/w32/w32os.c
@@ -22,7 +22,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <windows.h>
#include <process.h>
#include <io.h>
+#if _WIN32_WINNT > 0x0601
#include <synchapi.h>
+#endif
#include "pathstuff.h"
#include "sub_proc.h"
#include "w32err.h"
@@ -429,7 +431,7 @@ osync_get_mutex ()
/* Prepare the mutex handle string for our children.
2 hex digits per byte + 2 characters for "0x" + null. */
mutex = xmalloc ((2 * sizeof (osync_handle)) + 2 + 1);
- sprintf (mutex, "0x%Ix", (unsigned long long)osync_handle);
+ sprintf (mutex, "0x%Ix", (unsigned long long)(DWORD_PTR)osync_handle);
}
return mutex;
@@ -449,7 +451,7 @@ osync_parse_mutex (const char *mutex)
if (endp[0] != '\0')
OS (fatal, NILF, _("invalid output sync mutex: %s"), mutex);
- osync_handle = (HANDLE) i;
+ osync_handle = (HANDLE) (DWORD_PTR) i;
return 1;
}