[Libreoffice-commits] core.git: lingucomponent/source

Tor Lillqvist tml at collabora.com
Fri May 23 03:14:56 PDT 2014


 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   23 ++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit 7933b269ba4c5a49dd394eef15e98c55a19038ef
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri May 23 13:12:05 2014 +0300

    Reintroduce Win_GetShortPathName()
    
    Change-Id: Id15d1d4d9b7fb9bb2a0a5f52b5ec1928c38bd27b

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 9f7028b..94abeb9 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -507,6 +507,29 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling(
     return NULL;
 }
 
+#if defined(WNT)
+static 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)
+
 Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const OUString& aWord,
         const ::com::sun::star::lang::Locale& aLocale,
         const ::com::sun::star::beans::PropertyValues& aProperties )


More information about the Libreoffice-commits mailing list