Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
b19ef4a2
Commit
b19ef4a2
authored
Dec 01, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error handling for fopen() on raw streams.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
07fd22c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
rawinputstream.cc
src/rawinputstream.cc
+5
-3
rawoutputstream.cc
src/rawoutputstream.cc
+5
-3
No files found.
src/rawinputstream.cc
View file @
b19ef4a2
...
...
@@ -2,6 +2,7 @@
#include "rawconverter.hh"
#include <assert.h>
#include <string.h>
using
std
::
string
;
using
std
::
vector
;
...
...
@@ -53,11 +54,9 @@ RawInputStream::open (const string& filename, const RawFormat& format)
return
Error
(
"RawInputStream: input format: missing sample rate"
);
Error
err
=
Error
::
Code
::
NONE
;
RawConverter
*
rc
=
RawConverter
::
create
(
format
,
err
);
m_raw_converter
.
reset
(
RawConverter
::
create
(
format
,
err
)
);
if
(
err
)
return
err
;
assert
(
rc
);
m_raw_converter
.
reset
(
rc
);
if
(
filename
==
"-"
)
{
...
...
@@ -67,6 +66,9 @@ RawInputStream::open (const string& filename, const RawFormat& format)
else
{
m_input_file
=
fopen
(
filename
.
c_str
(),
"r"
);
if
(
!
m_input_file
)
return
Error
(
strerror
(
errno
));
m_close_file
=
true
;
}
...
...
src/rawoutputstream.cc
View file @
b19ef4a2
#include "rawoutputstream.hh"
#include <assert.h>
#include <string.h>
using
std
::
string
;
using
std
::
vector
;
...
...
@@ -23,11 +24,9 @@ RawOutputStream::open (const string& filename, const RawFormat& format)
return
Error
(
"RawOutputStream: output format: missing sample rate"
);
Error
err
=
Error
::
Code
::
NONE
;
RawConverter
*
rc
=
RawConverter
::
create
(
format
,
err
);
m_raw_converter
.
reset
(
RawConverter
::
create
(
format
,
err
)
);
if
(
err
)
return
err
;
assert
(
rc
);
m_raw_converter
.
reset
(
rc
);
if
(
filename
==
"-"
)
{
...
...
@@ -37,6 +36,9 @@ RawOutputStream::open (const string& filename, const RawFormat& format)
else
{
m_output_file
=
fopen
(
filename
.
c_str
(),
"w"
);
if
(
!
m_output_file
)
return
Error
(
strerror
(
errno
));
m_close_file
=
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