From 2c82cdf9962fbfe7092fa133c359ccc243c4ddbf Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Wed, 28 May 2014 18:03:07 -0700 Subject: [PATCH] Fix for {.0f} precision in plFormat() --- Sources/Plasma/CoreLib/plFormat.cpp | 2 +- Sources/Plasma/CoreLib/plFormat.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/CoreLib/plFormat.cpp b/Sources/Plasma/CoreLib/plFormat.cpp index b7554598..8122166f 100644 --- a/Sources/Plasma/CoreLib/plFormat.cpp +++ b/Sources/Plasma/CoreLib/plFormat.cpp @@ -406,7 +406,7 @@ PL_FORMAT_IMPL(double) size_t end = 0; format_buffer[end++] = '%'; - if (format.fPrecision) { + if (format.fPrecision >= 0) { int count = snprintf(format_buffer + end, arrsize(format_buffer) - end, ".%d", format.fPrecision); diff --git a/Sources/Plasma/CoreLib/plFormat.h b/Sources/Plasma/CoreLib/plFormat.h index a3901b01..add69600 100644 --- a/Sources/Plasma/CoreLib/plFormat.h +++ b/Sources/Plasma/CoreLib/plFormat.h @@ -115,7 +115,7 @@ namespace plFormat_Private struct FormatSpec { int fMinimumLength = 0; /**< Requested minimum padding length */ - int fPrecision = 0; /**< Requested precision for floating-point */ + int fPrecision = -1; /**< Requested precision for floating-point */ char fPadChar = 0; /**< Explicit padding char (default is space) */ Alignment fAlignment = kAlignDefault; /**< Requested pad alignment */