[svn-commits] tzafrir: tools/trunk r6976 - /tools/trunk/xpp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 12 14:21:05 CDT 2009


Author: tzafrir
Date: Wed Aug 12 14:21:01 2009
New Revision: 6976

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6976
Log:
xpp: cleanup gcc warnings and one real astribank_tool bug

xpp rev: 7281

Modified:
    tools/trunk/xpp/astribank_tool.c
    tools/trunk/xpp/fpga_load.c
    tools/trunk/xpp/mpp_funcs.c

Modified: tools/trunk/xpp/astribank_tool.c
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/astribank_tool.c?view=diff&rev=6976&r1=6975&r2=6976
==============================================================================
--- tools/trunk/xpp/astribank_tool.c (original)
+++ tools/trunk/xpp/astribank_tool.c Wed Aug 12 14:21:01 2009
@@ -150,8 +150,6 @@
 	char			*opt_port = NULL;
 	char			*opt_watchdog = NULL;
 	char			*opt_reset = NULL;
-	int			tws_portnum;
-	int			full_reset;
 	int			ret;
 
 	progname = argv[0];
@@ -177,7 +175,11 @@
 				break;
 			case 'r':
 				opt_reset = optarg;
-				if((full_reset = reset_kind(opt_reset)) < 0)
+				/*
+				 * Sanity check so we can reject bad
+				 * arguments before device access.
+				 */
+				if(reset_kind(opt_reset) < 0)
 					usage();
 				break;
 			case 'v':
@@ -213,6 +215,12 @@
 	}
 	show_hardware(astribank);
 	if(opt_reset) {
+		int	full_reset;
+
+		if((full_reset = reset_kind(opt_reset)) < 0) {
+			ERR("Bad reset kind '%s'\n", opt_reset);
+			return 1;
+		}
 		if((ret = mpp_reset(astribank, full_reset)) < 0) {
 			ERR("%s Reseting astribank failed: %d\n",
 				(full_reset) ? "Full" : "Half", ret);
@@ -232,6 +240,7 @@
 		}
 	} else if(opt_port) {
 		int	new_portnum = strtoul(opt_port, NULL, 0);
+		int	tws_portnum = mpp_tws_portnum(astribank);
 		char	*msg = (new_portnum == tws_portnum)
 					? " Same same, never mind..."
 					: "";

Modified: tools/trunk/xpp/fpga_load.c
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/fpga_load.c?view=diff&rev=6976&r1=6975&r2=6976
==============================================================================
--- tools/trunk/xpp/fpga_load.c (original)
+++ tools/trunk/xpp/fpga_load.c Wed Aug 12 14:21:01 2009
@@ -210,7 +210,7 @@
 		return NULL;
 	}
 	/* Find last '/' */
-	if((p = memrchr(path, '/', strlen(path))) == NULL) {
+	if((p = (const char *)memrchr(path, '/', strlen(path))) == NULL) {
 		ERR("Missing a '/' in %s\n", path);
 		return NULL;
 	}
@@ -221,7 +221,7 @@
 		return NULL;
 	}
 	/* Search for a '/' before that */
-	p = memrchr(path, '/', p - path);
+	p = (const char *)memrchr(path, '/', p - path);
 	if(p == NULL)
 		p = path;		/* Relative path */
 	else

Modified: tools/trunk/xpp/mpp_funcs.c
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/mpp_funcs.c?view=diff&rev=6976&r1=6975&r2=6976
==============================================================================
--- tools/trunk/xpp/mpp_funcs.c (original)
+++ tools/trunk/xpp/mpp_funcs.c Wed Aug 12 14:21:01 2009
@@ -605,9 +605,9 @@
 		size = ret;
 		goto out;
 	}
+	size = reply->header.len - sizeof(struct mpp_header) - sizeof(struct d_EEPROM_BLK_RD_REPLY);
 	INFO("size=%d offset=0x%X\n", size, CMD_FIELD(reply, EEPROM_BLK_RD_REPLY, offset));
 	dump_packet(LOG_DEBUG, "BLK_RD", (char *)reply, ret);
-	size = reply->header.len - sizeof(struct mpp_header) - sizeof(struct d_EEPROM_BLK_RD_REPLY);
 	if(size > len) {
 		ERR("Truncating reply (was %d, now %d)\n", size, len);
 		size = len;




More information about the svn-commits mailing list