diff options
author | László Németh <nemeth@numbertext.org> | 2014-05-22 12:27:44 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2014-05-23 01:06:50 +0200 |
commit | 6d06aa8ba83b7629603cd86cf14a63c432ce268f (patch) | |
tree | b5dee722f6f43f1acb20af35534b37d20df8fee7 /lingucomponent/source | |
parent | 7818974103fcdf16e03354f62a4165eedea4427c (diff) |
fdo#48017 WIN32 long path support in Hyphen and MyThes
Change-Id: Ifb068efb553ed24a7caf65dbab28726bdeced0e6
Diffstat (limited to 'lingucomponent/source')
-rw-r--r-- | lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 10 | ||||
-rw-r--r-- | lingucomponent/source/lingutil/lingutil.cxx | 27 | ||||
-rw-r--r-- | lingucomponent/source/lingutil/lingutil.hxx | 10 | ||||
-rw-r--r-- | lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 14 |
4 files changed, 10 insertions, 51 deletions
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 2fb10c1d70a2..86b0d5e36c8d 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -285,14 +285,12 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo OUString dictpath; osl::FileBase::getSystemPathFromFileURL( DictFN, dictpath ); - OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) ); #if defined(WNT) - // workaround for Windows specific problem that the - // path length in calls to 'fopen' is limted to somewhat - // about 120+ characters which will usually be exceed when - // using dictionaries as extensions. - sTmp = Win_GetShortPathName( dictpath ); + // Hyphen waits UTF-8 encoded paths with \\?\ long path prefix. + OString sTmp = OUStringToOString(dicpath, RTL_TEXTENCODING_UTF8); +#else + OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) ); #endif if ( ( dict = hnj_hyphen_load ( sTmp.getStr()) ) == NULL ) diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx index 18e5f57890e6..769a023c9096 100644 --- a/lingucomponent/source/lingutil/lingutil.cxx +++ b/lingucomponent/source/lingutil/lingutil.cxx @@ -17,10 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#if defined(WNT) -#include <windows.h> -#endif - #include <osl/thread.h> #include <osl/file.hxx> #include <tools/debug.hxx> @@ -45,29 +41,6 @@ using ::com::sun::star::lang::Locale; using namespace ::com::sun::star; -#if defined(WNT) -OString Win_GetShortPathName( const OUString &rLongPathName ) -{ - OString aRes; - - sal_Unicode aShortBuffer[1024] = {0}; - sal_Int32 nShortBufSize = SAL_N_ELEMENTS( aShortBuffer ); - - // use the version of 'GetShortPathName' that can deal with Unicode... - sal_Int32 nShortLen = GetShortPathNameW( - reinterpret_cast<LPCWSTR>( rLongPathName.getStr() ), - reinterpret_cast<LPWSTR>( aShortBuffer ), - nShortBufSize ); - - if (nShortLen < nShortBufSize) // conversion successful? - aRes = OString( OU2ENC( OUString( aShortBuffer, nShortLen ), osl_getThreadTextEncoding()) ); - else - OSL_FAIL( "Win_GetShortPathName: buffer to short" ); - - return aRes; -} -#endif //defined(WNT) - // build list of old style diuctionaries (not as extensions) to use. // User installed dictionaries (the ones residing in the user paths) // will get precedence over system installed ones for the same language. diff --git a/lingucomponent/source/lingutil/lingutil.hxx b/lingucomponent/source/lingutil/lingutil.hxx index 9a4f0f6a830d..bda6de1a7432 100644 --- a/lingucomponent/source/lingutil/lingutil.hxx +++ b/lingucomponent/source/lingutil/lingutil.hxx @@ -48,16 +48,6 @@ inline bool operator == ( const ::com::sun::star::lang::Locale &rL1, const ::com rL1.Variant == rL2.Variant; } -#if defined(WNT) - -// to be use to get a short path name under Windows that still can be used with -// the 'fopen' call. This is necessary since under Windows there seems to be -// a restriction of only about 110-130 characters length to a path name in order -// for it to work with 'fopen'. And that length is usually easily exceeded -// when using extensions... -OString Win_GetShortPathName( const OUString &rLongPathName ); -#endif - // temporary function, to be removed when new style dictionaries // using configuration entries are fully implemented and provided std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char * pDicType ); diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index 679aba9a0a95..73d05426e8c3 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -328,16 +328,14 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes OUString nidx; osl::FileBase::getSystemPathFromFileURL(datpath,ndat); osl::FileBase::getSystemPathFromFileURL(idxpath,nidx); - OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding())); - OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding())); #if defined(WNT) - // workaround for Windows specific problem that the - // path length in calls to 'fopen' is limted to somewhat - // about 120+ characters which will usually be exceed when - // using dictionaries as extensions. - aTmpidx = Win_GetShortPathName( nidx ); - aTmpdat = Win_GetShortPathName( ndat ); + // MyThes waits UTF-8 encoded paths with \\?\ long path prefix. + OString aTmpidx = OUStringToOString(nidx, RTL_TEXTENCODING_UTF8); + OString aTmpdat = OUStringToOString(ndat, RTL_TEXTENCODING_UTF8); +#else + OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding())); + OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding())); #endif aThes[i] = new MyThes(aTmpidx.getStr(),aTmpdat.getStr()); |