All current usages of it are incompatible with localization.
For example strcasecmp("i", "I") != 0 is possible, but would
break many of the places where it is used.
Instead use our own implementations that always treat the data
as ASCII.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
tags/n0.9
| @@ -13,6 +13,9 @@ libavutil: 2011-04-18 | |||||
| API changes, most recent first: | API changes, most recent first: | ||||
| 2011-11-03 - xxxxxxx - lavu 51.23.0 | |||||
| Add av_strcasecmp() and av_strncasecmp() to avstring.h. | |||||
| 2011-10-20 - b35e9e1 - lavu 51.22.0 | 2011-10-20 - b35e9e1 - lavu 51.22.0 | ||||
| Add av_strtok() to avstring.h. | Add av_strtok() to avstring.h. | ||||
| @@ -44,13 +44,13 @@ | |||||
| #include <linux/videodev2.h> | #include <linux/videodev2.h> | ||||
| #endif | #endif | ||||
| #include <time.h> | #include <time.h> | ||||
| #include <strings.h> | |||||
| #include "libavutil/imgutils.h" | #include "libavutil/imgutils.h" | ||||
| #include "libavutil/log.h" | #include "libavutil/log.h" | ||||
| #include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
| #include "avdevice.h" | #include "avdevice.h" | ||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "libavutil/pixdesc.h" | #include "libavutil/pixdesc.h" | ||||
| #include "libavutil/avstring.h" | |||||
| static const int desired_video_buffers = 256; | static const int desired_video_buffers = 256; | ||||
| @@ -470,7 +470,7 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) | |||||
| for (i = 0;; i++) { | for (i = 0;; i++) { | ||||
| standard.index = i; | standard.index = i; | ||||
| ret = ioctl(s->fd, VIDIOC_ENUMSTD, &standard); | ret = ioctl(s->fd, VIDIOC_ENUMSTD, &standard); | ||||
| if (ret < 0 || !strcasecmp(standard.name, s->standard)) | |||||
| if (ret < 0 || !av_strcasecmp(standard.name, s->standard)) | |||||
| break; | break; | ||||
| } | } | ||||
| if (ret < 0) { | if (ret < 0) { | ||||
| @@ -16,10 +16,8 @@ | |||||
| * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||
| */ | */ | ||||
| #define _BSD_SOURCE //strcasecmp | |||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | |||||
| #include <inttypes.h> | #include <inttypes.h> | ||||
| #include "config.h" | #include "config.h" | ||||
| @@ -33,6 +31,8 @@ | |||||
| #include "libswscale/swscale.h" | #include "libswscale/swscale.h" | ||||
| #include "libavutil/avstring.h" | |||||
| //===========================================================================// | //===========================================================================// | ||||
| // commented out 16 and 15 bit output support, because the conversion | // commented out 16 and 15 bit output support, because the conversion | ||||
| @@ -208,14 +208,14 @@ static int vf_open(vf_instance_t *vf, char *args){ | |||||
| for(i=0;i<256;i++) gray_pal[i]=0x01010101*i; | for(i=0;i<256;i++) gray_pal[i]=0x01010101*i; | ||||
| if (args) | if (args) | ||||
| { | { | ||||
| if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else | |||||
| if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else | |||||
| if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else | |||||
| if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else | |||||
| if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else | |||||
| if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else | |||||
| if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else | |||||
| if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else | |||||
| if (!av_strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else | |||||
| if (!av_strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else | |||||
| if (!av_strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else | |||||
| if (!av_strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else | |||||
| if (!av_strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else | |||||
| if (!av_strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else | |||||
| if (!av_strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else | |||||
| if (!av_strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else | |||||
| { | { | ||||
| mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); | mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); | ||||
| return 0; | return 0; | ||||
| @@ -19,12 +19,12 @@ | |||||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
| */ | */ | ||||
| #include <strings.h> | |||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||
| #include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||
| #include "libavutil/bswap.h" | #include "libavutil/bswap.h" | ||||
| #include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| #include "libavutil/avstring.h" | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "avi.h" | #include "avi.h" | ||||
| #include "dv.h" | #include "dv.h" | ||||
| @@ -307,7 +307,7 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date) | |||||
| if (sscanf(date, "%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d", | if (sscanf(date, "%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d", | ||||
| month, &day, time, &year) == 4) { | month, &day, time, &year) == 4) { | ||||
| for (i=0; i<12; i++) | for (i=0; i<12; i++) | ||||
| if (!strcasecmp(month, months[i])) { | |||||
| if (!av_strcasecmp(month, months[i])) { | |||||
| snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", | snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", | ||||
| year, i+1, day, time); | year, i+1, day, time); | ||||
| av_dict_set(metadata, "creation_time", buffer, 0); | av_dict_set(metadata, "creation_time", buffer, 0); | ||||
| @@ -22,7 +22,6 @@ | |||||
| #include "libavutil/avstring.h" | #include "libavutil/avstring.h" | ||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include <unistd.h> | #include <unistd.h> | ||||
| #include <strings.h> | |||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "network.h" | #include "network.h" | ||||
| #include "http.h" | #include "http.h" | ||||
| @@ -250,12 +249,12 @@ static int process_line(URLContext *h, char *line, int line_count, | |||||
| p++; | p++; | ||||
| while (isspace(*p)) | while (isspace(*p)) | ||||
| p++; | p++; | ||||
| if (!strcasecmp(tag, "Location")) { | |||||
| if (!av_strcasecmp(tag, "Location")) { | |||||
| strcpy(s->location, p); | strcpy(s->location, p); | ||||
| *new_location = 1; | *new_location = 1; | ||||
| } else if (!strcasecmp (tag, "Content-Length") && s->filesize == -1) { | |||||
| } else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) { | |||||
| s->filesize = atoll(p); | s->filesize = atoll(p); | ||||
| } else if (!strcasecmp (tag, "Content-Range")) { | |||||
| } else if (!av_strcasecmp (tag, "Content-Range")) { | |||||
| /* "bytes $from-$to/$document_size" */ | /* "bytes $from-$to/$document_size" */ | ||||
| const char *slash; | const char *slash; | ||||
| if (!strncmp (p, "bytes ", 6)) { | if (!strncmp (p, "bytes ", 6)) { | ||||
| @@ -265,16 +264,16 @@ static int process_line(URLContext *h, char *line, int line_count, | |||||
| s->filesize = atoll(slash+1); | s->filesize = atoll(slash+1); | ||||
| } | } | ||||
| h->is_streamed = 0; /* we _can_ in fact seek */ | h->is_streamed = 0; /* we _can_ in fact seek */ | ||||
| } else if (!strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) { | |||||
| } else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) { | |||||
| h->is_streamed = 0; | h->is_streamed = 0; | ||||
| } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) { | |||||
| } else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) { | |||||
| s->filesize = -1; | s->filesize = -1; | ||||
| s->chunksize = 0; | s->chunksize = 0; | ||||
| } else if (!strcasecmp (tag, "WWW-Authenticate")) { | |||||
| } else if (!av_strcasecmp (tag, "WWW-Authenticate")) { | |||||
| ff_http_auth_handle_header(&s->auth_state, tag, p); | ff_http_auth_handle_header(&s->auth_state, tag, p); | ||||
| } else if (!strcasecmp (tag, "Authentication-Info")) { | |||||
| } else if (!av_strcasecmp (tag, "Authentication-Info")) { | |||||
| ff_http_auth_handle_header(&s->auth_state, tag, p); | ff_http_auth_handle_header(&s->auth_state, tag, p); | ||||
| } else if (!strcasecmp (tag, "Connection")) { | |||||
| } else if (!av_strcasecmp (tag, "Connection")) { | |||||
| if (!strcmp(p, "close")) | if (!strcmp(p, "close")) | ||||
| s->willclose = 1; | s->willclose = 1; | ||||
| } | } | ||||
| @@ -29,7 +29,6 @@ | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||
| #include "internal.h" | #include "internal.h" | ||||
| #include <strings.h> | |||||
| typedef struct { | typedef struct { | ||||
| const AVClass *class; /**< Class for private options. */ | const AVClass *class; /**< Class for private options. */ | ||||
| @@ -125,7 +124,7 @@ static enum CodecID av_str2id(const IdStrMap *tags, const char *str) | |||||
| str++; | str++; | ||||
| while (tags->id) { | while (tags->id) { | ||||
| if (!strcasecmp(str, tags->str)) | |||||
| if (!av_strcasecmp(str, tags->str)) | |||||
| return tags->id; | return tags->id; | ||||
| tags++; | tags++; | ||||
| @@ -281,7 +280,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | |||||
| st->codec->codec_id = s1->audio_codec_id; | st->codec->codec_id = s1->audio_codec_id; | ||||
| }else{ | }else{ | ||||
| const char *str= strrchr(s->path, '.'); | const char *str= strrchr(s->path, '.'); | ||||
| s->split_planes = str && !strcasecmp(str + 1, "y"); | |||||
| s->split_planes = str && !av_strcasecmp(str + 1, "y"); | |||||
| st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | ||||
| st->codec->codec_id = av_str2id(img_tags, s->path); | st->codec->codec_id = av_str2id(img_tags, s->path); | ||||
| } | } | ||||
| @@ -377,7 +376,7 @@ static int write_header(AVFormatContext *s) | |||||
| img->is_pipe = 1; | img->is_pipe = 1; | ||||
| str = strrchr(img->path, '.'); | str = strrchr(img->path, '.'); | ||||
| img->split_planes = str && !strcasecmp(str + 1, "y"); | |||||
| img->split_planes = str && !av_strcasecmp(str + 1, "y"); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -33,9 +33,9 @@ | |||||
| #include "libavutil/random_seed.h" | #include "libavutil/random_seed.h" | ||||
| #include "libavutil/lfg.h" | #include "libavutil/lfg.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| #include "libavutil/avstring.h" | |||||
| #include "libavcodec/xiph.h" | #include "libavcodec/xiph.h" | ||||
| #include "libavcodec/mpeg4audio.h" | #include "libavcodec/mpeg4audio.h" | ||||
| #include <strings.h> | |||||
| typedef struct ebml_master { | typedef struct ebml_master { | ||||
| int64_t pos; ///< absolute offset in the file where the master's elements start | int64_t pos; ///< absolute offset in the file where the master's elements start | ||||
| @@ -767,7 +767,7 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme | |||||
| end_ebml_master(s->pb, targets); | end_ebml_master(s->pb, targets); | ||||
| while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) | while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) | ||||
| if (strcasecmp(t->key, "title") && strcasecmp(t->key, "stereo_mode")) | |||||
| if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) | |||||
| mkv_write_simpletag(s->pb, t); | mkv_write_simpletag(s->pb, t); | ||||
| end_ebml_master(s->pb, tag); | end_ebml_master(s->pb, tag); | ||||
| @@ -18,10 +18,10 @@ | |||||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
| */ | */ | ||||
| #include <strings.h> | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "metadata.h" | #include "metadata.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| #include "libavutil/avstring.h" | |||||
| #if FF_API_OLD_METADATA2 | #if FF_API_OLD_METADATA2 | ||||
| AVDictionaryEntry * | AVDictionaryEntry * | ||||
| @@ -69,13 +69,13 @@ void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, | |||||
| key = mtag->key; | key = mtag->key; | ||||
| if (s_conv) | if (s_conv) | ||||
| for (sc=s_conv; sc->native; sc++) | for (sc=s_conv; sc->native; sc++) | ||||
| if (!strcasecmp(key, sc->native)) { | |||||
| if (!av_strcasecmp(key, sc->native)) { | |||||
| key = sc->generic; | key = sc->generic; | ||||
| break; | break; | ||||
| } | } | ||||
| if (d_conv) | if (d_conv) | ||||
| for (dc=d_conv; dc->native; dc++) | for (dc=d_conv; dc->native; dc++) | ||||
| if (!strcasecmp(key, dc->generic)) { | |||||
| if (!av_strcasecmp(key, dc->generic)) { | |||||
| key = dc->native; | key = dc->native; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -19,7 +19,6 @@ | |||||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
| */ | */ | ||||
| #include <strings.h> | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||
| #include "id3v1.h" | #include "id3v1.h" | ||||
| @@ -69,7 +68,7 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) | |||||
| buf[127] = 0xFF; /* default to unknown genre */ | buf[127] = 0xFF; /* default to unknown genre */ | ||||
| if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre | if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre | ||||
| for(i = 0; i <= ID3v1_GENRE_MAX; i++) { | for(i = 0; i <= ID3v1_GENRE_MAX; i++) { | ||||
| if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) { | |||||
| if (!av_strcasecmp(tag->value, ff_id3v1_genre_str[i])) { | |||||
| buf[127] = i; | buf[127] = i; | ||||
| count++; | count++; | ||||
| break; | break; | ||||
| @@ -20,7 +20,6 @@ | |||||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
| */ | */ | ||||
| #include <strings.h> | |||||
| #include "libavutil/avstring.h" | #include "libavutil/avstring.h" | ||||
| #include "libavutil/bswap.h" | #include "libavutil/bswap.h" | ||||
| #include "libavutil/dict.h" | #include "libavutil/dict.h" | ||||
| @@ -459,8 +458,8 @@ static int decode_info_header(NUTContext *nut){ | |||||
| set_disposition_bits(s, str_value, stream_id_plus1 - 1); | set_disposition_bits(s, str_value, stream_id_plus1 - 1); | ||||
| continue; | continue; | ||||
| } | } | ||||
| if(metadata && strcasecmp(name,"Uses") | |||||
| && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces")) | |||||
| if(metadata && av_strcasecmp(name,"Uses") | |||||
| && av_strcasecmp(name,"Depends") && av_strcasecmp(name,"Replaces")) | |||||
| av_dict_set(metadata, name, str_value, 0); | av_dict_set(metadata, name, str_value, 0); | ||||
| } | } | ||||
| } | } | ||||
| @@ -20,13 +20,13 @@ | |||||
| */ | */ | ||||
| #include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||
| #include "libavutil/avstring.h" | |||||
| #include "libavcodec/get_bits.h" | #include "libavcodec/get_bits.h" | ||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "mpegts.h" | #include "mpegts.h" | ||||
| #include "url.h" | #include "url.h" | ||||
| #include <unistd.h> | #include <unistd.h> | ||||
| #include <strings.h> | |||||
| #include "network.h" | #include "network.h" | ||||
| #include "rtpdec.h" | #include "rtpdec.h" | ||||
| @@ -91,7 +91,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, | |||||
| RTPDynamicProtocolHandler *handler; | RTPDynamicProtocolHandler *handler; | ||||
| for (handler = RTPFirstDynamicPayloadHandler; | for (handler = RTPFirstDynamicPayloadHandler; | ||||
| handler; handler = handler->next) | handler; handler = handler->next) | ||||
| if (!strcasecmp(name, handler->enc_name) && | |||||
| if (!av_strcasecmp(name, handler->enc_name) && | |||||
| codec_type == handler->codec_type) | codec_type == handler->codec_type) | ||||
| return handler; | return handler; | ||||
| return NULL; | return NULL; | ||||
| @@ -31,7 +31,6 @@ | |||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "libavutil/avstring.h" | #include "libavutil/avstring.h" | ||||
| #include "libavcodec/get_bits.h" | #include "libavcodec/get_bits.h" | ||||
| #include <strings.h> | |||||
| /** Structure listing useful vars to parse RTP packet payload*/ | /** Structure listing useful vars to parse RTP packet payload*/ | ||||
| struct PayloadContext | struct PayloadContext | ||||
| @@ -206,7 +205,7 @@ static int parse_fmtp(AVStream *stream, PayloadContext *data, | |||||
| if (codec->codec_id == CODEC_ID_AAC) { | if (codec->codec_id == CODEC_ID_AAC) { | ||||
| /* Looking for a known attribute */ | /* Looking for a known attribute */ | ||||
| for (i = 0; attr_names[i].str; ++i) { | for (i = 0; attr_names[i].str; ++i) { | ||||
| if (!strcasecmp(attr, attr_names[i].str)) { | |||||
| if (!av_strcasecmp(attr, attr_names[i].str)) { | |||||
| if (attr_names[i].type == ATTR_NAME_TYPE_INT) { | if (attr_names[i].type == ATTR_NAME_TYPE_INT) { | ||||
| *(int *)((char *)data+ | *(int *)((char *)data+ | ||||
| attr_names[i].offset) = atoi(value); | attr_names[i].offset) = atoi(value); | ||||
| @@ -33,7 +33,6 @@ | |||||
| #if HAVE_POLL_H | #if HAVE_POLL_H | ||||
| #include <poll.h> | #include <poll.h> | ||||
| #endif | #endif | ||||
| #include <strings.h> | |||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "network.h" | #include "network.h" | ||||
| #include "os_support.h" | #include "os_support.h" | ||||
| @@ -660,7 +659,7 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) | |||||
| get_word_sep(transport_protocol, sizeof(transport_protocol), | get_word_sep(transport_protocol, sizeof(transport_protocol), | ||||
| "/", &p); | "/", &p); | ||||
| if (!strcasecmp (transport_protocol, "rtp")) { | |||||
| if (!av_strcasecmp (transport_protocol, "rtp")) { | |||||
| get_word_sep(profile, sizeof(profile), "/;,", &p); | get_word_sep(profile, sizeof(profile), "/;,", &p); | ||||
| lower_transport[0] = '\0'; | lower_transport[0] = '\0'; | ||||
| /* rtp/avp/<protocol> */ | /* rtp/avp/<protocol> */ | ||||
| @@ -669,14 +668,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) | |||||
| ";,", &p); | ";,", &p); | ||||
| } | } | ||||
| th->transport = RTSP_TRANSPORT_RTP; | th->transport = RTSP_TRANSPORT_RTP; | ||||
| } else if (!strcasecmp (transport_protocol, "x-pn-tng") || | |||||
| !strcasecmp (transport_protocol, "x-real-rdt")) { | |||||
| } else if (!av_strcasecmp (transport_protocol, "x-pn-tng") || | |||||
| !av_strcasecmp (transport_protocol, "x-real-rdt")) { | |||||
| /* x-pn-tng/<protocol> */ | /* x-pn-tng/<protocol> */ | ||||
| get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p); | get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p); | ||||
| profile[0] = '\0'; | profile[0] = '\0'; | ||||
| th->transport = RTSP_TRANSPORT_RDT; | th->transport = RTSP_TRANSPORT_RDT; | ||||
| } | } | ||||
| if (!strcasecmp(lower_transport, "TCP")) | |||||
| if (!av_strcasecmp(lower_transport, "TCP")) | |||||
| th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; | th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; | ||||
| else | else | ||||
| th->lower_transport = RTSP_LOWER_TRANSPORT_UDP; | th->lower_transport = RTSP_LOWER_TRANSPORT_UDP; | ||||
| @@ -1555,7 +1554,7 @@ redirect: | |||||
| if (rt->server_type != RTSP_SERVER_REAL && reply->real_challenge[0]) { | if (rt->server_type != RTSP_SERVER_REAL && reply->real_challenge[0]) { | ||||
| rt->server_type = RTSP_SERVER_REAL; | rt->server_type = RTSP_SERVER_REAL; | ||||
| continue; | continue; | ||||
| } else if (!strncasecmp(reply->server, "WMServer/", 9)) { | |||||
| } else if (!av_strncasecmp(reply->server, "WMServer/", 9)) { | |||||
| rt->server_type = RTSP_SERVER_WMS; | rt->server_type = RTSP_SERVER_WMS; | ||||
| } else if (rt->server_type == RTSP_SERVER_REAL) | } else if (rt->server_type == RTSP_SERVER_REAL) | ||||
| strcpy(real_challenge, reply->real_challenge); | strcpy(real_challenge, reply->real_challenge); | ||||
| @@ -38,7 +38,6 @@ | |||||
| #include "url.h" | #include "url.h" | ||||
| #include <sys/time.h> | #include <sys/time.h> | ||||
| #include <time.h> | #include <time.h> | ||||
| #include <strings.h> | |||||
| #include <stdarg.h> | #include <stdarg.h> | ||||
| #if CONFIG_NETWORK | #if CONFIG_NETWORK | ||||
| #include "network.h" | #include "network.h" | ||||
| @@ -170,7 +169,7 @@ int av_match_ext(const char *filename, const char *extensions) | |||||
| while (*p != '\0' && *p != ',' && q-ext1<sizeof(ext1)-1) | while (*p != '\0' && *p != ',' && q-ext1<sizeof(ext1)-1) | ||||
| *q++ = *p++; | *q++ = *p++; | ||||
| *q = '\0'; | *q = '\0'; | ||||
| if (!strcasecmp(ext1, ext)) | |||||
| if (!av_strcasecmp(ext1, ext)) | |||||
| return 1; | return 1; | ||||
| if (*p == '\0') | if (*p == '\0') | ||||
| break; | break; | ||||
| @@ -191,11 +190,11 @@ static int match_format(const char *name, const char *names) | |||||
| namelen = strlen(name); | namelen = strlen(name); | ||||
| while ((p = strchr(names, ','))) { | while ((p = strchr(names, ','))) { | ||||
| len = FFMAX(p - names, namelen); | len = FFMAX(p - names, namelen); | ||||
| if (!strncasecmp(name, names, len)) | |||||
| if (!av_strncasecmp(name, names, len)) | |||||
| return 1; | return 1; | ||||
| names = p+1; | names = p+1; | ||||
| } | } | ||||
| return !strcasecmp(name, names); | |||||
| return !av_strcasecmp(name, names); | |||||
| } | } | ||||
| AVOutputFormat *av_guess_format(const char *short_name, const char *filename, | AVOutputFormat *av_guess_format(const char *short_name, const char *filename, | ||||
| @@ -189,6 +189,33 @@ char *av_strtok(char *s, const char *delim, char **saveptr) | |||||
| return tok; | return tok; | ||||
| } | } | ||||
| #define TOUPPER(c) do { if (c >= 'a' && c <= 'z') c -= 'a' - 'A'; } while (0) | |||||
| int av_strcasecmp(const char *a, const char *b) | |||||
| { | |||||
| uint8_t c1, c2; | |||||
| do { | |||||
| c1 = *a++; | |||||
| c2 = *b++; | |||||
| TOUPPER(c1); | |||||
| TOUPPER(c2); | |||||
| } while (c1 && c1 == c2); | |||||
| return c1 - c2; | |||||
| } | |||||
| int av_strncasecmp(const char *a, const char *b, size_t n) | |||||
| { | |||||
| const char *end = a + n; | |||||
| uint8_t c1, c2; | |||||
| do { | |||||
| c1 = *a++; | |||||
| c2 = *b++; | |||||
| TOUPPER(c1); | |||||
| TOUPPER(c2); | |||||
| } while (a < end && c1 && c1 == c2); | |||||
| return c1 - c2; | |||||
| } | |||||
| #ifdef TEST | #ifdef TEST | ||||
| #undef printf | #undef printf | ||||
| @@ -165,4 +165,16 @@ char *av_get_token(const char **buf, const char *term); | |||||
| */ | */ | ||||
| char *av_strtok(char *s, const char *delim, char **saveptr); | char *av_strtok(char *s, const char *delim, char **saveptr); | ||||
| /** | |||||
| * Locale independent case-insensitive compare. | |||||
| * Note: This means only ASCII-range characters are case-insensitive | |||||
| */ | |||||
| int av_strcasecmp(const char *a, const char *b); | |||||
| /** | |||||
| * Locale independent case-insensitive compare. | |||||
| * Note: This means only ASCII-range characters are case-insensitive | |||||
| */ | |||||
| int av_strncasecmp(const char *a, const char *b, size_t n); | |||||
| #endif /* AVUTIL_AVSTRING_H */ | #endif /* AVUTIL_AVSTRING_H */ | ||||
| @@ -156,6 +156,10 @@ struct AVDictionary { | |||||
| #define puts please_use_av_log_instead_of_puts | #define puts please_use_av_log_instead_of_puts | ||||
| #undef perror | #undef perror | ||||
| #define perror please_use_av_log_instead_of_perror | #define perror please_use_av_log_instead_of_perror | ||||
| #undef strcasecmp | |||||
| #define strcasecmp please_use_av_strcasecmp | |||||
| #undef strncasecmp | |||||
| #define strncasecmp please_use_av_strncasecmp | |||||
| #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ | #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ | ||||
| {\ | {\ | ||||
| @@ -21,7 +21,6 @@ | |||||
| * misc parsing utilities | * misc parsing utilities | ||||
| */ | */ | ||||
| #include <strings.h> | |||||
| #include <sys/time.h> | #include <sys/time.h> | ||||
| #include <time.h> | #include <time.h> | ||||
| @@ -294,7 +293,7 @@ static ColorEntry color_table[] = { | |||||
| static int color_table_compare(const void *lhs, const void *rhs) | static int color_table_compare(const void *lhs, const void *rhs) | ||||
| { | { | ||||
| return strcasecmp(lhs, ((const ColorEntry *)rhs)->name); | |||||
| return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name); | |||||
| } | } | ||||
| #define ALPHA_SEP '@' | #define ALPHA_SEP '@' | ||||
| @@ -320,7 +319,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, | |||||
| len = strlen(color_string2); | len = strlen(color_string2); | ||||
| rgba_color[3] = 255; | rgba_color[3] = 255; | ||||
| if (!strcasecmp(color_string2, "random") || !strcasecmp(color_string2, "bikeshed")) { | |||||
| if (!av_strcasecmp(color_string2, "random") || !av_strcasecmp(color_string2, "bikeshed")) { | |||||
| int rgba = av_get_random_seed(); | int rgba = av_get_random_seed(); | ||||
| rgba_color[0] = rgba >> 24; | rgba_color[0] = rgba >> 24; | ||||
| rgba_color[1] = rgba >> 16; | rgba_color[1] = rgba >> 16; | ||||
| @@ -525,7 +524,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration) | |||||
| p = timestr; | p = timestr; | ||||
| q = NULL; | q = NULL; | ||||
| if (!duration) { | if (!duration) { | ||||
| if (!strncasecmp(timestr, "now", len)) { | |||||
| if (!av_strncasecmp(timestr, "now", len)) { | |||||
| *timeval = (int64_t) now * 1000000; | *timeval = (int64_t) now * 1000000; | ||||
| return 0; | return 0; | ||||
| } | } | ||||