changeset 145:7bf5f01e419d

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
author dcubed
date Wed, 26 Mar 2008 20:18:22 -0700
parents 1f45ae5ea94a
children 52c76fc0a3a9
files src/share/instrument/JarFacade.c
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/instrument/JarFacade.c	Mon Mar 24 17:20:54 2008 -0700
+++ b/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;