Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
ab863321
Commit
ab863321
authored
Jul 20, 2004
by
Josh Coalson
Browse files
observe padding byte requirement when writing test WAVEs
parent
a9414544
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test_streams/main.c
View file @
ab863321
...
...
@@ -612,7 +612,8 @@ foo:
static
FLAC__bool
generate_wav
(
const
char
*
filename
,
unsigned
sample_rate
,
unsigned
channels
,
unsigned
bytes_per_sample
,
unsigned
samples
)
{
const
unsigned
size
=
channels
*
bytes_per_sample
*
samples
;
const
unsigned
true_size
=
channels
*
bytes_per_sample
*
samples
;
const
unsigned
padded_size
=
(
true_size
+
1
)
&
(
~
1u
);
FILE
*
f
;
unsigned
i
;
...
...
@@ -620,7 +621,7 @@ static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsig
return
false
;
if
(
fwrite
(
"RIFF"
,
1
,
4
,
f
)
<
4
)
goto
foo
;
if
(
!
write_little_endian_uint32
(
f
,
size
+
36
))
if
(
!
write_little_endian_uint32
(
f
,
padded_
size
+
36
))
goto
foo
;
if
(
fwrite
(
"WAVEfmt
\020\000\000\000\001\000
"
,
1
,
14
,
f
)
<
14
)
goto
foo
;
...
...
@@ -636,12 +637,15 @@ static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsig
goto
foo
;
if
(
fwrite
(
"data"
,
1
,
4
,
f
)
<
4
)
goto
foo
;
if
(
!
write_little_endian_uint32
(
f
,
size
))
if
(
!
write_little_endian_uint32
(
f
,
true_
size
))
goto
foo
;
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
true_
size
;
i
++
)
if
(
fputc
(
i
,
f
)
==
EOF
)
goto
foo
;
for
(
;
i
<
padded_size
;
i
++
)
if
(
fputc
(
0
,
f
)
==
EOF
)
goto
foo
;
fclose
(
f
);
return
true
;
...
...
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