~ppsspp/ppsspp/ffmpeg

« back to all changes in this revision

Viewing changes to libavutil/avstring.h

  • Committer: Henrik Rydgård
  • Date: 2014-01-03 10:44:32 UTC
  • Revision ID: git-v1:87c6c126784b1718bfa448ecf2e6a9fef781eb4e
Update our ffmpeg snapshot to a clone of the official repository.

This is because Maxim's at3plus support has been officially merged!

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#define AVUTIL_AVSTRING_H
23
23
 
24
24
#include <stddef.h>
 
25
#include <stdint.h>
25
26
#include "attributes.h"
26
27
 
27
28
/**
131
132
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
132
133
 
133
134
/**
 
135
 * Get the count of continuous non zero chars starting from the beginning.
 
136
 *
 
137
 * @param len maximum number of characters to check in the string, that
 
138
 *            is the maximum value which is returned by the function
 
139
 */
 
140
static inline size_t av_strnlen(const char *s, size_t len)
 
141
{
 
142
    size_t i;
 
143
    for (i = 0; i < len && s[i]; i++)
 
144
        ;
 
145
    return i;
 
146
}
 
147
 
 
148
/**
134
149
 * Print arguments following specified format into a large enough auto
135
150
 * allocated buffer. It is similar to GNU asprintf().
136
151
 * @param fmt printf-compatible format string, specifying how the
295
310
int av_escape(char **dst, const char *src, const char *special_chars,
296
311
              enum AVEscapeMode mode, int flags);
297
312
 
 
313
#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES          1 ///< accept codepoints over 0x10FFFF
 
314
#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS             2 ///< accept non-characters - 0xFFFE and 0xFFFF
 
315
#define AV_UTF8_FLAG_ACCEPT_SURROGATES                 4 ///< accept UTF-16 surrogates codes
 
316
#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML
 
317
 
 
318
#define AV_UTF8_FLAG_ACCEPT_ALL \
 
319
    AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES
 
320
 
 
321
/**
 
322
 * Read and decode a single UTF-8 code point (character) from the
 
323
 * buffer in *buf, and update *buf to point to the next byte to
 
324
 * decode.
 
325
 *
 
326
 * In case of an invalid byte sequence, the pointer will be updated to
 
327
 * the next byte after the invalid sequence and the function will
 
328
 * return an error code.
 
329
 *
 
330
 * Depending on the specified flags, the function will also fail in
 
331
 * case the decoded code point does not belong to a valid range.
 
332
 *
 
333
 * @note For speed-relevant code a carefully implemented use of
 
334
 * GET_UTF8() may be preferred.
 
335
 *
 
336
 * @param codep   pointer used to return the parsed code in case of success.
 
337
 *                The value in *codep is set even in case the range check fails.
 
338
 * @param bufp    pointer to the address the first byte of the sequence
 
339
 *                to decode, updated by the function to point to the
 
340
 *                byte next after the decoded sequence
 
341
 * @param buf_end pointer to the end of the buffer, points to the next
 
342
 *                byte past the last in the buffer. This is used to
 
343
 *                avoid buffer overreads (in case of an unfinished
 
344
 *                UTF-8 sequence towards the end of the buffer).
 
345
 * @param flags   a collection of AV_UTF8_FLAG_* flags
 
346
 * @return >= 0 in case a sequence was successfully read, a negative
 
347
 * value in case of invalid sequence
 
348
 */
 
349
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
 
350
                   unsigned int flags);
 
351
 
298
352
/**
299
353
 * @}
300
354
 */