annotate avstring.h @ 819:1672d4566595 libavutil

Make DECLARE_ALIGNED macros work with external array specifiers The macro implementation might need the name of the variable being declared for compiler-specific syntax. Moving array specifiers outside the macro invocation allows this to work.
author mru
date Thu, 21 Jan 2010 12:59:22 +0000
parents 197e6e41f46f
children 5dc6729a3b4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
1 /*
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
2 * Copyright (c) 2007 Mans Rullgard
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
3 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
5 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
10 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
15 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
19 */
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
20
567
bd4052d9050c Globally rename the header inclusion guard names.
stefano
parents: 392
diff changeset
21 #ifndef AVUTIL_AVSTRING_H
bd4052d9050c Globally rename the header inclusion guard names.
stefano
parents: 392
diff changeset
22 #define AVUTIL_AVSTRING_H
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
23
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
24 #include <stddef.h>
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
25
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
26 /**
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
27 * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
28 * the address of the first character in str after the prefix.
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
29 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
30 * @param str input string
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
31 * @param pfx prefix to test
637
683a6dbdd2b2 spelling/grammar/consistency review part III
diego
parents: 633
diff changeset
32 * @param ptr updated if the prefix is matched inside str
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
33 * @return non-zero if the prefix matches, zero otherwise
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
34 */
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
35 int av_strstart(const char *str, const char *pfx, const char **ptr);
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
36
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
37 /**
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
38 * Return non-zero if pfx is a prefix of str independent of case. If
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
39 * it is, *ptr is set to the address of the first character in str
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
40 * after the prefix.
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
41 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
42 * @param str input string
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
43 * @param pfx prefix to test
637
683a6dbdd2b2 spelling/grammar/consistency review part III
diego
parents: 633
diff changeset
44 * @param ptr updated if the prefix is matched inside str
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
45 * @return non-zero if the prefix matches, zero otherwise
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
46 */
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
47 int av_stristart(const char *str, const char *pfx, const char **ptr);
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
48
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
49 /**
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
50 * Copy the string src to dst, but no more than size - 1 bytes, and
633
8c48a1b999a3 spelling/grammar/consistency review part I
diego
parents: 567
diff changeset
51 * null-terminate dst.
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
52 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
53 * This function is the same as BSD strlcpy().
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
54 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
55 * @param dst destination buffer
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
56 * @param src source string
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
57 * @param size size of destination buffer
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
58 * @return the length of src
778
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
59 *
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
60 * WARNING: since the return value is the length of src, src absolutely
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
61 * _must_ be a properly 0-terminated string, otherwise this will read beyond
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
62 * the end of the buffer and possibly crash.
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
63 */
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
64 size_t av_strlcpy(char *dst, const char *src, size_t size);
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
65
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
66 /**
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
67 * Append the string src to the string dst, but to a total length of
633
8c48a1b999a3 spelling/grammar/consistency review part I
diego
parents: 567
diff changeset
68 * no more than size - 1 bytes, and null-terminate dst.
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
69 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
70 * This function is similar to BSD strlcat(), but differs when
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
71 * size <= strlen(dst).
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
72 *
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
73 * @param dst destination buffer
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
74 * @param src source string
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
75 * @param size size of destination buffer
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
76 * @return the total length of src and dst
778
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
77 *
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
78 * WARNING: since the return value use the length of src and dst, these absolutely
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
79 * _must_ be a properly 0-terminated strings, otherwise this will read beyond
81aecbb6bbb2 Add warnings to av_strlcat and av_strlcpy doxygen that the input strings
reimar
parents: 637
diff changeset
80 * the end of the buffer and possibly crash.
347
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
81 */
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
82 size_t av_strlcat(char *dst, const char *src, size_t size);
2fb35d82b0bd add some string functions
mru
parents:
diff changeset
83
369
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
84 /**
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
85 * Append output to a string, according to a format. Never write out of
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
86 * the destination buffer, and and always put a terminating 0 within
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
87 * the buffer.
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
88 * @param dst destination buffer (string to which the output is
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
89 * appended)
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
90 * @param size total size of the destination buffer
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
91 * @param fmt printf-compatible format string, specifying how the
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
92 * following parameters are used
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
93 * @return the length of the string that would have been generated
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
94 * if enough space had been available
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
95 */
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
96 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...);
2cd0add8ac0c Implement av_strlcatf(): a strlcat which adds a printf style formatted string
lucabe
parents: 347
diff changeset
97
799
cb32a271f4cd Add a function to convert a number to a av_malloced string.
michael
parents: 778
diff changeset
98 /**
cb32a271f4cd Add a function to convert a number to a av_malloced string.
michael
parents: 778
diff changeset
99 * Convert a number to a av_malloced string.
cb32a271f4cd Add a function to convert a number to a av_malloced string.
michael
parents: 778
diff changeset
100 */
cb32a271f4cd Add a function to convert a number to a av_malloced string.
michael
parents: 778
diff changeset
101 char *av_d2str(double d);
cb32a271f4cd Add a function to convert a number to a av_malloced string.
michael
parents: 778
diff changeset
102
567
bd4052d9050c Globally rename the header inclusion guard names.
stefano
parents: 392
diff changeset
103 #endif /* AVUTIL_AVSTRING_H */