Commit 9718193a authored by Alexander Strasser's avatar Alexander Strasser Committed by Diego Biurrun
Browse files

device: Simplify construction of native device name in win2k_open()



Avoid error handling where it is not needed.
Signed-off-by: default avatarAlexander Strasser <eclipse7@gmx.net>
Signed-off-by: Diego Biurrun's avatarDiego Biurrun <diego@biurrun.de>
parent 2697472e
...@@ -468,11 +468,8 @@ static int libc_open ( dvdcss_t dvdcss, const char *psz_device ) ...@@ -468,11 +468,8 @@ static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
#if defined( WIN32 ) #if defined( WIN32 )
static int win2k_open ( dvdcss_t dvdcss, const char *psz_device ) static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
{ {
char psz_dvd[7]; char psz_dvd[7] = "\\\\.\\\0:";
if( snprintf( psz_dvd, sizeof(psz_dvd), "\\\\.\\%c:", psz_device[0] ) < 0) psz_dvd[4] = psz_device[0];
{
goto error;
}
/* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read /* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
* _and_ write access to the device (so we can make SCSI Pass Through * _and_ write access to the device (so we can make SCSI Pass Through
...@@ -496,16 +493,13 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device ) ...@@ -496,16 +493,13 @@ static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE ) if( (HANDLE) dvdcss->i_fd == INVALID_HANDLE_VALUE )
{ {
goto error; print_error( dvdcss, "failed opening device" );
return -1;
} }
dvdcss->i_pos = 0; dvdcss->i_pos = 0;
return 0; return 0;
error:
print_error( dvdcss, "failed opening device" );
return -1;
} }
#endif /* defined( WIN32 ) */ #endif /* defined( WIN32 ) */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment