src/share/vm/utilities/ostream.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/share/vm/utilities/ostream.cpp
src/share/vm/utilities/ostream.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 82,91 ****
--- 82,93 ----
}
}
// Execute a vsprintf, using the given buffer if necessary.
// Return a pointer to the formatted string.
+ PRAGMA_DIAG_PUSH
+ PRAGMA_FORMAT_NONLITERAL_IGNORED
const char* outputStream::do_vsnprintf(char* buffer, size_t buflen,
const char* format, va_list ap,
bool add_cr,
size_t& result_len) {
const char* result;
*** 117,137 ****
--- 119,142 ----
buffer[result_len++] = '\n';
buffer[result_len] = 0;
}
return result;
}
+ PRAGMA_DIAG_POP
+ ATTRIBUTE_PRINTF(2, 3)
void outputStream::print(const char* format, ...) {
char buffer[O_BUFLEN];
va_list ap;
va_start(ap, format);
size_t len;
const char* str = do_vsnprintf(buffer, O_BUFLEN, format, ap, false, len);
write(str, len);
va_end(ap);
}
+ ATTRIBUTE_PRINTF(2, 3)
void outputStream::print_cr(const char* format, ...) {
char buffer[O_BUFLEN];
va_list ap;
va_start(ap, format);
size_t len;
*** 145,160 ****
--- 150,168 ----
size_t len;
const char* str = do_vsnprintf(buffer, O_BUFLEN, format, argptr, false, len);
write(str, len);
}
+ PRAGMA_DIAG_PUSH
+ PRAGMA_FORMAT_NONLITERAL_IGNORED
void outputStream::vprint_cr(const char* format, va_list argptr) {
char buffer[O_BUFLEN];
size_t len;
const char* str = do_vsnprintf(buffer, O_BUFLEN, format, argptr, true, len);
write(str, len);
}
+ PRAGMA_DIAG_POP
void outputStream::fill_to(int col) {
int need_fill = col - position();
sp(need_fill);
}
*** 266,276 ****
*/
void outputStream::print_data(void* data, size_t len, bool with_ascii) {
size_t limit = (len + 16) / 16 * 16;
for (size_t i = 0; i < limit; ++i) {
if (i % 16 == 0) {
! indent().print("%07x:", i);
}
if (i % 2 == 0) {
print(" ");
}
if (i < len) {
--- 274,284 ----
*/
void outputStream::print_data(void* data, size_t len, bool with_ascii) {
size_t limit = (len + 16) / 16 * 16;
for (size_t i = 0; i < limit; ++i) {
if (i % 16 == 0) {
! indent().print(PTR_FORMAT_W(07)":", i);
}
if (i % 2 == 0) {
print(" ");
}
if (i < len) {
*** 287,297 ****
char c = ((char*)data)[idx];
print("%c", c >= 32 && c <= 126 ? c : '.');
}
}
}
! print_cr("");
}
}
}
stringStream::stringStream(size_t initial_size) : outputStream() {
--- 295,305 ----
char c = ((char*)data)[idx];
print("%c", c >= 32 && c <= 126 ? c : '.');
}
}
}
! cr();
}
}
}
stringStream::stringStream(size_t initial_size) : outputStream() {
*** 604,614 ****
// dump vm version, os version, platform info, build id,
// memory usage and command line flags into header
void gcLogFileStream::dump_loggc_header() {
if (is_open()) {
! print_cr(Abstract_VM_Version::internal_vm_info_string());
os::print_memory_info(this);
print("CommandLine flags: ");
CommandLineFlags::printSetFlags(this);
}
}
--- 612,622 ----
// dump vm version, os version, platform info, build id,
// memory usage and command line flags into header
void gcLogFileStream::dump_loggc_header() {
if (is_open()) {
! print_raw_cr(Abstract_VM_Version::internal_vm_info_string());
os::print_memory_info(this);
print("CommandLine flags: ");
CommandLineFlags::printSetFlags(this);
}
}
*** 685,695 ****
jio_snprintf(time_msg, sizeof(time_msg), "File %s rotated at %s\n",
_file_name, os::local_time_string((char *)time_str, sizeof(time_str)));
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print(time_msg);
}
dump_loggc_header();
return;
}
--- 693,703 ----
jio_snprintf(time_msg, sizeof(time_msg), "File %s rotated at %s\n",
_file_name, os::local_time_string((char *)time_str, sizeof(time_str)));
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print_raw(time_msg);
}
dump_loggc_header();
return;
}
*** 718,728 ****
os::local_time_string((char *)time_str, sizeof(time_str)),
msg, renamed_file_name);
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print(time_msg);
}
fclose(_file);
_file = NULL;
--- 726,736 ----
os::local_time_string((char *)time_str, sizeof(time_str)),
msg, renamed_file_name);
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print_raw(time_msg);
}
fclose(_file);
_file = NULL;
*** 763,773 ****
os::local_time_string((char *)time_str, sizeof(time_str)),
current_file_name);
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print(time_msg);
}
dump_loggc_header();
// remove the existing file
if (access(current_file_name, F_OK) == 0) {
--- 771,781 ----
os::local_time_string((char *)time_str, sizeof(time_str)),
current_file_name);
write(time_msg, strlen(time_msg));
if (out != NULL) {
! out->print_raw(time_msg);
}
dump_loggc_header();
// remove the existing file
if (access(current_file_name, F_OK) == 0) {
src/share/vm/utilities/ostream.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File