From 65f75b3b255a4db2484d88ba03fed71ba331aa81 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Tue, 13 Oct 2009 19:36:40 +0200 Subject: #i105876# check fgets return (thanks cmc) --- padmin/source/cmddlg.cxx | 54 ++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'padmin/source') diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index 9aa65c8ce204..c6daf547369c 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -79,20 +79,22 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which gs 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 2 - && aCommand.GetChar( nLen-2 ) == 'g' - && aCommand.GetChar( nLen-1 ) == 's' ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 2 + && aCommand.GetChar( nLen-2 ) == 'g' + && aCommand.GetChar( nLen-1 ) == 's' ) + { + aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } @@ -100,19 +102,21 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which distill 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 7 - && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 7 + && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + { + aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } -- cgit From 6ce14717d50ed3fad1f5879faf5d034aaf8f3d3b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 3 Nov 2009 18:12:19 +0100 Subject: #i104678# use high contrast mode setting instead of IsDark (paradigm shift begun with issue i35482) --- padmin/source/adddlg.cxx | 2 +- padmin/source/padialog.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'padmin/source') diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index 052de2cbb731..58c37dcffa83 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -807,7 +807,7 @@ AddPrinterDialog::~AddPrinterDialog() void AddPrinterDialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER ) ) ) ); else m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER_HC ) ) ) ); diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 5b49409a1c8a..f73427526be6 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -106,7 +106,7 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) : void PADialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) { m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER ) ) ); m_aFaxImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_FAX ) ) ); -- cgit