Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
flac
Commits
9b8fdafe
Commit
9b8fdafe
authored
Mar 29, 2013
by
Erik de Castro Lopo
Browse files
src/test_libFLAC/decoders.c : Minor improvement.
parent
1ec6e3a0
Changes
1
Show whitespace changes
Inline
Side-by-side
src/test_libFLAC/decoders.c
View file @
9b8fdafe
...
...
@@ -29,6 +29,7 @@
#include "FLAC/stream_decoder.h"
#include "share/grabbag.h"
#include "share/compat.h"
#include "share/safe_str.h"
#include "test_libs_common/file_utils_flac.h"
#include "test_libs_common/metadata_utils.h"
...
...
@@ -49,6 +50,7 @@ static const char * const LayerString[] = {
typedef
struct
{
Layer
layer
;
FILE
*
file
;
char
filename
[
512
];
unsigned
current_metadata_number
;
FLAC__bool
ignore_errors
;
FLAC__bool
error_occurred
;
...
...
@@ -84,6 +86,12 @@ static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder)
return
false
;
}
static
void
open_test_file
(
StreamDecoderClientData
*
pdcd
,
int
is_ogg
,
const
char
*
mode
)
{
pdcd
->
file
=
fopen
(
flacfilename
(
is_ogg
),
mode
);
safe_strncpy
(
pdcd
->
filename
,
flacfilename
(
is_ogg
),
sizeof
(
pdcd
->
filename
));
}
static
void
init_metadata_blocks_
(
void
)
{
mutils__init_metadata_blocks
(
&
streaminfo_
,
&
padding_
,
&
seektable_
,
&
application1_
,
&
application2_
,
&
vorbiscomment_
,
&
cuesheet_
,
&
picture_
,
&
unknown_
);
...
...
@@ -315,7 +323,7 @@ static FLAC__bool stream_decoder_test_respond_(FLAC__StreamDecoder *decoder, Str
/* for FLAC__stream_encoder_init_FILE(), the FLAC__stream_encoder_finish() closes the file so we have to keep re-opening: */
if
(
dcd
->
layer
==
LAYER_FILE
)
{
printf
(
"opening %sFLAC file... "
,
is_ogg
?
"Ogg "
:
""
);
dcd
->
file
=
fopen
(
flacfilename
(
is_ogg
)
,
"rb"
);
open_test_file
(
dcd
,
is_ogg
,
"rb"
);
if
(
0
==
dcd
->
file
)
{
printf
(
"ERROR (%s)
\n
"
,
strerror
(
errno
));
return
false
;
...
...
@@ -466,7 +474,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg)
if
(
layer
<
LAYER_FILENAME
)
{
printf
(
"opening %sFLAC file... "
,
is_ogg
?
"Ogg "
:
""
);
decoder_client_data
.
file
=
fopen
(
flacfilename
(
is_ogg
)
,
"rb"
);
open_test_file
(
&
decoder_client_data
,
is_ogg
,
"rb"
);
if
(
0
==
decoder_client_data
.
file
)
{
printf
(
"ERROR (%s)
\n
"
,
strerror
(
errno
));
return
false
;
...
...
Write
Preview
Supports
Markdown
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