8188855: Fix VS10 build after "8187658: Bigger buffer for GetAdaptersAddresses"
authorgoetz
Fri, 06 Oct 2017 08:37:08 +0200
changeset 47317 62e749769358
parent 47316 1129253d3bc7
child 47318 423f5e46016e
8188855: Fix VS10 build after "8187658: Bigger buffer for GetAdaptersAddresses" Reviewed-by: vtewari, simonis
src/java.base/windows/native/libnet/NetworkInterface_winXP.c
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Thu Oct 05 18:29:47 2017 +0100
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c	Fri Oct 06 08:37:08 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, 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
@@ -79,6 +79,7 @@
             strlen("IP Helper Library GetAdaptersAddresses function failed"
                    " with error == ") + 10;
     int _ret = 0;
+    int try;
 
 
     adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE);
@@ -94,7 +95,7 @@
     flags |= GAA_FLAG_INCLUDE_PREFIX;
     ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
 
-    for (int try = 0; ret == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
+    for (try = 0; ret == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
         IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
         if (len < (ULONG_MAX - BUFF_SIZE)) {
             len += BUFF_SIZE;
@@ -160,6 +161,7 @@
     size_t error_msg_buf_size =
         strlen("IP Helper Library GetAdaptersAddresses function failed with error == ") + 10;
     int _ret = 0;
+    int try;
     adapterInfo = (IP_ADAPTER_ADDRESSES *) malloc(BUFF_SIZE);
     if (adapterInfo == NULL) {
         JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
@@ -171,7 +173,7 @@
     flags |= GAA_FLAG_SKIP_MULTICAST;
     flags |= GAA_FLAG_INCLUDE_PREFIX;
     val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
-    for (int try = 0; val == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
+    for (try = 0; val == ERROR_BUFFER_OVERFLOW && try < MAX_TRIES; ++try) {
         IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
         if (len < (ULONG_MAX - BUFF_SIZE)) {
             len += BUFF_SIZE;