* Fixed broken FormatMonetary() versions which also fixes a warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34297 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0d70a99f23
commit
c668114b36
@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
* Copyright 2009, Destugues, pulkomandy@gmail.com.
|
||||||
*/
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Country.h>
|
#include <Country.h>
|
||||||
@ -425,14 +426,20 @@ ssize_t
|
|||||||
BCountry::FormatMonetary(char* string, size_t maxSize, double value)
|
BCountry::FormatMonetary(char* string, size_t maxSize, double value)
|
||||||
{
|
{
|
||||||
BString fullString;
|
BString fullString;
|
||||||
FormatMonetary(&fullString, value);
|
ssize_t written = FormatMonetary(&fullString, value);
|
||||||
strncpy(string, fullString.String(), maxSize);
|
if (written < 0)
|
||||||
|
return written;
|
||||||
|
|
||||||
|
return strlcpy(string, fullString.String(), maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
BCountry::FormatMonetary(BString* string, double value)
|
BCountry::FormatMonetary(BString* string, double value)
|
||||||
{
|
{
|
||||||
|
if (string == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
UErrorCode err;
|
UErrorCode err;
|
||||||
NumberFormat* numberFormatter
|
NumberFormat* numberFormatter
|
||||||
= NumberFormat::createCurrencyInstance(*fICULocale, err);
|
= NumberFormat::createCurrencyInstance(*fICULocale, err);
|
||||||
@ -447,7 +454,7 @@ BCountry::FormatMonetary(BString* string, double value)
|
|||||||
|
|
||||||
ICUString.toUTF8(stringConverter);
|
ICUString.toUTF8(stringConverter);
|
||||||
|
|
||||||
return B_OK;
|
return string->Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user