Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
f52a5055
Commit
f52a5055
authored
Dec 30, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vcd ioctl_ReadSectors() : factorize error case
parent
ebab71b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
+18
-30
modules/access/vcd/cdrom.c
modules/access/vcd/cdrom.c
+18
-30
No files found.
modules/access/vcd/cdrom.c
View file @
f52a5055
...
@@ -506,16 +506,14 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -506,16 +506,14 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
SEEK_SET
)
==
-
1
)
SEEK_SET
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"Could not lseek to sector %d"
,
i_sector
);
msg_Err
(
p_this
,
"Could not lseek to sector %d"
,
i_sector
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
-
1
;
}
}
if
(
read
(
p_vcddev
->
i_vcdimage_handle
,
p_block
,
VCD_SECTOR_SIZE
*
i_nb
)
if
(
read
(
p_vcddev
->
i_vcdimage_handle
,
p_block
,
VCD_SECTOR_SIZE
*
i_nb
)
==
-
1
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"Could not read sector %d"
,
i_sector
);
msg_Err
(
p_this
,
"Could not read sector %d"
,
i_sector
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
-
1
;
}
}
}
}
...
@@ -543,8 +541,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -543,8 +541,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
if
(
ioctl
(
p_vcddev
->
i_device_handle
,
DKIOCCDREAD
,
&
cd_read
)
==
-
1
)
if
(
ioctl
(
p_vcddev
->
i_device_handle
,
DKIOCCDREAD
,
&
cd_read
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"could not read block %d"
,
i_sector
);
msg_Err
(
p_this
,
"could not read block %d"
,
i_sector
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
-
1
;
}
}
#elif defined( WIN32 )
#elif defined( WIN32 )
...
@@ -570,10 +567,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -570,10 +567,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
sizeof
(
RAW_READ_INFO
),
p_block
,
sizeof
(
RAW_READ_INFO
),
p_block
,
VCD_SECTOR_SIZE
*
i_nb
,
&
dwBytesReturned
,
VCD_SECTOR_SIZE
*
i_nb
,
&
dwBytesReturned
,
NULL
)
==
0
)
NULL
)
==
0
)
{
goto
error
;
free
(
p_block
);
return
-
1
;
}
}
}
else
return
-
1
;
else
return
-
1
;
}
}
...
@@ -595,11 +589,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -595,11 +589,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
if
(
rc
)
if
(
rc
)
{
{
msg_Err
(
p_this
,
"could not read block %d"
,
i_sector
);
msg_Err
(
p_this
,
"could not read block %d"
,
i_sector
);
goto
error
;
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
return
-
1
;
}
}
#elif defined( HAVE_SCSIREQ_IN_SYS_SCSIIO_H )
#elif defined( HAVE_SCSIREQ_IN_SYS_SCSIIO_H )
...
@@ -630,15 +620,13 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -630,15 +620,13 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
if
(
i_ret
==
-
1
)
if
(
i_ret
==
-
1
)
{
{
msg_Err
(
p_this
,
"SCIOCCOMMAND failed"
);
msg_Err
(
p_this
,
"SCIOCCOMMAND failed"
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
-
1
;
}
}
if
(
sc
.
retsts
||
sc
.
error
)
if
(
sc
.
retsts
||
sc
.
error
)
{
{
msg_Err
(
p_this
,
"SCSI command failed: status %d error %d"
,
msg_Err
(
p_this
,
"SCSI command failed: status %d error %d"
,
sc
.
retsts
,
sc
.
error
);
sc
.
retsts
,
sc
.
error
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
-
1
;
}
}
#elif defined( HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H )
#elif defined( HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H )
...
@@ -648,24 +636,21 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -648,24 +636,21 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
==
-
1
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"Could not set block size"
);
msg_Err
(
p_this
,
"Could not set block size"
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
(
-
1
);
}
}
if
(
lseek
(
p_vcddev
->
i_device_handle
,
if
(
lseek
(
p_vcddev
->
i_device_handle
,
i_sector
*
VCD_SECTOR_SIZE
,
SEEK_SET
)
==
-
1
)
i_sector
*
VCD_SECTOR_SIZE
,
SEEK_SET
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"Could not lseek to sector %d"
,
i_sector
);
msg_Err
(
p_this
,
"Could not lseek to sector %d"
,
i_sector
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
(
-
1
);
}
}
if
(
read
(
p_vcddev
->
i_device_handle
,
if
(
read
(
p_vcddev
->
i_device_handle
,
p_block
,
VCD_SECTOR_SIZE
*
i_nb
)
==
-
1
)
p_block
,
VCD_SECTOR_SIZE
*
i_nb
)
==
-
1
)
{
{
msg_Err
(
p_this
,
"Could not read sector %d"
,
i_sector
);
msg_Err
(
p_this
,
"Could not read sector %d"
,
i_sector
);
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
goto
error
;
return
(
-
1
);
}
}
#else
#else
...
@@ -686,11 +671,9 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -686,11 +671,9 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
i_sector
);
i_sector
);
if
(
i
==
0
)
if
(
i
==
0
)
{
goto
error
;
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
else
return
(
-
1
);
break
;
}
else
break
;
}
}
}
}
#endif
#endif
...
@@ -710,6 +693,11 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
...
@@ -710,6 +693,11 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
}
}
return
(
0
);
return
(
0
);
error:
if
(
i_type
==
VCD_TYPE
)
free
(
p_block
);
return
(
-
1
);
}
}
/****************************************************************************
/****************************************************************************
...
...
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