From 1c00e55a9d2a5529a02091701164fc6816ae4211 Mon Sep 17 00:00:00 2001 From: dcubed Date: Wed, 26 Mar 2008 20:18:22 -0700 Subject: [PATCH] 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 --- src/share/instrument/JarFacade.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/share/instrument/JarFacade.c b/src/share/instrument/JarFacade.c index a60bdbee1..85c5bd30b 100644 --- a/src/share/instrument/JarFacade.c +++ b/src/share/instrument/JarFacade.c @@ -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 +#endif /* _WIN32 */ #include #include @@ -45,8 +53,9 @@ doAttribute(const char* name, const char* value, void* user_data) { 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 @@ doAttribute(const char* name, const char* value, void* user_data) { 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 @@ doAttribute(const char* name, const char* value, void* user_data) { } 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; -- GitLab