Mercurial > libavformat.hg
changeset 2193:5ce5fad0dfac libavformat
replace the uses of old string functions that Reimar missed
author | mru |
---|---|
date | Sun, 24 Jun 2007 11:27:12 +0000 |
parents | c97fab0f9803 |
children | b1a13cba29f8 |
files | file.c http.c rtp_h264.c rtpproto.c rtsp.c |
diffstat | 5 files changed, 27 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/file.c Sun Jun 24 07:45:19 2007 +0000 +++ b/file.c Sun Jun 24 11:27:12 2007 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avstring.h" #include <fcntl.h> #include <unistd.h> #include <sys/time.h> @@ -31,7 +32,7 @@ int access; int fd; - strstart(filename, "file:", &filename); + av_strstart(filename, "file:", &filename); if (flags & URL_RDWR) { access = O_CREAT | O_TRUNC | O_RDWR;
--- a/http.c Sun Jun 24 07:45:19 2007 +0000 +++ b/http.c Sun Jun 24 11:27:12 2007 +0000 @@ -63,7 +63,7 @@ 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 @@ 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)
--- a/rtp_h264.c Sun Jun 24 07:45:19 2007 +0000 +++ b/rtp_h264.c Sun Jun 24 11:27:12 2007 +0000 @@ -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 @@ 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 @@ 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 @@ /* 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. }
--- a/rtpproto.c Sun Jun 24 07:45:19 2007 +0000 +++ b/rtpproto.c Sun Jun 24 11:27:12 2007 +0000 @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avstring.h" #include <unistd.h> #include <stdarg.h> @@ -72,11 +73,11 @@ 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); }
--- a/rtsp.c Sun Jun 24 07:45:19 2007 +0000 +++ b/rtsp.c Sun Jun 24 11:27:12 2007 +0000 @@ -80,7 +80,7 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ } } } - } 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 @@ } } } - } 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 @@ /* 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 @@ /* 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 @@ 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; }