[asterisk-commits] wdoekes: branch 11 r429673 - in /branches/11: addons/ooh323c/src/ apps/ chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 17 03:25:09 CST 2014


Author: wdoekes
Date: Wed Dec 17 03:24:50 2014
New Revision: 429673

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=429673
Log:
Fix printf problems with high ascii characters after r413586 (1.8).

In r413586 (1.8) various casts were added to silence gcc 4.10 warnings.
Those fixes included things like:

    -out += sprintf(out, "%%%02X", (unsigned char) *ptr);
    +out += sprintf(out, "%%%02X", (unsigned) *ptr);

That works for low ascii characters, but for the high range that yields
e.g. FFFFFFC3 when C3 is expected.

This changeset:
- fixes those casts to use the 'hh' unsigned char modifier instead
- consistently uses %02x instead of %2.2x (or other non-standard usage)
- adds a few 'h' modifiers in various places
- fixes a 'replcaes' typo
- dev/urandon typo (in 13+ patch)

Review: https://reviewboard.asterisk.org/r/4263/

ASTERISK-24619 #close
Reported by: Stefan27 (on IRC)

Modified:
    branches/11/addons/ooh323c/src/printHandler.c
    branches/11/apps/app_adsiprog.c
    branches/11/apps/app_getcpeid.c
    branches/11/apps/app_osplookup.c
    branches/11/apps/app_sms.c
    branches/11/channels/chan_h323.c
    branches/11/channels/chan_iax2.c
    branches/11/channels/chan_misdn.c
    branches/11/channels/chan_sip.c
    branches/11/channels/chan_unistim.c
    branches/11/channels/iax2-parser.c
    branches/11/channels/misdn/ie.c
    branches/11/channels/sig_pri.c
    branches/11/channels/vcodecs.c
    branches/11/main/loader.c
    branches/11/main/manager.c
    branches/11/main/netsock.c
    branches/11/main/udptl.c
    branches/11/main/utils.c
    branches/11/pbx/dundi-parser.c
    branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c
    branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c
    branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c
    branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c
    branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c
    branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c
    branches/11/res/res_crypto.c
    branches/11/res/res_pktccops.c
    branches/11/res/res_rtp_asterisk.c
    branches/11/utils/astman.c
    branches/11/utils/smsq.c

Modified: branches/11/addons/ooh323c/src/printHandler.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/addons/ooh323c/src/printHandler.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/addons/ooh323c/src/printHandler.c (original)
+++ branches/11/addons/ooh323c/src/printHandler.c Wed Dec 17 03:24:50 2014
@@ -268,7 +268,7 @@
       if (bufsiz > 1) buffer[1] = '\0';
       for (i = 0; i < numocts; i++) {
          if (i < bufsiz - 1) {
-            sprintf (lbuf, "%02x", (unsigned)data[i]);
+            sprintf (lbuf, "%02hhx", (unsigned char)data[i]);
             strcat (&buffer[(i*2)+1], lbuf);
          }
          else break;

Modified: branches/11/apps/app_adsiprog.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_adsiprog.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/apps/app_adsiprog.c (original)
+++ branches/11/apps/app_adsiprog.c Wed Dec 17 03:24:50 2014
@@ -1447,7 +1447,7 @@
 	int x;
 	printf("%s %s: [ ", type, vname);
 	for (x = 0; x < buflen; x++)
-		printf("%02x ", buf[x]);
+		printf("%02hhx ", buf[x]);
 	printf("]\n");
 }
 #endif

Modified: branches/11/apps/app_getcpeid.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_getcpeid.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/apps/app_getcpeid.c (original)
+++ branches/11/apps/app_getcpeid.c Wed Dec 17 03:24:50 2014
@@ -87,9 +87,8 @@
 		res = ast_adsi_get_cpeid(chan, cpeid, 0);
 		if (res > 0) {
 			gotcpeid = 1;
-			ast_verb(3, "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n",
-				(unsigned)cpeid[0], (unsigned)cpeid[1], (unsigned)cpeid[2],
-				(unsigned)cpeid[3], ast_channel_name(chan));
+			ast_verb(3, "Got CPEID of '%02hhx:%02hhx:%02hhx:%02hhx' on '%s'\n",
+				cpeid[0], cpeid[1], cpeid[2], cpeid[3], ast_channel_name(chan));
 		}
 		if (res > -1) {
 			strcpy(data[1], "Measuring CPE...");
@@ -103,9 +102,8 @@
 		}
 		if (res > -1) {
 			if (gotcpeid)
-				snprintf(data[1], 80, "CPEID: %02x:%02x:%02x:%02x",
-					(unsigned)cpeid[0], (unsigned)cpeid[1],
-					(unsigned)cpeid[2], (unsigned)cpeid[3]);
+				snprintf(data[1], 80, "CPEID: %02hhx:%02hhx:%02hhx:%02hhx",
+					cpeid[0], cpeid[1], cpeid[2], cpeid[3]);
 			else
 				strcpy(data[1], "CPEID Unknown");
 			if (gotgeometry) 

Modified: branches/11/apps/app_osplookup.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_osplookup.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/apps/app_osplookup.c (original)
+++ branches/11/apps/app_osplookup.c Wed Dec 17 03:24:50 2014
@@ -1425,7 +1425,9 @@
 	int res;
 
 	if ((uuid != NULL) && (bufsize > OSP_SIZE_UUIDSTR)) {
-		snprintf(buffer, bufsize, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		snprintf(buffer, bufsize, "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-"
+					  "%02hhx%02hhx-%02hhx%02hhx-"
+					  "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
 			uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
 			uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
 		res = OSP_OK;

Modified: branches/11/apps/app_sms.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_sms.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/apps/app_sms.c (original)
+++ branches/11/apps/app_sms.c Wed Dec 17 03:24:50 2014
@@ -782,7 +782,7 @@
 		unsigned char n;
 
 		if (h->mr >= 0) {
-			snprintf(mrs, sizeof(mrs), "%02X", (unsigned)h->mr);
+			snprintf(mrs, sizeof(mrs), "%02hhX", (unsigned char)h->mr);
 		}
 		snprintf(line, sizeof(line), "%s %c%c%c%s %s %s %s ",
 			isodate(time(NULL), buf, sizeof(buf)),
@@ -1015,7 +1015,7 @@
 		unsigned int p;
 		fprintf(o, "udh#");
 		for (p = 0; p < h->udhl; p++) {
-			fprintf(o, "%02X", (unsigned)h->udh[p]);
+			fprintf(o, "%02hhX", (unsigned char)h->udh[p]);
 		}
 		fprintf(o, "\n");
 	}
@@ -1048,7 +1048,7 @@
 			if (p == h->udl) {              /* can write in ucs-1 hex */
 				fprintf(o, "ud#");
 				for (p = 0; p < h->udl; p++) {
-					fprintf(o, "%02X", (unsigned)h->ud[p]);
+					fprintf(o, "%02hhX", (unsigned char)h->ud[p]);
 				}
 				fprintf(o, "\n");
 			} else {                        /* write in UCS-2 */
@@ -1139,7 +1139,7 @@
 				return 0xFF;		  /* duh! */
 			}
 		} else {
-			ast_log(LOG_WARNING, "Unknown message type %02X\n", (unsigned)h->imsg[2]);
+			ast_log(LOG_WARNING, "Unknown message type %02hhX\n", h->imsg[2]);
 			return 0xFF;
 		}
 	} else {                                /* client */
@@ -1162,7 +1162,7 @@
 				return 0xFF;                /* duh! */
 			}
 		} else {
-			ast_log(LOG_WARNING, "Unknown message type %02X\n", (unsigned)h->imsg[2]);
+			ast_log(LOG_WARNING, "Unknown message type %02hhX\n", h->imsg[2]);
 			return 0xFF;
 		}
 	}
@@ -1244,7 +1244,7 @@
 	int f;
 
 	for (p = s, f = 0; f < size && f < MAX_DEBUG_LEN; f++, p += 3) {
-		sprintf(p, "%02X ", (unsigned)buf[f]);
+		sprintf(p, "%02hhX ", (unsigned char)buf[f]);
 	}
 	return(s);
 }
@@ -1482,7 +1482,7 @@
 	int n = (dir == DIR_RX) ? h->ibytep : msg[1] + 2;
 	int q = 0;
 	while (q < n && q < 30) {
-		sprintf(p, " %02X", (unsigned)msg[q++]);
+		sprintf(p, " %02hhX", msg[q++]);
 		p += 3;
 	}
 	if (q < n) {

Modified: branches/11/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_h323.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/chan_h323.c (original)
+++ branches/11/channels/chan_h323.c Wed Dec 17 03:24:50 2014
@@ -654,7 +654,7 @@
 	/* indicate that this is an outgoing call */
 	pvt->outgoing = 1;
 
-	ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", ast_channel_transfercapability(c), ast_transfercapability2str(ast_channel_transfercapability(c)));
+	ast_verb(3, "Requested transfer capability: 0x%02hx - %s\n", ast_channel_transfercapability(c), ast_transfercapability2str(ast_channel_transfercapability(c)));
 	if (h323debug)
 		ast_debug(1, "Placing outgoing call to %s, %d/%d\n", called_addr, pvt->options.dtmfcodec[0], pvt->options.dtmfcodec[1]);
 	ast_mutex_unlock(&pvt->lock);

Modified: branches/11/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_iax2.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/chan_iax2.c (original)
+++ branches/11/channels/chan_iax2.c Wed Dec 17 03:24:50 2014
@@ -357,7 +357,7 @@
 			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)
@@ -6461,7 +6461,7 @@
 
 		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;
 
@@ -6508,7 +6508,7 @@
 		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))
@@ -8127,7 +8127,7 @@
 			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;
@@ -8257,7 +8257,7 @@
 			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;
 		}
@@ -8340,7 +8340,7 @@
 			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);
 			}

Modified: branches/11/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_misdn.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/chan_misdn.c (original)
+++ branches/11/channels/chan_misdn.c Wed Dec 17 03:24:50 2014
@@ -7500,7 +7500,7 @@
 		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

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Wed Dec 17 03:24:50 2014
@@ -8215,7 +8215,7 @@
 				}
 				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);
@@ -23381,7 +23381,7 @@
 		   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);
 		}
@@ -25787,7 +25787,7 @@
 		} else {
 			/* Go and take over the target call */
 			if (sipdebug)
-				ast_debug(4, "Sending this call to the invite/replcaes handler %s\n", p->callid);
+				ast_debug(4, "Sending this call to the invite/replaces handler %s\n", p->callid);
 			res = handle_invite_replaces(p, req, addr, seqno, nounlock);
 			refer_locked = 0;
 			goto request_invite_cleanup;

Modified: branches/11/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_unistim.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/chan_unistim.c (original)
+++ branches/11/channels/chan_unistim.c Wed Dec 17 03:24:50 2014
@@ -898,7 +898,7 @@
 					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");
 
 	}
@@ -937,7 +937,7 @@
 
 /*#ifdef DUMP_PACKET */
 	if (unistimdebug) {
-		ast_verb(6, "Sending datas with seq #0x%.4x Using slot #%d :\n", (unsigned)pte->seq_server, buf_pos);
+		ast_verb(6, "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),
@@ -1093,7 +1093,7 @@
 {
 	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;
@@ -1165,7 +1165,7 @@
 	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;
@@ -1430,7 +1430,7 @@
 		 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;
 		}
@@ -1440,7 +1440,7 @@
 			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,
@@ -1942,7 +1942,7 @@
 	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) {
@@ -4381,7 +4381,7 @@
 		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));
 		}
 		switch (pte->state) {
@@ -4546,15 +4546,14 @@
 		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(6, "ACK received for packet #0x%.4x\n", (unsigned)seq);
+			ast_verb(6, "ACK received for packet #0x%04x\n", (unsigned)seq);
 		}
 		pte->nb_retransmit = 0;
 
@@ -4570,7 +4569,7 @@
 				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);
@@ -4578,13 +4577,13 @@
 		}
 		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;
@@ -4608,7 +4607,7 @@
 		}
 		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 */
@@ -4618,29 +4617,28 @@
 			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;
 }
 
@@ -4984,7 +4982,7 @@
 					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
 

Modified: branches/11/channels/iax2-parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/iax2-parser.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/iax2-parser.c (original)
+++ branches/11/channels/iax2-parser.c Wed Dec 17 03:24:50 2014
@@ -97,7 +97,7 @@
 	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++;
 	}
 }

Modified: branches/11/channels/misdn/ie.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/misdn/ie.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/misdn/ie.c (original)
+++ branches/11/channels/misdn/ie.c Wed Dec 17 03:24:50 2014
@@ -293,7 +293,7 @@
 	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 @@
 	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 @@
 			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 @@
 		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 @@
 			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 @@
 		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 @@
 		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);

Modified: branches/11/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sig_pri.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/sig_pri.c (original)
+++ branches/11/channels/sig_pri.c Wed Dec 17 03:24:50 2014
@@ -690,15 +690,15 @@
 		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;
 	}
@@ -7911,7 +7911,7 @@
 	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 */

Modified: branches/11/channels/vcodecs.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/vcodecs.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/channels/vcodecs.c (original)
+++ branches/11/channels/vcodecs.c Wed Dec 17 03:24:50 2014
@@ -209,9 +209,9 @@
 			if (i != 0)
 				ast_log(LOG_WARNING, "%s\n", buf);
 			memset(buf, '\0', sizeof(buf));
-			sprintf(buf, "%04x: ", i);
-		}
-		sprintf(buf + 6 + x*3, "%02x ", b->data[i]);
+			sprintf(buf, "%04x: ", (unsigned)i);
+		}
+		sprintf(buf + 6 + x*3, "%02hhx ", b->data[i]);
 		if (i > 31 && i < last2lines)
 			i = last2lines - 1;
 	}
@@ -1056,7 +1056,7 @@
 	}
 	/* 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;
 	}

Modified: branches/11/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/loader.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/main/loader.c (original)
+++ branches/11/main/loader.c Wed Dec 17 03:24:50 2014
@@ -304,7 +304,7 @@
 	char buf[256]; /* large enough so we don't have to worry */
 
 	for (pos = 0, x = 0; x < 16; x++)
-		pos += sprintf(buf + pos, " %02x", (unsigned)*d++);
+		pos += sprintf(buf + pos, " %02hhx", *d++);
 
 	ast_debug(1, "Unexpected signature:%s\n", buf);
 

Modified: branches/11/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/manager.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/main/manager.c (original)
+++ branches/11/main/manager.c Wed Dec 17 03:24:50 2014
@@ -2653,7 +2653,7 @@
 			MD5Update(&md5, (unsigned char *) user->secret, strlen(user->secret));
 			MD5Final(digest, &md5);
 			for (x = 0; x < 16; x++)
-				len += sprintf(md5key + len, "%2.2x", (unsigned)digest[x]);
+				len += sprintf(md5key + len, "%02hhx", digest[x]);
 			if (!strcmp(md5key, key)) {
 				error = 0;
 			} else {

Modified: branches/11/main/netsock.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/netsock.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/main/netsock.c (original)
+++ branches/11/main/netsock.c Wed Dec 17 03:24:50 2014
@@ -215,10 +215,10 @@
 			*s = '\0';
 	} else {
 		for (x = 0; x < 5; x++) {
-			sprintf(s, "%02x:", (unsigned)eid->eid[x]);
+			sprintf(s, "%02hhx:", eid->eid[x]);
 			s += 3;
 		}
-		sprintf(s, "%02x", (unsigned)eid->eid[5]);
+		sprintf(s, "%02hhx", eid->eid[5]);
 	}
 	return os;
 }

Modified: branches/11/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/udptl.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/main/udptl.c (original)
+++ branches/11/main/udptl.c Wed Dec 17 03:24:50 2014
@@ -478,7 +478,7 @@
 #if 0
 			fprintf(stderr, "FEC: ");
 			for (j = 0; j < s->rx[x].fec_len[i]; j++)
-				fprintf(stderr, "%02X ", data[j]);
+				fprintf(stderr, "%02hhX ", data[j]);
 			fprintf(stderr, "\n");
 #endif
 		}

Modified: branches/11/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/utils.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/main/utils.c (original)
+++ branches/11/main/utils.c Wed Dec 17 03:24:50 2014
@@ -261,7 +261,7 @@
 	MD5Final(digest, &md5);
 	ptr = output;
 	for (x = 0; x < 16; x++)
-		ptr += sprintf(ptr, "%2.2x", (unsigned)digest[x]);
+		ptr += sprintf(ptr, "%02hhx", digest[x]);
 }
 
 /*! \brief Produce 40 char SHA1 hash of value. */
@@ -279,7 +279,7 @@
 	SHA1Result(&sha, Message_Digest);
 	ptr = output;
 	for (x = 0; x < 20; x++)
-		ptr += sprintf(ptr, "%2.2x", (unsigned)Message_Digest[x]);
+		ptr += sprintf(ptr, "%02hhx", Message_Digest[x]);
 }
 
 /*! \brief Produce a 20 byte SHA1 hash of value. */
@@ -430,7 +430,7 @@
 			if (out - outbuf >= buflen - 3) {
 				break;
 			}
-			out += sprintf(out, "%%%02X", (unsigned) *ptr);
+			out += sprintf(out, "%%%02hhX", (unsigned char) *ptr);
 		} else {
 			*out = *ptr;	/* Continue copying the string */
 			out++;

Modified: branches/11/pbx/dundi-parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/pbx/dundi-parser.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/pbx/dundi-parser.c (original)
+++ branches/11/pbx/dundi-parser.c Wed Dec 17 03:24:50 2014
@@ -61,7 +61,7 @@
 			*s = '\0';
 	} else {
 		for (x=0;x<6;x++) {
-			sprintf(s, "%02X", (unsigned)eid->eid[x]);
+			sprintf(s, "%02hhX", (unsigned char)eid->eid[x]);
 			s += 2;
 		}
 	}
@@ -320,7 +320,7 @@
 	if ((len > 16) && !(len % 16)) {
 		/* Build up IV */
 		for (x=0;x<16;x++) {
-			snprintf(iv + (x << 1), 3, "%02x", (unsigned)((unsigned char *)value)[x]);
+			snprintf(iv + (x << 1), 3, "%02hhx", ((unsigned char *)value)[x]);
 		}
 		snprintf(output, maxlen, "[IV %s] %d encrypted blocks\n", iv, len / 16);
 	} else
@@ -334,7 +334,7 @@
 	output[maxlen - 1] = '\0';
 	strcpy(output, "[ ");
 	for (x=0;x<len;x++) {
-		snprintf(output + strlen(output), maxlen - strlen(output) - 1, "%02x ", (unsigned)u[x]);
+		snprintf(output + strlen(output), maxlen - strlen(output) - 1, "%02hhx ", u[x]);
 	}
 	strncat(output + strlen(output), "]", maxlen - strlen(output) - 1);
 }
@@ -464,7 +464,7 @@
 	} else {
 		class = commands[(int)(fhi->cmdresp & 0x3f)];
 	}
-	snprintf(subclass2, (int)sizeof(subclass2), "%02x", (unsigned)fhi->cmdflags);
+	snprintf(subclass2, (int)sizeof(subclass2), "%02hhx", (unsigned char)fhi->cmdflags);
 	subclass = subclass2;
 	snprintf(tmp, (int)sizeof(tmp), 
 		"%s-Frame -- OSeqno: %3.3d ISeqno: %3.3d Type: %s (%s)\n",

Modified: branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c (original)
+++ branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c Wed Dec 17 03:24:50 2014
@@ -53,7 +53,7 @@
     
     for (i = 0; i < PJ_SHA1_DIGEST_SIZE/4; i++) {
         for (j = 0; j < 4; j++) {
-            sprintf(c,"%02X", digest[i*4+j]);
+            sprintf(c,"%02hhX", digest[i*4+j]);
             c += 2;
         }
         sprintf(c, " ");

Modified: branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c (original)
+++ branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c Wed Dec 17 03:24:50 2014
@@ -63,7 +63,7 @@
 
     for (i = 0; i < sizeof(ci->serial_no) && !ci->serial_no[i]; ++i);
     for (; i < sizeof(ci->serial_no); ++i) {
-	len = pj_ansi_snprintf(p, end-p, "%02X ", ci->serial_no[i]);
+	len = pj_ansi_snprintf(p, end-p, "%02hhX ", ci->serial_no[i]);
 	CHECK_BUF_LEN();
     }
     *(p-1) = '\n';

Modified: branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c (original)
+++ branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c Wed Dec 17 03:24:50 2014
@@ -567,7 +567,7 @@
 	p += 12;
 
 	for (j=0; j<20 && i<data_len && p<(buf+length-10); ++j, ++i) {
-	    pj_ansi_sprintf(p, "%02x ", (*data) & 0xFF);
+	    pj_ansi_sprintf(p, "%02hhx ", (*data) & 0xFF);
 	    p += 3;
 	    data++;
 	}
@@ -924,7 +924,7 @@
 	unsigned i;
 	puts("");
 	printf("{ ");
-	for (i=0; i<len; ++i) printf("0x%02x, ", packet[i]);
+	for (i=0; i<len; ++i) printf("0x%02hhx, ", packet[i]);
 	puts(" }");
     }
 #endif

Modified: branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c (original)
+++ branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c Wed Dec 17 03:24:50 2014
@@ -2559,7 +2559,7 @@
     buffer += 7;
 
     for (i=0; i<data_len; ++i) {
-	pj_ansi_sprintf(buffer, "%02x", (*data) & 0xFF);
+	pj_ansi_sprintf(buffer, "%02hhx", (*data) & 0xFF);
 	buffer += 2;
 	data++;
     }

Modified: branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c (original)
+++ branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c Wed Dec 17 03:24:50 2014
@@ -42,7 +42,7 @@
     buffer += 7;
 
     for (i=0; i<data_len; ++i) {
-	pj_ansi_sprintf(buffer, "%02x", (*data) & 0xFF);
+	pj_ansi_sprintf(buffer, "%02hhx", (*data) & 0xFF);
 	buffer += 2;
 	data++;
     }

Modified: branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c (original)
+++ branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c Wed Dec 17 03:24:50 2014
@@ -561,7 +561,7 @@
 	    //const pj_uint8_t *pkt = (const pj_uint8_t*)data;
 
 	    //PJ_LOG(5,(turn_sock->pool->obj_name, 
-	    //	      "Packet start: %02X %02X %02X %02X", 
+	    //	      "Packet start: %02hhX %02hhX %02hhX %02hhX", 
 	    //	      pkt[0], pkt[1], pkt[2], pkt[3]));
 
 	    //PJ_LOG(5,(turn_sock->pool->obj_name, 

Modified: branches/11/res/res_crypto.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_crypto.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/res_crypto.c (original)
+++ branches/11/res/res_crypto.c Wed Dec 17 03:24:50 2014
@@ -532,7 +532,7 @@
 {
 	int x;
 	for (x = 0; x < 16; x++) {
-		sum += sprintf(sum, "%02x", (unsigned)*(md5++));
+		sum += sprintf(sum, "%02hhx", *(md5++));
 	}
 }
 

Modified: branches/11/res/res_pktccops.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_pktccops.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/res_pktccops.c (original)
+++ branches/11/res/res_pktccops.c Wed Dec 17 03:24:50 2014
@@ -799,9 +799,9 @@
 				if ((idx = ast_poll_fd_index(pfds, nfds, cmts->sfd)) > -1 && (pfds[idx].revents & POLLIN)) {
 					len = cops_getmsg(cmts->sfd, recmsg);
 					if (len > 0) {
-						ast_debug(3, "COPS: got from %s:\n Header: versflag=0x%.2x opcode=%i clienttype=0x%.4x msglength=%u\n",
-							cmts->name, (unsigned)recmsg->verflag,
-							recmsg->opcode, (unsigned)recmsg->clienttype, recmsg->length);
+						ast_debug(3, "COPS: got from %s:\n Header: versflag=0x%02hhx opcode=%i clienttype=0x%04hx msglength=%u\n",
+							cmts->name, recmsg->verflag,
+							recmsg->opcode, recmsg->clienttype, recmsg->length);
 						if (recmsg->object != NULL) {
 							pobject = recmsg->object;
 							while (pobject != NULL) {

Modified: branches/11/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_rtp_asterisk.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/res/res_rtp_asterisk.c (original)
+++ branches/11/res/res_rtp_asterisk.c Wed Dec 17 03:24:50 2014
@@ -1329,7 +1329,7 @@
 		}
 
 		for (i = 0; i < size; i++) {
-			sprintf(local_fingerprint, "%.2X:", (unsigned)fingerprint[i]);
+			sprintf(local_fingerprint, "%02hhX:", fingerprint[i]);
 			local_fingerprint += 3;
 		}
 
@@ -1491,7 +1491,7 @@
 	rtp->remote_hash = hash;
 
 	while ((value = strsep(&tmp, ":")) && (pos != (EVP_MAX_MD_SIZE - 1))) {
-		sscanf(value, "%02x", (unsigned int*)&rtp->remote_fingerprint[pos++]);
+		sscanf(value, "%02hhx", &rtp->remote_fingerprint[pos++]);
 	}
 }
 

Modified: branches/11/utils/astman.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/utils/astman.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/utils/astman.c (original)
+++ branches/11/utils/astman.c Wed Dec 17 03:24:50 2014
@@ -723,7 +723,7 @@
 				MD5Update(&md5, (unsigned char *)pass, strlen(pass));
 				MD5Final(digest, &md5);
 				for (x=0; x<16; x++)
-					len += sprintf(md5key + len, "%2.2x", digest[x]);
+					len += sprintf(md5key + len, "%02hhx", digest[x]);
 				manager_action("Login",
 						"AuthType: MD5\r\n"
 						"Username: %s\r\n"

Modified: branches/11/utils/smsq.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/utils/smsq.c?view=diff&rev=429673&r1=429672&r2=429673
==============================================================================
--- branches/11/utils/smsq.c (original)
+++ branches/11/utils/smsq.c Wed Dec 17 03:24:50 2014
@@ -390,14 +390,14 @@
             {
                for (n = 0, x = 0; x < udl; x++)
                {
-                  sprintf (tmp + n, "%02X", ud[x]);
+                  sprintf (tmp + n, "%02hX", ud[x]);
                   n += 2;
                }
                setenv ("ud8", tmp, 1);
             }
             for (n = 0, x = 0; x < udl; x++)
             {
-               sprintf (tmp + n, "%04X", ud[x]);
+               sprintf (tmp + n, "%04hX", ud[x]);
                n += 4;
             }
             setenv ("ud16", tmp, 1);
@@ -730,13 +730,13 @@
             {                   /* use one byte hex */
                fprintf (f, "ud#");
                for (p = 0; p < udl; p++)
-                  fprintf (f, "%02X", ud[p]);
+                  fprintf (f, "%02hX", ud[p]);
             }
          } else
          {                      /* use two byte hex */
             fprintf (f, "ud##");
             for (p = 0; p < udl; p++)
-               fprintf (f, "%04X", ud[p]);
+               fprintf (f, "%04hX", ud[p]);
          }
          fprintf (f, "\n");
       }




More information about the asterisk-commits mailing list