6679866: 3/2 portability issues with JLI-batch-200803 on Win*
authordcubed
Wed, 26 Mar 2008 20:18:22 -0700
changeset 285 1db7e0f6f7b0
parent 284 14672d061f7a
child 286 2a80925bf7ac
6679866: 3/2 portability issues with JLI-batch-200803 on Win* Summary: Make minor tweaks to the fix for 6274276 to make the Win* compiler happy... Reviewed-by: sspitsyn, ohair
jdk/src/share/instrument/JarFacade.c
--- a/jdk/src/share/instrument/JarFacade.c	Mon Mar 24 17:20:54 2008 -0700
+++ b/jdk/src/share/instrument/JarFacade.c	Wed Mar 26 20:18:22 2008 -0700
@@ -23,6 +23,14 @@
  * have any questions.
  */
 
+#ifdef _WIN32
+/*
+ * Win* needs this include. However, Linux and Solaris do not.
+ * Having this include on Solaris SPARC breaks having non US-ASCII
+ * characters in the value of the Premain-Class attribute.
+ */
+#include <ctype.h>
+#endif /* _WIN32 */
 #include <string.h>
 #include <stdlib.h>
 
@@ -45,8 +53,9 @@
         if (attribute->name == NULL) {
             free(attribute);
         } else {
-            char *begin = value;
+            char *begin = (char *)value;
             char *end;
+            size_t value_len;
 
             /* skip any leading white space */
             while (isspace(*begin)) {
@@ -66,7 +75,7 @@
                 return;
             }
 
-            size_t value_len = (size_t)(end - begin);
+            value_len = (size_t)(end - begin);
             attribute->value = malloc(value_len + 1);
             if (attribute->value == NULL) {
                 free(attribute->name);
@@ -74,7 +83,7 @@
             } else {
                 /* save the value without leading or trailing whitespace */
                 strncpy(attribute->value, begin, value_len);
-                attribute->value[value_len] = NULL;
+                attribute->value[value_len] = '\0';
                 attribute->next = NULL;
                 if (context->head == NULL) {
                     context->head = attribute;