Replace all strcasecmp/strncasecmp usages.

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>
This commit is contained in:
Reimar Döffinger
2011-11-02 20:17:25 +01:00
parent 475fb67d0b
commit 96949dafcc
18 changed files with 93 additions and 55 deletions

View File

@@ -16,10 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _BSD_SOURCE //strcasecmp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "config.h"
@@ -33,6 +31,8 @@
#include "libswscale/swscale.h"
#include "libavutil/avstring.h"
//===========================================================================//
// 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;
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);
return 0;