X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=genwave.c;h=fe74658108829df5de41efe256468e7d8e119d0a;hp=8f3207655b1376c0c874a88e4fbbf48814f06e6a;hb=5566f74eb29be75da44e29ba72ee6f015249ce61;hpb=e9bfe48fc5254e79e59c6ffc1698912175edf4e3 diff --git a/genwave.c b/genwave.c index 8f32076..fe74658 100644 --- a/genwave.c +++ b/genwave.c @@ -9,7 +9,7 @@ /* ulaw -> signed 16-bit */ -static short isdn_audio_ulaw_to_s16[] = +static unsigned short isdn_audio_ulaw_to_s16[] = { 0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84, 0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84, @@ -46,7 +46,7 @@ static short isdn_audio_ulaw_to_s16[] = }; /* alaw -> signed 16-bit */ -static short isdn_audio_alaw_to_s16[] = +static unsigned short isdn_audio_alaw_to_s16[] = { 0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4, 0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74, @@ -100,6 +100,7 @@ void write_law(FILE *fp, char *name, char law) unsigned int i; short sample; unsigned int size, wsize; + int __attribute__((__unused__)) ret; if ((lfp=fopen(name,"r"))) { /* get size */ @@ -125,18 +126,18 @@ void write_law(FILE *fp, char *name, char law) fmt.data_rate = 16000; fmt.bytes_sample = 2; fmt.bits_sample = 16; - fwrite(&fmt, sizeof(fmt), 1, fp); + ret = fwrite(&fmt, sizeof(fmt), 1, fp); /* data */ fprintf(fp, "data%c%c%c%c", (char)(size&0xff), (char)((size>>8)&0xff), (char)((size>>16)&0xff), (char)(size>>24)); i = 0; while(i < size) { - fread(buffer, 1, 1, lfp); + ret = fread(buffer, 1, 1, lfp); if (law == 'a') - sample = isdn_audio_alaw_to_s16[*buffer]; + sample = (signed short)isdn_audio_alaw_to_s16[*buffer]; else - sample = isdn_audio_ulaw_to_s16[*buffer]; - fwrite(&sample, 2, 1, fp); + sample = (signed short)isdn_audio_ulaw_to_s16[*buffer]; + ret = fwrite(&sample, 2, 1, fp); i+=2; }