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
49f34fbf
Commit
49f34fbf
authored
Jan 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderBuffer: use NewVarSize()
parent
fe6094a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
DecoderBuffer.cxx
src/DecoderBuffer.cxx
+10
-13
No files found.
src/DecoderBuffer.cxx
View file @
49f34fbf
...
@@ -21,8 +21,7 @@
...
@@ -21,8 +21,7 @@
#include "DecoderBuffer.hxx"
#include "DecoderBuffer.hxx"
#include "DecoderAPI.hxx"
#include "DecoderAPI.hxx"
#include "util/ConstBuffer.hxx"
#include "util/ConstBuffer.hxx"
#include "util/VarSize.hxx"
#include <glib.h>
#include <assert.h>
#include <assert.h>
#include <string.h>
#include <string.h>
...
@@ -43,24 +42,22 @@ struct DecoderBuffer {
...
@@ -43,24 +42,22 @@ struct DecoderBuffer {
/** the actual buffer (dynamic size) */
/** the actual buffer (dynamic size) */
unsigned
char
data
[
sizeof
(
size_t
)];
unsigned
char
data
[
sizeof
(
size_t
)];
DecoderBuffer
(
Decoder
*
_decoder
,
InputStream
&
_is
,
size_t
_size
)
:
decoder
(
_decoder
),
is
(
&
_is
),
size
(
_size
),
length
(
0
),
consumed
(
0
)
{}
};
};
DecoderBuffer
*
DecoderBuffer
*
decoder_buffer_new
(
Decoder
*
decoder
,
InputStream
&
is
,
decoder_buffer_new
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
)
size_t
size
)
{
{
DecoderBuffer
*
buffer
=
(
DecoderBuffer
*
)
g_malloc
(
sizeof
(
*
buffer
)
-
sizeof
(
buffer
->
data
)
+
size
);
assert
(
size
>
0
);
assert
(
size
>
0
);
buffer
->
decoder
=
decoder
;
return
NewVarSize
<
DecoderBuffer
>
(
sizeof
(
DecoderBuffer
::
data
),
buffer
->
is
=
&
is
;
size
,
buffer
->
size
=
size
;
decoder
,
is
,
size
);
buffer
->
length
=
0
;
buffer
->
consumed
=
0
;
return
buffer
;
}
}
void
void
...
@@ -68,7 +65,7 @@ decoder_buffer_free(DecoderBuffer *buffer)
...
@@ -68,7 +65,7 @@ decoder_buffer_free(DecoderBuffer *buffer)
{
{
assert
(
buffer
!=
nullptr
);
assert
(
buffer
!=
nullptr
);
g_fre
e
(
buffer
);
DeleteVarSiz
e
(
buffer
);
}
}
bool
bool
...
...
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