summaryrefslogtreecommitdiff
path: root/os/windows/posix.c
diff options
context:
space:
mode:
authorSitsofe Wheeler <sitsofe@yahoo.com>2020-08-19 23:58:35 +0100
committerSitsofe Wheeler <sitsofe@yahoo.com>2020-09-12 11:50:35 +0100
commit4937100f4695df4893606f8aa9375cde62c2c80d (patch)
tree0611b666c3a79b4f6587687546891cfb843f8eac /os/windows/posix.c
parentf5515176825b1d0fc3b5ed6450b1f29510f955d5 (diff)
downloadfio-4937100f4695df4893606f8aa9375cde62c2c80d.tar.gz
fio-4937100f4695df4893606f8aa9375cde62c2c80d.tar.bz2
windows: fix DWORD format string complaints
Printing DWORD variables causes Windows clang to grumble about types: os/windows/cpu-affinity.c:263:5: error: format specifies type 'int' but the argument has type 'DWORD' (aka 'unsigned long') [-Werror,-Wformat] GetLastError()); ^~~~~~~~~~~~~~ Since a DWORD is defined to be an unsigned 32 bit integer and is declared to be an unsigned long (https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2 ) just use long as the format specifier. When printing the cpu mask in hex on legacy Windows builds, cast to unsigned long long which should be safe because there won't be more than 64 CPUs with old versions of Windows. (As some format strings are longer than the wrapping width, make an exception and avoid splitting/preserve them to make greping easier) Suggested-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Diffstat (limited to 'os/windows/posix.c')
-rw-r--r--os/windows/posix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/os/windows/posix.c b/os/windows/posix.c
index 31271de0..9e9f12ef 100644
--- a/os/windows/posix.c
+++ b/os/windows/posix.c
@@ -168,7 +168,7 @@ int win_to_posix_error(DWORD winerr)
case ERROR_FILE_INVALID:
return ENXIO;
default:
- log_err("fio: windows error %d not handled\n", winerr);
+ log_err("fio: windows error %lu not handled\n", winerr);
return EIO;
}
@@ -188,7 +188,8 @@ int GetNumLogicalProcessors(void)
if (error == ERROR_INSUFFICIENT_BUFFER)
processor_info = malloc(len);
else {
- log_err("Error: GetLogicalProcessorInformation failed: %d\n", error);
+ log_err("Error: GetLogicalProcessorInformation failed: %lu\n",
+ error);
return -1;
}