8198302: VS2017 (C4477) java.base/windows/native/libnet/NetworkInterface_winXP.c incorrect printf format strings
Summary: Cast to expected data type
Reviewed-by: chegar, clanger, rriggs
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Tue Mar 06 10:45:47 2018 -0800
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Tue Mar 06 10:51:26 2018 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,14 +39,15 @@
#ifdef DEBUG
void printnif (netif *nif) {
#ifdef _WIN64
- printf ("nif:0x%I64x name:%s\n", nif,nif->name);
+ printf ("nif:0x%I64x name:%s\n", (UINT_PTR)nif, nif->name);
#else
- printf ("nif:0x%x name:%s\n", nif,nif->name);
+ printf ("nif:0x%x name:%s\n", nif, nif->name);
#endif
if (nif->dNameIsUnicode) {
- printf ("dName:%S index:%d ", nif->displayName,nif->index);
+ printf ("dName:%S index:%d ", (unsigned short *)nif->displayName,
+ nif->index);
} else {
- printf ("dName:%s index:%d ", nif->displayName,nif->index);
+ printf ("dName:%s index:%d ", nif->displayName, nif->index);
}
printf ("naddrs:%d\n", nif->naddrs);
}