The ifx_gl_cv_outbuflen() function
The ifx_gl_cv_outbuflen() function calculates an approximation of the number of bytes required to store a code-set converted multibyte character.
Syntax
#include <ifxgls.h>
...
int ifx_gl_cv_outbuflen(dst_codeset, src_codeset, src_bytes)
char *dst_codeset;
char *src_codeset;
int src_bytes;
- dst_codeset
- A pointer to the name of the destination (target) code set.
- src_codeset
- A pointer to the name of the source code set.
- src_bytes
- The number of bytes in the buffer of multibyte characters to be code-set converted.
Valid in client application | Valid in DataBlade® UDR |
---|---|
Yes | Yes |
Usage
The ifx_gl_cv_outbuflen() function
returns one of the following values:
- The exact number of bytes that a buffer of code-set-converted multibyte characters requires
- A close over-approximation of this number of bytes
Use this function to determine whether code-set conversion of multibyte characters can be performed in place. If the value that this function that returns is not equal to src_bytes, code-set conversion of multibyte characters cannot be performed in place. You must allocate a separate multibyte destination buffer. However, if the value that this function returns is exactly equal to src_bytes, you can perform multibyte code-set conversion in place.
The code sets, src_codeset and dst_codeset,
can be any of the following:
- Locale names
- Code-set names
- The IFX_GL_PROC_CS macro
Return values
- >=0
- The number of bytes required to store multibyte characters of length src_bytes after they have been code-set converted.
- -1
- The function was not successful, and the error number is set to indicate the cause. See the Errors section.
Errors
If an error occurred, this function
returns -1 and sets the ifx_gl_lc_errno() error
number to the following value.
- IFX_GL_FILEERR
- Retrieval of the conversion information for the specified code sets failed. This failure might be due to invalid code-set names, a missing registry file, a missing code-set-conversion object file or one with an incorrect format, or insufficient memory for the code-set-conversion object.