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.
Unified · Split
| @@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | API changes, most recent first: | 14 | API changes, most recent first: |
| 15 | 15 | ||
| 16 | 2011-11-03 - xxxxxxx - lavu 51.23.0 | ||
| 17 | Add av_strcasecmp() and av_strncasecmp() to avstring.h. | ||
| 18 | |||
| 16 | 2011-10-20 - b35e9e1 - lavu 51.22.0 | 19 | 2011-10-20 - b35e9e1 - lavu 51.22.0 |
| 17 | Add av_strtok() to avstring.h. | 20 | Add av_strtok() to avstring.h. |
| 18 | 21 | ||
| @@ -44,13 +44,13 @@ · 43 unmodified lines | |||
| 44 | #include <linux/videodev2.h> | 44 | #include <linux/videodev2.h> |
| 45 | #endif | 45 | #endif |
| 46 | #include <time.h> | 46 | #include <time.h> |
| 47 | #include <strings.h> | ||
| 48 | #include "libavutil/imgutils.h" | 47 | #include "libavutil/imgutils.h" |
| 49 | #include "libavutil/log.h" | 48 | #include "libavutil/log.h" |
| 50 | #include "libavutil/opt.h" | 49 | #include "libavutil/opt.h" |
| 51 | #include "avdevice.h" | 50 | #include "avdevice.h" |
| 52 | #include "libavutil/parseutils.h" | 51 | #include "libavutil/parseutils.h" |
| 53 | #include "libavutil/pixdesc.h" | 52 | #include "libavutil/pixdesc.h" |
| 53 | #include "libavutil/avstring.h" | ||
| 54 | 54 | ||
| 55 | static const int desired_video_buffers = 256; | 55 | static const int desired_video_buffers = 256; |
| 56 | 56 | ||
| @@ -470,7 +470,7 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap) · 413 unmodified lines | |||
| 470 | for (i = 0;; i++) { | 470 | for (i = 0;; i++) { |
| 471 | standard.index = i; | 471 | standard.index = i; |
| 472 | ret = ioctl(s->fd, VIDIOC_ENUMSTD, &standard); | 472 | ret = ioctl(s->fd, VIDIOC_ENUMSTD, &standard); |
| 473 | if (ret < 0 || !strcasecmp(standard.name, s->standard)) | 473 | if (ret < 0 || !av_strcasecmp(standard.name, s->standard)) |
| 474 | break; | 474 | break; |
| 475 | } | 475 | } |
| 476 | if (ret < 0) { | 476 | if (ret < 0) { |
| @@ -16,10 +16,8 @@ · 15 unmodified lines | |||
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #define _BSD_SOURCE //strcasecmp | ||
| 20 | #include <stdio.h> | 19 | #include <stdio.h> |
| 21 | #include <stdlib.h> | 20 | #include <stdlib.h> |
| 22 | #include <string.h> | ||
| 23 | #include <inttypes.h> | 21 | #include <inttypes.h> |
| 24 | 22 | ||
| 25 | #include "config.h" | 23 | #include "config.h" |
| @@ -33,6 +31,8 @@ · 7 unmodified lines | |||
| 33 | 31 | ||
| 34 | #include "libswscale/swscale.h" | 32 | #include "libswscale/swscale.h" |
| 35 | 33 | ||
| 34 | #include "libavutil/avstring.h" | ||
| 35 | |||
| 36 | //===========================================================================// | 36 | //===========================================================================// |
| 37 | 37 | ||
| 38 | // commented out 16 and 15 bit output support, because the conversion | 38 | // 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){ · 169 unmodified lines | |||
| 208 | for(i=0;i<256;i++) gray_pal[i]=0x01010101*i; | 208 | for(i=0;i<256;i++) gray_pal[i]=0x01010101*i; |
| 209 | if (args) | 209 | if (args) |
| 210 | { | 210 | { |
| 211 | if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else | 211 | if (!av_strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else |
| 212 | if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else | 212 | if (!av_strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else |
| 213 | if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else | 213 | if (!av_strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else |
| 214 | if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else | 214 | if (!av_strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else |
| 215 | if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else | 215 | if (!av_strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else |
| 216 | if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else | 216 | if (!av_strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else |
| 217 | if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else | 217 | if (!av_strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else |
| 218 | if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else | 218 | if (!av_strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else |
| 219 | { | 219 | { |
| 220 | mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); | 220 | mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args); |
| 221 | return 0; | 221 | return 0; |
| @@ -19,12 +19,12 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <strings.h> | ||
| 23 | #include "libavutil/intreadwrite.h" | 22 | #include "libavutil/intreadwrite.h" |
| 24 | #include "libavutil/mathematics.h" | 23 | #include "libavutil/mathematics.h" |
| 25 | #include "libavutil/bswap.h" | 24 | #include "libavutil/bswap.h" |
| 26 | #include "libavutil/opt.h" | 25 | #include "libavutil/opt.h" |
| 27 | #include "libavutil/dict.h" | 26 | #include "libavutil/dict.h" |
| 27 | #include "libavutil/avstring.h" | ||
| 28 | #include "avformat.h" | 28 | #include "avformat.h" |
| 29 | #include "avi.h" | 29 | #include "avi.h" |
| 30 | #include "dv.h" | 30 | #include "dv.h" |
| @@ -307,7 +307,7 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date) · 276 unmodified lines | |||
| 307 | if (sscanf(date, "%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d", | 307 | if (sscanf(date, "%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d", |
| 308 | month, &day, time, &year) == 4) { | 308 | month, &day, time, &year) == 4) { |
| 309 | for (i=0; i<12; i++) | 309 | for (i=0; i<12; i++) |
| 310 | if (!strcasecmp(month, months[i])) { | 310 | if (!av_strcasecmp(month, months[i])) { |
| 311 | snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", | 311 | snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", |
| 312 | year, i+1, day, time); | 312 | year, i+1, day, time); |
| 313 | av_dict_set(metadata, "creation_time", buffer, 0); | 313 | av_dict_set(metadata, "creation_time", buffer, 0); |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | |||
| 22 | #include "libavutil/avstring.h" | 22 | #include "libavutil/avstring.h" |
| 23 | #include "avformat.h" | 23 | #include "avformat.h" |
| 24 | #include <unistd.h> | 24 | #include <unistd.h> |
| 25 | #include <strings.h> | ||
| 26 | #include "internal.h" | 25 | #include "internal.h" |
| 27 | #include "network.h" | 26 | #include "network.h" |
| 28 | #include "http.h" | 27 | #include "http.h" |
| @@ -250,12 +249,12 @@ static int process_line(URLContext *h, char *line, int line_count, · 221 unmodified lines | |||
| 250 | p++; | 249 | p++; |
| 251 | while (isspace(*p)) | 250 | while (isspace(*p)) |
| 252 | p++; | 251 | p++; |
| 253 | if (!strcasecmp(tag, "Location")) { | 252 | if (!av_strcasecmp(tag, "Location")) { |
| 254 | strcpy(s->location, p); | 253 | strcpy(s->location, p); |
| 255 | *new_location = 1; | 254 | *new_location = 1; |
| 256 | } else if (!strcasecmp (tag, "Content-Length") && s->filesize == -1) { | 255 | } else if (!av_strcasecmp (tag, "Content-Length") && s->filesize == -1) { |
| 257 | s->filesize = atoll(p); | 256 | s->filesize = atoll(p); |
| 258 | } else if (!strcasecmp (tag, "Content-Range")) { | 257 | } else if (!av_strcasecmp (tag, "Content-Range")) { |
| 259 | /* "bytes $from-$to/$document_size" */ | 258 | /* "bytes $from-$to/$document_size" */ |
| 260 | const char *slash; | 259 | const char *slash; |
| 261 | if (!strncmp (p, "bytes ", 6)) { | 260 | if (!strncmp (p, "bytes ", 6)) { |
| @@ -265,16 +264,16 @@ static int process_line(URLContext *h, char *line, int line_count, · 3 unmodified lines | |||
| 265 | s->filesize = atoll(slash+1); | 264 | s->filesize = atoll(slash+1); |
| 266 | } | 265 | } |
| 267 | h->is_streamed = 0; /* we _can_ in fact seek */ | 266 | h->is_streamed = 0; /* we _can_ in fact seek */ |
| 268 | } else if (!strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) { | 267 | } else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) { |
| 269 | h->is_streamed = 0; | 268 | h->is_streamed = 0; |
| 270 | } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) { | 269 | } else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) { |
| 271 | s->filesize = -1; | 270 | s->filesize = -1; |
| 272 | s->chunksize = 0; | 271 | s->chunksize = 0; |
| 273 | } else if (!strcasecmp (tag, "WWW-Authenticate")) { | 272 | } else if (!av_strcasecmp (tag, "WWW-Authenticate")) { |
| 274 | ff_http_auth_handle_header(&s->auth_state, tag, p); | 273 | ff_http_auth_handle_header(&s->auth_state, tag, p); |
| 275 | } else if (!strcasecmp (tag, "Authentication-Info")) { | 274 | } else if (!av_strcasecmp (tag, "Authentication-Info")) { |
| 276 | ff_http_auth_handle_header(&s->auth_state, tag, p); | 275 | ff_http_auth_handle_header(&s->auth_state, tag, p); |
| 277 | } else if (!strcasecmp (tag, "Connection")) { | 276 | } else if (!av_strcasecmp (tag, "Connection")) { |
| 278 | if (!strcmp(p, "close")) | 277 | if (!strcmp(p, "close")) |
| 279 | s->willclose = 1; | 278 | s->willclose = 1; |
| 280 | } | 279 | } |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | #include "avformat.h" | 29 | #include "avformat.h" |
| 30 | #include "avio_internal.h" | 30 | #include "avio_internal.h" |
| 31 | #include "internal.h" | 31 | #include "internal.h" |
| 32 | #include <strings.h> | ||
| 33 | 32 | ||
| 34 | typedef struct { | 33 | typedef struct { |
| 35 | const AVClass *class; /**< Class for private options. */ | 34 | const AVClass *class; /**< Class for private options. */ |
| @@ -125,7 +124,7 @@ static enum CodecID av_str2id(const IdStrMap *tags, const char *str) · 89 unmodified lines | |||
| 125 | str++; | 124 | str++; |
| 126 | 125 | ||
| 127 | while (tags->id) { | 126 | while (tags->id) { |
| 128 | if (!strcasecmp(str, tags->str)) | 127 | if (!av_strcasecmp(str, tags->str)) |
| 129 | return tags->id; | 128 | return tags->id; |
| 130 | 129 | ||
| 131 | tags++; | 130 | tags++; |
| @@ -281,7 +280,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 149 unmodified lines | |||
| 281 | st->codec->codec_id = s1->audio_codec_id; | 280 | st->codec->codec_id = s1->audio_codec_id; |
| 282 | }else{ | 281 | }else{ |
| 283 | const char *str= strrchr(s->path, '.'); | 282 | const char *str= strrchr(s->path, '.'); |
| 284 | s->split_planes = str && !strcasecmp(str + 1, "y"); | 283 | s->split_planes = str && !av_strcasecmp(str + 1, "y"); |
| 285 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | 284 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 286 | st->codec->codec_id = av_str2id(img_tags, s->path); | 285 | st->codec->codec_id = av_str2id(img_tags, s->path); |
| 287 | } | 286 | } |
| @@ -377,7 +376,7 @@ static int write_header(AVFormatContext *s) · 89 unmodified lines | |||
| 377 | img->is_pipe = 1; | 376 | img->is_pipe = 1; |
| 378 | 377 | ||
| 379 | str = strrchr(img->path, '.'); | 378 | str = strrchr(img->path, '.'); |
| 380 | img->split_planes = str && !strcasecmp(str + 1, "y"); | 379 | img->split_planes = str && !av_strcasecmp(str + 1, "y"); |
| 381 | return 0; | 380 | return 0; |
| 382 | } | 381 | } |
| 383 | 382 | ||
| @@ -33,9 +33,9 @@ · 32 unmodified lines | |||
| 33 | #include "libavutil/random_seed.h" | 33 | #include "libavutil/random_seed.h" |
| 34 | #include "libavutil/lfg.h" | 34 | #include "libavutil/lfg.h" |
| 35 | #include "libavutil/dict.h" | 35 | #include "libavutil/dict.h" |
| 36 | #include "libavutil/avstring.h" | ||
| 36 | #include "libavcodec/xiph.h" | 37 | #include "libavcodec/xiph.h" |
| 37 | #include "libavcodec/mpeg4audio.h" | 38 | #include "libavcodec/mpeg4audio.h" |
| 38 | #include <strings.h> | ||
| 39 | 39 | ||
| 40 | typedef struct ebml_master { | 40 | typedef struct ebml_master { |
| 41 | int64_t pos; ///< absolute offset in the file where the master's elements start | 41 | 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 · 725 unmodified lines | |||
| 767 | end_ebml_master(s->pb, targets); | 767 | end_ebml_master(s->pb, targets); |
| 768 | 768 | ||
| 769 | while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) | 769 | while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) |
| 770 | if (strcasecmp(t->key, "title") && strcasecmp(t->key, "stereo_mode")) | 770 | if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) |
| 771 | mkv_write_simpletag(s->pb, t); | 771 | mkv_write_simpletag(s->pb, t); |
| 772 | 772 | ||
| 773 | end_ebml_master(s->pb, tag); | 773 | end_ebml_master(s->pb, tag); |
| @@ -18,10 +18,10 @@ · 17 unmodified lines | |||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <strings.h> | ||
| 22 | #include "avformat.h" | 21 | #include "avformat.h" |
| 23 | #include "metadata.h" | 22 | #include "metadata.h" |
| 24 | #include "libavutil/dict.h" | 23 | #include "libavutil/dict.h" |
| 24 | #include "libavutil/avstring.h" | ||
| 25 | 25 | ||
| 26 | #if FF_API_OLD_METADATA2 | 26 | #if FF_API_OLD_METADATA2 |
| 27 | AVDictionaryEntry * | 27 | AVDictionaryEntry * |
| @@ -69,13 +69,13 @@ void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, · 41 unmodified lines | |||
| 69 | key = mtag->key; | 69 | key = mtag->key; |
| 70 | if (s_conv) | 70 | if (s_conv) |
| 71 | for (sc=s_conv; sc->native; sc++) | 71 | for (sc=s_conv; sc->native; sc++) |
| 72 | if (!strcasecmp(key, sc->native)) { | 72 | if (!av_strcasecmp(key, sc->native)) { |
| 73 | key = sc->generic; | 73 | key = sc->generic; |
| 74 | break; | 74 | break; |
| 75 | } | 75 | } |
| 76 | if (d_conv) | 76 | if (d_conv) |
| 77 | for (dc=d_conv; dc->native; dc++) | 77 | for (dc=d_conv; dc->native; dc++) |
| 78 | if (!strcasecmp(key, dc->generic)) { | 78 | if (!av_strcasecmp(key, dc->generic)) { |
| 79 | key = dc->native; | 79 | key = dc->native; |
| 80 | break; | 80 | break; |
| 81 | } | 81 | } |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <strings.h> | ||
| 23 | #include "avformat.h" | 22 | #include "avformat.h" |
| 24 | #include "avio_internal.h" | 23 | #include "avio_internal.h" |
| 25 | #include "id3v1.h" | 24 | #include "id3v1.h" |
| @@ -69,7 +68,7 @@ static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf) · 43 unmodified lines | |||
| 69 | buf[127] = 0xFF; /* default to unknown genre */ | 68 | buf[127] = 0xFF; /* default to unknown genre */ |
| 70 | if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre | 69 | if ((tag = av_dict_get(s->metadata, "TCON", NULL, 0))) { //genre |
| 71 | for(i = 0; i <= ID3v1_GENRE_MAX; i++) { | 70 | for(i = 0; i <= ID3v1_GENRE_MAX; i++) { |
| 72 | if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) { | 71 | if (!av_strcasecmp(tag->value, ff_id3v1_genre_str[i])) { |
| 73 | buf[127] = i; | 72 | buf[127] = i; |
| 74 | count++; | 73 | count++; |
| 75 | break; | 74 | break; |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | |||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include <strings.h> | ||
| 24 | #include "libavutil/avstring.h" | 23 | #include "libavutil/avstring.h" |
| 25 | #include "libavutil/bswap.h" | 24 | #include "libavutil/bswap.h" |
| 26 | #include "libavutil/dict.h" | 25 | #include "libavutil/dict.h" |
| @@ -459,8 +458,8 @@ static int decode_info_header(NUTContext *nut){ · 432 unmodified lines | |||
| 459 | set_disposition_bits(s, str_value, stream_id_plus1 - 1); | 458 | set_disposition_bits(s, str_value, stream_id_plus1 - 1); |
| 460 | continue; | 459 | continue; |
| 461 | } | 460 | } |
| 462 | if(metadata && strcasecmp(name,"Uses") | 461 | if(metadata && av_strcasecmp(name,"Uses") |
| 463 | && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces")) | 462 | && av_strcasecmp(name,"Depends") && av_strcasecmp(name,"Replaces")) |
| 464 | av_dict_set(metadata, name, str_value, 0); | 463 | av_dict_set(metadata, name, str_value, 0); |
| 465 | } | 464 | } |
| 466 | } | 465 | } |
| @@ -20,13 +20,13 @@ · 19 unmodified lines | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "libavutil/mathematics.h" | 22 | #include "libavutil/mathematics.h" |
| 23 | #include "libavutil/avstring.h" | ||
| 23 | #include "libavcodec/get_bits.h" | 24 | #include "libavcodec/get_bits.h" |
| 24 | #include "avformat.h" | 25 | #include "avformat.h" |
| 25 | #include "mpegts.h" | 26 | #include "mpegts.h" |
| 26 | #include "url.h" | 27 | #include "url.h" |
| 27 | 28 | ||
| 28 | #include <unistd.h> | 29 | #include <unistd.h> |
| 29 | #include <strings.h> | ||
| 30 | #include "network.h" | 30 | #include "network.h" |
| 31 | 31 | ||
| 32 | #include "rtpdec.h" | 32 | #include "rtpdec.h" |
| @@ -91,7 +91,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, · 58 unmodified lines | |||
| 91 | RTPDynamicProtocolHandler *handler; | 91 | RTPDynamicProtocolHandler *handler; |
| 92 | for (handler = RTPFirstDynamicPayloadHandler; | 92 | for (handler = RTPFirstDynamicPayloadHandler; |
| 93 | handler; handler = handler->next) | 93 | handler; handler = handler->next) |
| 94 | if (!strcasecmp(name, handler->enc_name) && | 94 | if (!av_strcasecmp(name, handler->enc_name) && |
| 95 | codec_type == handler->codec_type) | 95 | codec_type == handler->codec_type) |
| 96 | return handler; | 96 | return handler; |
| 97 | return NULL; | 97 | return NULL; |
| @@ -31,7 +31,6 @@ · 30 unmodified lines | |||
| 31 | #include "internal.h" | 31 | #include "internal.h" |
| 32 | #include "libavutil/avstring.h" | 32 | #include "libavutil/avstring.h" |
| 33 | #include "libavcodec/get_bits.h" | 33 | #include "libavcodec/get_bits.h" |
| 34 | #include <strings.h> | ||
| 35 | 34 | ||
| 36 | /** Structure listing useful vars to parse RTP packet payload*/ | 35 | /** Structure listing useful vars to parse RTP packet payload*/ |
| 37 | struct PayloadContext | 36 | struct PayloadContext |
| @@ -206,7 +205,7 @@ static int parse_fmtp(AVStream *stream, PayloadContext *data, · 168 unmodified lines | |||
| 206 | if (codec->codec_id == CODEC_ID_AAC) { | 205 | if (codec->codec_id == CODEC_ID_AAC) { |
| 207 | /* Looking for a known attribute */ | 206 | /* Looking for a known attribute */ |
| 208 | for (i = 0; attr_names[i].str; ++i) { | 207 | for (i = 0; attr_names[i].str; ++i) { |
| 209 | if (!strcasecmp(attr, attr_names[i].str)) { | 208 | if (!av_strcasecmp(attr, attr_names[i].str)) { |
| 210 | if (attr_names[i].type == ATTR_NAME_TYPE_INT) { | 209 | if (attr_names[i].type == ATTR_NAME_TYPE_INT) { |
| 211 | *(int *)((char *)data+ | 210 | *(int *)((char *)data+ |
| 212 | attr_names[i].offset) = atoi(value); | 211 | attr_names[i].offset) = atoi(value); |
| @@ -33,7 +33,6 @@ · 32 unmodified lines | |||
| 33 | #if HAVE_POLL_H | 33 | #if HAVE_POLL_H |
| 34 | #include <poll.h> | 34 | #include <poll.h> |
| 35 | #endif | 35 | #endif |
| 36 | #include <strings.h> | ||
| 37 | #include "internal.h" | 36 | #include "internal.h" |
| 38 | #include "network.h" | 37 | #include "network.h" |
| 39 | #include "os_support.h" | 38 | #include "os_support.h" |
| @@ -660,7 +659,7 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) · 620 unmodified lines | |||
| 660 | 659 | ||
| 661 | get_word_sep(transport_protocol, sizeof(transport_protocol), | 660 | get_word_sep(transport_protocol, sizeof(transport_protocol), |
| 662 | "/", &p); | 661 | "/", &p); |
| 663 | if (!strcasecmp (transport_protocol, "rtp")) { | 662 | if (!av_strcasecmp (transport_protocol, "rtp")) { |
| 664 | get_word_sep(profile, sizeof(profile), "/;,", &p); | 663 | get_word_sep(profile, sizeof(profile), "/;,", &p); |
| 665 | lower_transport[0] = '\0'; | 664 | lower_transport[0] = '\0'; |
| 666 | /* rtp/avp/<protocol> */ | 665 | /* rtp/avp/<protocol> */ |
| @@ -669,14 +668,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p) · 2 unmodified lines | |||
| 669 | ";,", &p); | 668 | ";,", &p); |
| 670 | } | 669 | } |
| 671 | th->transport = RTSP_TRANSPORT_RTP; | 670 | th->transport = RTSP_TRANSPORT_RTP; |
| 672 | } else if (!strcasecmp (transport_protocol, "x-pn-tng") || | 671 | } else if (!av_strcasecmp (transport_protocol, "x-pn-tng") || |
| 673 | !strcasecmp (transport_protocol, "x-real-rdt")) { | 672 | !av_strcasecmp (transport_protocol, "x-real-rdt")) { |
| 674 | /* x-pn-tng/<protocol> */ | 673 | /* x-pn-tng/<protocol> */ |
| 675 | get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p); | 674 | get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p); |
| 676 | profile[0] = '\0'; | 675 | profile[0] = '\0'; |
| 677 | th->transport = RTSP_TRANSPORT_RDT; | 676 | th->transport = RTSP_TRANSPORT_RDT; |
| 678 | } | 677 | } |
| 679 | if (!strcasecmp(lower_transport, "TCP")) | 678 | if (!av_strcasecmp(lower_transport, "TCP")) |
| 680 | th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; | 679 | th->lower_transport = RTSP_LOWER_TRANSPORT_TCP; |
| 681 | else | 680 | else |
| 682 | th->lower_transport = RTSP_LOWER_TRANSPORT_UDP; | 681 | th->lower_transport = RTSP_LOWER_TRANSPORT_UDP; |
| @@ -1555,7 +1554,7 @@ redirect: · 872 unmodified lines | |||
| 1555 | if (rt->server_type != RTSP_SERVER_REAL && reply->real_challenge[0]) { | 1554 | if (rt->server_type != RTSP_SERVER_REAL && reply->real_challenge[0]) { |
| 1556 | rt->server_type = RTSP_SERVER_REAL; | 1555 | rt->server_type = RTSP_SERVER_REAL; |
| 1557 | continue; | 1556 | continue; |
| 1558 | } else if (!strncasecmp(reply->server, "WMServer/", 9)) { | 1557 | } else if (!av_strncasecmp(reply->server, "WMServer/", 9)) { |
| 1559 | rt->server_type = RTSP_SERVER_WMS; | 1558 | rt->server_type = RTSP_SERVER_WMS; |
| 1560 | } else if (rt->server_type == RTSP_SERVER_REAL) | 1559 | } else if (rt->server_type == RTSP_SERVER_REAL) |
| 1561 | strcpy(real_challenge, reply->real_challenge); | 1560 | strcpy(real_challenge, reply->real_challenge); |
| @@ -38,7 +38,6 @@ · 37 unmodified lines | |||
| 38 | #include "url.h" | 38 | #include "url.h" |
| 39 | #include <sys/time.h> | 39 | #include <sys/time.h> |
| 40 | #include <time.h> | 40 | #include <time.h> |
| 41 | #include <strings.h> | ||
| 42 | #include <stdarg.h> | 41 | #include <stdarg.h> |
| 43 | #if CONFIG_NETWORK | 42 | #if CONFIG_NETWORK |
| 44 | #include "network.h" | 43 | #include "network.h" |
| @@ -170,7 +169,7 @@ int av_match_ext(const char *filename, const char *extensions) · 125 unmodified lines | |||
| 170 | while (*p != '\0' && *p != ',' && q-ext1<sizeof(ext1)-1) | 169 | while (*p != '\0' && *p != ',' && q-ext1<sizeof(ext1)-1) |
| 171 | *q++ = *p++; | 170 | *q++ = *p++; |
| 172 | *q = '\0'; | 171 | *q = '\0'; |
| 173 | if (!strcasecmp(ext1, ext)) | 172 | if (!av_strcasecmp(ext1, ext)) |
| 174 | return 1; | 173 | return 1; |
| 175 | if (*p == '\0') | 174 | if (*p == '\0') |
| 176 | break; | 175 | break; |
| @@ -191,11 +190,11 @@ static int match_format(const char *name, const char *names) · 14 unmodified lines | |||
| 191 | namelen = strlen(name); | 190 | namelen = strlen(name); |
| 192 | while ((p = strchr(names, ','))) { | 191 | while ((p = strchr(names, ','))) { |
| 193 | len = FFMAX(p - names, namelen); | 192 | len = FFMAX(p - names, namelen); |
| 194 | if (!strncasecmp(name, names, len)) | 193 | if (!av_strncasecmp(name, names, len)) |
| 195 | return 1; | 194 | return 1; |
| 196 | names = p+1; | 195 | names = p+1; |
| 197 | } | 196 | } |
| 198 | return !strcasecmp(name, names); | 197 | return !av_strcasecmp(name, names); |
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | AVOutputFormat *av_guess_format(const char *short_name, const char *filename, | 200 | 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) · 188 unmodified lines | |||
| 189 | return tok; | 189 | return tok; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | #define TOUPPER(c) do { if (c >= 'a' && c <= 'z') c -= 'a' - 'A'; } while (0) | ||
| 193 | |||
| 194 | int av_strcasecmp(const char *a, const char *b) | ||
| 195 | { | ||
| 196 | uint8_t c1, c2; | ||
| 197 | do { | ||
| 198 | c1 = *a++; | ||
| 199 | c2 = *b++; | ||
| 200 | TOUPPER(c1); | ||
| 201 | TOUPPER(c2); | ||
| 202 | } while (c1 && c1 == c2); | ||
| 203 | return c1 - c2; | ||
| 204 | } | ||
| 205 | |||
| 206 | int av_strncasecmp(const char *a, const char *b, size_t n) | ||
| 207 | { | ||
| 208 | const char *end = a + n; | ||
| 209 | uint8_t c1, c2; | ||
| 210 | do { | ||
| 211 | c1 = *a++; | ||
| 212 | c2 = *b++; | ||
| 213 | TOUPPER(c1); | ||
| 214 | TOUPPER(c2); | ||
| 215 | } while (a < end && c1 && c1 == c2); | ||
| 216 | return c1 - c2; | ||
| 217 | } | ||
| 218 | |||
| 192 | #ifdef TEST | 219 | #ifdef TEST |
| 193 | 220 | ||
| 194 | #undef printf | 221 | #undef printf |
| @@ -165,4 +165,16 @@ char *av_get_token(const char **buf, const char *term); · 164 unmodified lines | |||
| 165 | */ | 165 | */ |
| 166 | char *av_strtok(char *s, const char *delim, char **saveptr); | 166 | char *av_strtok(char *s, const char *delim, char **saveptr); |
| 167 | 167 | ||
| 168 | /** | ||
| 169 | * Locale independent case-insensitive compare. | ||
| 170 | * Note: This means only ASCII-range characters are case-insensitive | ||
| 171 | */ | ||
| 172 | int av_strcasecmp(const char *a, const char *b); | ||
| 173 | |||
| 174 | /** | ||
| 175 | * Locale independent case-insensitive compare. | ||
| 176 | * Note: This means only ASCII-range characters are case-insensitive | ||
| 177 | */ | ||
| 178 | int av_strncasecmp(const char *a, const char *b, size_t n); | ||
| 179 | |||
| 168 | #endif /* AVUTIL_AVSTRING_H */ | 180 | #endif /* AVUTIL_AVSTRING_H */ |
| @@ -156,6 +156,10 @@ struct AVDictionary { · 155 unmodified lines | |||
| 156 | #define puts please_use_av_log_instead_of_puts | 156 | #define puts please_use_av_log_instead_of_puts |
| 157 | #undef perror | 157 | #undef perror |
| 158 | #define perror please_use_av_log_instead_of_perror | 158 | #define perror please_use_av_log_instead_of_perror |
| 159 | #undef strcasecmp | ||
| 160 | #define strcasecmp please_use_av_strcasecmp | ||
| 161 | #undef strncasecmp | ||
| 162 | #define strncasecmp please_use_av_strncasecmp | ||
| 159 | 163 | ||
| 160 | #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ | 164 | #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ |
| 161 | {\ | 165 | {\ |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | * misc parsing utilities | 21 | * misc parsing utilities |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <strings.h> | ||
| 25 | #include <sys/time.h> | 24 | #include <sys/time.h> |
| 26 | #include <time.h> | 25 | #include <time.h> |
| 27 | 26 | ||
| @@ -294,7 +293,7 @@ static ColorEntry color_table[] = { · 266 unmodified lines | |||
| 294 | 293 | ||
| 295 | static int color_table_compare(const void *lhs, const void *rhs) | 294 | static int color_table_compare(const void *lhs, const void *rhs) |
| 296 | { | 295 | { |
| 297 | return strcasecmp(lhs, ((const ColorEntry *)rhs)->name); | 296 | return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name); |
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | #define ALPHA_SEP '@' | 299 | #define ALPHA_SEP '@' |
| @@ -320,7 +319,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, · 19 unmodified lines | |||
| 320 | len = strlen(color_string2); | 319 | len = strlen(color_string2); |
| 321 | rgba_color[3] = 255; | 320 | rgba_color[3] = 255; |
| 322 | 321 | ||
| 323 | if (!strcasecmp(color_string2, "random") || !strcasecmp(color_string2, "bikeshed")) { | 322 | if (!av_strcasecmp(color_string2, "random") || !av_strcasecmp(color_string2, "bikeshed")) { |
| 324 | int rgba = av_get_random_seed(); | 323 | int rgba = av_get_random_seed(); |
| 325 | rgba_color[0] = rgba >> 24; | 324 | rgba_color[0] = rgba >> 24; |
| 326 | rgba_color[1] = rgba >> 16; | 325 | rgba_color[1] = rgba >> 16; |
| @@ -525,7 +524,7 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration) · 198 unmodified lines | |||
| 525 | p = timestr; | 524 | p = timestr; |
| 526 | q = NULL; | 525 | q = NULL; |
| 527 | if (!duration) { | 526 | if (!duration) { |
| 528 | if (!strncasecmp(timestr, "now", len)) { | 527 | if (!av_strncasecmp(timestr, "now", len)) { |
| 529 | *timeval = (int64_t) now * 1000000; | 528 | *timeval = (int64_t) now * 1000000; |
| 530 | return 0; | 529 | return 0; |
| 531 | } | 530 | } |