Author: axeld Date: 2009-11-26 20:48:15 +0100 (Thu, 26 Nov 2009) New Revision: 34297 Changeset: http://dev.haiku-os.org/changeset/34297/haiku Modified: haiku/trunk/src/kits/locale/Country.cpp Log: * Fixed broken FormatMonetary() versions which also fixes a warning. Modified: haiku/trunk/src/kits/locale/Country.cpp =================================================================== --- haiku/trunk/src/kits/locale/Country.cpp 2009-11-26 18:54:30 UTC (rev 34296) +++ haiku/trunk/src/kits/locale/Country.cpp 2009-11-26 19:48:15 UTC (rev 34297) @@ -1,7 +1,8 @@ -/* -** Copyright 2003, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2003-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Copyright 2009, Destugues, pulkomandy@xxxxxxxxxx + * Distributed under the terms of the MIT License. + */ #include <Country.h> @@ -425,14 +426,20 @@ BCountry::FormatMonetary(char* string, size_t maxSize, double value) { BString fullString; - FormatMonetary(&fullString, value); - strncpy(string, fullString.String(), maxSize); + ssize_t written = FormatMonetary(&fullString, value); + if (written < 0) + return written; + + return strlcpy(string, fullString.String(), maxSize); } ssize_t BCountry::FormatMonetary(BString* string, double value) { + if (string == NULL) + return B_BAD_VALUE; + UErrorCode err; NumberFormat* numberFormatter = NumberFormat::createCurrencyInstance(*fICULocale, err); @@ -447,7 +454,7 @@ ICUString.toUTF8(stringConverter); - return B_OK; + return string->Length(); }