make compile with gcc 4.* without warnings. (hopefully with all versions)
authorSuper User <root@isdn.jolly.ten>
Tue, 29 Jul 2008 17:00:12 +0000 (19:00 +0200)
committerSuper User <root@isdn.jolly.ten>
Tue, 29 Jul 2008 17:00:12 +0000 (19:00 +0200)
modified:   Makefile
modified:   bchannel.c
modified:   chan_lcr.h
modified:   extension.c
modified:   gentones.c
modified:   genwave.c
modified:   joinpbx.cpp
modified:   tones.c

Makefile
bchannel.c
chan_lcr.h
extension.c
gentones.c
genwave.c
joinpbx.cpp
tones.c

index 78e3ead..63aeeee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,8 +47,8 @@ endif
 ifdef WITH-CRYPTO
 LIBDIR += -L/usr/local/ssl/lib
 CFLAGS += -I/usr/local/ssl/include
-#LIBS += -lcrypto
-LIBS += /usr/local/ssl/lib/libcrypto.a
+LIBS += -lcrypto
+#LIBS += /usr/local/ssl/lib/libcrypto.a
 endif
 
 #all:
index 6b005ec..c5dcc4b 100644 (file)
@@ -559,7 +559,7 @@ int bchannel_handle(void)
 {
        int ret, work = 0;
        struct bchannel *bchannel;
-       char buffer[2048+MISDN_HEADER_LEN];
+       unsigned char buffer[2048+MISDN_HEADER_LEN];
        struct mISDNhead *hh = (struct mISDNhead *)buffer;
 
        /* process all bchannels */
index 0ed661e..92a5fdf 100644 (file)
@@ -24,7 +24,7 @@ struct chan_call {
                                        /* audio is available */
        int                     cause, location;
                                        /* store cause from lcr */
-       unsigned char           dialque[64];
+       char                    dialque[64];
                                        /* queue dialing prior setup ack */
        char                    oad[64];/* caller id in number format */
 
index b1f6120..ed88c15 100644 (file)
@@ -1348,7 +1348,7 @@ int write_log(char *number, char *callerid, char *calledid, time_t start, time_t
        tm = localtime(&start);
        fprintf(fp,"%s %2d %04d %02d:%02d:%02d %s", mon[tm->tm_mon], tm->tm_mday, tm->tm_year+1900, tm->tm_hour, tm->tm_min, tm->tm_sec, number);
        if (stop)
-               fprintf(fp," %2ld:%02ld:%02ld", (stop-start)/3600, (((unsigned int)(stop-start))/60)%60, ((unsigned int)(stop-start))%60);
+               fprintf(fp," %2ld:%02d:%02d", (stop-start)/3600, (((unsigned int)(stop-start))/60)%60, ((unsigned int)(stop-start))%60);
        else
                fprintf(fp," --:--:--");
        fprintf(fp," %s -> %s", callerid, calledid);
index a883780..bf91e26 100644 (file)
@@ -164,7 +164,7 @@ void write_wav(FILE *fp, char *wav, char law)
                        fprintf(stderr, "Error: %s is no riff file!\n", wav);
                        return;
                }
-               printf("%c%c%c%c size=%ld\n",buffer[0],buffer[1],buffer[2],buffer[3],size);
+               printf("%c%c%c%c size=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],size);
                fread(buffer,4,1,wfp);
                size -= 4;
                if (!!strncmp((char *)buffer, "WAVE", 4))
@@ -178,17 +178,17 @@ void write_wav(FILE *fp, char *wav, char law)
                        if (size>0 && size<8)
                        {
                                fclose(wfp);
-                               fprintf(stderr, "Error: Remaining file size %ld not large enough for next chunk.\n",size);
+                               fprintf(stderr, "Error: Remaining file size %d not large enough for next chunk.\n",size);
                                return;
                        }
                        fread(buffer,8,1,wfp);
                        chunk=(buffer[4]) + (buffer[5]<<8) + (buffer[6]<<16) + (buffer[7]<<24);
-//printf("DEBUG: size(%ld) - (8+chunk(%ld) = size(%ld)\n", size, chunk, size-chunk-8);
+//printf("DEBUG: size(%d) - (8+chunk(%d) = size(%d)\n", size, chunk, size-chunk-8);
                        size -= (8+chunk);
                        if (size < 0)
                        {
                                fclose(wfp);
-                               fprintf(stderr, "Error: Chunk '%c%c%c%c' is larger than remainig file size (length=%ld)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk);
+                               fprintf(stderr, "Error: Chunk '%c%c%c%c' is larger than remainig file size (length=%d)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk);
                                return;
                        }
 //                     printf("%c%c%c%c lenght=%d\n",buffer[0],buffer[1],buffer[2],buffer[3],chunk);
@@ -212,9 +212,9 @@ void write_wav(FILE *fp, char *wav, char law)
                                printf("Channels: %d\n", channels);
                                if (fmt->sample_rate != 8000)
                                {
-                                       fprintf(stderr, "Warning: File has sample rate of %ld.\n", fmt->sample_rate);
+                                       fprintf(stderr, "Warning: File has sample rate of %d.\n", fmt->sample_rate);
                                }
-                               printf("Sample Rate: %ld\n", fmt->sample_rate);
+                               printf("Sample Rate: %d\n", fmt->sample_rate);
                                if (fmt->bits_sample!=8 && fmt->bits_sample!=16)
                                {
                                        fclose(wfp);
@@ -233,7 +233,7 @@ void write_wav(FILE *fp, char *wav, char law)
                                        fprintf(stderr, "Error: No fmt chunk fount in file.\n");
                                        return;
                                }
-                               printf("Length: %ld samples (%ld.%03ld seconds)\n", chunk/bytes/channels, chunk/bytes/channels/8000, ((chunk/bytes/channels)%8000)*1000/8000);
+                               printf("Length: %d samples (%d.%03d seconds)\n", chunk/bytes/channels, chunk/bytes/channels/8000, ((chunk/bytes/channels)%8000)*1000/8000);
                                i=0;
                                if (bytes==2 && channels==1)
                                {
@@ -282,7 +282,7 @@ void write_wav(FILE *fp, char *wav, char law)
                                gotdata = 1;
                        } else
                        {
-                               printf("Ignoring chunk '%c%c%c%c' (length=%ld)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk);
+                               printf("Ignoring chunk '%c%c%c%c' (length=%d)\n",buffer[0],buffer[1],buffer[2],buffer[3], chunk);
                                while(chunk > (signed int)sizeof(buffer))
                                {
                                        fread(buffer, sizeof(buffer), 1, wfp);
index cb62262..c614a2e 100644 (file)
--- a/genwave.c
+++ b/genwave.c
@@ -106,7 +106,7 @@ void write_law(FILE *fp, char *name, char law)
                /* get size */
                fseek(lfp, 0, SEEK_END);
                size = ftell(lfp);
-               printf("samples: %ld\n", size);
+               printf("samples: %d\n", size);
                size += size;
                fseek(lfp, 0, SEEK_SET);
 
index 21cb91d..e68669a 100644 (file)
@@ -134,12 +134,12 @@ void joinpbx_debug(class JoinPBX *joinpbx, char *function)
                epoint = find_epoint_id(relation->epoint_id);
                if (!epoint)
                {
-                       PDEBUG(DEBUG_JOIN, "warning: relations epoint id=%ld doesn't exists!\n", relation->epoint_id);
+                       PDEBUG(DEBUG_JOIN, "warning: relations epoint id=%d doesn't exists!\n", relation->epoint_id);
                        relation = relation->next;
                        continue;
                }
                buffer[0] = '\0';
-               UPRINT(strchr(buffer,0), "*** ep%ld", relation->epoint_id);
+               UPRINT(strchr(buffer,0), "*** ep%d", relation->epoint_id);
                UPRINT(strchr(buffer,0), " ifs=");
                portlist = epoint->ep_portlist;
                while(portlist)
@@ -148,7 +148,7 @@ void joinpbx_debug(class JoinPBX *joinpbx, char *function)
                        if (port)
                                UPRINT(strchr(buffer,0), "%s,", port->p_name);
                        else
-                               UPRINT(strchr(buffer,0), "<port %ld doesn't exist>,", portlist->port_id);
+                               UPRINT(strchr(buffer,0), "<port %d doesn't exist>,", portlist->port_id);
                        portlist = portlist->next;
                }
 //             UPRINT(strchr(buffer,0), " endpoint=%d on=%s hold=%s", epoint->ep_serial, (epoint->ep_join_id==joinpbx->j_serial)?"yes":"no", (epoint->get_hold_id()==joinpbx->j_serial)?"yes":"no");
diff --git a/tones.c b/tones.c
index fd85529..48625bb 100644 (file)
--- a/tones.c
+++ b/tones.c
@@ -342,7 +342,8 @@ int read_tone(int fh, unsigned char *buffer, int codec, int len, signed int size
                                l = l>>2;
                                while(i < l)
                                {
-                                       sample = (*buf32++) + (*buf32++);
+                                       sample = (*buf32++);
+                                       sample += (*buf32++);
                                        if (sample < -32767)
                                                sample = -32767;
                                        if (sample > 32767)
@@ -534,7 +535,7 @@ int fetch_tones(void)
                p = p_next;
        }
 
-       printf("PBX: Memory used for tones: %ld bytes (%d samples)\n", memory, samples);
+       printf("PBX: Memory used for tones: %d bytes (%d samples)\n", memory, samples);
        PDEBUG(DEBUG_PORT, "Memory used for tones: %ld bytes (%d samples)\n", memory, samples);
 
        return(1);