8196882: VS2017 Hotspot Defined vsnprintf Function Causes C2084 Already Defined Compilation Error

Add os::vsnprintf and os::snprintf.

Reviewed-by: lfoltan, stuefe, mlarsson
This commit is contained in:
Kim Barrett 2018-02-27 18:17:57 -05:00
parent f2c21c058d
commit d2ce0ae7d4
12 changed files with 193 additions and 50 deletions

View file

@ -331,8 +331,15 @@ char* os::reserve_memory_aligned(size_t size, size_t alignment, int file_desc) {
return aligned_base;
}
int os::log_vsnprintf(char* buf, size_t len, const char* fmt, va_list args) {
return vsnprintf(buf, len, fmt, args);
int os::vsnprintf(char* buf, size_t len, const char* fmt, va_list args) {
// All supported POSIX platforms provide C99 semantics.
int result = ::vsnprintf(buf, len, fmt, args);
// If an encoding error occurred (result < 0) then it's not clear
// whether the buffer is NUL terminated, so ensure it is.
if ((result < 0) && (len > 0)) {
buf[len - 1] = '\0';
}
return result;
}
int os::get_fileno(FILE* fp) {