summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-28 12:08:27 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-28 12:09:11 +0200
commit2349c6a4743b517e705f90cc2a4eaf8ed70958e1 (patch)
tree342ef3ba50c5c26fe1909a1946b4722c008759df
parent1eed4c837828c00dff4ef0b2cf29b1e2962e912d (diff)
CMIS UCP: strings coming from libcmis are UTF-8, not ascii
Change-Id: Ieb906b8acb677bfc74abc35abb06312704887b66
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx19
-rw-r--r--ucb/source/ucp/cmis/cmis_datasupplier.cxx4
2 files changed, 13 insertions, 10 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index fb78931c6ba0..977e2a3761ed 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -64,6 +64,7 @@
64#include "cmis_resultset.hxx" 64#include "cmis_resultset.hxx"
65 65
66#define OUSTR_TO_STDSTR(s) string( rtl::OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() ) 66#define OUSTR_TO_STDSTR(s) string( rtl::OUStringToOString( s, RTL_TEXTENCODING_UTF8 ).getStr() )
67#define STD_TO_OUSTR( str ) rtl::OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
67 68
68using namespace com::sun::star; 69using namespace com::sun::star;
69using namespace std; 70using namespace std;
@@ -98,8 +99,8 @@ namespace
98 rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest 99 rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest
99 = new ucbhelper::SimpleAuthenticationRequest( 100 = new ucbhelper::SimpleAuthenticationRequest(
100 m_sUrl, m_sBindingUrl, ::rtl::OUString(), 101 m_sUrl, m_sBindingUrl, ::rtl::OUString(),
101 rtl::OUString::createFromAscii( username.c_str( ) ), 102 STD_TO_OUSTR( username ),
102 rtl::OUString::createFromAscii( password.c_str( ) ), 103 STD_TO_OUSTR( password ),
103 ::rtl::OUString(), true, false ); 104 ::rtl::OUString(), true, false );
104 xIH->handle( xRequest.get() ); 105 xIH->handle( xRequest.get() );
105 106
@@ -300,7 +301,7 @@ namespace cmis
300 { 301 {
301 rtl::OUString sTitle; 302 rtl::OUString sTitle;
302 if ( getObject().get() ) 303 if ( getObject().get() )
303 sTitle = rtl::OUString::createFromAscii( getObject()->getName().c_str( ) ); 304 sTitle = STD_TO_OUSTR( getObject()->getName() );
304 else if ( m_pObjectProps.size() > 0 ) 305 else if ( m_pObjectProps.size() > 0 )
305 { 306 {
306 map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" ); 307 map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
@@ -308,7 +309,7 @@ namespace cmis
308 { 309 {
309 vector< string > values = it->second->getStrings( ); 310 vector< string > values = it->second->getStrings( );
310 if ( values.size() > 0 ) 311 if ( values.size() > 0 )
311 sTitle = rtl::OUString::createFromAscii( values.front( ).c_str( ) ); 312 sTitle = STD_TO_OUSTR( values.front( ) );
312 } 313 }
313 } 314 }
314 315
@@ -343,7 +344,7 @@ namespace cmis
343 else 344 else
344 path = getObject()->getName( ); 345 path = getObject()->getName( );
345 346
346 xRow->appendString( rProp, rtl::OUString::createFromAscii( path.c_str() ) ); 347 xRow->appendString( rProp, STD_TO_OUSTR( path ) );
347 } 348 }
348 else 349 else
349 xRow->appendVoid( rProp ); 350 xRow->appendVoid( rProp );
@@ -557,7 +558,7 @@ namespace cmis
557 try 558 try
558 { 559 {
559 object = m_pSession->getObjectByPath( newPath ); 560 object = m_pSession->getObjectByPath( newPath );
560 sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) ); 561 sNewPath = STD_TO_OUSTR( newPath );
561 } 562 }
562 catch ( const libcmis::Exception& ) 563 catch ( const libcmis::Exception& )
563 { 564 {
@@ -594,7 +595,7 @@ namespace cmis
594 if ( bIsFolder ) 595 if ( bIsFolder )
595 { 596 {
596 libcmis::FolderPtr pNew = pFolder->createFolder( m_pObjectProps ); 597 libcmis::FolderPtr pNew = pFolder->createFolder( m_pObjectProps );
597 sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) ); 598 sNewPath = STD_TO_OUSTR( newPath );
598 } 599 }
599 else 600 else
600 { 601 {
@@ -602,7 +603,7 @@ namespace cmis
602 uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut ); 603 uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut );
603 copyData( xInputStream, xOutput ); 604 copyData( xInputStream, xOutput );
604 libcmis::DocumentPtr pNew = pFolder->createDocument( m_pObjectProps, pOut, string() ); 605 libcmis::DocumentPtr pNew = pFolder->createDocument( m_pObjectProps, pOut, string() );
605 sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) ); 606 sNewPath = STD_TO_OUSTR( newPath );
606 } 607 }
607 } 608 }
608 609
@@ -899,7 +900,7 @@ namespace cmis
899 if ( !parentPath.empty() ) 900 if ( !parentPath.empty() )
900 { 901 {
901 URL aUrl( m_sURL ); 902 URL aUrl( m_sURL );
902 aUrl.setObjectPath( rtl::OUString::createFromAscii( parentPath.c_str( ) ) ); 903 aUrl.setObjectPath( STD_TO_OUSTR( parentPath ) );
903 sRet = aUrl.asString( ); 904 sRet = aUrl.asString( );
904 } 905 }
905 906
diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
index 59ffd73ff609..edddc9e8e3b9 100644
--- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx
+++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx
@@ -18,6 +18,8 @@
18#include "cmis_content.hxx" 18#include "cmis_content.hxx"
19#include "cmis_provider.hxx" 19#include "cmis_provider.hxx"
20 20
21#define STD_TO_OUSTR( str ) rtl::OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
22
21using namespace com::sun::star; 23using namespace com::sun::star;
22using namespace std; 24using namespace std;
23 25
@@ -98,7 +100,7 @@ namespace cmis
98 100
99 // Get the URL from the Path 101 // Get the URL from the Path
100 URL aUrl( mxContent->getIdentifier( )->getContentIdentifier( ) ); 102 URL aUrl( mxContent->getIdentifier( )->getContentIdentifier( ) );
101 aUrl.setObjectPath( rtl::OUString::createFromAscii( sObjectPath.c_str( ) ) ); 103 aUrl.setObjectPath( STD_TO_OUSTR( sObjectPath ) );
102 rtl::OUString aId = aUrl.asString( ); 104 rtl::OUString aId = aUrl.asString( );
103 105
104 maResults[ nIndex ]->aId = aId; 106 maResults[ nIndex ]->aId = aId;