fix up various warnings found via the addition of format string checking... some...
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 18 Mar 2008 16:23:05 +0000 (16:23 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 18 Mar 2008 16:23:05 +0000 (16:23 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109475 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c
channels/misdn/isdn_lib.c
channels/misdn/isdn_lib.h

index a2b800c..1a5d671 100644 (file)
@@ -285,7 +285,8 @@ static pthread_t misdn_tasks_thread;
 
 static int *misdn_ports;
 
-static void chan_misdn_log(int level, int port, char *tmpl, ...);
+static void chan_misdn_log(int level, int port, char *tmpl, ...)
+       __attribute__ ((format (printf, 3, 4)));
 
 static struct ast_channel *misdn_new(struct chan_list *cl, int state,  char *exten, char *callerid, int format, int port, int c);
 static void send_digit_to_chan(struct chan_list *cl, char digit );
@@ -464,11 +465,11 @@ static void print_facility(struct FacParm *fac, struct misdn_bchannel *bc)
                        else if (fac->u.AOCDcur.freeOfCharge)
                                chan_misdn_log(1,bc->port," --> AOCD currency: free of charge\n");
                        else if (fac->u.AOCDchu.billingId >= 0)
-                               chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d billingId:%d\n",
+                               chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s billingId:%d\n",
                                                fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
                                                (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total", fac->u.AOCDcur.billingId);
                        else
-                               chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%d\n",
+                               chan_misdn_log(1,bc->port," --> AOCD currency: currency:%s amount:%d multiplier:%d typeOfChargingInfo:%s\n",
                                                fac->u.AOCDcur.currency, fac->u.AOCDcur.currencyAmount, fac->u.AOCDcur.multiplier,
                                                (fac->u.AOCDcur.typeOfChargingInfo == 0) ? "subTotal" : "total");
                        break;
@@ -4705,7 +4706,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
                int res;
                int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples);
 
-               chan_misdn_log(9, bc->port, "TONE_GEN: len:%d\n");
+               chan_misdn_log(9, bc->port, "TONE_GEN: len:%d\n", tone_len);
 
                if (!ast)
                        break;
@@ -4960,7 +4961,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
 #endif
                break;
                default:
-                       chan_misdn_log(0, bc->port," --> not yet handled: facility type:%p\n", bc->fac_in.Function);
+                       chan_misdn_log(0, bc->port," --> not yet handled: facility type:%d\n", bc->fac_in.Function);
                }
                
                break;
@@ -5603,7 +5604,7 @@ int misdn_jb_fill(struct misdn_jb *jb, const char *data, int len)
                jb->state_buffer = wp - rp;
        else
                jb->state_buffer = jb->size - rp + wp;
-       chan_misdn_log(9, 0, "misdn_jb_fill: written:%d | Bufferstatus:%d p:%x\n", len, jb->state_buffer, jb);
+       chan_misdn_log(9, 0, "misdn_jb_fill: written:%d | Bufferstatus:%d p:%p\n", len, jb->state_buffer, jb);
 
        if (jb->state_full) {
                jb->wp = wp;
@@ -5669,11 +5670,11 @@ int misdn_jb_empty(struct misdn_jb *jb, char *data, int len)
                        jb->state_buffer = wp - rp;
                else
                        jb->state_buffer = jb->size - rp + wp;
-               chan_misdn_log(9, 0, "misdn_jb_empty: read:%d | Bufferstatus:%d p:%x\n", len, jb->state_buffer, jb);
+               chan_misdn_log(9, 0, "misdn_jb_empty: read:%d | Bufferstatus:%d p:%p\n", len, jb->state_buffer, jb);
 
                jb->rp = rp;
        } else
-               chan_misdn_log(9, 0, "misdn_jb_empty: Wait...requested:%d p:%x\n", len, jb);
+               chan_misdn_log(9, 0, "misdn_jb_empty: Wait...requested:%d p:%p\n", len, jb);
 
        ast_mutex_unlock(&jb->mutexjb);
 
index 90a6c8d..d1c2c48 100644 (file)
@@ -3243,7 +3243,7 @@ void misdn_lib_log_ies(struct misdn_bchannel *bc)
 
        cb_log(5, stack->port, " --> urate:%d rate:%d mode:%d user1:%d\n", bc->urate, bc->rate, bc->mode,bc->user1);
        
-       cb_log(5, stack->port, " --> bc:%x h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
+       cb_log(5, stack->port, " --> bc:%p h:%d sh:%d\n", bc, bc->holded, bc->stack_holder);
 }
 
 void misdn_send_lock(struct misdn_bchannel *bc);
@@ -4336,7 +4336,7 @@ struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned lon
 {
        struct misdn_bchannel *help;
 
-       cb_log(4,stack?stack->port:0, "*HOLDER: find %x\n",l3id);
+       cb_log(4,stack?stack->port:0, "*HOLDER: find %lx\n",l3id);
        
        if (!stack) return NULL;
        
index 85922c6..8e2154d 100644 (file)
@@ -377,12 +377,14 @@ struct misdn_bchannel {
 
 
 enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
-void (*cb_log) (int level, int port, char *tmpl, ...);
+void (*cb_log) (int level, int port, char *tmpl, ...)
+       __attribute__ ((format (printf, 3, 4)));
 int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
 
 struct misdn_lib_iface {
        enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
-       void (*cb_log)(int level, int port, char *tmpl, ...);
+       void (*cb_log)(int level, int port, char *tmpl, ...)
+               __attribute__ ((format (printf, 3, 4)));
        int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
 };