From: Andreas Eversberg Date: Thu, 11 Mar 2010 13:07:20 +0000 (+0100) Subject: Fixed compiler warnings when compiling with gcc 4.3.4. X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=commitdiff_plain;h=0c65074b5b88b2da2390078d0fab6c72f228709d Fixed compiler warnings when compiling with gcc 4.3.4. Fixed names of moved include files (OpenBSC). modified: Makefile.am modified: Makefile.in modified: README modified: chan_lcr.c modified: configure modified: configure.ac modified: genrc.c modified: gentones.c modified: genwave.c modified: gsm.cpp modified: mISDN.cpp modified: main.c modified: port.cpp modified: tones.c modified: trace.c --- diff --git a/Makefile.am b/Makefile.am index 17f9a29..2125468 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,11 +45,11 @@ INSTALLATION_DEFINES = \ if ENABLE_GSM -GSM_INCLUDE = -DWITH_GSM -I./openbsc/include +GSM_INCLUDE = -DWITH_GSM -I./openbsc/include -I./libosmocore/include GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c openbsc/src/bsc_init.c openbsc/src/vty_interface.c openbsc/src/vty_interface_layer3.c -GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -ldbi -lcrypt +GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -L./libosmocore/src/ -losmocore -ldbi -lcrypt #gsm_audio.po: gsm_audio.c gsm_audio.h # $(CC) -D_GNU_SOURCE -fPIC -c gsm_audio.c -o gsm_audio.po diff --git a/Makefile.in b/Makefile.in index 1a2bd77..e45b8a0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -249,9 +249,9 @@ INSTALLATION_DEFINES = \ -DLOG_DIR="\"$(LOGdir)\"" \ -DEXTENSION_DATA="\"$(EXTENSIONdir)\"" -@ENABLE_GSM_TRUE@GSM_INCLUDE = -DWITH_GSM -I./openbsc/include +@ENABLE_GSM_TRUE@GSM_INCLUDE = -DWITH_GSM -I./openbsc/include -I./libosmocore/include @ENABLE_GSM_TRUE@GSM_SOURCE = gsm_audio.c gsm.cpp gsm_conf.c openbsc/src/bsc_init.c openbsc/src/vty_interface.c openbsc/src/vty_interface_layer3.c -@ENABLE_GSM_TRUE@GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -ldbi -lcrypt +@ENABLE_GSM_TRUE@GSM_LIB = /usr/lib/libgsm.a ./openbsc/src/libbsc.a ./openbsc/src/libmsc.a ./openbsc/src/libvty.a -L./libosmocore/src/ -losmocore -ldbi -lcrypt #gsm_audio.po: gsm_audio.c gsm_audio.h # $(CC) -D_GNU_SOURCE -fPIC -c gsm_audio.c -o gsm_audio.po @@ -294,15 +294,15 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile + $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/README b/README index 9b8aae1..e6bd449 100644 --- a/README +++ b/README @@ -539,6 +539,9 @@ Changes after Version 1.7 -> Use options "t:q250" for disabling mISDN_dsp and adding a 250ms delay. - Fixed HLC (higher layer capability) modification to LCR routing. - Fixed chan_lcr fax queue buffer. Added LCR_TRANSFERCAPABILITY environment. +- Fixed compiler warnings when compiling with gcc 4.3.4. + + diff --git a/chan_lcr.c b/chan_lcr.c index 040f921..6a953a2 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -2356,9 +2356,11 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz break; #ifdef AST_CONTROL_SRCUPDATE case AST_CONTROL_SRCUPDATE: +#else + case 20: +#endif CDEBUG(call, ast, "Received AST_CONTROL_SRCUPDATE from Asterisk.\n"); break; -#endif default: CERROR(call, ast, "Received indicate from Asterisk with unknown condition %d.\n", cond); res = -1; diff --git a/configure b/configure index 9340f73..62e9cd7 100755 --- a/configure +++ b/configure @@ -6297,9 +6297,9 @@ else if test "x$with_gsm" != xcheck ; then { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ . +{ { $as_echo "$as_me:$LINENO: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC and libosmocore source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ openbsc ; ln -s patch_to_libosmocore osmocore See \`config.log' for more details." >&5 -$as_echo "$as_me: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ . +$as_echo "$as_me: error: --with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC and libosmocore source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ openbsc ; ln -s patch_to_libosmocore osmocore See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi diff --git a/configure.ac b/configure.ac index d138e16..cc7cc9b 100644 --- a/configure.ac +++ b/configure.ac @@ -108,7 +108,7 @@ AS_IF([test "x$with_gsm" != xno], [with_gsm="yes"], [if test "x$with_gsm" != xcheck ; then AC_MSG_FAILURE( - [--with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ .]) + [--with-gsm was given, but openbsc/include/openbsc/gsm_data.h was not found! Pleas link OpenBSC and libosmocore source directory to LCR source directory: ln -s path_to_openbsc/openbsc/ openbsc ; ln -s patch_to_libosmocore osmocore]) fi ]) ]) diff --git a/genrc.c b/genrc.c index 3e349f4..1d5a076 100644 --- a/genrc.c +++ b/genrc.c @@ -39,6 +39,7 @@ int main(void) FILE *fp; int i = 0, j, jj, n; char input[256], file[256]; + int ret; printf("\n\nThis program generates a script, which is used to start/stop/restart mISDN\n"); printf("driver. Please select card only once. Mode and options are given by LCR.\n"); @@ -52,7 +53,7 @@ int main(void) } do { printf("\nSelect driver number[1-n] (or enter 'done'): "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); } while (atoi(input) <= 0 && !!strcmp(input, "done")); type[i] = atoi(input); i++; @@ -66,22 +67,22 @@ int main(void) } printf("\nEnter LAW audio mode. For a-LAW (default), just enter 0. For u-LAW enter 1.\n[0..n | 0xn]: "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); lawopt = strtoul(input, NULL, 0); printf("\nEnter debugging flags of mISDN core. For no debug, just enter 0.\n[0..n | 0xn]: "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); coredebug = strtoul(input, NULL, 0); printf("\nEnter debugging flags of cards. For no debug, just enter 0.\n[0..n | 0xn]: "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); carddebug = strtoul(input, NULL, 0); printf("\nEnter dsp debugging flags of driver. For no debug, just enter 0.\n[0..n | 0xn]: "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); dspdebug = strtoul(input, NULL, 0); n = i; printf("\nWhere do you like to load the modules from, enter 0 for default, 1 for\n'/usr/local/lcr/modules/' or the full path.\n[0 | 1 | ]: "); fflush(stdout); - scanf("%s", input); + ret = scanf("%s", input); if (!strcmp(input, "0")) SCPY(input, ""); if (!strcmp(input, "1")) @@ -90,7 +91,7 @@ int main(void) SCAT(input, "/"); printf("\n\nFinally tell me where to write the mISDN rc file.\nEnter the name 'mISDN' for current directory.\nYou may want to say '/usr/local/lcr/mISDN' or '/etc/rc.d/mISDN'\n: "); fflush(stdout); - scanf("%s", file); + ret = scanf("%s", file); if (!(fp=fopen(file, "w"))) { fprintf(stderr, "\nError: Failed to open '%s', try again.\n", file); exit(EXIT_FAILURE); diff --git a/gentones.c b/gentones.c index 6cdaf37..aaac659 100644 --- a/gentones.c +++ b/gentones.c @@ -150,9 +150,10 @@ void write_wav(FILE *fp, char *wav, char law) short sample, sample2; signed int size, chunk; int gotfmt = 0, gotdata = 0; + int ret; if ((wfp=fopen(wav,"r"))) { - fread(buffer,8,1,wfp); + ret=fread(buffer,8,1,wfp); size=(buffer[4]) + (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24); if (!!strncmp((char *)buffer, "RIFF", 4)) { fclose(wfp); @@ -160,7 +161,7 @@ void write_wav(FILE *fp, char *wav, char law) return; } printf("%c%c%c%c size=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],size); - fread(buffer,4,1,wfp); + ret=fread(buffer,4,1,wfp); size -= 4; if (!!strncmp((char *)buffer, "WAVE", 4)) { fclose(wfp); @@ -173,7 +174,7 @@ void write_wav(FILE *fp, char *wav, char law) fprintf(stderr, "Error: Remaining file size %d not large enough for next chunk.\n",size); return; } - fread(buffer,8,1,wfp); + ret=fread(buffer,8,1,wfp); chunk=(buffer[4]) + (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24); //printf("DEBUG: size(%d) - (8+chunk(%d) = size(%d)\n", size, chunk, size-chunk-8); size -= (8+chunk); @@ -189,7 +190,7 @@ void write_wav(FILE *fp, char *wav, char law) fprintf(stderr, "Error: Fmt chunk illegal size.\n"); return; } - fread(buffer, chunk, 1, wfp); + ret=fread(buffer, chunk, 1, wfp); fmt = (struct fmt *)buffer; if (fmt->channels<1 || fmt->channels>2) { fclose(wfp); @@ -221,7 +222,7 @@ void write_wav(FILE *fp, char *wav, char law) i=0; if (bytes==2 && channels==1) { while(i (signed int)sizeof(buffer)) { - fread(buffer, sizeof(buffer), 1, wfp); + ret=fread(buffer, sizeof(buffer), 1, wfp); chunk -= sizeof(buffer); } if (chunk) - fread(buffer, chunk, 1, wfp); + ret=fread(buffer, chunk, 1, wfp); } } diff --git a/genwave.c b/genwave.c index 8f32076..685b5fa 100644 --- a/genwave.c +++ b/genwave.c @@ -100,6 +100,7 @@ void write_law(FILE *fp, char *name, char law) unsigned int i; short sample; unsigned int size, wsize; + int 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]; else sample = isdn_audio_ulaw_to_s16[*buffer]; - fwrite(&sample, 2, 1, fp); + ret = fwrite(&sample, 2, 1, fp); i+=2; } diff --git a/gsm.cpp b/gsm.cpp index 9ffcc4c..b2bdd6b 100644 --- a/gsm.cpp +++ b/gsm.cpp @@ -18,10 +18,10 @@ extern "C" { #include #include -#include +#include #include #include -#include +#include #include #include struct gsm_network *bsc_gsmnet = 0; diff --git a/mISDN.cpp b/mISDN.cpp index 7be3d4f..f5f8717 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -1832,13 +1832,14 @@ static int mISDN_upqueue(struct lcr_fd *fd, unsigned int what, void *instance, i struct mbuffer *mb; struct l3_msg *l3m; char byte; + int ret; /* unset global semaphore */ upqueue_avail = 0; // with a very small incident, upqueue_avail may be set by mISDN thread and // another byte may be sent to the pipe, which causes a call to this function // again with nothing in the upqueue. this is no problem. - read(fd->fd, &byte, 1); + ret = read(fd->fd, &byte, 1); /* process all ports */ mISDNport = mISDNport_first; @@ -2068,7 +2069,8 @@ int do_layer3(struct mlayer3 *ml3, unsigned int cmd, unsigned int pid, struct l3 // this is no problem. upqueue_avail = 1; char byte = 0; - write(upqueue_pipe[1], &byte, 1); + int ret; + ret = write(upqueue_pipe[1], &byte, 1); } return 0; } diff --git a/main.c b/main.c index b70ed05..b425abe 100644 --- a/main.c +++ b/main.c @@ -242,8 +242,9 @@ int main(int argc, char *argv[]) /* query available isdn ports */ if (!(strcasecmp(argv[1],"query"))) { + int rc; fprintf(stderr, "-> Using 'misdn_info'\n"); - system("misdn_info"); + rc = system("misdn_info"); ret = 0; goto free; } diff --git a/port.cpp b/port.cpp index e88175b..a083fa2 100644 --- a/port.cpp +++ b/port.cpp @@ -647,6 +647,7 @@ int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ig char filename[256]; time_t now; struct tm *now_tm; + int ret; if (!extension) { PERROR("Port(%d) not an extension\n", p_serial); @@ -711,7 +712,7 @@ int Port::open_record(int type, int vbox, int skip, char *extension, int anon_ig case CODEC_MONO: case CODEC_STEREO: case CODEC_8BIT: - fwrite(dummyheader, sizeof(dummyheader), 1, p_record); + ret = fwrite(dummyheader, sizeof(dummyheader), 1, p_record); break; case CODEC_LAW: @@ -739,6 +740,7 @@ void Port::close_record(int beep, int mute) char *p; struct caller_info callerinfo; const char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~"; + int ret; if (!p_record) return; @@ -801,7 +803,7 @@ void Port::close_record(int beep, int mute) } i = 0; while(i < beep) { - fwrite(beep_mono, sizeof(beep_mono), 1, p_record); + ret = fwrite(beep_mono, sizeof(beep_mono), 1, p_record); i += sizeof(beep_mono); p_record_length += sizeof(beep_mono); } @@ -861,7 +863,7 @@ void Port::close_record(int beep, int mute) fmt.bits_sample = 8; /* one channel */ break; } - fwrite(&fmt, sizeof(fmt), 1, p_record); + ret = fwrite(&fmt, sizeof(fmt), 1, p_record); /* data */ fprintf(p_record, "data%c%c%c%c", (unsigned char)(size&0xff), (unsigned char)((size>>8)&0xff), (unsigned char)((size>>16)&0xff), (unsigned char)(size>>24)); @@ -939,6 +941,7 @@ void Port::record(unsigned char *data, int length, int dir_fromup) signed short *s; int free, i, ii; signed int sample; + int ret; /* no recording */ if (!p_record || !length) @@ -988,7 +991,7 @@ same_again: p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK; i++; } - fwrite(write_buffer, 512, 1, p_record); + ret = fwrite(write_buffer, 512, 1, p_record); p_record_length += 512; break; @@ -1011,7 +1014,7 @@ same_again: i++; } } - fwrite(write_buffer, 1024, 1, p_record); + ret = fwrite(write_buffer, 1024, 1, p_record); p_record_length += 1024; break; @@ -1023,7 +1026,7 @@ same_again: p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK; i++; } - fwrite(write_buffer, 512, 1, p_record); + ret = fwrite(write_buffer, 512, 1, p_record); p_record_length += 512; break; @@ -1035,7 +1038,7 @@ same_again: p_record_buffer_readp = (p_record_buffer_readp + 1) & RECORD_BUFFER_MASK; i++; } - fwrite(write_buffer, 256, 1, p_record); + ret = fwrite(write_buffer, 256, 1, p_record); p_record_length += 256; break; } @@ -1075,7 +1078,7 @@ different_again: *s++ = sample; i++; } - fwrite(write_buffer, ii<<1, 1, p_record); + ret = fwrite(write_buffer, ii<<1, 1, p_record); p_record_length += (ii<<1); break; @@ -1098,7 +1101,7 @@ different_again: i++; } } - fwrite(write_buffer, ii<<2, 1, p_record); + ret = fwrite(write_buffer, ii<<2, 1, p_record); p_record_length += (ii<<2); break; @@ -1114,7 +1117,7 @@ different_again: *d++ = (sample+0x8000) >> 8; i++; } - fwrite(write_buffer, ii, 1, p_record); + ret = fwrite(write_buffer, ii, 1, p_record); p_record_length += ii; break; @@ -1130,7 +1133,7 @@ different_again: *d++ = audio_s16_to_law[sample & 0xffff]; i++; } - fwrite(write_buffer, ii, 1, p_record); + ret = fwrite(write_buffer, ii, 1, p_record); p_record_length += ii; break; } diff --git a/tones.c b/tones.c index 93d04e9..ad69011 100644 --- a/tones.c +++ b/tones.c @@ -48,6 +48,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) int linksize; int l; char *p; + int ret; /* try to open the law file */ @@ -104,7 +105,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) SPRINT(filename, "%s.wav", file); if ((fh = open(filename, O_RDONLY)) >= 0) { /* get wave header */ - read(fh, buffer, 8); + ret = read(fh, buffer, 8); size=(buffer[4]) + (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24); if (!!strncmp((char *)buffer, "RIFF", 4)) { close(fh); @@ -113,7 +114,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) return(-1); } // printf("%c%c%c%c size=%ld\n",buffer[0],buffer[1],buffer[2],buffer[3],size); - read(fh, buffer, 4); + ret = read(fh, buffer, 4); size -= 4; if (!!strncmp((char *)buffer, "WAVE", 4)) { close(fh); @@ -128,7 +129,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) PERROR("Remaining file size %ld not large enough for next chunk.\n",size); return(-1); } - read(fh, buffer, 8); + ret = read(fh, buffer, 8); chunk=(buffer[4]) + (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24); size -= (8+chunk); // printf("%c%c%c%c length=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],chunk); @@ -145,7 +146,7 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) PERROR("File %s Fmt chunk illegal size.\n", filename); return(-1); } - read(fh, buffer, chunk); + ret = read(fh, buffer, chunk); fmt = (struct fmt *)buffer; if (fmt->channels<1 || fmt->channels>2) { close(fh); @@ -211,11 +212,11 @@ int open_tone(char *file, int *codec, signed int *length, signed int *left) } else { // PDEBUG(DEBUG_PORT, "Unknown chunk '%c%c%c%c'\n",buffer[0],buffer[1],buffer[2],buffer[3]); while(chunk > sizeof(buffer)) { - read(fh, buffer, sizeof(buffer)); + ret = read(fh, buffer, sizeof(buffer)); chunk -= sizeof(buffer); } if (chunk) - read(fh, buffer, chunk); + ret = read(fh, buffer, chunk); } } diff --git a/trace.c b/trace.c index b8dc001..9d192da 100644 --- a/trace.c +++ b/trace.c @@ -264,6 +264,7 @@ void _end_trace(const char *__file, int __line) FILE *fp; struct admin_list *admin; struct admin_queue *response, **responsep; /* response pointer */ + int ret; if (!trace.name[0]) PERROR("trace not started in file %s line %d\n", __file, __line); @@ -278,7 +279,7 @@ void _end_trace(const char *__file, int __line) if (options.log[0]) { fp = fopen(options.log, "a"); if (fp) { - fwrite(string, strlen(string), 1, fp); + ret = fwrite(string, strlen(string), 1, fp); fclose(fp); } }