8130036: Fix problems with imprecise C++ coding

Reviewed-by: dholmes, kbarrett
This commit is contained in:
Goetz Lindenmaier 2015-06-29 10:16:48 +02:00
parent 037958ba9a
commit bd938df14f
3 changed files with 9 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -586,8 +586,6 @@ static bool scan_line(const char * line,
return false; return false;
} }
// Scan next flag and value in line, return MethodMatcher object on success, NULL on failure. // Scan next flag and value in line, return MethodMatcher object on success, NULL on failure.
// On failure, error_msg contains description for the first error. // On failure, error_msg contains description for the first error.
// For future extensions: set error_msg on first error. // For future extensions: set error_msg on first error.
@ -665,7 +663,7 @@ static MethodMatcher* scan_flag_and_value(const char* type, const char* line, in
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type);
} }
} else { } else {
jio_snprintf(errorbuf, sizeof(errorbuf), " Value cannot be read for flag %s of type %s", flag, type); jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type);
} }
} else if (strcmp(type, "double") == 0) { } else if (strcmp(type, "double") == 0) {
char buffer[2][256]; char buffer[2][256];
@ -680,10 +678,10 @@ static MethodMatcher* scan_flag_and_value(const char* type, const char* line, in
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type);
} }
} else { } else {
jio_snprintf(errorbuf, sizeof(errorbuf), " Type %s not supported ", type); jio_snprintf(errorbuf, buf_size, " Type %s not supported ", type);
} }
} else { } else {
jio_snprintf(errorbuf, sizeof(errorbuf), " Flag name for type %s should be alphanumeric ", type); jio_snprintf(errorbuf, buf_size, " Flag name for type %s should be alphanumeric ", type);
} }
return NULL; return NULL;
} }

View file

@ -1002,8 +1002,9 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
vmSymbols::throwable_void_signature(), vmSymbols::throwable_void_signature(),
&args); &args);
} else { } else {
if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT) if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT) {
narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL); narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
}
return box((jvalue*) result.get_value_addr(), rtype, THREAD); return box((jvalue*) result.get_value_addr(), rtype, THREAD);
} }
} }

View file

@ -411,10 +411,11 @@ void VMError::report(outputStream* st) {
} }
st->cr(); st->cr();
} else { } else {
if (_message != NULL) if (_message != NULL) {
st->print("# "); st->print("# ");
st->print_cr("%s", _message); st->print_cr("%s", _message);
} }
}
// In error file give some solutions // In error file give some solutions
if (_verbose) { if (_verbose) {
st->print_cr("# Possible reasons:"); st->print_cr("# Possible reasons:");