[MPlayer-dev-eng] ctype.h functions on win32

Gianluigi Tiesi mplayer at netfarm.it
Sun Oct 14 17:27:22 CEST 2007


forgot the attachments


-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
Index: vobsub.c
===================================================================
--- vobsub.c	(revision 24785)
+++ vobsub.c	(working copy)
@@ -225,7 +225,7 @@
 /**********************************************************************/
 
 static ssize_t
-vobsub_getline(char **lineptr, size_t *n, rar_stream_t *stream)
+vobsub_getline(unsigned char **lineptr, size_t *n, rar_stream_t *stream)
 {
     size_t res = 0;
     int c;
@@ -235,7 +235,7 @@
 	    *n = 4096;
     }
     else if (*n == 0) {
-	char *tmp = realloc(*lineptr, 4096);
+	unsigned char *tmp = realloc(*lineptr, 4096);
 	if (tmp) {
 	    *lineptr = tmp;
 	    *n = 4096;
@@ -682,11 +682,11 @@
 }
 
 static int
-vobsub_parse_id(vobsub_t *vob, const char *line)
+vobsub_parse_id(vobsub_t *vob, const unsigned char *line)
 {
     // id: xx, index: n
     size_t idlen;
-    const char *p, *q;
+    const unsigned char *p, *q;
     p  = line;
     while (isspace(*p))
 	++p;
@@ -710,10 +710,10 @@
 }
 
 static int
-vobsub_parse_timestamp(vobsub_t *vob, const char *line)
+vobsub_parse_timestamp(vobsub_t *vob, const unsigned char *line)
 {
     // timestamp: HH:MM:SS.mmm, filepos: 0nnnnnnnnn
-    const char *p;
+    const unsigned char *p;
     int h, m, s, ms;
     off_t filepos;
     while (isspace(*line))
@@ -765,7 +765,7 @@
 }
 
 static int
-vobsub_parse_size(vobsub_t *vob, const char *line)
+vobsub_parse_size(vobsub_t *vob, const unsigned char *line)
 {
     // size: WWWxHHH
     char *p;
@@ -782,7 +782,7 @@
 }
 
 static int
-vobsub_parse_origin(vobsub_t *vob, const char *line)
+vobsub_parse_origin(vobsub_t *vob, const unsigned char *line)
 {
     // org: X,Y
     char *p;
@@ -799,13 +799,13 @@
 }
 
 static int
-vobsub_parse_palette(vobsub_t *vob, const char *line)
+vobsub_parse_palette(vobsub_t *vob, const unsigned char *line)
 {
     // palette: XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX
     unsigned int n;
     n = 0;
     while (1) {
-	const char *p;
+	const unsigned char *p;
 	int r, g, b, y, u, v, tmp;
 	while (isspace(*line))
 	    ++line;
@@ -833,7 +833,7 @@
 }
 
 static int
-vobsub_parse_custom(vobsub_t *vob, const char *line)
+vobsub_parse_custom(vobsub_t *vob, const unsigned char *line)
 {
     //custom colors: OFF/ON(0/1)
     if ((strncmp("ON", line + 15, 2) == 0)||strncmp("1", line + 15, 1) == 0)
@@ -846,14 +846,14 @@
 }
 
 static int
-vobsub_parse_cuspal(vobsub_t *vob, const char *line)
+vobsub_parse_cuspal(vobsub_t *vob, const unsigned char *line)
 {
     //colors: XXXXXX, XXXXXX, XXXXXX, XXXXXX
     unsigned int n;
     n = 0;
     line += 40;
     while(1){
-    	const char *p;
+    	const unsigned char *p;
 	while (isspace(*line))
 	    ++line;
 	p=line;
@@ -873,7 +873,7 @@
 
 /* don't know how to use tridx */
 static int
-vobsub_parse_tridx(const char *line)
+vobsub_parse_tridx(const unsigned char *line)
 {
     //tridx: XXXX
     int tridx;
@@ -883,7 +883,7 @@
 }
 
 static int
-vobsub_parse_delay(vobsub_t *vob, const char *line)
+vobsub_parse_delay(vobsub_t *vob, const unsigned char *line)
 {
     int h, m, s, ms;
     int forward = 1;
@@ -909,7 +909,7 @@
 }
 
 static int
-vobsub_set_lang(const char *line)
+vobsub_set_lang(const unsigned char *line)
 {
     if (vobsub_id == -1)
         vobsub_id = atoi(line + 8);
@@ -917,9 +917,9 @@
 }
 
 static int
-vobsub_parse_forced_subs(vobsub_t *vob, const char *line)
+vobsub_parse_forced_subs(vobsub_t *vob, const unsigned char *line)
 {
-    const char *p;
+    const unsigned char *p;
 
     p  = line;
     while (isspace(*p))
@@ -942,7 +942,7 @@
     ssize_t line_size;
     int res = -1;
 	size_t line_reserve = 0;
-	char *line = NULL;
+	unsigned char *line = NULL;
     do {
 	line_size = vobsub_getline(&line, &line_reserve, fd);
 	if (line_size < 0) {
Index: stream/udp.c
===================================================================
--- stream/udp.c	(revision 24785)
+++ stream/udp.c	(working copy)
@@ -69,7 +69,7 @@
     return -1;
   }
 
-  if (isalpha (url->hostname[0]))
+  if (isalpha ((unsigned char) url->hostname[0]))
   {
 #ifndef HAVE_WINSOCK2
     hp = (struct hostent *) gethostbyname (url->hostname);
@@ -120,7 +120,7 @@
   }
 	
 #ifdef HAVE_WINSOCK2
-  if (isalpha (url->hostname[0]))
+  if (isalpha ((unsigned char) url->hostname[0]))
   {
     hp = (struct hostent *) gethostbyname (url->hostname);
     if (!hp)
Index: stream/stream_dvd.c
===================================================================
--- stream/stream_dvd.c	(revision 24785)
+++ stream/stream_dvd.c	(working copy)
@@ -156,8 +156,8 @@
   stream_opts_fields
 };
 
-int dvd_parse_chapter_range(m_option_t *conf, const char *range) {
-  const char *s;
+int dvd_parse_chapter_range(m_option_t *conf, const unsigned char *range) {
+  const unsigned char *s;
   char *t;
   if (!range)
     return M_OPT_MISSING_PARAM;
Index: stream/tv.c
===================================================================
--- stream/tv.c	(revision 24785)
+++ stream/tv.c	(working copy)
@@ -470,7 +470,7 @@
 	int channel = 0;
 	if (tvh->tv_param->channel)
 	 {
-	   if (isdigit(*tvh->tv_param->channel))
+	   if (isdigit((unsigned char) *tvh->tv_param->channel))
 		/* if tvh->tv_param->channel begins with a digit interpret it as a number */
 		channel = atoi(tvh->tv_param->channel);
 	   else
Index: codec-cfg.c
===================================================================
--- codec-cfg.c	(revision 24785)
+++ codec-cfg.c	(working copy)
@@ -323,7 +323,7 @@
 static int validate_codec(codecs_t *c, int type)
 {
 	unsigned int i;
-	char *tmp_name = c->name;
+	unsigned char *tmp_name = c->name;
 
 	for (i = 0; i < strlen(tmp_name) && isalnum(tmp_name[i]); i++)
 		/* NOTHING */;
@@ -417,8 +417,8 @@
 
 static FILE *fp;
 static int line_num = 0;
-static char *line;
-static char *token[MAX_NR_TOKEN];
+static unsigned char *line;
+static unsigned char *token[MAX_NR_TOKEN];
 static int read_nextline = 1;
 
 static int get_token(int min, int max)
Index: libao2/ao_alsa.c
===================================================================
--- libao2/ao_alsa.c	(revision 24785)
+++ libao2/ao_alsa.c	(working copy)
@@ -261,7 +261,7 @@
 static int try_open_device(const char *device, int open_mode, int try_ac3)
 {
   int err, len;
-  char *ac3_device, *args;
+  unsigned char *ac3_device, *args;
 
   if (try_ac3) {
     /* to set the non-audio bit, use AES0=6 */
Index: dvdread/ifo_print.c
===================================================================
--- dvdread/ifo_print.c	(revision 24785)
+++ dvdread/ifo_print.c	(working copy)
@@ -404,7 +404,7 @@
  
   if(attr->type == 1) {
     if(isalpha((int)(attr->lang_code >> 8))
-       && isalpha((int)(attr->lang_code & 0xff))) {
+       && ((int)(attr->lang_code & 0xff))) {
       printf("%c%c ", attr->lang_code >> 8, attr->lang_code & 0xff);
     } else {
       printf("%02x%02x ", attr->lang_code >> 8, attr->lang_code & 0xff);
Index: parser-cfg.c
===================================================================
--- parser-cfg.c	(revision 24785)
+++ parser-cfg.c	(working copy)
@@ -41,10 +41,10 @@
 #define MAX_OPT_LEN	1000
 #define MAX_PARAM_LEN	1500
 	FILE *fp;
-	char *line;
-	char opt[MAX_OPT_LEN + 1];
-	char param[MAX_PARAM_LEN + 1];
-	char c;		/* for the "" and '' check */
+	unsigned char *line;
+	unsigned char opt[MAX_OPT_LEN + 1];
+	unsigned char param[MAX_PARAM_LEN + 1];
+	unsigned char c;		/* for the "" and '' check */
 	int tmp;
 	int line_num = 0;
 	int line_pos;	/* line pos */
Index: libvo/vo_fbdev.c
===================================================================
--- libvo/vo_fbdev.c	(revision 24785)
+++ libvo/vo_fbdev.c	(working copy)
@@ -84,8 +84,8 @@
 
 static FILE *fp;
 static int line_num = 0;
-static char *line;
-static char *token[MAX_NR_TOKEN];
+static unsigned char *line;
+static unsigned char *token[MAX_NR_TOKEN];
 
 static int get_token(int num)
 {
Index: subreader.c
===================================================================
--- subreader.c	(revision 24785)
+++ subreader.c	(working copy)
@@ -67,12 +67,12 @@
 unsigned long previous_sub_end;
 #endif
 
-static int eol(char p) {
+static int eol(unsigned char p) {
 	return (p=='\r' || p=='\n' || p=='\0');
 }
 
 /* Remove leading and trailing space */
-static void trail_space(char *s) {
+static void trail_space(unsigned char *s) {
 	int i = 0;
 	while (isspace(s[i])) ++i;
 	if (i) strcpy(s, s + i);
@@ -625,8 +625,8 @@
  * by set, based on code by szabi (dunnowhat sub format ;-)
  */
 static subtitle *sub_read_line_pjs(stream_t *st,subtitle *current) {
-    char line[LINE_LEN+1];
-    char text[LINE_LEN+1], *s, *d;
+    unsigned char line[LINE_LEN+1];
+    unsigned char text[LINE_LEN+1], *s, *d;
 
     if (!stream_read_line (st, line, LINE_LEN))
 	return NULL;
@@ -666,7 +666,7 @@
 	char line[LINE_LEN+1];
 	float a,b;
 	int num=0;
-	char *p, *q;
+	unsigned char *p, *q;
 
 	do
 	{
@@ -818,7 +818,7 @@
 
 static subtitle *sub_read_line_jacosub(stream_t* st, subtitle * current)
 {
-    char line1[LINE_LEN], line2[LINE_LEN], directive[LINE_LEN], *p, *q;
+    unsigned char line1[LINE_LEN], line2[LINE_LEN], directive[LINE_LEN], *p, *q;
     unsigned a1, a2, a3, a4, b1, b2, b3, b4, comment = 0;
     static unsigned jacoTimeres = 30;
     static int jacoShift = 0;
@@ -1728,7 +1728,7 @@
 #endif
 
 
-static void strcpy_trim(char *d, char *s)
+static void strcpy_trim(unsigned char *d, unsigned char *s)
 {
     // skip leading whitespace
     while (*s && !isalnum(*s)) {
@@ -1778,7 +1778,7 @@
    }
 }
 
-static int whiteonly(char *s)
+static int whiteonly(unsigned char *s)
 {
     while (*s) {
 	if (isalnum(*s)) return 0;
Index: libmpdemux/mf.c
===================================================================
--- libmpdemux/mf.c	(revision 24785)
+++ libmpdemux/mf.c	(working copy)
@@ -49,7 +49,7 @@
      while ( fgets( fname,255,lst_f ) ) 
       {
        /* remove spaces from end of fname */
-       char *t=fname + strlen( fname ) - 1;
+       unsigned char *t=fname + strlen( fname ) - 1;
        while ( t > fname && isspace( *t ) ) *(t--)=0;
        if ( stat( fname,&fs ) ) 
         {
Index: libmpdemux/demux_mkv.c
===================================================================
--- libmpdemux/demux_mkv.c	(revision 24785)
+++ libmpdemux/demux_mkv.c	(working copy)
@@ -303,7 +303,7 @@
 }
 
 static int
-vobsub_parse_palette (sh_sub_t *sh, const char *start)
+vobsub_parse_palette (sh_sub_t *sh, const unsigned char *start)
 {
   int i, r, g, b, y, u, v, tmp;
 
@@ -345,7 +345,7 @@
 }
 
 static int
-vobsub_parse_custom_colors (sh_sub_t *sh, const char *start)
+vobsub_parse_custom_colors (sh_sub_t *sh, const unsigned char *start)
 {
   int use_custom_colors, i;
 
@@ -387,7 +387,7 @@
 }
 
 static int
-vobsub_parse_forced_subs (sh_sub_t *sh, const char *start)
+vobsub_parse_forced_subs (sh_sub_t *sh, const unsigned char *start)
 {
   start += 12;
   while (isspace(*start))
-------------- next part --------------
Index: avformat.h
===================================================================
--- avformat.h	(revision 10734)
+++ avformat.h	(working copy)
@@ -863,7 +863,7 @@
  * @number frame number
  * @return 0 if OK, -1 if format error.
  */
-int av_get_frame_filename(char *buf, int buf_size,
+int av_get_frame_filename(unsigned char *buf, int buf_size,
                           const char *path, int number);
 
 /**
Index: utils.c
===================================================================
--- utils.c	(revision 10734)
+++ utils.c	(working copy)
@@ -2586,7 +2586,7 @@
 
 int64_t parse_date(const char *datestr, int duration)
 {
-    const char *p;
+    const unsigned char *p;
     int64_t t;
     struct tm dt;
     int i;
@@ -2598,7 +2598,7 @@
         "%H:%M:%S",
         "%H%M%S",
     };
-    const char *q;
+    const unsigned char *q;
     int is_utc, len;
     char lastch;
     int negative = 0;
@@ -2739,11 +2739,11 @@
     return 0;
 }
 
-int av_get_frame_filename(char *buf, int buf_size,
+int av_get_frame_filename(unsigned char *buf, int buf_size,
                           const char *path, int number)
 {
-    const char *p;
-    char *q, buf1[20], c;
+    const unsigned char *p;
+    unsigned char *q, buf1[20], c;
     int nd, len, percentd_found;
 
     q = buf;
Index: cutils.c
===================================================================
--- cutils.c	(revision 10734)
+++ cutils.c	(working copy)
@@ -105,7 +105,7 @@
     val = 0;
     for(i = 0; i < len_max; i++) {
         c = *p;
-        if (!isdigit(c))
+        if (!isdigit((unsigned char) c))
             break;
         val = (val * 10) + c - '0';
         p++;
Index: http.c
===================================================================
--- http.c	(revision 10734)
+++ http.c	(working copy)
@@ -150,11 +150,11 @@
     return *s->buf_ptr++;
 }
 
-static int process_line(URLContext *h, char *line, int line_count,
+static int process_line(URLContext *h, unsigned char *line, int line_count,
                         int *new_location)
 {
     HTTPContext *s = h->priv_data;
-    char *tag, *p;
+    unsigned char *tag, *p;
 
     /* end of header */
     if (line[0] == '\0')
Index: avio.c
===================================================================
--- avio.c	(revision 10734)
+++ avio.c	(working copy)
@@ -40,7 +40,7 @@
 {
     URLContext *uc;
     URLProtocol *up;
-    const char *p;
+    const unsigned char *p;
     char proto_str[128], *q;
     int err;
 
-------------- next part --------------
Index: eval.c
===================================================================
--- eval.c	(revision 10734)
+++ eval.c	(working copy)
@@ -385,7 +385,7 @@
     char w[strlen(s) + 1], * wp = w;
 
     while (*s)
-        if (!isspace(*s++)) *wp++ = s[-1];
+        if (!isspace((unsigned char) *s++)) *wp++ = s[-1];
     *wp++ = 0;
 
     p.stack_index=100;


More information about the MPlayer-dev-eng mailing list