--- motion-3.2.2/avilib.c	2005-06-20 20:22:13.000000000 +0200
+++ motion-3.2.2-signed-fix/avilib.c	2005-06-20 20:23:58.000000000 +0200
@@ -1,6 +1,9 @@
 /*
  *  avilib.c
  *
+ *  Angel Carpintero - June 2005
+ *  gcc4 warning fixes
+ *
  *  Copyright (C) Thomas Östreich - June 2001
  *  multiple audio track support Copyright (C) 2002 Thomas Östreich 
  *
@@ -218,7 +221,7 @@ static int avi_add_chunk(avi_t *AVI, uns
    return 0;
 }
 
-#define OUTD(n) long2str(ix00+bl,n); bl+=4
+#define OUTD(n) long2str((unsigned char *)ix00+bl,n); bl+=4
 #define OUTW(n) ix00[bl] = (n)&0xff; ix00[bl+1] = (n>>8)&0xff; bl+=2
 #define OUTC(n) ix00[bl] = (n)&0xff; bl+=1
 #define OUTS(s) memcpy(ix00+bl,s,4); bl+=4
@@ -261,7 +264,7 @@ static int avi_ixnn_entry(avi_t *AVI, av
 	OUTD(ch->aIndex[k].dwSize);
 
     }
-    avi_add_chunk (AVI, ch->fcc, ix00, max);
+    avi_add_chunk (AVI, (unsigned char *)ch->fcc, (unsigned char *)ix00, max);
 
     free(ix00);
 
@@ -379,7 +382,7 @@ static int avi_add_odml_index_entry(avi_
 {
     char fcc[5];
 
-    int audio = (strchr (tag, 'w')?1:0);
+    int audio = (strchr ((char *)tag, 'w')?1:0);
     int video = !audio;
 
     unsigned int cur_std_idx;
@@ -389,11 +392,11 @@ static int avi_add_odml_index_entry(avi_
     if (video) {
 
 	if (!AVI->video_superindex) {
-	    if (avi_init_super_index(AVI, "ix00", &AVI->video_superindex) < 0) return -1;
+	    if (avi_init_super_index(AVI,(unsigned char *) "ix00", &AVI->video_superindex) < 0) return -1;
              AVI->video_superindex->nEntriesInUse++;
 	    cur_std_idx = AVI->video_superindex->nEntriesInUse-1;
 
-	    if (avi_add_std_index (AVI, "ix00", "00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) 
+	    if (avi_add_std_index (AVI, (unsigned char *) "ix00",(unsigned char *) "00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) 
 		return -1;
 	} // init
 
@@ -407,13 +410,13 @@ static int avi_add_odml_index_entry(avi_
 #ifdef DEBUG_ODML
 	    printf("ODML: fcc = %s\n", fcc);
 #endif
-	    if (avi_init_super_index(AVI, fcc, &AVI->track[AVI->aptr].audio_superindex) < 0) return -1;
+	    if (avi_init_super_index(AVI, (unsigned char *)fcc, &AVI->track[AVI->aptr].audio_superindex) < 0) return -1;
 
 
 	    AVI->track[AVI->aptr].audio_superindex->nEntriesInUse++;
 
 	    snprintf(fcc, sizeof(fcc), "ix%02d", AVI->aptr+1);
-	    if (avi_add_std_index (AVI, fcc, tag, AVI->track[AVI->aptr].audio_superindex->stdindex[ 
+	    if (avi_add_std_index (AVI, (unsigned char *)fcc, tag, AVI->track[AVI->aptr].audio_superindex->stdindex[ 
 			AVI->track[AVI->aptr].audio_superindex->nEntriesInUse - 1 ]) < 0
 	       ) return -1;
 	} // init
@@ -460,7 +463,7 @@ static int avi_add_odml_index_entry(avi_
 	    return -1;
 	}
 
-	if (avi_add_std_index (AVI, "ix00", "00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) 
+	if (avi_add_std_index (AVI, (unsigned char *)"ix00", (unsigned char *)"00db", AVI->video_superindex->stdindex[ cur_std_idx ]) < 0) 
 	    return -1;
 
 	for (audtr = 0; audtr < AVI->anum; audtr++) {
@@ -473,7 +476,7 @@ static int avi_add_odml_index_entry(avi_
 
 	    snprintf(fcc, sizeof(fcc), "ix%02d", audtr+1);
 	    snprintf(aud, sizeof(aud), "0%01dwb", audtr+1);
-	    if (avi_add_std_index (AVI, fcc, aud, AVI->track[audtr].audio_superindex->stdindex[ 
+	    if (avi_add_std_index (AVI, (unsigned char *)fcc, (unsigned char *)aud, AVI->track[audtr].audio_superindex->stdindex[ 
 			AVI->track[audtr].audio_superindex->nEntriesInUse - 1 ]) < 0
 	       ) return -1;
 	}
@@ -510,7 +513,7 @@ static int avi_add_odml_index_entry(avi_
 		// qwBaseOffset will contain the start of the second riff chunk
 	    }
 	    // Fix the Offsets later at closing time
-	    avi_add_chunk(AVI, (unsigned char *)"RIFF", "AVIXLIST\0\0\0\0movi", 16);
+	    avi_add_chunk(AVI, (unsigned char *)"RIFF", (unsigned char *)"AVIXLIST\0\0\0\0movi", 16);
 
 	    AVI->video_superindex->stdindex[ cur_std_idx ]->qwBaseOffset = AVI->pos -16 -8;
 #ifdef DEBUG_ODML
@@ -1089,7 +1092,7 @@ static int avi_parse_comments (int fd, c
 	    len += 4;
 
 	    // write length + '\0'
-	    long2str(buf+len, k+1); len += 4;
+	    long2str((unsigned char *)buf+len, k+1); len += 4;
 
 	    // write comment string
 	    memcpy (buf+len, d, k);
@@ -1606,7 +1609,7 @@ static int avi_close_output_file(avi_t *
    memcpy(AVI_header+nhb, id_str, id_len);
    nhb += id_len;
 
-   info_len = avi_parse_comments (AVI->comment_fd, AVI_header+nhb, HEADERBYTES - nhb - 8 - 12);
+   info_len = avi_parse_comments (AVI->comment_fd, (unsigned char *)AVI_header+nhb, HEADERBYTES - nhb - 8 - 12);
    if (info_len <= 0) info_len=0;
 
    // write correct len
@@ -1675,13 +1678,13 @@ static int avi_close_output_file(avi_t *
 	    lseek(AVI->fdes, AVI->video_superindex->stdindex[k]->qwBaseOffset+4, SEEK_SET);
 	    len = AVI->video_superindex->stdindex[k+1]->qwBaseOffset -
 		  AVI->video_superindex->stdindex[k]->qwBaseOffset - 8;
-	    long2str(f, len);
+	    long2str((unsigned char *)f, len);
 	    avi_write(AVI->fdes, f, 4);
 
 	    // len of the LIST/movi chunk
 	    lseek(AVI->fdes, 8, SEEK_CUR);
 	    len -= 12;
-	    long2str(f, len);
+	    long2str((unsigned char *)f, len);
 	    avi_write(AVI->fdes, f, 4);
        }
    }
@@ -1739,9 +1742,9 @@ static int avi_write_data(avi_t *AVI, ch
    /* Output tag and data */
    
    if(audio)
-     n = avi_add_chunk(AVI,(unsigned char *)astr,data,length);
+     n = avi_add_chunk(AVI,(unsigned char *)astr,(unsigned char *)data,length);
    else
-     n = avi_add_chunk(AVI,(unsigned char *)"00db",data,length);
+     n = avi_add_chunk(AVI,(unsigned char *)"00db",(unsigned char *)data,length);
    
    if (n) return -1;
    
@@ -2381,7 +2384,7 @@ int avi_parse_input_file(avi_t *AVI, int
 	   AVI->track[AVI->aptr].a_codech_off = header_offset + i;
 	   
          }
-         else if (strncasecmp (hdrl_data+i,"iavs",4) ==0 && ! auds_strh_seen) {
+         else if (strncasecmp ((char *)hdrl_data+i,"iavs",4) ==0 && ! auds_strh_seen) {
 	     fprintf(stderr, "AVILIB: error - DV AVI Type 1 no supported\n");
 	     return (-1);
 	 }
@@ -2389,7 +2392,7 @@ int avi_parse_input_file(avi_t *AVI, int
             lasttag = 0;
          num_stream++;
       }
-      else if(strncasecmp(hdrl_data+i,"dmlh",4) == 0) {
+      else if(strncasecmp((char *)hdrl_data+i,"dmlh",4) == 0) {
 	  AVI->total_frames = str2ulong(hdrl_data+i+8);
 #ifdef DEBUG_ODML
 	 fprintf(stderr, "real number of frames %d\n", AVI->total_frames);
@@ -2466,22 +2469,22 @@ int avi_parse_input_file(avi_t *AVI, int
 	    //            auds_strf_seen = 1;
          }
       }
-      else if(strncasecmp(hdrl_data+i,"indx",4) == 0) {
+      else if(strncasecmp((char *)hdrl_data+i,"indx",4) == 0) {
 	 char *a;
 	 int j;
 
 	 if(lasttag == 1) // V I D E O
 	 { 
 
-	    a = hdrl_data+i;
+	    a = (char *)hdrl_data+i;
 
 	    AVI->video_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk));
 	    memcpy (AVI->video_superindex->fcc, a, 4);             a += 4;
-	    AVI->video_superindex->dwSize = str2ulong(a);          a += 4;
-	    AVI->video_superindex->wLongsPerEntry = str2ushort(a); a += 2;
+	    AVI->video_superindex->dwSize = str2ulong((unsigned char *)a);          a += 4;
+	    AVI->video_superindex->wLongsPerEntry = str2ushort((unsigned char *)a); a += 2;
 	    AVI->video_superindex->bIndexSubType = *a;             a += 1;
 	    AVI->video_superindex->bIndexType = *a;                a += 1;
-	    AVI->video_superindex->nEntriesInUse = str2ulong(a);   a += 4;
+	    AVI->video_superindex->nEntriesInUse = str2ulong((unsigned char *)a);   a += 4;
 	    memcpy (AVI->video_superindex->dwChunkId, a, 4);       a += 4;
 
 	    // 3 * reserved
@@ -2494,9 +2497,9 @@ int avi_parse_input_file(avi_t *AVI, int
 
 	    // position of ix## chunks
 	    for (j=0; j<AVI->video_superindex->nEntriesInUse; ++j) {
-	       AVI->video_superindex->aIndex[j].qwOffset = str2ullong (a);  a += 8;
-	       AVI->video_superindex->aIndex[j].dwSize = str2ulong (a);     a += 4;
-	       AVI->video_superindex->aIndex[j].dwDuration = str2ulong (a); a += 4;
+	       AVI->video_superindex->aIndex[j].qwOffset = str2ullong ((unsigned char *)a);  a += 8;
+	       AVI->video_superindex->aIndex[j].dwSize = str2ulong ((unsigned char *)a);     a += 4;
+	       AVI->video_superindex->aIndex[j].dwDuration = str2ulong ((unsigned char *)a); a += 4;
 
 #ifdef DEBUG_ODML
 	       printf("[%d] 0x%llx 0x%lx %lu\n", j, 
@@ -2526,15 +2529,15 @@ int avi_parse_input_file(avi_t *AVI, int
          else if(lasttag == 2) // A U D I O
          {
 
-	    a = hdrl_data+i;
+	    a = (char *)hdrl_data+i;
 
 	    AVI->track[AVI->aptr].audio_superindex = (avisuperindex_chunk *) malloc (sizeof (avisuperindex_chunk));
 	    memcpy (AVI->track[AVI->aptr].audio_superindex->fcc, a, 4);             a += 4;
-	    AVI->track[AVI->aptr].audio_superindex->dwSize = str2ulong(a);          a += 4;
-	    AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry = str2ushort(a); a += 2;
+	    AVI->track[AVI->aptr].audio_superindex->dwSize = str2ulong((unsigned char *)a);          a += 4;
+	    AVI->track[AVI->aptr].audio_superindex->wLongsPerEntry = str2ushort((unsigned char *)a); a += 2;
 	    AVI->track[AVI->aptr].audio_superindex->bIndexSubType = *a;             a += 1;
 	    AVI->track[AVI->aptr].audio_superindex->bIndexType = *a;                a += 1;
-	    AVI->track[AVI->aptr].audio_superindex->nEntriesInUse = str2ulong(a);   a += 4;
+	    AVI->track[AVI->aptr].audio_superindex->nEntriesInUse = str2ulong((unsigned char *)a);   a += 4;
 	    memcpy (AVI->track[AVI->aptr].audio_superindex->dwChunkId, a, 4);       a += 4;
 
 	    // 3 * reserved
@@ -2548,9 +2551,9 @@ int avi_parse_input_file(avi_t *AVI, int
 
 	    // position of ix## chunks
 	    for (j=0; j<AVI->track[AVI->aptr].audio_superindex->nEntriesInUse; ++j) {
-	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].qwOffset = str2ullong (a);  a += 8;
-	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwSize = str2ulong (a);     a += 4;
-	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwDuration = str2ulong (a); a += 4;
+	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].qwOffset = str2ullong ((unsigned char *)a);  a += 8;
+	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwSize = str2ulong ((unsigned char *)a);     a += 4;
+	       AVI->track[AVI->aptr].audio_superindex->aIndex[j].dwDuration = str2ulong ((unsigned char *)a); a += 4;
 
 #ifdef DEBUG_ODML
 	       printf("[%d] 0x%llx 0x%lx %lu\n", j, 
@@ -2574,9 +2577,9 @@ int avi_parse_input_file(avi_t *AVI, int
 	 }
 	 i += 8;
       }
-      else if((strncasecmp(hdrl_data+i,"JUNK",4) == 0) ||
-              (strncasecmp(hdrl_data+i,"strn",4) == 0) ||
-              (strncasecmp(hdrl_data+i,"vprp",4) == 0)){
+      else if((strncasecmp((char *)hdrl_data+i,"JUNK",4) == 0) ||
+              (strncasecmp((char *)hdrl_data+i,"strn",4) == 0) ||
+              (strncasecmp((char *)hdrl_data+i,"vprp",4) == 0)){
 	 i += 8;
 	 // do not reset lasttag
       } else
@@ -2746,7 +2749,7 @@ int avi_parse_input_file(avi_t *AVI, int
 	    continue;
 	 }
 
-	 nrEntries = str2ulong(en + 12);
+	 nrEntries = str2ulong((unsigned char *)en + 12);
 #ifdef DEBUG_ODML
 	 //printf("[%d:0] Video nrEntries %ld\n", j, nrEntries);
 #endif
@@ -2763,9 +2766,9 @@ int avi_parse_input_file(avi_t *AVI, int
 
 	 while (k < nvi) {
 
-	    AVI->video_index[k].pos = offset + str2ulong(en); en += 4;
-	    AVI->video_index[k].len = str2ulong_len(en);
-	    AVI->video_index[k].key = str2ulong_key(en); en += 4;
+	    AVI->video_index[k].pos = offset + str2ulong((unsigned char *)en); en += 4;
+	    AVI->video_index[k].len = str2ulong_len((unsigned char *)en);
+	    AVI->video_index[k].key = str2ulong_key((unsigned char *)en); en += 4;
 
 	    // completely empty chunk
 	    if (AVI->video_index[k].pos-offset == 0 && AVI->video_index[k].len == 0) {
@@ -2825,12 +2828,12 @@ int avi_parse_input_file(avi_t *AVI, int
 	       continue;
 	    }
 
-	    nrEntries = str2ulong(en + 12);
+	    nrEntries = str2ulong((unsigned char *)en + 12);
 	    //if (nrEntries > 50) nrEntries = 2; // XXX
 #ifdef DEBUG_ODML
 	    //printf("[%d:%d] Audio nrEntries %ld\n", j, audtr, nrEntries);
 #endif
-	    offset = str2ullong(en + 20);
+	    offset = str2ullong((unsigned char *)en + 20);
 
 	    // skip header
 	    en += hdrl_len;
@@ -2839,8 +2842,8 @@ int avi_parse_input_file(avi_t *AVI, int
 
 	    while (k < nai[audtr]) {
 
-	       AVI->track[audtr].audio_index[k].pos = offset + str2ulong(en); en += 4;
-	       AVI->track[audtr].audio_index[k].len = str2ulong_len(en); en += 4;
+	       AVI->track[audtr].audio_index[k].pos = offset + str2ulong((unsigned char *)en); en += 4;
+	       AVI->track[audtr].audio_index[k].len = str2ulong_len((unsigned char *)en); en += 4;
 	       AVI->track[audtr].audio_index[k].tot = tot[audtr];
 	       tot[audtr] += AVI->track[audtr].audio_index[k].len;
 
@@ -3550,9 +3553,9 @@ int AVI_read_wave_header( int fd, struct
 	    wave->data.id[0], wave->data.id[1], wave->data.id[2], wave->data.id[3]);
 	    */
 
-    if( strncasecmp(wave->riff.id     , "RIFF",4) != 0 ||
-	strncasecmp(wave->riff.wave_id, "WAVE",4) != 0 ||
-	strncasecmp(wave->format.id   , "fmt ",4) != 0 )
+    if( strncasecmp((char *)wave->riff.id     , "RIFF",4) != 0 ||
+	strncasecmp((char *)wave->riff.wave_id, "WAVE",4) != 0 ||
+	strncasecmp((char *)wave->format.id   , "fmt ",4) != 0 )
     {
 	AVI_errno = AVI_ERR_NO_AVI;
 	return -1;
