Kaydet (Commit) b7bee6c1 authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Michael Stahl

osl: osl_closeDirectory cleanup

When I was reading this code, it wasn't entirely clear to me without
looking at the typedef of oslDirectory whether I was dealing with a
variable or a pointer, so I have changed this to pDirectory. I also
made a small tweak to the whitespace to help readability.

I also changed from explicit comparison to nullptr to the more
conventional style.

Change-Id: I4e9a69575733ab71a175d14a30c1976e6771ed5b
Reviewed-on: https://gerrit.libreoffice.org/39536Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst a62507eb
...@@ -224,33 +224,33 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect ...@@ -224,33 +224,33 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
return oslTranslateFileError(OSL_FET_ERROR, errno); return oslTranslateFileError(OSL_FET_ERROR, errno);
} }
oslFileError SAL_CALL osl_closeDirectory( oslDirectory Directory ) oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory)
{ {
oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(Directory); oslDirectoryImpl* pDirImpl = static_cast<oslDirectoryImpl*>(pDirectory);
oslFileError err = osl_File_E_None; oslFileError err = osl_File_E_None;
OSL_ASSERT( Directory ); OSL_ASSERT(pDirectory);
if( pDirImpl == nullptr ) if (!pDirImpl)
return osl_File_E_INVAL; return osl_File_E_INVAL;
#ifdef ANDROID #ifdef ANDROID
if( pDirImpl->eKind == oslDirectoryImpl::KIND_ASSETS ) if (pDirImpl->eKind == oslDirectoryImpl::KIND_ASSETS)
{ {
if (lo_apk_closedir( pDirImpl->pApkDirStruct )) if (lo_apk_closedir(pDirImpl->pApkDirStruct))
err = osl_File_E_IO; err = osl_File_E_IO;
} }
else else
#endif #endif
{ {
if( closedir( pDirImpl->pDirStruct ) ) if (closedir( pDirImpl->pDirStruct))
err = oslTranslateFileError(OSL_FET_ERROR, errno); err = oslTranslateFileError(OSL_FET_ERROR, errno);
} }
/* cleanup members */ /* cleanup members */
rtl_uString_release( pDirImpl->ustrPath ); rtl_uString_release(pDirImpl->ustrPath);
rtl_freeMemory( pDirImpl ); rtl_freeMemory(pDirImpl);
return err; return err;
} }
......
Markdown is supported
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