Re: API change proposal: ucurr_forLocale

Vladimir Weinstein <[email protected]> Tue, 11 Nov 2003 15:51:33 -0800
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
My motivation is to reduce the changes to the user's code. The API should indeed 
return the result length for the consistency.

Thank you.

Regards,
v.

Markus Scherer wrote:

> Vladimir Weinstein wrote:
> 
>>  * @return pointer to the buffer containing the currency code.
>>  * @draft ICU 2.8
>>  */
>> U_CAPI UChar* U_EXPORT2
>> ucurr_forLocale(const char* locale,
>>         UChar* buffer,
>>         int32_t bufferCapacity,
>>                 UErrorCode* ec);
> 
> 
> The new signature should return the int32_t result length instead of the 
> UChar *buffer. Even though this means more changes where this function 
> is used (rarely), it does not make sense to have this one function work 
> differently from all others in ICU where we write into fill-in buffers.
> 
> See "Using C Strings: NUL-Terminated vs. Length Parameters"/"Output 
> string" in http://oss.software.ibm.com/icu/userguide/strings.html
> 
> markus
> 
> _______________________________________________
> icu mailing list
> [email protected]
> http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu
> 

-- 
Vladimir Weinstein, IBM GCoC-Unicode/ICU  San Jose, CA [email protected]