From 0b413caadfbe68b278ca5ba33b6d204687586ea9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 30 Oct 2017 17:10:28 +0200 Subject: loplugin:constantparam in sal,sax Change-Id: I7ca2fd05d1cf61f9038c529a853e72fedb1c9ed0 Reviewed-on: https://gerrit.libreoffice.org/44087 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/sax/tools/converter.hxx | 5 +-- sal/osl/unx/file.cxx | 32 +++++++++--------- sal/osl/unx/file_error_transl.cxx | 6 ++-- sal/osl/unx/file_error_transl.hxx | 10 +----- sal/osl/unx/file_misc.cxx | 39 +++++++++++----------- sal/osl/unx/file_stat.cxx | 14 ++++---- sal/osl/unx/file_url.cxx | 18 +++++----- sal/osl/unx/file_volume.cxx | 4 +-- sax/qa/cppunit/test_converter.cxx | 12 +++---- sax/source/tools/converter.cxx | 13 +++----- sc/source/filter/oox/revisionfragment.cxx | 2 +- sc/source/filter/oox/sheetdatabuffer.cxx | 2 +- .../filter/xml/XMLCalculationSettingsContext.cxx | 2 +- sc/source/filter/xml/XMLTrackedChangesContext.cxx | 2 +- sfx2/source/bastyp/frmhtmlw.cxx | 4 +-- sfx2/source/doc/SfxDocumentMetaData.cxx | 2 +- .../chart/SchXMLCalculationSettingsContext.cxx | 2 +- xmloff/source/core/DocumentSettingsContext.cxx | 2 +- xmloff/source/core/xmluconv.cxx | 2 +- xmloff/source/draw/ximppage.cxx | 2 +- xmloff/source/forms/handler/vcl_date_handler.cxx | 2 +- .../source/text/XMLChangedRegionImportContext.cxx | 2 +- xmloff/source/text/txtflde.cxx | 2 +- xmloff/source/text/txtfldi.cxx | 7 ++-- xmloff/source/xforms/SchemaRestrictionContext.cxx | 2 +- 25 files changed, 86 insertions(+), 104 deletions(-) diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 095102804ace..b98516a9da87 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -170,17 +170,14 @@ public: /** convert util::DateTime to XMLSchema-2 "time" or "dateTime" string */ static void convertTimeOrDateTime(OUStringBuffer& rBuffer, - const css::util::DateTime& rDateTime, - sal_Int16 const* pTimeZoneOffset); + const css::util::DateTime& rDateTime); /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime */ static bool parseDateTime( css::util::DateTime& rDateTime, - boost::optional * pTimeZoneOffset, const OUString& rString ); /** convert XMLSchema-2 "time" or "dateTime" string to util::DateTime */ static bool parseTimeOrDateTime(css::util::DateTime& rDateTime, - boost::optional * pTimeZoneOffset, const OUString& rString); /** convert XMLSchema-2 "date" or "dateTime" string to util::DateTime or diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index b97e157c29be..de36b3d26a9c 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -299,7 +299,7 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize) if (ftruncate_with_name(m_fd, nSize, m_strFilePath) == -1) { /* Failure. Save original result. Try fallback algorithm */ - oslFileError result = oslTranslateFileError(OSL_FET_ERROR, errno); + oslFileError result = oslTranslateFileError(errno); /* Check against current size. Fail upon 'shrink' */ if (uSize <= getSize()) @@ -379,7 +379,7 @@ oslFileError FileHandle_Impl::readAt( } if (nBytes == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); *pBytesRead = nBytes; @@ -402,7 +402,7 @@ oslFileError FileHandle_Impl::writeAt( ssize_t nBytes = ::pwrite(m_fd, pBuffer, nBytesToWrite, nOffset); if (nBytes == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); m_size = std::max(m_size, sal::static_int_cast< sal_uInt64 >(nOffset + nBytes)); @@ -422,7 +422,7 @@ oslFileError FileHandle_Impl::readFileAt( // not seekable (pipe) ssize_t nBytes = ::read(m_fd, pBuffer, nBytesRequested); if (nBytes == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); *pBytesRead = nBytes; @@ -503,7 +503,7 @@ oslFileError FileHandle_Impl::writeFileAt( // not seekable (pipe) ssize_t nBytes = ::write(m_fd, pBuffer, nBytesToWrite); if (nBytes == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); *pBytesWritten = nBytes; @@ -958,7 +958,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI { int saved_errno = errno; SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << ") failed: " << strerror(saved_errno)); - return oslTranslateFileError(OSL_FET_ERROR, saved_errno); + return oslTranslateFileError(saved_errno); } #if !HAVE_FEATURE_MACOSX_SANDBOX @@ -970,7 +970,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI { int saved_errno = errno; SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_GETFL) failed: " << strerror(saved_errno)); - eRet = oslTranslateFileError(OSL_FET_ERROR, saved_errno); + eRet = oslTranslateFileError(saved_errno); (void) close(fd); return eRet; } @@ -979,7 +979,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI { int saved_errno = errno; SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETFL) failed: " << strerror(saved_errno)); - eRet = oslTranslateFileError(OSL_FET_ERROR, saved_errno); + eRet = oslTranslateFileError(saved_errno); (void) close(fd); return eRet; } @@ -992,7 +992,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI { int saved_errno = errno; SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fstat(" << fd << ") failed: " << strerror(saved_errno)); - eRet = oslTranslateFileError(OSL_FET_ERROR, saved_errno); + eRet = oslTranslateFileError(saved_errno); (void) close(fd); return eRet; } @@ -1013,7 +1013,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI /* Mac OSX returns ENOTSUP for webdav drives. We should try read lock */ if ((errno != ENOTSUP) || ((flock(fd, LOCK_SH | LOCK_NB) == 1) && (errno != ENOTSUP))) { - eRet = oslTranslateFileError(OSL_FET_ERROR, errno); + eRet = oslTranslateFileError(errno); (void) close(fd); return eRet; } @@ -1030,7 +1030,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, sal_uI { int saved_errno = errno; SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << ", " << ((flags & O_RDWR) ? "writeable":"readonly") << "): fcntl(" << fd << ", F_SETLK) failed: " << strerror(saved_errno)); - eRet = oslTranslateFileError(OSL_FET_ERROR, saved_errno); + eRet = oslTranslateFileError(saved_errno); (void) close(fd); return eRet; } @@ -1071,7 +1071,7 @@ oslFileError SAL_CALL openFile(rtl_uString* ustrFileURL, oslFileHandle* pHandle, #ifdef MACOSX if (macxp_resolveAlias(buffer, sizeof(buffer)) != 0) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); #endif /* MACOSX */ return openFilePath(buffer, pHandle, uFlags, mode); @@ -1111,7 +1111,7 @@ oslFileError SAL_CALL osl_closeFile(oslFileHandle Handle) else if (close(pImpl->m_fd) == -1) { /* translate error code */ - result = oslTranslateFileError(OSL_FET_ERROR, errno); + result = oslTranslateFileError(errno); } (void) pthread_mutex_unlock(&(pImpl->m_mutex)); @@ -1139,7 +1139,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle) return result; if (fsync(pImpl->m_fd) == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); return osl_File_E_None; } @@ -1191,7 +1191,7 @@ oslFileError SAL_CALL osl_mapFile( void* p = mmap(nullptr, nLength, PROT_READ, MAP_SHARED, pImpl->m_fd, nOffset); if (p == MAP_FAILED) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); *ppAddr = p; @@ -1255,7 +1255,7 @@ static oslFileError unmapFile(void* pAddr, sal_uInt64 uLength) size_t const nLength = sal::static_int_cast< size_t >(uLength); if (munmap(pAddr, nLength) == -1) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); return osl_File_E_None; } diff --git a/sal/osl/unx/file_error_transl.cxx b/sal/osl/unx/file_error_transl.cxx index c012e25de04c..2ebebe006889 100644 --- a/sal/osl/unx/file_error_transl.cxx +++ b/sal/osl/unx/file_error_transl.cxx @@ -21,15 +21,15 @@ #include "file_error_transl.hxx" #include -oslFileError oslTranslateFileError(bool bIsError, int Errno) +oslFileError oslTranslateFileError(int Errno) { oslFileError osl_error = osl_File_E_invalidError; - OSL_ENSURE((bIsError && (0 != Errno)) || (!bIsError && (0 == Errno)), "oslTranslateFileError strange input combination!"); + OSL_ENSURE(0 != Errno, "oslTranslateFileError strange input combination!"); /* Have a look at file_error_transl.hxx for the reason that we do this here */ - if (bIsError && (Errno == 0)) + if (Errno == 0) return osl_error; switch(Errno) diff --git a/sal/osl/unx/file_error_transl.hxx b/sal/osl/unx/file_error_transl.hxx index 5357db3d28b0..77340f9b0748 100644 --- a/sal/osl/unx/file_error_transl.hxx +++ b/sal/osl/unx/file_error_transl.hxx @@ -23,23 +23,15 @@ #include #include -#define OSL_FET_ERROR true - /** Translate errno's to osl file errors - @param [in] bIsError specifies if nErrno should be interpreted as error, - some libc functions signaling an error but errno is - nevertheless 0 in this case the function should at - least return osl_File_E_Unknown but in no case - osl_File_E_None! - @param [in] nErrno the errno if errno is 0 and bIsError is true the function returns osl_File_E_Unknown @returns the osl error code appropriate to the errno */ -oslFileError oslTranslateFileError(bool bIsError, int Errno); +oslFileError oslTranslateFileError(int Errno); #endif diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 8cb00fcc5a1d..5f7bdc5b010b 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -222,7 +222,7 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect rtl_uString_release( ustrSystemPath ); - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); } oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory) @@ -244,7 +244,7 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory) #endif { if (closedir( pDirImpl->pDirStruct)) - err = oslTranslateFileError(OSL_FET_ERROR, errno); + err = oslTranslateFileError(errno); } /* cleanup members */ @@ -262,14 +262,13 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory pDirectory) * on request *********************************************/ -static struct dirent* osl_readdir_impl_(DIR* pdir, bool bFilterLocalAndParentDir) +static struct dirent* osl_readdir_impl_(DIR* pdir) { struct dirent* pdirent; while ((pdirent = readdir(pdir)) != nullptr) { - if (bFilterLocalAndParentDir && - ((strcmp(pdirent->d_name, ".") == 0) || (strcmp(pdirent->d_name, "..") == 0))) + if ((strcmp(pdirent->d_name, ".") == 0) || (strcmp(pdirent->d_name, "..") == 0)) continue; break; } @@ -299,7 +298,7 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory pDirectory, else #endif { - pEntry = osl_readdir_impl_(pDirImpl->pDirStruct, true); + pEntry = osl_readdir_impl_(pDirImpl->pDirStruct); } if (!pEntry) @@ -361,7 +360,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString* ustrFileURL, oslDirector if (access_u(ustrSystemPath, F_OK) == -1) { - osl_error = oslTranslateFileError(OSL_FET_ERROR, errno); + osl_error = oslTranslateFileError(errno); } else { @@ -414,7 +413,7 @@ oslFileError osl_createDirectoryWithFlags( #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_createDirectory( path, flags ); @@ -435,7 +434,7 @@ oslFileError SAL_CALL osl_removeDirectory( rtl_uString* ustrDirectoryURL ) #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_removeDirectory( path ); @@ -461,7 +460,7 @@ oslFileError osl_psz_createDirectory(char const * pszPath, sal_uInt32 flags) if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } return osl_File_E_None; @@ -476,7 +475,7 @@ static oslFileError osl_psz_removeDirectory( const sal_Char* pszPath ) if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } return osl_File_E_None; @@ -527,7 +526,7 @@ static oslFileError create_dir_recursively_( return osl_File_E_None; if (native_err != ENOENT) - return oslTranslateFileError(OSL_FET_ERROR, native_err); + return oslTranslateFileError(native_err); // we step back until '/a_dir' at maximum because // we should get an error unequal ENOENT when @@ -598,7 +597,7 @@ oslFileError SAL_CALL osl_moveFile( rtl_uString* ustrFileURL, rtl_uString* ustrD #ifdef MACOSX if ( macxp_resolveAlias( srcPath, PATH_MAX ) != 0 || macxp_resolveAlias( destPath, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return oslDoMoveFile( srcPath, destPath ); @@ -625,7 +624,7 @@ oslFileError SAL_CALL osl_copyFile( rtl_uString* ustrFileURL, rtl_uString* ustrD #ifdef MACOSX if ( macxp_resolveAlias( srcPath, PATH_MAX ) != 0 || macxp_resolveAlias( destPath, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_copyFile( srcPath, destPath, false ); @@ -645,7 +644,7 @@ oslFileError SAL_CALL osl_removeFile( rtl_uString* ustrFileURL ) #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_removeFile( path ); @@ -686,7 +685,7 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } if ( S_ISDIR(aStat.st_mode) ) @@ -698,7 +697,7 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } return osl_File_E_None; @@ -713,7 +712,7 @@ static oslFileError osl_psz_moveFile(const sal_Char* pszPath, const sal_Char* ps if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } return osl_File_E_None; @@ -738,7 +737,7 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } /* mfe: we do only copy files here! */ @@ -848,7 +847,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char* if ( nRet > 0 ) { - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } if ( DestFileExists == 1 ) diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx index 3ea74e80918c..2b960d017fea 100644 --- a/sal/osl/unx/file_stat.cxx +++ b/sal/osl/unx/file_stat.cxx @@ -172,7 +172,7 @@ namespace { rtl::OUString link_target; if (!osl::realpath(file_path, link_target)) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); oslFileError osl_error = osl_getFileURLFromSystemPath(link_target.pData, &pStat->ustrLinkTargetURL); if (osl_error != osl_File_E_None) @@ -212,7 +212,7 @@ oslFileError SAL_CALL osl_getFileStatus(oslDirectoryItem Item, oslFileStatus* pS bool bStatNeeded = is_stat_call_necessary(uFieldMask, pImpl->getFileType()); if (bStatNeeded && (osl::lstat(file_path, file_stat) != 0)) - return oslTranslateFileError(OSL_FET_ERROR, errno); + return oslTranslateFileError(errno); if (bStatNeeded) { @@ -290,7 +290,7 @@ static oslFileError osl_psz_setFileAttributes( const sal_Char* pszFilePath, sal_ nNewMode|=S_IXOTH; if (chmod(pszFilePath, nNewMode) < 0) - osl_error = oslTranslateFileError(OSL_FET_ERROR, errno); + osl_error = oslTranslateFileError(errno); return osl_error; } @@ -309,7 +309,7 @@ oslFileError SAL_CALL osl_setFileAttributes( rtl_uString* ustrFileURL, sal_uInt6 #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_setFileAttributes( path, uAttributes ); @@ -332,7 +332,7 @@ static oslFileError osl_psz_setFileTime ( if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } #ifdef DEBUG_OSL_FILE @@ -389,7 +389,7 @@ static oslFileError osl_psz_setFileTime ( if ( nRet < 0 ) { nRet=errno; - return oslTranslateFileError(OSL_FET_ERROR, nRet); + return oslTranslateFileError(nRet); } return osl_File_E_None; @@ -413,7 +413,7 @@ oslFileError SAL_CALL osl_setFileTime ( #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_setFileTime( path, pLastAccessTime, pLastWriteTime ); diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index 2041c984ec02..428bfec90e3f 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -429,20 +429,20 @@ namespace { char unresolved_path[PATH_MAX]; if (!UnicodeToText(unresolved_path, sizeof(unresolved_path), path, rtl_ustr_getLength(path))) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); char resolved_path[PATH_MAX]; if (realpath(unresolved_path, resolved_path)) { if (!TextToUnicode(resolved_path, strlen(resolved_path), path, PATH_MAX)) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); } else { if (EACCES == errno || ENOTDIR == errno || ENOENT == errno) *failed = true; else - ferr = oslTranslateFileError(OSL_FET_ERROR, errno); + ferr = oslTranslateFileError(errno); } } @@ -458,7 +458,7 @@ namespace { /* the given unresolved path must not exceed PATH_MAX */ if (unresolved_path.getLength() >= (PATH_MAX - 2)) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); sal_Unicode path_resolved_so_far[PATH_MAX]; const sal_Unicode* punresolved = unresolved_path.getStr(); @@ -507,7 +507,7 @@ namespace /* a file or directory name may start with '.' */ if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); ustrchrcat(*punresolved++, path_resolved_so_far); @@ -524,7 +524,7 @@ namespace else if (*punresolved == '/') { if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); ustrchrcat(*punresolved++, path_resolved_so_far); @@ -540,7 +540,7 @@ namespace if (!_islastchr(path_resolved_so_far, '/')) { if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); ustrchrcat('/', path_resolved_so_far); } @@ -549,7 +549,7 @@ namespace else // any other character { if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel) - return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG); + return oslTranslateFileError(ENAMETOOLONG); ustrchrcat(*punresolved++, path_resolved_so_far); @@ -713,7 +713,7 @@ oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileUR /* convert unicode path to text */ if(!UnicodeToText( buffer, bufLen, ustrSystemPath->buffer, ustrSystemPath->length)) - osl_error = oslTranslateFileError(OSL_FET_ERROR, errno); + osl_error = oslTranslateFileError(errno); rtl_uString_release(ustrSystemPath); diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 5a69039e0a18..5dc41cc0f7ea 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -107,7 +107,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI #ifdef MACOSX if ( macxp_resolveAlias( path, PATH_MAX ) != 0 ) - return oslTranslateFileError( OSL_FET_ERROR, errno ); + return oslTranslateFileError( errno ); #endif/* MACOSX */ return osl_psz_getVolumeInformation( path, pInfo, uFieldMask); @@ -218,7 +218,7 @@ static oslFileError osl_psz_getVolumeInformation ( OSL_detail_STATFS_INIT(sfs); if ((OSL_detail_STATFS(pszDirectory, &sfs)) < (0)) { - oslFileError result = oslTranslateFileError(OSL_FET_ERROR, errno); + oslFileError result = oslTranslateFileError(errno); return result; } diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 02471ebff740..7fd28345c0a6 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -159,7 +159,7 @@ void doTest(util::DateTime const & rdt, char const*const pis, OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); - bool bSuccess( Converter::parseDateTime(odt, nullptr, is) ); + bool bSuccess( Converter::parseDateTime(odt, is) ); SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDateTime(rdt, odt)); @@ -173,8 +173,7 @@ void doTest(util::DateTime const & rdt, char const*const pis, void doTestDateTimeF(char const*const pis) { util::DateTime odt; - bool bSuccess = Converter::parseDateTime(odt, nullptr, - OUString::createFromAscii(pis)); + bool bSuccess = Converter::parseDateTime(odt, OUString::createFromAscii(pis)); SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds); CPPUNIT_ASSERT(!bSuccess); } @@ -254,12 +253,12 @@ void doTestTime(util::DateTime const & rdt, char const*const pis, OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); - bool bSuccess( Converter::parseTimeOrDateTime(odt, nullptr, is) ); + bool bSuccess( Converter::parseTimeOrDateTime(odt, is) ); SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDateTime(rdt, odt)); OUStringBuffer buf; - Converter::convertTimeOrDateTime(buf, odt, nullptr); + Converter::convertTimeOrDateTime(buf, odt); SAL_INFO("sax.cppunit","" << buf.toString()); CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos), buf.makeStringAndClear()); @@ -268,8 +267,7 @@ void doTestTime(util::DateTime const & rdt, char const*const pis, void doTestTimeF(char const*const pis) { util::DateTime odt; - bool bSuccess = Converter::parseTimeOrDateTime(odt, nullptr, - OUString::createFromAscii(pis)); + bool bSuccess = Converter::parseTimeOrDateTime(odt, OUString::createFromAscii(pis)); SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds); CPPUNIT_ASSERT_MESSAGE(pis, !bSuccess); } diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index d2a84cd8ea7d..121ae8a2ffa4 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1334,19 +1334,18 @@ static void convertTimeZone( /** convert util::DateTime to ISO "time" or "dateTime" string */ void Converter::convertTimeOrDateTime( OUStringBuffer& i_rBuffer, - const css::util::DateTime& i_rDateTime, - sal_Int16 const* pTimeZoneOffset) + const css::util::DateTime& i_rDateTime) { if (i_rDateTime.Year == 0 || i_rDateTime.Month < 1 || i_rDateTime.Month > 12 || i_rDateTime.Day < 1 || i_rDateTime.Day > 31) { convertTime(i_rBuffer, i_rDateTime); - convertTimeZone(i_rBuffer, i_rDateTime, pTimeZoneOffset); + convertTimeZone(i_rBuffer, i_rDateTime, nullptr); } else { - convertDateTime(i_rBuffer, i_rDateTime, pTimeZoneOffset, true); + convertDateTime(i_rBuffer, i_rDateTime, nullptr, true); } } @@ -1397,11 +1396,10 @@ void Converter::convertDateTime( /** convert ISO "date" or "dateTime" string to util::DateTime */ bool Converter::parseDateTime( util::DateTime& rDateTime, - boost::optional *const pTimeZoneOffset, const OUString& rString ) { bool isDateTime; - return parseDateOrDateTime(nullptr, rDateTime, isDateTime, pTimeZoneOffset, + return parseDateOrDateTime(nullptr, rDateTime, isDateTime, nullptr, rString); } @@ -1851,12 +1849,11 @@ static bool lcl_parseDateTime( /** convert ISO "time" or "dateTime" string to util::DateTime */ bool Converter::parseTimeOrDateTime( util::DateTime & rDateTime, - boost::optional * pTimeZoneOffset, const OUString & rString) { bool dummy; return lcl_parseDateTime( - nullptr, rDateTime, dummy, pTimeZoneOffset, rString, true); + nullptr, rDateTime, dummy, nullptr, rString, true); } /** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */ diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index d7eb692c361d..bacde362a7ab 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -289,7 +289,7 @@ void RevisionHeadersFragment::importHeader( const AttributeList& rAttribs ) if (!aDateTimeStr.isEmpty()) { util::DateTime aDateTime; - sax::Converter::parseDateTime(aDateTime, nullptr, aDateTimeStr); + sax::Converter::parseDateTime(aDateTime, aDateTimeStr); Date aDate(aDateTime); tools::Time aTime(aDateTime); aMetadata.maDateTime.SetDate(aDate.GetDate()); diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 9b17c3e1001f..6acc7a8724f5 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -208,7 +208,7 @@ void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 nErrorCod void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& rDateString ) { css::util::DateTime aDateTime; - if (!sax::Converter::parseDateTime( aDateTime, nullptr, rDateString)) + if (!sax::Converter::parseDateTime( aDateTime, rDateString)) { SAL_WARN("sc.filter", "SheetDataBuffer::setDateCell - could not parse: " << rDateString); // At least don't lose data. diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx index f3eb92525053..18771bbb95e1 100644 --- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx +++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx @@ -151,7 +151,7 @@ ScXMLNullDateContext::ScXMLNullDateContext( ScXMLImport& rImport, if (aIter != rAttrList->end()) { util::DateTime aDateTime; - ::sax::Converter::parseDateTime(aDateTime, nullptr, aIter.toString()); + ::sax::Converter::parseDateTime(aDateTime, aIter.toString()); util::Date aDate; aDate.Day = aDateTime.Day; aDate.Month = aDateTime.Month; diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx index 37d532c1baf7..20db3cb71a81 100644 --- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx +++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx @@ -472,7 +472,7 @@ SvXMLImportContextRef ScXMLChangeInfoContext::CreateChildContext( sal_uInt16 nPr void SAL_CALL ScXMLChangeInfoContext::endFastElement( sal_Int32 /*nElement*/ ) { aInfo.sUser = sAuthorBuffer.makeStringAndClear(); - ::sax::Converter::parseDateTime(aInfo.aDateTime, nullptr, + ::sax::Converter::parseDateTime(aInfo.aDateTime, sDateTimeBuffer.makeStringAndClear()); aInfo.sComment = sCommentBuffer.makeStringAndClear(); pChangeTrackingImportHelper->SetActionInfo(aInfo); diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 77ad3a324e45..f373a6f324b4 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -163,7 +163,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, // created ::util::DateTime uDT = i_xDocProps->getCreationDate(); OUStringBuffer aBuffer; - ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT, nullptr); + ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, aBuffer.makeStringAndClear(), false, eDestEnc, pNonConvertableChars ); @@ -176,7 +176,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, // changed uDT = i_xDocProps->getModificationDate(); - ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT, nullptr); + ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, aBuffer.makeStringAndClear(), false, eDestEnc, pNonConvertableChars ); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 93b93eb1b5a3..06343859c834 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -464,7 +464,7 @@ textToDateOrDateTime(css::util::Date & io_rd, css::util::DateTime & io_rdt, bool SAL_CALL textToDateTime(css::util::DateTime & io_rdt, const OUString& i_text) throw () { - if (::sax::Converter::parseDateTime(io_rdt, nullptr, i_text)) { + if (::sax::Converter::parseDateTime(io_rdt, i_text)) { return true; } else { SAL_WARN_IF(!i_text.isEmpty(), "sfx.doc", "Invalid date: " << i_text); diff --git a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx index a323fe0d2e44..7814a8b77a8f 100644 --- a/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx +++ b/xmloff/source/chart/SchXMLCalculationSettingsContext.cxx @@ -51,7 +51,7 @@ SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& { util::DateTime aNullDate; const OUString sValue = xAttrList->getValueByIndex( i ); - ::sax::Converter::parseDateTime(aNullDate, nullptr, sValue); + ::sax::Converter::parseDateTime(aNullDate, sValue); m_aNullDate <<= aNullDate; } } diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 9b151366adb6..d53ce780fb5e 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -573,7 +573,7 @@ void XMLConfigItemContext::EndElement() else if (IsXMLToken(msType, XML_DATETIME)) { util::DateTime aDateTime; - ::sax::Converter::parseDateTime(aDateTime, nullptr, msValue); + ::sax::Converter::parseDateTime(aDateTime, msValue); mrAny <<= aDateTime; } else if (IsXMLToken(msType, XML_BASE64BINARY)) diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index fb22fa8281b7..0285aa3f7a3f 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -433,7 +433,7 @@ bool SvXMLUnitConverter::convertDateTime( double& fDateTime, const OUString& rString, const css::util::Date& aTempNullDate) { css::util::DateTime aDateTime; - bool bSuccess = ::sax::Converter::parseDateTime(aDateTime, nullptr, rString); + bool bSuccess = ::sax::Converter::parseDateTime(aDateTime, rString); if (bSuccess) { diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 8ee9a8754430..ddf42faee6b8 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -197,7 +197,7 @@ void DrawAnnotationContext::EndElement() mxAnnotation->setInitials( maInitialsBuffer.makeStringAndClear() ); util::DateTime aDateTime; - if (::sax::Converter::parseDateTime(aDateTime, nullptr, + if (::sax::Converter::parseDateTime(aDateTime, maDateBuffer.makeStringAndClear())) { mxAnnotation->setDateTime(aDateTime); diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx index 4dde7c21045f..ec518f9be94d 100644 --- a/xmloff/source/forms/handler/vcl_date_handler.cxx +++ b/xmloff/source/forms/handler/vcl_date_handler.cxx @@ -67,7 +67,7 @@ namespace xmloff { DateTime aDateTime; Date aDate; - if (::sax::Converter::parseDateTime( aDateTime, nullptr, i_attributeValue )) + if (::sax::Converter::parseDateTime( aDateTime, i_attributeValue )) { aDate.Day = aDateTime.Day; aDate.Month = aDateTime.Month; diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx index 29b118fcb08a..bf29d7390efd 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.cxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx @@ -159,7 +159,7 @@ void XMLChangedRegionImportContext::SetChangeInfo( const OUString& rDate) { util::DateTime aDateTime; - if (::sax::Converter::parseDateTime(aDateTime, nullptr, rDate)) + if (::sax::Converter::parseDateTime(aDateTime, rDate)) { GetImport().GetTextImport()->RedlineAdd( rType, sID, rAuthor, rComment, aDateTime, bMergeLastPara); diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 6cc0690a35d7..620c69a6cc75 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2639,7 +2639,7 @@ void XMLTextFieldExport::ProcessTimeOrDateTime(enum XMLTokenEnum eName, OUStringBuffer aBuffer; // date/time value - ::sax::Converter::convertTimeOrDateTime(aBuffer, rTime, nullptr); + ::sax::Converter::convertTimeOrDateTime(aBuffer, rTime); // output attribute ProcessString(eName, aBuffer.makeStringAndClear(), true); diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index b63071354564..d100263d2fcf 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -989,8 +989,7 @@ void XMLTimeFieldImportContext::ProcessAttribute( { case XML_TOK_TEXTFIELD_TIME_VALUE: { - if (::sax::Converter::parseTimeOrDateTime(aDateTimeValue, nullptr, - sAttrValue)) + if (::sax::Converter::parseTimeOrDateTime(aDateTimeValue, sAttrValue)) { bTimeOK = true; } @@ -1108,7 +1107,7 @@ void XMLDateFieldImportContext::ProcessAttribute( { case XML_TOK_TEXTFIELD_DATE_VALUE: { - if (::sax::Converter::parseDateTime(aDateTimeValue, nullptr, sAttrValue)) + if (::sax::Converter::parseDateTime(aDateTimeValue, sAttrValue)) { bTimeOK = true; } @@ -3460,7 +3459,7 @@ void XMLAnnotationImportContext::PrepareField( xPropertySet->setPropertyValue("Initials", makeAny(sInitials)); util::DateTime aDateTime; - if (::sax::Converter::parseDateTime(aDateTime, nullptr, + if (::sax::Converter::parseDateTime(aDateTime, aDateBuffer.makeStringAndClear())) { /* diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx index 86a52ba9a09b..f3bb38fbc48d 100644 --- a/xmloff/source/xforms/SchemaRestrictionContext.cxx +++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx @@ -193,7 +193,7 @@ Any xforms_date( const OUString& rValue ) Any xforms_dateTime( const OUString& rValue ) { util::DateTime aDateTime; - bool const bSuccess = ::sax::Converter::parseDateTime(aDateTime, nullptr, rValue); + bool const bSuccess = ::sax::Converter::parseDateTime(aDateTime, rValue); return bSuccess ? makeAny( aDateTime ) : Any(); } -- cgit