logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mtext_from_data -

Description

       Allocate a new M-text with specified data. The mtext_from_data() function allocates a new M-text whose
       character sequence is specified by array data of nitems elements.  format specifies the format of data.

       When format is either MTEXT_FORMAT_US_ASCII or MTEXT_FORMAT_UTF_8, the contents of data must be of the
       type unsigned char, and nitems counts by byte.

       When format is either MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE, the contents of data must be of the
       type unsigned short, and nitems counts by unsigned short.

       When format is either MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE, the contents of data must be of the
       type unsigned, and nitems counts by unsigned.

       The character sequence of the M-text is not modifiable.
        The contents of data must not be modified while the M-text is alive.

       The allocated M-text will not be freed unless the user explicitly does so with the m17n_object_unref()
       function. Even in that case, data is not freed.

Errors

           MERROR_MTEXT

Name

       mtext_from_data -

Return Value

           If the operation was successful, mtext_from_data() returns a pointer to the allocated M-text.
           Otherwise it returns NULL and assigns an error code to the external variable merror_code.

Synopsis

MText* mtext_from_data (const void * data, int nitems, enum MTextFormatformat)

See Also