add sanity check to queuing of packets in rawiso xmit

git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@159 53a565d1-3bb7-0310-b661-cf11e63c67ab
This commit is contained in:
ddennedy 2005-07-04 03:00:50 +00:00
parent 87941d01c4
commit 1906551515
2 changed files with 15 additions and 6 deletions

View File

@ -269,7 +269,6 @@ int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle, int tag_m
return 0; return 0;
} }
static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle) static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle)
{ {
struct raw1394_iso_status *stat = &handle->iso_status; struct raw1394_iso_status *stat = &handle->iso_status;
@ -282,6 +281,10 @@ static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle)
goto out; goto out;
} }
/* ensure stat->n_packets is sane */
if (stat->n_packets > stat->config.buf_packets)
stat->n_packets = stat->config.buf_packets;
/* we could potentially send up to stat->n_packets packets */ /* we could potentially send up to stat->n_packets packets */
packets.n_packets = 0; packets.n_packets = 0;
packets.infos = malloc(stat->n_packets * sizeof(struct raw1394_iso_packet_info)); packets.infos = malloc(stat->n_packets * sizeof(struct raw1394_iso_packet_info));

View File

@ -1207,7 +1207,9 @@ typedef int (*iso_handler_t)(raw1394handle_t, int channel, size_t length,
**/ **/
iso_handler_t raw1394_set_iso_handler(raw1394handle_t handle, iso_handler_t raw1394_set_iso_handler(raw1394handle_t handle,
unsigned int channel, unsigned int channel,
iso_handler_t new_h); iso_handler_t new_h)
__attribute__ ((deprecated));
/** /**
* raw1394_start_iso_rcv - enable isochronous receiving (DEPRECATED) * raw1394_start_iso_rcv - enable isochronous receiving (DEPRECATED)
* @handle: libraw1394 handle * @handle: libraw1394 handle
@ -1219,7 +1221,8 @@ iso_handler_t raw1394_set_iso_handler(raw1394handle_t handle,
* Isochronous packets are then passed to the callback specified with * Isochronous packets are then passed to the callback specified with
* raw1394_set_iso_handler(). * raw1394_set_iso_handler().
**/ **/
int raw1394_start_iso_rcv(raw1394handle_t handle, unsigned int channel); int raw1394_start_iso_rcv(raw1394handle_t handle, unsigned int channel)
__attribute__ ((deprecated));
/** /**
* raw1394_stop_iso_rcv - stop isochronous receiving (DEPRECATED) * raw1394_stop_iso_rcv - stop isochronous receiving (DEPRECATED)
@ -1230,7 +1233,8 @@ int raw1394_start_iso_rcv(raw1394handle_t handle, unsigned int channel);
* *
* Stops the reception of isochronous packets in @channel on @handle. * Stops the reception of isochronous packets in @channel on @handle.
**/ **/
int raw1394_stop_iso_rcv(raw1394handle_t handle, unsigned int channel); int raw1394_stop_iso_rcv(raw1394handle_t handle, unsigned int channel)
__attribute__ ((deprecated));
/** /**
* raw1394_start_iso_write - initiate an isochronous packet write (DEPRECATED) * raw1394_start_iso_write - initiate an isochronous packet write (DEPRECATED)
@ -1259,7 +1263,8 @@ int raw1394_stop_iso_rcv(raw1394handle_t handle, unsigned int channel);
int raw1394_start_iso_write(raw1394handle_t handle, unsigned int channel, int raw1394_start_iso_write(raw1394handle_t handle, unsigned int channel,
unsigned int tag, unsigned int sy, unsigned int tag, unsigned int sy,
unsigned int speed, size_t length, quadlet_t *data, unsigned int speed, size_t length, quadlet_t *data,
unsigned long rawtag); unsigned long rawtag)
__attribute__ ((deprecated));
/** /**
* raw1394_iso_write - DEPRECATED * raw1394_iso_write - DEPRECATED
@ -1269,7 +1274,8 @@ int raw1394_start_iso_write(raw1394handle_t handle, unsigned int channel,
**/ **/
int raw1394_iso_write(raw1394handle_t handle, unsigned int channel, int raw1394_iso_write(raw1394handle_t handle, unsigned int channel,
unsigned int tag, unsigned int sy, unsigned int speed, unsigned int tag, unsigned int sy, unsigned int speed,
size_t length, quadlet_t *data); size_t length, quadlet_t *data)
__attribute__ ((deprecated));
#ifdef __cplusplus #ifdef __cplusplus
} }