diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-23 17:27:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-23 17:27:08 +0100 |
commit | 35f3759e5ca44bc7bc8f275833e1be54494c5ff3 (patch) | |
tree | c8ca5a1bba830be43647d4e1db686a90bfa5b2ef /sal | |
parent | f1bd815f60c78495259ae19ea68eacdb8b43a9e8 (diff) |
There's no way to create an oslVolumeDeviceHandle for unx
...so the functions operating on them can all just return osl_File_E_INVAL. (The
way to create an oslVolumeDeviceHandle is via osl_getVolumeInformation storing
it into oslVolumeInfo.pDeviceHandle. But the unx implementation of
osl_getVolumeInformation never sets that, so it'll stay at the null value that
callers must initialize it to.)
Change-Id: Ibabd89e8f9de0892a0e815d30b6397f869e7df70
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 114 |
1 files changed, 6 insertions, 108 deletions
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 5462368c0308..6db0beba2a39 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -19,8 +19,6 @@ #include <sal/config.h> -#include <cassert> - #include "osl/file.h" #include "osl/diagnose.h" @@ -79,21 +77,8 @@ * ToDo * * - Fix: check for corresponding struct sizes in exported functions - * - check size/use of oslVolumeDeviceHandle * - check size/use of oslVolumeInfo ***********************************************************************/ -/****************************************************************************** - * - * Data Type Definition - * - ******************************************************************************/ - -struct oslVolumeDeviceHandleImpl -{ - sal_Char pszMountPoint[PATH_MAX]; - sal_Char ident[4]; - sal_uInt32 RefCount; -}; /****************************************************************************** * @@ -332,106 +317,19 @@ static oslFileError osl_psz_getVolumeInformation ( return osl_File_E_None; } -/****************************************************************************** - * - * GENERIC FLOPPY FUNCTIONS - * - *****************************************************************************/ - -/***************************************** - * osl_getVolumeDeviceMountPath - ****************************************/ -static rtl_uString* oslMakeUStrFromPsz(const sal_Char* pszStr, rtl_uString** ustrValid) -{ - rtl_string2UString( - ustrValid, - pszStr, - rtl_str_getLength( pszStr ), - osl_getThreadTextEncoding(), - OUSTRING_TO_OSTRING_CVTFLAGS ); - OSL_ASSERT(*ustrValid != nullptr); - - return *ustrValid; -} - -oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath ) +oslFileError osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle, rtl_uString ** ) { - oslVolumeDeviceHandleImpl* pItem = static_cast<oslVolumeDeviceHandleImpl*>(Handle); - sal_Char Buffer[RTL_CONSTASCII_LENGTH("file://") + PATH_MAX]; - - Buffer[0] = '\0'; - - if ( pItem == nullptr || pstrPath == nullptr ) - { - return osl_File_E_INVAL; - } - - if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) - { - return osl_File_E_INVAL; - } - - int n = snprintf(Buffer, sizeof(Buffer), "file://%s", pItem->pszMountPoint); - assert(n >= 0 && unsigned(n) < sizeof(Buffer)); (void) n; - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"Mount Point is: '%s'\n",Buffer); -#endif - - oslMakeUStrFromPsz(Buffer, pstrPath); - - return osl_File_E_None; + return osl_File_E_INVAL; } -/***************************************** - * osl_acquireVolumeDeviceHandle - ****************************************/ - -oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) +oslFileError osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle ) { - oslVolumeDeviceHandleImpl* pItem =static_cast<oslVolumeDeviceHandleImpl*>(Handle); - - if ( pItem == nullptr ) - { - return osl_File_E_INVAL; - } - - if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) - { - return osl_File_E_INVAL; - } - - ++pItem->RefCount; - - return osl_File_E_None; + return osl_File_E_INVAL; } -/***************************************** - * osl_releaseVolumeDeviceHandle - ****************************************/ - -oslFileError osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) +oslFileError osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle ) { - oslVolumeDeviceHandleImpl* pItem =static_cast<oslVolumeDeviceHandleImpl*>(Handle); - - if ( pItem == nullptr ) - { - return osl_File_E_INVAL; - } - - if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) - { - return osl_File_E_INVAL; - } - - --pItem->RefCount; - - if ( pItem->RefCount == 0 ) - { - rtl_freeMemory(pItem); - } - - return osl_File_E_None; + return osl_File_E_INVAL; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |