ICU-1109 remove uprv_fillOutputString(), replaced by new function int32_t UnicodeString::extract(UChar *, int32_t, UErrorCode &)

X-SVN-Rev: 5697
This commit is contained in:
Markus Scherer 2001-09-05 23:41:11 +00:00
parent 0844431640
commit 7c6e2b4cef
3 changed files with 0 additions and 49 deletions

View file

@ -108,10 +108,6 @@ SOURCE=.\convert.cpp
# End Source File
# Begin Source File
SOURCE=.\cpputils.cpp
# End Source File
# Begin Source File
SOURCE=.\cstring.c
# End Source File
# Begin Source File

View file

@ -1,35 +0,0 @@
/**********************************************************************
* Copyright (C) 1999-2001, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************/
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "cpputils.h"
/** Simple utility to fill a UChar array from a UnicodeString */
U_CAPI int32_t U_EXPORT2
uprv_fillOutputString(const UnicodeString &temp,
UChar *dest,
int32_t destCapacity,
UErrorCode *status) {
int32_t length = temp.length();
if (destCapacity > 0) {
// copy the contents; extract() will check if it needs to copy anything at all
temp.extract(0, destCapacity, dest, 0);
// zero-terminate the dest buffer if possible
if (length < destCapacity) {
dest[length] = 0;
}
}
// set the error code according to the necessary buffer length
if (length > destCapacity && U_SUCCESS(*status)) {
*status = U_BUFFER_OVERFLOW_ERROR;
}
// return the full string length
return length;
}

View file

@ -17,9 +17,6 @@
#include "unicode/utypes.h"
#include "cmemory.h"
// forward declaration
class UnicodeString;
/*==========================================================================*/
/* Array copy utility functions */
/*==========================================================================*/
@ -57,11 +54,4 @@ uprv_arrayCopy(const UChar *src, int32_t srcStart,
UChar *dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
/** Simple utility to fill a UChar array from a UnicodeString */
U_CAPI int32_t U_EXPORT2
uprv_fillOutputString(const UnicodeString &temp,
UChar *dest,
int32_t destCapacity,
UErrorCode *status);
#endif /* _CPPUTILS */