[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - desktop/source
Laurent Godard
lgodard.libre at laposte.net
Tue Jan 20 08:14:58 PST 2015
desktop/source/app/dispatchwatcher.cxx | 37 +++++++++++++++++++--------------
1 file changed, 22 insertions(+), 15 deletions(-)
New commits:
commit ef93d0ccb0c2ef010fc1f1089e55f1d9c74e61fd
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Thu Jan 15 18:40:47 2015 +0100
executeDispatchRequests : cleaning outputs
- replace RTL_TEXTENCODING_UTF8 with osl_getThreadTextEncoding()
- replace printf statements with std::cerr and std::cout
Change-Id: Id374efac90f86bbfdc817f2266a5c995d72902e4
(cherry picked from commit 905bab9e46f9a15d4402954b70913d66fc6d3cd5)
Reviewed-on: https://gerrit.libreoffice.org/14042
Tested-by: Michael Stahl <mstahl at redhat.com>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 2480c69..80eb9b6 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -139,7 +139,12 @@ const SfxFilter* impl_getExportFilterFromUrl( const rtl::OUString& rUrl, const r
pFilter = impl_lookupExportFilterForUrl( rUrl, rFactory );
if ( !pFilter )
{
- std::cerr << "Error: no export filter for " << rUrl << " found, now using the default filter for " << rFactory << "\n";
+ OUString aTempName;
+ FileBase::getSystemPathFromFileURL( rUrl, aTempName );
+ OString aSource = OUStringToOString ( aTempName, osl_getThreadTextEncoding() );
+ OString aFactory = OUStringToOString ( rFactory, osl_getThreadTextEncoding() );
+ std::cerr << "Error: no export filter for " << aSource << " found, now using the default filter for " << aFactory << std::endl;
+
pFilter = SfxFilter::GetDefaultFilterFromFactory( rFactory );
}
@@ -513,7 +518,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
if( aDispatchRequest.aRequestType == REQUEST_CAT )
{
if( ::osl::FileBase::createTempFile(0, 0, &fileForCat) != ::osl::FileBase::E_None )
- fprintf( stderr, "Error: Cannot create temporary file...\n" );
+ std::cerr << "Error: Cannot create temporary file..." << std::endl ;
aOutFile = fileForCat;
}
@@ -549,15 +554,15 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
OUString aTempName;
FileBase::getSystemPathFromFileURL( aName, aTempName );
- OString aSource8 = OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
+ OString aSource8 = OUStringToOString ( aTempName, osl_getThreadTextEncoding() );
FileBase::getSystemPathFromFileURL( aOutFile, aTempName );
- OString aTargetURL8 = OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
+ OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding() );
if( aDispatchRequest.aRequestType != REQUEST_CAT )
{
- printf("convert %s -> %s using %s\n", aSource8.getStr(), aTargetURL8.getStr(),
- OUStringToOString( aFilter, RTL_TEXTENCODING_UTF8 ).getStr());
+ std::cout << "convert " << aSource8 << " -> " << aTargetURL8;
+ std::cout << " using filter : " << OUStringToOString( aFilter, osl_getThreadTextEncoding() ) << std::endl;
if( FStatHelper::IsDocument( aOutFile ) )
- printf("Overwriting: %s\n",OUStringToOString( aTempName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ std::cout << "Overwriting: " << OUStringToOString( aTempName, osl_getThreadTextEncoding() ) << std::endl ;
}
try
{
@@ -577,7 +582,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
osl::File::RC aRC = aFile.open( osl_File_OpenFlag_Read );
if( aRC != osl::File::E_None )
{
- fprintf( stderr, "Error: Cannot read from temp file\n" );
+ std::cerr << "Error: Cannot read from temp file" << std::endl;
}
else
{
@@ -594,7 +599,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
{
std::cout << aStr[i];
}
- std::cout << "\n";
+ std::cout << std::endl;
}
aFile.close();
osl::File::remove( fileForCat );
@@ -621,12 +626,14 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
OUString aTempName;
FileBase::getSystemPathFromFileURL( aName, aTempName );
- OString aSource8 = OUStringToOString ( aTempName, RTL_TEXTENCODING_UTF8 );
+ OString aSource8 = OUStringToOString ( aTempName, osl_getThreadTextEncoding() );
FileBase::getSystemPathFromFileURL( aOutFile, aTempName );
- OString aTargetURL8 = OUStringToOString(aTempName, RTL_TEXTENCODING_UTF8 );
- printf("print %s -> %s using %s\n", aSource8.getStr(), aTargetURL8.getStr(),
- aPrinterName.isEmpty() ?
- "<default_printer>" : OUStringToOString( aPrinterName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ OString aTargetURL8 = OUStringToOString(aTempName, osl_getThreadTextEncoding() );
+
+ std::cout << "print " << aSource8 << " -> " << aTargetURL8;
+ std::cout << " using " << aPrinterName.isEmpty() ?
+ "<default_printer>" : OUStringToOString( aPrinterName, osl_getThreadTextEncoding() );
+ std::cout << std::endl;
// create the custom printer, if given
Sequence < PropertyValue > aPrinterArgs( 1 );
@@ -663,7 +670,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
}
else
{
- std::cerr << ("Error: source file could not be loaded\n");
+ std::cerr << "Error: source file could not be loaded" << std::endl;
}
// remove the document
More information about the Libreoffice-commits
mailing list