Changeset e0791ca6584cc946e3cbd94695c88cb6bde4d289
- Timestamp:
- 06/06/08 13:07:07
(3 months ago)
- Author:
- Pierre d'Herbemont <pdherbemont@videolan.org>
- git-committer:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1212750427 +0200
- git-parent:
[fedb1403b0e27202857cc76bef1da40a4f09aa6e]
- git-author:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1212749918 +0200
- Message:
stream: Support reading to NULL buffer in *Immediate method.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7076fe3 |
re0791ca |
|
| 1525 | 1525 | #endif |
|---|
| 1526 | 1526 | |
|---|
| 1527 | | if( p_read == NULL ) |
|---|
| | 1527 | /* No buffer, do as if we were seeking. */ |
|---|
| | 1528 | if( !p_read ) |
|---|
| 1528 | 1529 | { |
|---|
| 1529 | 1530 | /* seek within this stream if possible, else use plain old read and discard */ |
|---|
| 1530 | | stream_sys_t *p_sys = s->p_sys; |
|---|
| 1531 | 1531 | access_t *p_access = p_sys->p_access; |
|---|
| 1532 | | bool b_aseek; |
|---|
| 1533 | | access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek ); |
|---|
| 1534 | | if( b_aseek ) |
|---|
| 1535 | | return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read; |
|---|
| | 1532 | |
|---|
| | 1533 | /* seeking after EOF is not what we want */ |
|---|
| | 1534 | if( !( p_access->info.b_eof ) ) |
|---|
| | 1535 | { |
|---|
| | 1536 | bool b_aseek; |
|---|
| | 1537 | access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek ); |
|---|
| | 1538 | if( b_aseek ) |
|---|
| | 1539 | return AStreamSeekImmediate( s, p_sys->i_pos + i_read ) ? 0 : i_read; |
|---|
| | 1540 | } |
|---|
| 1536 | 1541 | } |
|---|
| 1537 | 1542 | |
|---|
| … | … | |
| 1561 | 1566 | if( i_to_read ) |
|---|
| 1562 | 1567 | { |
|---|
| 1563 | | i_to_read = AReadStream( s, p_read, i_to_read ); |
|---|
| | 1568 | if( p_read ) |
|---|
| | 1569 | i_to_read = AReadStream( s, p_read, i_to_read ); |
|---|
| | 1570 | else |
|---|
| | 1571 | { |
|---|
| | 1572 | void * dummy = malloc(i_to_read); |
|---|
| | 1573 | i_to_read = AReadStream( s, dummy, i_to_read ); |
|---|
| | 1574 | free(dummy); |
|---|
| | 1575 | } |
|---|
| 1564 | 1576 | } |
|---|
| 1565 | 1577 | |
|---|