From f7d78f3654f8181fb889000dfc2b9a91ca85e418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Sun, 24 Jun 2007 11:27:12 +0000 Subject: replace the uses of old string functions that Reimar missed Originally committed as revision 9406 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/file.c | 3 ++- libavformat/http.c | 4 ++-- libavformat/rtp_h264.c | 7 ++++--- libavformat/rtpproto.c | 7 ++++--- libavformat/rtsp.c | 30 +++++++++++++++--------------- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'libavformat') diff --git a/libavformat/file.c b/libavformat/file.c index 3caf80a61b..7acf446133 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avstring.h" #include #include #include @@ -31,7 +32,7 @@ static int file_open(URLContext *h, const char *filename, int flags) int access; int fd; - strstart(filename, "file:", &filename); + av_strstart(filename, "file:", &filename); if (flags & URL_RDWR) { access = O_CREAT | O_TRUNC | O_RDWR; diff --git a/libavformat/http.c b/libavformat/http.c index 6acf094443..0d9591e3a6 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -63,7 +63,7 @@ static int http_open_cnx(URLContext *h) proxy_path = getenv("http_proxy"); use_proxy = (proxy_path != NULL) && !getenv("no_proxy") && - strstart(proxy_path, "http://", NULL); + av_strstart(proxy_path, "http://", NULL); /* fill the dest addr */ redo: @@ -126,7 +126,7 @@ static int http_open(URLContext *h, const char *uri, int flags) h->priv_data = s; s->filesize = -1; s->off = 0; - pstrcpy (s->location, URL_SIZE, uri); + av_strlcpy(s->location, uri, URL_SIZE); ret = http_open_cnx(h); if (ret != 0) diff --git a/libavformat/rtp_h264.c b/libavformat/rtp_h264.c index 564424d5d3..0b8853072f 100644 --- a/libavformat/rtp_h264.c +++ b/libavformat/rtp_h264.c @@ -47,6 +47,7 @@ #include "rtp_internal.h" #include "rtp_h264.h" #include "base64.h" +#include "avstring.h" /** RTP/H264 specific private data. @@ -357,7 +358,7 @@ static int parse_h264_sdp_line(AVStream * stream, void *data, assert(h264_data->cookie == MAGIC_COOKIE); - if (strstart(p, "framesize:", &p)) { + if (av_strstart(p, "framesize:", &p)) { char buf1[50]; char *dst = buf1; @@ -375,7 +376,7 @@ static int parse_h264_sdp_line(AVStream * stream, void *data, codec->width = atoi(buf1); codec->height = atoi(p + 1); // skip the - codec->pix_fmt = PIX_FMT_YUV420P; - } else if (strstart(p, "fmtp:", &p)) { + } else if (av_strstart(p, "fmtp:", &p)) { char attr[256]; char value[4096]; @@ -390,7 +391,7 @@ static int parse_h264_sdp_line(AVStream * stream, void *data, /* grab the codec extra_data from the config parameter of the fmtp line */ sdp_parse_fmtp_config_h264(stream, h264_data, attr, value); } - } else if (strstart(p, "cliprect:", &p)) { + } else if (av_strstart(p, "cliprect:", &p)) { // could use this if we wanted. } diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 73f07c6ccd..f56b63f534 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avstring.h" #include #include @@ -72,11 +73,11 @@ static void url_add_option(char *buf, int buf_size, const char *fmt, ...) va_start(ap, fmt); if (strchr(buf, '?')) - pstrcat(buf, buf_size, "&"); + av_strlcat(buf, "&", buf_size); else - pstrcat(buf, buf_size, "?"); + av_strlcat(buf, "?", buf_size); vsnprintf(buf1, sizeof(buf1), fmt, ap); - pstrcat(buf, buf_size, buf1); + av_strlcat(buf, buf1, buf_size); va_end(ap); } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 05349ab2ac..3a3ffbd13d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -80,7 +80,7 @@ int rtsp_default_protocols = (1 << RTSP_PROTOCOL_RTP_UDP); static int rtsp_probe(AVProbeData *p) { - if (strstart(p->filename, "rtsp:", NULL)) + if (av_strstart(p->filename, "rtsp:", NULL)) return AVPROBE_SCORE_MAX; return 0; } @@ -338,7 +338,7 @@ static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) char buf[256]; skip_spaces(&p); - if (!stristart(p, "npt=", &p)) + if (!av_stristart(p, "npt=", &p)) return; *start = AV_NOPTS_VALUE; @@ -460,7 +460,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, av_strlcpy(rtsp_st->control_url, s->filename, sizeof(rtsp_st->control_url)); break; case 'a': - if (strstart(p, "control:", &p) && s->nb_streams > 0) { + if (av_strstart(p, "control:", &p) && s->nb_streams > 0) { char proto[32]; /* get the control url */ st = s->streams[s->nb_streams - 1]; @@ -475,7 +475,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } else { av_strlcpy(rtsp_st->control_url, p, sizeof(rtsp_st->control_url)); } - } else if (strstart(p, "rtpmap:", &p)) { + } else if (av_strstart(p, "rtpmap:", &p)) { /* NOTE: rtpmap is only supported AFTER the 'm=' tag */ get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); @@ -486,7 +486,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, sdp_parse_rtpmap(st->codec, rtsp_st, payload_type, p); } } - } else if (strstart(p, "fmtp:", &p)) { + } else if (av_strstart(p, "fmtp:", &p)) { /* NOTE: fmtp is only supported AFTER the 'a=rtpmap:xxx' tag */ get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); @@ -503,7 +503,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } } } - } else if(strstart(p, "framesize:", &p)) { + } else if(av_strstart(p, "framesize:", &p)) { // let dynamic protocol handlers have a stab at the line. get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); @@ -516,7 +516,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } } } - } else if(strstart(p, "range:", &p)) { + } else if(av_strstart(p, "range:", &p)) { int64_t start, end; // this is so that seeking on a streamed file can work. @@ -683,15 +683,15 @@ void rtsp_parse_line(RTSPHeader *reply, const char *buf) /* NOTE: we do case independent match for broken servers */ p = buf; - if (stristart(p, "Session:", &p)) { + if (av_stristart(p, "Session:", &p)) { get_word_sep(reply->session_id, sizeof(reply->session_id), ";", &p); - } else if (stristart(p, "Content-Length:", &p)) { + } else if (av_stristart(p, "Content-Length:", &p)) { reply->content_length = strtol(p, NULL, 10); - } else if (stristart(p, "Transport:", &p)) { + } else if (av_stristart(p, "Transport:", &p)) { rtsp_parse_transport(reply, p); - } else if (stristart(p, "CSeq:", &p)) { + } else if (av_stristart(p, "CSeq:", &p)) { reply->seq = strtol(p, NULL, 10); - } else if (stristart(p, "Range:", &p)) { + } else if (av_stristart(p, "Range:", &p)) { rtsp_parse_range_npt(p, &reply->range_start, &reply->range_end); } } @@ -1327,7 +1327,7 @@ static int sdp_probe(AVProbeData *p1) /* we look for a line beginning "c=IN IP4" */ while (p < p_end && *p != '\0') { - if (p + sizeof("c=IN IP4") - 1 < p_end && strstart(p, "c=IN IP4", NULL)) + if (p + sizeof("c=IN IP4") - 1 < p_end && av_strstart(p, "c=IN IP4", NULL)) return AVPROBE_SCORE_MAX / 2; while(p < p_end - 1 && *p != '\n') p++; @@ -1432,8 +1432,8 @@ static int redir_probe(AVProbeData *pd) p = pd->buf; while (redir_isspace(*p)) p++; - if (strstart(p, "http://", NULL) || - strstart(p, "rtsp://", NULL)) + if (av_strstart(p, "http://", NULL) || + av_strstart(p, "rtsp://", NULL)) return AVPROBE_SCORE_MAX; return 0; } -- cgit v1.2.3