Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
efb29007
Commit
efb29007
authored
Sep 30, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_buffer: added function decoder_buffer_skip()
parent
82c6c137
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
decoder_buffer.c
src/decoder_buffer.c
+26
-0
decoder_buffer.h
src/decoder_buffer.h
+10
-0
No files found.
src/decoder_buffer.c
View file @
efb29007
...
...
@@ -138,3 +138,29 @@ decoder_buffer_consume(struct decoder_buffer *buffer, size_t nbytes)
assert
(
buffer
->
consumed
<=
buffer
->
length
);
}
bool
decoder_buffer_skip
(
struct
decoder_buffer
*
buffer
,
size_t
nbytes
)
{
size_t
length
;
const
void
*
data
;
bool
success
;
/* this could probably be optimized by seeking */
while
(
true
)
{
data
=
decoder_buffer_read
(
buffer
,
&
length
);
if
(
data
!=
NULL
)
{
if
(
length
>
nbytes
)
length
=
nbytes
;
decoder_buffer_consume
(
buffer
,
length
);
nbytes
-=
length
;
if
(
nbytes
==
0
)
return
true
;
}
success
=
decoder_buffer_fill
(
buffer
);
if
(
!
success
)
return
false
;
}
}
src/decoder_buffer.h
View file @
efb29007
...
...
@@ -93,4 +93,14 @@ decoder_buffer_read(const struct decoder_buffer *buffer, size_t *length_r);
void
decoder_buffer_consume
(
struct
decoder_buffer
*
buffer
,
size_t
nbytes
);
/**
* Skips the specified number of bytes, discarding its data.
*
* @param buffer the decoder_buffer object
* @param nbytes the number of bytes to skip
* @return true on success, false on error
*/
bool
decoder_buffer_skip
(
struct
decoder_buffer
*
buffer
,
size_t
nbytes
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment