diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_iax2.c | 12 | ||||
-rw-r--r-- | channels/chan_misdn.c | 2 | ||||
-rw-r--r-- | channels/chan_sip.c | 4 | ||||
-rw-r--r-- | channels/chan_unistim.c | 46 | ||||
-rw-r--r-- | channels/iax2/parser.c | 2 | ||||
-rw-r--r-- | channels/misdn/ie.c | 14 | ||||
-rw-r--r-- | channels/sig_pri.c | 8 | ||||
-rw-r--r-- | channels/vcodecs.c | 6 |
8 files changed, 46 insertions, 48 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 39861db0e..c01bf5c7a 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -387,7 +387,7 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL; break; \ \ for (idx = 0; idx < 16; idx++) \ - sprintf(digest + (idx << 1), "%2.2x", (unsigned) key[idx]); \ + sprintf(digest + (idx << 1), "%02hhx", (unsigned char) key[idx]); \ \ ast_log(LOG_NOTICE, msg " IAX_COMMAND_RTKEY to rotate key to '%s'\n", digest); \ } while(0) @@ -6442,7 +6442,7 @@ static int decode_frame(ast_aes_decrypt_key *dcx, struct ast_iax2_full_hdr *fh, padding = 16 + (workspace[15] & 0x0f); if (iaxdebug) - ast_debug(1, "Decoding full frame with length %d (padding = %d) (15=%02x)\n", *datalen, padding, (unsigned)workspace[15]); + ast_debug(1, "Decoding full frame with length %d (padding = %d) (15=%02hhx)\n", *datalen, padding, workspace[15]); if (*datalen < padding + sizeof(struct ast_iax2_full_hdr)) return -1; @@ -6489,7 +6489,7 @@ static int encrypt_frame(ast_aes_encrypt_key *ecx, struct ast_iax2_full_hdr *fh, workspace[15] &= 0xf0; workspace[15] |= (padding & 0xf); if (iaxdebug) - ast_debug(1, "Encoding full frame %d/%d with length %d + %d padding (15=%02x)\n", fh->type, fh->csub, *datalen, padding, (unsigned)workspace[15]); + ast_debug(1, "Encoding full frame %d/%d with length %d + %d padding (15=%02hhx)\n", fh->type, fh->csub, *datalen, padding, workspace[15]); *datalen += padding; memcpy_encrypt(efh->encdata, workspace, *datalen - sizeof(struct ast_iax2_full_enc_hdr), ecx); if (*datalen >= 32 + sizeof(struct ast_iax2_full_enc_hdr)) @@ -8207,7 +8207,7 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies) MD5Final(digest, &md5); /* If they support md5, authenticate with it. */ for (x=0;x<16;x++) - sprintf(requeststr + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ + sprintf(requeststr + (x << 1), "%02hhx", digest[x]); /* safe */ if (!strcasecmp(requeststr, md5secret)) { res = 0; break; @@ -8339,7 +8339,7 @@ static int register_verify(int callno, struct ast_sockaddr *addr, struct iax_ies MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw)); MD5Final(digest, &md5); for (x=0;x<16;x++) - sprintf(requeststr + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ + sprintf(requeststr + (x << 1), "%02hhx", digest[x]); /* safe */ if (!strcasecmp(requeststr, md5secret)) break; } @@ -8423,7 +8423,7 @@ static int authenticate(const char *challenge, const char *secret, const char *k MD5Final(digest, &md5); /* If they support md5, authenticate with it. */ for (x=0;x<16;x++) - sprintf(digres + (x << 1), "%2.2x", (unsigned)digest[x]); /* safe */ + sprintf(digres + (x << 1), "%02hhx", digest[x]); /* safe */ if (pvt) { build_encryption_keys(digest, pvt); } diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 8011b8f28..3a4f52192 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -7541,7 +7541,7 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame) ast_debug(1, "write2mISDN %p %d bytes: ", p, frame->samples); for (i = 0; i < max; i++) { - ast_debug(1, "%2.2x ", ((char *) frame->data.ptr)[i]); + ast_debug(1, "%02hhx ", ((unsigned char *) frame->data.ptr)[i]); } } #endif diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a2604e0c9..8cd4eb54e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8369,7 +8369,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p } ast_str_append(&out, 0, " -> "); for (i = 0; i < f->datalen; i++) { - ast_str_append(&out, 0, "%02X ", (unsigned)arr[i]); + ast_str_append(&out, 0, "%02hhX ", arr[i]); } ast_verb(0, "%s\n", ast_str_buffer(out)); ast_free(out); @@ -23591,7 +23591,7 @@ static void handle_response_refer(struct sip_pvt *p, int resp, const char *rest, theoretically possible. */ if (resp < 299) { /* 1xx cases don't get here */ - ast_log(LOG_WARNING, "SIP transfer to %s had unxpected 2xx response (%d), confusion is possible. \n", p->refer->refer_to, resp); + ast_log(LOG_WARNING, "SIP transfer to %s had unexpected 2xx response (%d), confusion is possible. \n", p->refer->refer_to, resp); } else { ast_log(LOG_WARNING, "SIP transfer to %s with response (%d). \n", p->refer->refer_to, resp); } diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index 3dca9e876..44cfdb011 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -935,7 +935,7 @@ static void send_raw_client(int size, const unsigned char *data, struct sockaddr ast_inet_ntoa(addr_ourip->sin_addr), (int) size, ast_inet_ntoa(addr_to->sin_addr)); for (tmp = 0; tmp < size; tmp++) - ast_verb(0, "%.2x ", (unsigned char) data[tmp]); + ast_verb(0, "%02hhx ", data[tmp]); ast_verb(0, "\n******************************************\n"); } @@ -974,7 +974,7 @@ static void send_client(int size, const unsigned char *data, struct unistimsessi /*#ifdef DUMP_PACKET */ if (unistimdebug) { - ast_verb(0, "Sending datas with seq #0x%.4x Using slot #%d :\n", (unsigned)pte->seq_server, buf_pos); + ast_verb(0, "Sending datas with seq #0x%04x Using slot #%d :\n", (unsigned)pte->seq_server, buf_pos); } /*#endif */ send_raw_client(pte->wsabufsend[buf_pos].len, pte->wsabufsend[buf_pos].buf, &(pte->sin), @@ -1130,7 +1130,7 @@ static void send_icon(unsigned char pos, unsigned char status, struct unistimses { BUFFSEND; if (unistimdebug) { - ast_verb(0, "Sending icon pos %d with status 0x%.2x\n", pos, (unsigned)status); + ast_verb(0, "Sending icon pos %d with status 0x%02hhx\n", pos, status); } memcpy(buffsend + SIZE_HEADER, packet_send_icon, sizeof(packet_send_icon)); buffsend[9] = pos; @@ -1150,7 +1150,7 @@ static void send_expansion_icon(unsigned char pos, unsigned char status, struct { BUFFSEND; if (unistimdebug) { - ast_verb(0, "Sending expansion icon pos %d with status 0x%.2x\n", pos, (unsigned)status); + ast_verb(0, "Sending expansion icon pos %d with status 0x%02hhx\n", pos, status); } memcpy(buffsend + SIZE_HEADER, packet_send_expansion_icon, sizeof(packet_send_expansion_icon)); buffsend[10] = pos; @@ -1262,7 +1262,7 @@ send_favorite(unsigned char pos, unsigned char status, struct unistimsession *pt int i; if (unistimdebug) { - ast_verb(0, "Sending favorite pos %d with status 0x%.2x\n", pos, (unsigned)status); + ast_verb(0, "Sending favorite pos %d with status 0x%02hhx\n", pos, status); } memcpy(buffsend + SIZE_HEADER, packet_send_favorite, sizeof(packet_send_favorite)); buffsend[10] = pos; @@ -1539,7 +1539,7 @@ static int send_retransmit(struct unistimsession *pte) i < pte->last_buf_available; i++) { if (i < 0) { ast_log(LOG_WARNING, - "Asked to retransmit an ACKed slot ! last_buf_available=%d, seq_server = #0x%.4x last_seq_ack = #0x%.4x\n", + "Asked to retransmit an ACKed slot ! last_buf_available=%d, seq_server = #0x%04x last_seq_ack = #0x%04x\n", pte->last_buf_available, (unsigned)pte->seq_server, (unsigned)pte->last_seq_ack); continue; } @@ -1549,7 +1549,7 @@ static int send_retransmit(struct unistimsession *pte) unsigned short seq; seq = ntohs(sbuf[1]); - ast_verb(0, "Retransmit slot #%d (seq=#0x%.4x), last ack was #0x%.4x\n", i, + ast_verb(0, "Retransmit slot #%d (seq=#0x%04x), last ack was #0x%04x\n", i, (unsigned)seq, (unsigned)pte->last_seq_ack); } send_raw_client(pte->wsabufsend[i].len, pte->wsabufsend[i].buf, &pte->sin, @@ -2062,7 +2062,7 @@ static void rcv_mac_addr(struct unistimsession *pte, const unsigned char *buf) char addrmac[19]; int res = 0; for (tmp = 15; tmp < 15 + SIZE_HEADER; tmp++) { - sprintf(&addrmac[i], "%.2x", (unsigned) buf[tmp]); + sprintf(&addrmac[i], "%02hhx", buf[tmp]); i += 2; } if (unistimdebug) { @@ -4484,7 +4484,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession char keycode = buf[13]; if (unistimdebug) { - ast_verb(0, "Expansion key pressed: keycode = 0x%.2x - current state: %s\n", (unsigned)keycode, + ast_verb(0, "Expansion key pressed: keycode = 0x%02hhx - current state: %s\n", (unsigned char)keycode, ptestate_tostr(pte->state)); } } @@ -4492,7 +4492,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession char keycode = buf[13]; if (unistimdebug) { - ast_verb(0, "Key pressed: keycode = 0x%.2x - current state: %s\n", (unsigned)keycode, + ast_verb(0, "Key pressed: keycode = 0x%02hhx - current state: %s\n", (unsigned char)keycode, ptestate_tostr(pte->state)); } if (keycode == KEY_MUTE) { @@ -4660,15 +4660,14 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, return; } if (buf[5] != 2) { - ast_log(LOG_NOTICE, "%s Wrong direction : got 0x%.2x expected 0x02\n", tmpbuf, - (unsigned)buf[5]); + ast_log(LOG_NOTICE, "%s Wrong direction : got 0x%02hhx expected 0x02\n", tmpbuf, buf[5]); return; } seq = ntohs(sbuf[1]); if (buf[4] == 1) { ast_mutex_lock(&pte->lock); if (unistimdebug) { - ast_verb(0, "ACK received for packet #0x%.4x\n", (unsigned)seq); + ast_verb(0, "ACK received for packet #0x%04x\n", (unsigned)seq); } pte->nb_retransmit = 0; @@ -4684,7 +4683,7 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, pte->last_seq_ack = 0; } else { ast_log(LOG_NOTICE, - "%s Warning : ACK received for an already ACKed packet : #0x%.4x we are at #0x%.4x\n", + "%s Warning : ACK received for an already ACKed packet : #0x%04x we are at #0x%04x\n", tmpbuf, (unsigned)seq, (unsigned)pte->last_seq_ack); } ast_mutex_unlock(&pte->lock); @@ -4692,13 +4691,13 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, } if (pte->seq_server < seq) { ast_log(LOG_NOTICE, - "%s Error : ACK received for a non-existent packet : #0x%.4x\n", + "%s Error : ACK received for a non-existent packet : #0x%04x\n", tmpbuf, (unsigned)pte->seq_server); ast_mutex_unlock(&pte->lock); return; } if (unistimdebug) { - ast_verb(0, "%s ACK gap : Received ACK #0x%.4x, previous was #0x%.4x\n", + ast_verb(0, "%s ACK gap : Received ACK #0x%04x, previous was #0x%04x\n", tmpbuf, (unsigned)seq, (unsigned)pte->last_seq_ack); } pte->last_seq_ack = seq; @@ -4722,7 +4721,7 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, } if (pte->seq_phone > seq) { ast_log(LOG_NOTICE, - "%s Warning : received a retransmitted packet : #0x%.4x (we are at #0x%.4x)\n", + "%s Warning : received a retransmitted packet : #0x%04x (we are at #0x%04x)\n", tmpbuf, (unsigned)seq, (unsigned)pte->seq_phone); /* BUG ? pte->device->seq_phone = seq; */ /* Send ACK */ @@ -4732,29 +4731,28 @@ static void parsing(int size, unsigned char *buf, struct unistimsession *pte, return; } ast_log(LOG_NOTICE, - "%s Warning : we lost a packet : received #0x%.4x (we are at #0x%.4x)\n", + "%s Warning : we lost a packet : received #0x%04x (we are at #0x%04x)\n", tmpbuf, (unsigned)seq, (unsigned)pte->seq_phone); return; } if (buf[4] == 0) { - ast_log(LOG_NOTICE, "%s Retransmit request for packet #0x%.4x\n", tmpbuf, (unsigned)seq); + ast_log(LOG_NOTICE, "%s Retransmit request for packet #0x%04x\n", tmpbuf, (unsigned)seq); if (pte->last_seq_ack > seq) { ast_log(LOG_NOTICE, - "%s Error : received a request for an already ACKed packet : #0x%.4x\n", + "%s Error : received a request for an already ACKed packet : #0x%04x\n", tmpbuf, (unsigned)pte->last_seq_ack); return; } if (pte->seq_server < seq) { ast_log(LOG_NOTICE, - "%s Error : received a request for a non-existent packet : #0x%.4x\n", + "%s Error : received a request for a non-existent packet : #0x%04x\n", tmpbuf, (unsigned)pte->seq_server); return; } send_retransmit(pte); return; } - ast_log(LOG_NOTICE, "%s Unknown request : got 0x%.2x expected 0x00,0x01 or 0x02\n", - tmpbuf, (unsigned)buf[4]); + ast_log(LOG_NOTICE, "%s Unknown request : got 0x%02hhx expected 0x00,0x01 or 0x02\n", tmpbuf, buf[4]); return; } @@ -5096,7 +5094,7 @@ static int unistimsock_read(int *id, int fd, short events, void *ignore) dw_num_bytes_rcvd, ast_inet_ntoa(addr_from.sin_addr), tmp); for (dw_num_bytes_rcvdd = 0; dw_num_bytes_rcvdd < dw_num_bytes_rcvd; dw_num_bytes_rcvdd++) - ast_verb(0, "%.2x ", (unsigned char) buff[dw_num_bytes_rcvdd]); + ast_verb(0, "%02hhx ", buff[dw_num_bytes_rcvdd]); ast_verb(0, "\n******************************************\n"); #endif diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c index f1fc8f82d..2a3eabf41 100644 --- a/channels/iax2/parser.c +++ b/channels/iax2/parser.c @@ -111,7 +111,7 @@ static void dump_string_hex(char *output, int maxlen, void *value, int len) int i = 0; while (len-- && (i + 1) * 4 < maxlen) { - sprintf(output + (4 * i), "\\x%2.2x", (unsigned)*((unsigned char *)value + i)); + sprintf(output + (4 * i), "\\x%02hhx", *((unsigned char *)value + i)); i++; } } diff --git a/channels/misdn/ie.c b/channels/misdn/ie.c index 74ae897de..df5df9afe 100644 --- a/channels/misdn/ie.c +++ b/channels/misdn/ie.c @@ -293,7 +293,7 @@ static void enc_ie_call_id(unsigned char **ntmode, msg_t *msg, char *callid, int i = 0; while(i < callid_len) { - if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); + if (MISDN_IE_DEBG) printf(debug+(i*3), " %02hhx", (unsigned char)callid[i]); i++; } @@ -339,7 +339,7 @@ static void dec_ie_call_id(unsigned char *p, Q931_info_t *qi, char *callid, int i = 0; while(i < *callid_len) { - if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); + if (MISDN_IE_DEBG) printf(debug+(i*3), " %02hhx", (unsigned char)callid[i]); i++; } @@ -745,7 +745,7 @@ static void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, p[0] = IE_CHANNEL_ID; p[1] = l; p[2] = 0x80 + 0x20 + 0x03; -/* if (MISDN_IE_DEBG) printf("%02x\n", p[2]); */ +/* if (MISDN_IE_DEBG) printf("%02hhx\n", p[2]); */ return; /* end */ } l = 3; @@ -759,7 +759,7 @@ static void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, p[2] = 0x80 + 0x20 + (exclusive<<3) + 0x01; p[3] = 0x80 + 3; /* CCITT, Number, B-type */ p[4] = 0x80 + channel; -/* if (MISDN_IE_DEBG) printf("%02x %02x %02x\n", p[2], p[3], p[4]); */ +/* if (MISDN_IE_DEBG) printf("%02hhx %02hhx %02hhx\n", p[2], p[3], p[4]); */ } } @@ -849,7 +849,7 @@ static void dec_ie_channel_id(unsigned char *p, Q931_info_t *qi, int *exclusive, printf("%s: ERROR: PRI interface channel out of range (%d).\n", __FUNCTION__, *channel); return; } -/* if (MISDN_IE_DEBG) printf("%02x %02x %02x\n", p[1], p[2], p[3]); */ +/* if (MISDN_IE_DEBG) printf("%02hhx %02hhx %02hhx\n", p[1], p[2], p[3]); */ } if (MISDN_IE_DEBG) printf(" exclusive=%d channel=%d\n", *exclusive, *channel); @@ -1342,7 +1342,7 @@ static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, ch char debug[768]; for (i = 0; i < user_len; ++i) { - sprintf(debug + (i * 3), " %02x", user[i]); + sprintf(debug + (i * 3), " %02hhx", (unsigned char)user[i]); } debug[i * 3] = 0; printf(" protocol=%d user-user%s\n", protocol, debug); @@ -1387,7 +1387,7 @@ static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, ch char debug[768]; for (i = 0; i < *user_len; ++i) { - sprintf(debug + (i * 3), " %02x", user[i]); + sprintf(debug + (i * 3), " %02hhx", (unsigned char)user[i]); } debug[i * 3] = 0; printf(" protocol=%d user-user%s\n", *protocol, debug); diff --git a/channels/sig_pri.c b/channels/sig_pri.c index a26b56611..37d3e49c7 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -754,15 +754,15 @@ static void sig_pri_set_subaddress(struct ast_party_subaddress *ast_subaddress, ptr = cnum; len = pri_subaddress->length - 1; /* -1 account for zero based indexing */ for (x = 0; x < len; ++x) { - ptr += sprintf(ptr, "%02x", (unsigned)pri_subaddress->data[x]); + ptr += sprintf(ptr, "%02hhx", (unsigned char)pri_subaddress->data[x]); } if (pri_subaddress->odd_even_indicator) { /* ODD */ - sprintf(ptr, "%01x", (unsigned)((pri_subaddress->data[len]) >> 4)); + sprintf(ptr, "%01hhx", (unsigned char)((pri_subaddress->data[len]) >> 4)); } else { /* EVEN */ - sprintf(ptr, "%02x", (unsigned)pri_subaddress->data[len]); + sprintf(ptr, "%02hhx", (unsigned char)pri_subaddress->data[len]); } ast_subaddress->str = cnum; } @@ -8083,7 +8083,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rd if (p->pri->facilityenable) pri_facility_enable(p->pri->pri); - ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", (unsigned)ast_channel_transfercapability(ast), ast_transfercapability2str(ast_channel_transfercapability(ast))); + ast_verb(3, "Requested transfer capability: 0x%02hx - %s\n", ast_channel_transfercapability(ast), ast_transfercapability2str(ast_channel_transfercapability(ast))); dp_strip = 0; pridialplan = p->pri->dialplan - 1; if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */ diff --git a/channels/vcodecs.c b/channels/vcodecs.c index 72c7fa9c2..76aeb671f 100644 --- a/channels/vcodecs.c +++ b/channels/vcodecs.c @@ -209,9 +209,9 @@ void dump_buf(struct fbuf_t *b) if (i != 0) ast_log(LOG_WARNING, "%s\n", buf); memset(buf, '\0', sizeof(buf)); - sprintf(buf, "%04x: ", i); + sprintf(buf, "%04x: ", (unsigned)i); } - sprintf(buf + 6 + x*3, "%02x ", b->data[i]); + sprintf(buf + 6 + x*3, "%02hhx ", b->data[i]); if (i > 31 && i < last2lines) i = last2lines - 1; } @@ -1056,7 +1056,7 @@ static int h264_decap(struct fbuf_t *b, uint8_t *data, int len) } /* first of all, check if the packet has F == 0 */ if (data[0] & 0x80) { - ast_log(LOG_WARNING, "--- forbidden packet; nal: %02x\n", + ast_log(LOG_WARNING, "--- forbidden packet; nal: %02hhx\n", data[0]); return 1; } |