Logo Search packages:      
Sourcecode: inkscape version File versions

enum CRStatus cr_utils_utf8_str_to_ucs1 ( const guchar *  a_in,
gulong *  a_in_len,
guchar **  a_out,
gulong *  a_out_len 
)

Converts an utf8 buffer into an ucs1 buffer.

Parameters:
a_in_start the start of the input buffer.
a_in_end the end of the input buffer.
a_out out parameter. The resulting converted ucs4 buffer. Must be freed by the caller.
a_out_len out parameter. The length of the converted buffer.
Returns:
CR_OK upon successfull completion, an error code otherwise. Note that out parameters are valid if and only if this function returns CR_OK.

Definition at line 1155 of file cr-utils.c.

{
        enum CRStatus status = CR_OK;

        g_return_val_if_fail (a_in && a_in_len
                              && a_out && a_out_len, CR_BAD_PARAM_ERROR);

        if (*a_in_len < 1) {
                *a_out_len = 0;
                *a_out = NULL;
                return CR_OK;
        }

        status = cr_utils_utf8_str_len_as_ucs4 (a_in, &a_in[*a_in_len - 1],
                                                a_out_len);

        g_return_val_if_fail (status == CR_OK, status);

        *a_out = (guchar *) g_malloc0 (*a_out_len * sizeof (guint32));

        status = cr_utils_utf8_to_ucs1 (a_in, a_in_len, *a_out, a_out_len);
        return status;
}


Generated by  Doxygen 1.6.0   Back to index