changeset 55118:45a23c64d0f6

8219583: Windows build failure after JDK-8214777 (Avoid some GCC 8.X strncpy() errors in HotSpot) Reviewed-by: kbarrett, mikael
author shade
date Sat, 23 Feb 2019 10:55:45 +0100
parents c1885a1d62a3
children 446ec34c7838
files src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/classLoaderExt.cpp src/hotspot/share/classfile/verifier.cpp src/hotspot/share/services/diagnosticArgument.cpp src/hotspot/share/utilities/xmlstream.cpp
diffstat 5 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp	Fri Feb 22 18:54:23 2019 -0800
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Sat Feb 23 10:55:45 2019 +0100
@@ -60,6 +60,7 @@
 #include "runtime/arguments.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/os.hpp"
 #include "runtime/perfData.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/safepointVerifiers.hpp"
@@ -5747,8 +5748,8 @@
     int class_name_len = _class_name->utf8_length();
     int symbol_len = host_pkg_len + 1 + class_name_len;
     char* new_anon_name = NEW_RESOURCE_ARRAY(char, symbol_len + 1);
-    int n = snprintf(new_anon_name, symbol_len + 1, "%s/%.*s",
-                     host_pkg_name, class_name_len, _class_name->base());
+    int n = os::snprintf(new_anon_name, symbol_len + 1, "%s/%.*s",
+                         host_pkg_name, class_name_len, _class_name->base());
     assert(n == symbol_len, "Unexpected number of characters in string");
 
     // Decrement old _class_name to avoid leaking.
--- a/src/hotspot/share/classfile/classLoaderExt.cpp	Fri Feb 22 18:54:23 2019 -0800
+++ b/src/hotspot/share/classfile/classLoaderExt.cpp	Sat Feb 23 10:55:45 2019 +0100
@@ -208,7 +208,7 @@
         ResourceMark rm(THREAD);
         size_t libname_len = dir_len + name_len;
         char* libname = NEW_RESOURCE_ARRAY(char, libname_len + 1);
-        int n = snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start);
+        int n = os::snprintf(libname, libname_len + 1, "%.*s%s", dir_len, dir_name, file_start);
         assert((size_t)n == libname_len, "Unexpected number of characters in string");
         trace_class_path("library = ", libname);
         ClassLoader::update_class_path_entry_list(libname, true, false);
--- a/src/hotspot/share/classfile/verifier.cpp	Fri Feb 22 18:54:23 2019 -0800
+++ b/src/hotspot/share/classfile/verifier.cpp	Sat Feb 23 10:55:45 2019 +0100
@@ -2982,14 +2982,14 @@
     // add one dimension to component
     length++;
     arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
-    int n = snprintf(arr_sig_str, length + 1, "[%s", component_name);
+    int n = os::snprintf(arr_sig_str, length + 1, "[%s", component_name);
     assert(n == length, "Unexpected number of characters in string");
   } else {         // it's an object or interface
     const char* component_name = component_type.name()->as_utf8();
     // add one dimension to component with 'L' prepended and ';' postpended.
     length = (int)strlen(component_name) + 3;
     arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);
-    int n = snprintf(arr_sig_str, length + 1, "[L%s;", component_name);
+    int n = os::snprintf(arr_sig_str, length + 1, "[L%s;", component_name);
     assert(n == length, "Unexpected number of characters in string");
   }
   Symbol* arr_sig = create_temporary_symbol(
--- a/src/hotspot/share/services/diagnosticArgument.cpp	Fri Feb 22 18:54:23 2019 -0800
+++ b/src/hotspot/share/services/diagnosticArgument.cpp	Sat Feb 23 10:55:45 2019 +0100
@@ -180,7 +180,7 @@
     _value = NULL;
   } else {
     _value = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
-    int n = snprintf(_value, len + 1, "%.*s", (int)len, str);
+    int n = os::snprintf(_value, len + 1, "%.*s", (int)len, str);
     assert((size_t)n <= len, "Unexpected number of characters in string");
   }
 }
--- a/src/hotspot/share/utilities/xmlstream.cpp	Fri Feb 22 18:54:23 2019 -0800
+++ b/src/hotspot/share/utilities/xmlstream.cpp	Sat Feb 23 10:55:45 2019 +0100
@@ -356,11 +356,11 @@
   size_t kind_len;
   if (kind_end != NULL) {
     kind_len = kind_end - kind;
-    int n = snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind);
+    int n = os::snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind);
     assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string");
   } else {
     kind_len = format_len;
-    int n = snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len);
+    int n = os::snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len);
     assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string");
   }
   // Output the trailing event with the timestamp.