[asterisk-commits] rmudgett: branch rmudgett/misdn_facility r168013 - /team/rmudgett/misdn_facil...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 8 20:33:14 CST 2009


Author: rmudgett
Date: Thu Jan  8 20:33:14 2009
New Revision: 168013

URL: http://svn.digium.com/view/asterisk?view=rev&rev=168013
Log:
Merged from:
https://origsvn.digium.com/svn/asterisk/be/branches/C.2...

..........
r168012 | rmudgett | 2009-01-08 20:20:43 -0600 (Thu, 08 Jan 2009) | 7 lines

channels/misdn/ie.c
*  Fixed user-user encode/decode debug printing code.
*  Minor tweaks of parameter declarations.
channels/misdn/isdn_msg_parser.c
*  Fixed parse_notify() extraction of the redirection number
in NT mode.

Modified:
    team/rmudgett/misdn_facility/channels/misdn/ie.c
    team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c

Modified: team/rmudgett/misdn_facility/channels/misdn/ie.c
URL: http://svn.digium.com/view/asterisk/team/rmudgett/misdn_facility/channels/misdn/ie.c?view=diff&rev=168013&r1=168012&r2=168013
==============================================================================
--- team/rmudgett/misdn_facility/channels/misdn/ie.c (original)
+++ team/rmudgett/misdn_facility/channels/misdn/ie.c Thu Jan  8 20:33:14 2009
@@ -38,7 +38,7 @@
 #define MISDN_IE_DEBG 0
 
 /* support stuff */
-static void strnncpy(char *dest, const char *src, int len, int dst_len)
+static void strnncpy(char *dest, const char *src, size_t len, size_t dst_len)
 {
 	if (len > dst_len-1)
 		len = dst_len-1;
@@ -379,7 +379,7 @@
 	strncpy((char *)p+3, (char *)number, strlen((char *)number));
 }
 
-static void dec_ie_called_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, char *number, int number_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_called_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -463,7 +463,7 @@
 	}
 }
 
-static void dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, int number_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -565,7 +565,7 @@
 	}
 }
 
-static void dec_ie_connected_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, int number_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_connected_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -913,7 +913,7 @@
 }
 
 #if 0
-static void dec_ie_display(unsigned char *p, Q931_info_t *qi, char *display, int display_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_display(unsigned char *p, Q931_info_t *qi, char *display, size_t display_len, int nt, struct misdn_bchannel *bc)
 {
 	*display = '\0';
 
@@ -965,7 +965,7 @@
 }
 #endif
 
-static void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, char *keypad, int keypad_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_keypad(unsigned char *p, Q931_info_t *qi, char *keypad, size_t keypad_len, int nt, struct misdn_bchannel *bc)
 {
 	*keypad = '\0';
 
@@ -1180,7 +1180,7 @@
 	}
 }
 
-static void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, char *number, int number_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -1278,7 +1278,7 @@
 	}
 }
 
-static void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, char *number, int number_len, int nt, struct misdn_bchannel *bc)
+static void dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, char *number, size_t number_len, int nt, struct misdn_bchannel *bc)
 {
 	*type = -1;
 	*plan = -1;
@@ -1322,9 +1322,6 @@
 	Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
 	int l;
 
-	char debug[768];
-	int i;
-
 	if (protocol<0 || protocol>127)
 	{
 		printf("%s: ERROR: protocol(%d) is out of range.\n", __FUNCTION__, protocol);
@@ -1335,14 +1332,16 @@
 		return;
 	}
 
-	i = 0;
-	while(i < user_len)
-	{
-		if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]);
-		i++;
-	}
-		
-	if (MISDN_IE_DEBG) printf("    protocol=%d user-user%s\n", protocol, debug);
+	if (MISDN_IE_DEBG) {
+		size_t i;
+		char debug[768];
+
+		for (i = 0; i < user_len; ++i) {
+			sprintf(debug + (i * 3), " %02x", user[i]);
+		}	/* end for */
+		debug[i * 3] = 0;
+		printf("    protocol=%d user-user%s\n", protocol, debug);
+	}
 
 	l = user_len+1;
 	p = msg_put(msg, l+3);
@@ -1360,9 +1359,6 @@
 #if 1
 static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, char *user, int *user_len, int nt, struct misdn_bchannel *bc)
 {
-	char debug[768];
-	int i;
-
 	*user_len = 0;
 	*protocol = -1;
 
@@ -1381,15 +1377,16 @@
 	*protocol = p[1];
 	memcpy(user, p+2, (*user_len<=128)?*(user_len):128); /* clip to 128 maximum */
 
-	i = 0;
-	while(i < *user_len)
-	{
-		if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]);
-		i++;
-	}
-	debug[i*3] = '\0';
-		
-	if (MISDN_IE_DEBG) printf("    protocol=%d user-user%s\n", *protocol, debug);
+	if (MISDN_IE_DEBG) {
+		int i;
+		char debug[768];
+
+		for (i = 0; i < *user_len; ++i) {
+			sprintf(debug + (i * 3), " %02x", user[i]);
+		}	/* end for */
+		debug[i * 3] = 0;
+		printf("    protocol=%d user-user%s\n", *protocol, debug);
+	}
 }
 #endif
 

Modified: team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c?view=diff&rev=168013&r1=168012&r2=168013
==============================================================================
--- team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c (original)
+++ team/rmudgett/misdn_facility/channels/misdn/isdn_msg_parser.c Thu Jan  8 20:33:14 2009
@@ -1441,7 +1441,7 @@
 		bc->notify_description_code = description_code;
 	}
 
-	dec_ie_redir_dn(notify->NOTIFY, (Q931_info_t *) notify, &type, &plan, &present, number, sizeof(number), nt, bc);
+	dec_ie_redir_dn(notify->REDIR_DN, (Q931_info_t *) notify, &type, &plan, &present, number, sizeof(number), nt, bc);
 	if (0 <= type) {
 		bc->redirecting.to_changed = 1;
 




More information about the asterisk-commits mailing list