diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-12 19:21:01 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-12 19:21:01 +0000 |
commit | bf457f35a818448107aad560336df671755e589d (patch) | |
tree | bfa21efd31af7271177c8e2b3e63ec2c6fd75995 /xpp | |
parent | 6c67be02ffa70bc95357fd6b311ea7fbcdb8f6aa (diff) |
xpp: cleanup gcc warnings and one real astribank_tool bug
xpp rev: 7281
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@6976 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp')
-rw-r--r-- | xpp/astribank_tool.c | 15 | ||||
-rw-r--r-- | xpp/fpga_load.c | 4 | ||||
-rw-r--r-- | xpp/mpp_funcs.c | 2 |
3 files changed, 15 insertions, 6 deletions
diff --git a/xpp/astribank_tool.c b/xpp/astribank_tool.c index b9bcaaa..caee860 100644 --- a/xpp/astribank_tool.c +++ b/xpp/astribank_tool.c @@ -150,8 +150,6 @@ int main(int argc, char *argv[]) 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 @@ int main(int argc, char *argv[]) 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 @@ int main(int argc, char *argv[]) } 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 @@ int main(int argc, char *argv[]) } } 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..." : ""; diff --git a/xpp/fpga_load.c b/xpp/fpga_load.c index d99e3e7..bc32422 100644 --- a/xpp/fpga_load.c +++ b/xpp/fpga_load.c @@ -210,7 +210,7 @@ struct usb_device *dev_of_path(const char *path) 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 @@ struct usb_device *dev_of_path(const char *path) 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 diff --git a/xpp/mpp_funcs.c b/xpp/mpp_funcs.c index c52397f..53b1a7a 100644 --- a/xpp/mpp_funcs.c +++ b/xpp/mpp_funcs.c @@ -605,9 +605,9 @@ int mpp_eeprom_blk_rd(struct astribank_device *astribank, uint8_t *buf, uint16_t 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; |