ICU-388 and jb 853: ucnv_safeClone

X-SVN-Rev: 3656
This commit is contained in:
Jim Snyder Grant 2001-02-16 22:21:14 +00:00
parent 7f249bec73
commit 2a17db6667

View file

@ -263,6 +263,32 @@ ucnv_openCCSID (int32_t codepage,
UConverterPlatform platform,
UErrorCode * err);
/**
* Thread safe cloning operation
* @param cnv converter to be cloned
* @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated.
If buffer is not large enough, new memory will be allocated.
Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations.
* @param pBufferSize pointer to size of allocated space.
If *pBufferSize == 0, a sufficient size for use in cloning will
be returned ('pre-flighting')
If *pBufferSize is not enough for a stack-based safe clone,
new memory will be allocated.
* @param status to indicate whether the operation went on smoothly or there were errors
An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary.
* @return pointer to the new clone
* @draft API 1.8 freeze
*/
U_CAPI UConverter *
ucnv_safeClone(
const UConverter *cnv,
void *stackBuffer,
int32_t *pBufferSize,
UErrorCode *status);
#define U_CNV_SAFECLONE_BUFFERSIZE 512
/**
* Deletes the unicode converter and releases resources associated
* with just this instance.
@ -275,6 +301,9 @@ ucnv_openCCSID (int32_t codepage,
* @stable
*/
U_CAPI void U_EXPORT2
ucnv_close (UConverter * converter);