6679866: 3/2 portability issues with JLI-batch-200803 on Win*
Make minor tweaks to the fix for 6274276 to make the Win* compiler happy... Reviewed-by: sspitsyn, ohair
This commit is contained in:
parent
afd0a54dd0
commit
e1362bb54d
@ -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 @@ 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user