Skip to content
Snippets Groups Projects
Commit 3e2461f0 authored by Tinny Ng's avatar Tinny Ng
Browse files

Starting ICU 2.0, all ICU String functions have consistent NUL-termination...

Starting ICU 2.0, all ICU String functions have consistent NUL-termination behavior.  The returned length is always the number of output UChar's, not counting an additional, terminating Null.


git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173303 13f79535-47bb-0310-9956-ffa450edef68
parent 0727fe97
No related branches found
No related tags found
No related merge requests found
......@@ -791,8 +791,14 @@ unsigned int ICULCPTranscoder::calcRequiredSize(const char* const srcText)
if (err != U_BUFFER_OVERFLOW_ERROR)
return 0;
#if (U_ICU_VERSION_MAJOR_NUM < 2)
// Subtract one since it includes the terminator space
return (unsigned int)(targetCap - 1);
#else
// Starting ICU 2.0, this is fixed and all ICU String functions have consistent NUL-termination behavior.
// The returned length is always the number of output UChar's, not counting an additional, terminating NUL.
return (unsigned int)(targetCap);
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment