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
172a1dbd
Commit
172a1dbd
authored
Jul 22, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_byteswap: converted NULL checks to assertions
It is illegal to pass a NULL buffer to pcm_byteswap_X(). The result of this is that pcm_byteswap_X() never returns NULL.
parent
c5a662f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
pcm_byteswap.c
src/pcm_byteswap.c
+2
-4
pcm_convert.c
src/pcm_convert.c
+3
-6
No files found.
src/pcm_byteswap.c
View file @
172a1dbd
...
...
@@ -38,8 +38,7 @@ const int16_t *pcm_byteswap_16(struct pcm_buffer *buffer,
unsigned
i
;
int16_t
*
buf
=
pcm_buffer_get
(
buffer
,
len
);
if
(
!
buf
)
return
NULL
;
assert
(
buf
!=
NULL
);
for
(
i
=
0
;
i
<
len
/
2
;
i
++
)
buf
[
i
]
=
swab16
(
src
[
i
]);
...
...
@@ -61,8 +60,7 @@ const int32_t *pcm_byteswap_32(struct pcm_buffer *buffer,
unsigned
i
;
int32_t
*
buf
=
pcm_buffer_get
(
buffer
,
len
);
if
(
!
buf
)
return
NULL
;
assert
(
buf
!=
NULL
);
for
(
i
=
0
;
i
<
len
/
4
;
i
++
)
buf
[
i
]
=
swab32
(
src
[
i
]);
...
...
src/pcm_convert.c
View file @
172a1dbd
...
...
@@ -88,8 +88,7 @@ pcm_convert_16(struct pcm_convert_state *state,
if
(
dest_format
->
reverse_endian
)
{
buf
=
pcm_byteswap_16
(
&
state
->
byteswap_buffer
,
buf
,
len
);
if
(
!
buf
)
g_error
(
"pcm_byteswap_16() failed"
);
assert
(
buf
!=
NULL
);
}
*
dest_size_r
=
len
;
...
...
@@ -131,8 +130,7 @@ pcm_convert_24(struct pcm_convert_state *state,
if
(
dest_format
->
reverse_endian
)
{
buf
=
pcm_byteswap_32
(
&
state
->
byteswap_buffer
,
buf
,
len
);
if
(
!
buf
)
g_error
(
"pcm_byteswap_32() failed"
);
assert
(
buf
!=
NULL
);
}
*
dest_size_r
=
len
;
...
...
@@ -174,8 +172,7 @@ pcm_convert_32(struct pcm_convert_state *state,
if
(
dest_format
->
reverse_endian
)
{
buf
=
pcm_byteswap_32
(
&
state
->
byteswap_buffer
,
buf
,
len
);
if
(
!
buf
)
g_error
(
"pcm_byteswap_32() failed"
);
assert
(
buf
!=
NULL
);
}
*
dest_size_r
=
len
;
...
...
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