mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-5254 Fix for MinGW
X-SVN-Rev: 20078
This commit is contained in:
parent
90d0e2bd5b
commit
8e5113cc62
2 changed files with 21 additions and 8 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "unicode/ustring.h"
|
||||
|
||||
#include "cmemory.h"
|
||||
#include "uassert.h"
|
||||
#include "locmap.h"
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
|
@ -234,11 +235,16 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
|
|||
|
||||
nBuffer[0] = 0x0000;
|
||||
|
||||
/* Due to the arguments causing a result to be <= 23 characters (+2 for NULL and minus),
|
||||
we don't need to reallocate the buffer. */
|
||||
va_start(args, fmt);
|
||||
result = _vsnwprintf(nBuffer, STACK_BUFFER_SIZE, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (result < 0) {
|
||||
/* Just to make sure of the above statement, we add this assert */
|
||||
U_ASSERT(result >=0);
|
||||
// The following code is not used because _vscwprintf isn't available on MinGW at the moment.
|
||||
/*if (result < 0) {
|
||||
int newLength;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
@ -250,7 +256,7 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
|
|||
va_start(args, fmt);
|
||||
result = _vsnwprintf(nBuffer, newLength + 1, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}*/
|
||||
|
||||
// vswprintf is sensitive to the locale set by setlocale. For some locales
|
||||
// it doesn't use "." as the decimal separator, which is what GetNumberFormatW
|
||||
|
@ -325,9 +331,9 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
|
|||
DELETE_ARRAY(buffer);
|
||||
}
|
||||
|
||||
if (nBuffer != nStackBuffer) {
|
||||
/*if (nBuffer != nStackBuffer) {
|
||||
DELETE_ARRAY(nBuffer);
|
||||
}
|
||||
}*/
|
||||
|
||||
return appendTo;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "cstring.h"
|
||||
#include "locmap.h"
|
||||
#include "wintz.h"
|
||||
#include "uassert.h"
|
||||
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define VC_EXTRALEAN
|
||||
|
@ -137,11 +138,16 @@ static UnicodeString &getWindowsFormat(int32_t lcid, UBool currency, UnicodeStri
|
|||
|
||||
nBuffer[0] = 0x0000;
|
||||
|
||||
/* Due to the arguments causing a result to be <= 23 characters (+2 for NULL and minus),
|
||||
we don't need to reallocate the buffer. */
|
||||
va_start(args, fmt);
|
||||
result = _vsnwprintf(nBuffer, STACK_BUFFER_SIZE, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (result < 0) {
|
||||
/* Just to make sure of the above statement, we add this assert */
|
||||
U_ASSERT(result >=0);
|
||||
// The following code is not used because _vscwprintf isn't available on MinGW at the moment.
|
||||
/*if (result < 0) {
|
||||
int newLength;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
@ -153,7 +159,8 @@ static UnicodeString &getWindowsFormat(int32_t lcid, UBool currency, UnicodeStri
|
|||
va_start(args, fmt);
|
||||
result = _vsnwprintf(nBuffer, newLength + 1, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// vswprintf is sensitive to the locale set by setlocale. For some locales
|
||||
// it doesn't use "." as the decimal separator, which is what GetNumberFormatW
|
||||
|
@ -212,9 +219,9 @@ static UnicodeString &getWindowsFormat(int32_t lcid, UBool currency, UnicodeStri
|
|||
DELETE_ARRAY(buffer);
|
||||
}
|
||||
|
||||
if (nBuffer != nStackBuffer) {
|
||||
/*if (nBuffer != nStackBuffer) {
|
||||
DELETE_ARRAY(nBuffer);
|
||||
}
|
||||
}*/
|
||||
|
||||
return appendTo;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue