FFmpeg
urldecode.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFORMAT_URLDECODE_H
20 #define AVFORMAT_URLDECODE_H
21 
22 #include <stddef.h>
23 
24 /**
25  * Decodes an URL from its percent-encoded form back into normal
26  * representation. This function returns the decoded URL in a string.
27  * The URL to be decoded does not necessarily have to be encoded but
28  * in that case the original string is duplicated.
29  *
30  * @param url a string to be decoded.
31  * @param decode_plus_sign if nonzero plus sign is decoded to space
32  * @return new string with the URL decoded or NULL if decoding failed.
33  * Note that the returned string should be explicitly freed when not
34  * used anymore.
35  */
36 char *ff_urldecode(const char *url, int decode_plus_sign);
37 
38 /**
39  * Decodes an URL from its percent-encoded form back into normal
40  * representation. This function returns the decoded URL in a string.
41  * The URL to be decoded does not necessarily have to be encoded but
42  * in that case the original string is duplicated.
43  *
44  * @param dest the destination buffer.
45  * @param dest_len the maximum available space in the destination buffer.
46  * Must be bigger than FFMIN(strlen(url), url_max_len) to avoid
47  * an AVERROR(EINVAL) result
48  * @param url_max_len the maximum number of chars to read from url
49  * @param decode_plus_sign if nonzero plus sign is decoded to space
50  * @return the number of written bytes to dest excluding the zero terminator,
51  * negative on error
52  */
53 int ff_urldecode_len(char *dest, size_t dest_len, const char *url, size_t url_max_len, int decode_plus_sign);
54 #endif /* AVFORMAT_URLDECODE_H */
ff_urldecode
char * ff_urldecode(const char *url, int decode_plus_sign)
Decodes an URL from its percent-encoded form back into normal representation.
Definition: urldecode.c:80
ff_urldecode_len
int ff_urldecode_len(char *dest, size_t dest_len, const char *url, size_t url_max_len, int decode_plus_sign)
Decodes an URL from its percent-encoded form back into normal representation.
Definition: urldecode.c:99