Sanity check on driver device type at connect()

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1649 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent db013098e7
commit dcef3017c7

@ -1,3 +1,9 @@
2009-06-05 Rutger Hofman <rfhh>
* src/tap/cable.c: sanity check on driver device type at connect time
* have only /* style comments in the public includes, since that allows
a client app to compile with -ansi
2009-06-08 Arnim Laeuger <arniml>
* src/tap/cable.c, src/tap/cable/minimal.c, src/tap/Makefile.am:

@ -683,8 +683,16 @@ urj_tap_cable_parport_connect (urj_chain_t *chain, urj_cable_driver_t *driver,
urj_cable_parport_devtype_t devtype,
const char *devname, const urj_param_t *params[])
{
urj_cable_t *cable = urj_tap_cable_create (chain, driver);
urj_cable_t *cable;
if (driver->device_type != URJ_CABLE_DEVICE_PARPORT)
{
urj_error_set (URJ_ERROR_INVALID,
"parport cable needs parport_connect");
return NULL;
}
cable = urj_tap_cable_create (chain, driver);
if (cable == NULL)
return NULL;
@ -705,8 +713,15 @@ urj_cable_t *
urj_tap_cable_usb_connect (urj_chain_t *chain, urj_cable_driver_t *driver,
const urj_param_t *params[])
{
urj_cable_t *cable = urj_tap_cable_create (chain, driver);
urj_cable_t *cable;
if (driver->device_type != URJ_CABLE_DEVICE_USB)
{
urj_error_set (URJ_ERROR_INVALID, "USB cable needs usb_connect");
return NULL;
}
cable = urj_tap_cable_create (chain, driver);
if (cable == NULL)
return NULL;
@ -726,8 +741,15 @@ urj_cable_t *
urj_tap_cable_other_connect (urj_chain_t *chain, urj_cable_driver_t *driver,
const urj_param_t *params[])
{
urj_cable_t *cable = urj_tap_cable_create (chain, driver);
urj_cable_t *cable;
if (driver->device_type != URJ_CABLE_DEVICE_OTHER)
{
urj_error_set (URJ_ERROR_INVALID, "'other' cable needs other_connect");
return NULL;
}
cable = urj_tap_cable_create (chain, driver);
if (cable == NULL)
return NULL;

Loading…
Cancel
Save