Holger Hans Peter Freyther | 2b3379d | 2017-04-02 15:49:51 +0200 | [diff] [blame^] | 1 | From 2aac6a668be131c610b6705a99817e6baf10599f Mon Sep 17 00:00:00 2001 |
| 2 | From: Andreas Eversberg <jolly@eversberg.eu> |
| 3 | Date: Tue, 15 Dec 2015 20:49:18 +0100 |
| 4 | Subject: [PATCH] Fixed compiler warnings |
| 5 | |
| 6 | --- |
| 7 | alawulaw.c | 18 +++++++++--------- |
| 8 | gentones.c | 8 ++++---- |
| 9 | genwave.c | 10 +++++----- |
| 10 | 3 files changed, 18 insertions(+), 18 deletions(-) |
| 11 | |
| 12 | diff --git a/alawulaw.c b/alawulaw.c |
| 13 | index cafe1af..f38fa46 100644 |
| 14 | --- a/alawulaw.c |
| 15 | +++ b/alawulaw.c |
| 16 | @@ -13,7 +13,7 @@ signed int *audio_law_to_s32; |
| 17 | unsigned char silence; |
| 18 | |
| 19 | /* ulaw -> signed 16-bit */ |
| 20 | -static signed int audio_ulaw_to_s32[] = |
| 21 | +static unsigned int audio_ulaw_to_s32[] = |
| 22 | { |
| 23 | 0xffff8284, 0xffff8684, 0xffff8a84, 0xffff8e84, |
| 24 | 0xffff9284, 0xffff9684, 0xffff9a84, 0xffff9e84, |
| 25 | @@ -82,7 +82,7 @@ static signed int audio_ulaw_to_s32[] = |
| 26 | }; |
| 27 | |
| 28 | /* alaw -> signed 16-bit */ |
| 29 | -static signed int audio_alaw_to_s32[] = |
| 30 | +static unsigned int audio_alaw_to_s32[] = |
| 31 | { |
| 32 | 0x000013fc, 0xffffec04, 0x00000144, 0xfffffebc, |
| 33 | 0x0000517c, 0xffffae84, 0x0000051c, 0xfffffae4, |
| 34 | @@ -155,7 +155,7 @@ unsigned char audio_s16_to_law[65536]; |
| 35 | |
| 36 | |
| 37 | /* table is used to generate s16_to_alaw */ |
| 38 | -static short audio_alaw_relations[] = |
| 39 | +static unsigned short audio_alaw_relations[] = |
| 40 | { |
| 41 | 0x8684, 0x55, 0x8a84, 0xd5, 0x8e84, 0x15, 0x9284, 0x95, |
| 42 | 0x9684, 0x75, 0x9a84, 0xf5, 0x9e84, 0x35, 0xa284, 0xb5, |
| 43 | @@ -231,32 +231,32 @@ void generate_tables(char law) |
| 44 | |
| 45 | if (law == 'a') { |
| 46 | silence = 0x2a; |
| 47 | - audio_law_to_s32=audio_alaw_to_s32; |
| 48 | + audio_law_to_s32 = (signed int *)audio_alaw_to_s32; |
| 49 | /* generating alaw-table */ |
| 50 | i = j = 0; |
| 51 | while(i < 65536) { |
| 52 | - if (i-32768 > audio_alaw_relations[j<<1]) |
| 53 | + if (i-32768 > (signed short)audio_alaw_relations[j<<1]) |
| 54 | j++; |
| 55 | if (j>255) |
| 56 | j=255; |
| 57 | audio_s16_to_law[(i-32768) & 0xffff] |
| 58 | - = audio_alaw_relations[(j<<1)|1]; |
| 59 | + = (signed short)audio_alaw_relations[(j<<1)|1]; |
| 60 | i++; |
| 61 | } |
| 62 | } else { |
| 63 | silence = 0xff; |
| 64 | - audio_law_to_s32=audio_ulaw_to_s32; |
| 65 | + audio_law_to_s32 = (signed int *)audio_ulaw_to_s32; |
| 66 | /* generating ulaw-table */ |
| 67 | i = j = 0; |
| 68 | while(i < 32768) { |
| 69 | - if (i-32768 > audio_ulaw_to_s32[j]) |
| 70 | + if (i-32768 > (signed int)audio_ulaw_to_s32[j]) |
| 71 | j++; |
| 72 | audio_s16_to_law[(i-32768) & 0xffff] = j; |
| 73 | i++; |
| 74 | } |
| 75 | j = 255; |
| 76 | while(i < 65536) { |
| 77 | - if (i-0x32768 > audio_ulaw_to_s32[j]) |
| 78 | + if (i-0x32768 > (signed int)audio_ulaw_to_s32[j]) |
| 79 | j--; |
| 80 | audio_s16_to_law[(i-32768) & 0xffff] = j; |
| 81 | i++; |
| 82 | diff --git a/gentones.c b/gentones.c |
| 83 | index aaac659..a712f1a 100644 |
| 84 | --- a/gentones.c |
| 85 | +++ b/gentones.c |
| 86 | @@ -10,7 +10,7 @@ |
| 87 | |
| 88 | |
| 89 | /* ulaw -> signed 16-bit */ |
| 90 | -static short isdn_audio_ulaw_to_s16[] = |
| 91 | +static unsigned short isdn_audio_ulaw_to_s16[] = |
| 92 | { |
| 93 | 0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84, |
| 94 | 0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84, |
| 95 | @@ -47,7 +47,7 @@ static short isdn_audio_ulaw_to_s16[] = |
| 96 | }; |
| 97 | |
| 98 | /* alaw -> signed 16-bit */ |
| 99 | -static short isdn_audio_alaw_to_s16[] = |
| 100 | +static unsigned short isdn_audio_alaw_to_s16[] = |
| 101 | { |
| 102 | 0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4, |
| 103 | 0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74, |
| 104 | @@ -92,7 +92,7 @@ unsigned char encode_isdn(short sample, char law) |
| 105 | |
| 106 | i=0; |
| 107 | while(i<256) { |
| 108 | - diff = (law=='u')?isdn_audio_ulaw_to_s16[i]:isdn_audio_alaw_to_s16[i]-sample; |
| 109 | + diff = (law=='u')?((signed short)isdn_audio_ulaw_to_s16[i]):((signed short)isdn_audio_alaw_to_s16[i])-sample; |
| 110 | //printf("s16=%d sample%d diff=%d\n",isdn_audio_to_s16[i],sample,diff); |
| 111 | if (diff<0) |
| 112 | diff=0-diff; |
| 113 | @@ -150,7 +150,7 @@ void write_wav(FILE *fp, char *wav, char law) |
| 114 | short sample, sample2; |
| 115 | signed int size, chunk; |
| 116 | int gotfmt = 0, gotdata = 0; |
| 117 | - int ret; |
| 118 | + int __attribute__((__unused__)) ret; |
| 119 | |
| 120 | if ((wfp=fopen(wav,"r"))) { |
| 121 | ret=fread(buffer,8,1,wfp); |
| 122 | diff --git a/genwave.c b/genwave.c |
| 123 | index 685b5fa..fe74658 100644 |
| 124 | --- a/genwave.c |
| 125 | +++ b/genwave.c |
| 126 | @@ -9,7 +9,7 @@ |
| 127 | |
| 128 | |
| 129 | /* ulaw -> signed 16-bit */ |
| 130 | -static short isdn_audio_ulaw_to_s16[] = |
| 131 | +static unsigned short isdn_audio_ulaw_to_s16[] = |
| 132 | { |
| 133 | 0x8284, 0x8684, 0x8a84, 0x8e84, 0x9284, 0x9684, 0x9a84, 0x9e84, |
| 134 | 0xa284, 0xa684, 0xaa84, 0xae84, 0xb284, 0xb684, 0xba84, 0xbe84, |
| 135 | @@ -46,7 +46,7 @@ static short isdn_audio_ulaw_to_s16[] = |
| 136 | }; |
| 137 | |
| 138 | /* alaw -> signed 16-bit */ |
| 139 | -static short isdn_audio_alaw_to_s16[] = |
| 140 | +static unsigned short isdn_audio_alaw_to_s16[] = |
| 141 | { |
| 142 | 0x13fc, 0xec04, 0x0144, 0xfebc, 0x517c, 0xae84, 0x051c, 0xfae4, |
| 143 | 0x0a3c, 0xf5c4, 0x0048, 0xffb8, 0x287c, 0xd784, 0x028c, 0xfd74, |
| 144 | @@ -100,7 +100,7 @@ void write_law(FILE *fp, char *name, char law) |
| 145 | unsigned int i; |
| 146 | short sample; |
| 147 | unsigned int size, wsize; |
| 148 | - int ret; |
| 149 | + int __attribute__((__unused__)) ret; |
| 150 | |
| 151 | if ((lfp=fopen(name,"r"))) { |
| 152 | /* get size */ |
| 153 | @@ -134,9 +134,9 @@ void write_law(FILE *fp, char *name, char law) |
| 154 | while(i < size) { |
| 155 | ret = fread(buffer, 1, 1, lfp); |
| 156 | if (law == 'a') |
| 157 | - sample = isdn_audio_alaw_to_s16[*buffer]; |
| 158 | + sample = (signed short)isdn_audio_alaw_to_s16[*buffer]; |
| 159 | else |
| 160 | - sample = isdn_audio_ulaw_to_s16[*buffer]; |
| 161 | + sample = (signed short)isdn_audio_ulaw_to_s16[*buffer]; |
| 162 | ret = fwrite(&sample, 2, 1, fp); |
| 163 | i+=2; |
| 164 | } |
| 165 | -- |
| 166 | 1.9.1 |
| 167 | |