From 5615796c0a10d5068dfb61ecbfbb9ab048ae63cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Mon, 22 Oct 2018 04:14:01 +0200 Subject: Fix incorrect use of TQString() inside i18n(). Added controlled conversions to char* instead of automatic ascii conversions. The definition of -UTQT_NO_ASCII_CAST is no longer needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeLists.txt | 2 +- src/commonwidget.cpp | 4 ++-- src/compoundwidget.cpp | 16 ++++++++-------- src/htmlwidget.cpp | 2 +- src/loggingoptions.cpp | 14 +++++++------- src/main.cpp | 2 +- src/mainwidget.cpp | 2 +- src/scanwidget.cpp | 14 +++++++------- src/timingwidget.cpp | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5a8cc5..2548c34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ include( ConfigureChecks.cmake ) ###### global compiler settings -add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST ) +add_definitions( -DHAVE_CONFIG_H ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) diff --git a/src/commonwidget.cpp b/src/commonwidget.cpp index 7a13902..1287f73 100644 --- a/src/commonwidget.cpp +++ b/src/commonwidget.cpp @@ -96,7 +96,7 @@ bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr portRange = portRange.right( portRange.length( ) - 2 ); } else - { KMessageBox::error( this, i18n( TQString( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ])), i18n( "Internal error" )); + { KMessageBox::error( this, i18n( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ]), i18n( "Internal error" )); return false; } @@ -282,7 +282,7 @@ bool CommonWidget::getOptions( ) bool portRangesState = m_portRangesCheckBox->isChecked( ); if( portRangesState && portRanges.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Port ranges not specified" )), i18n( "Port ranges error" )); + { KMessageBox::error( this, i18n( "Port ranges not specified" ), i18n( "Port ranges error" )); return false; } diff --git a/src/compoundwidget.cpp b/src/compoundwidget.cpp index 66ba7b7..3a1ebc4 100644 --- a/src/compoundwidget.cpp +++ b/src/compoundwidget.cpp @@ -269,42 +269,42 @@ bool CompoundWidget::getOptions( bool& needRoot ) TQString targetFileValue = m_targetFileLineEdit->text( ); if( dataDirState && dataDirValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Data directory name not specified" )), i18n( "Data directory name error" )); + { KMessageBox::error( this, i18n( "Data directory name not specified" ), i18n( "Data directory name error" )); return false; } if( decoyState && decoyValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Decoy host list not specified" )), i18n( "Decoy hosts error" )); + { KMessageBox::error( this, i18n( "Decoy host list not specified" ), i18n( "Decoy hosts error" )); return false; } if( excludeState && excludeValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Exclude hosts not specified" )), i18n( "Exclude hosts error" )); + { KMessageBox::error( this, i18n( "Exclude hosts not specified" ), i18n( "Exclude hosts error" )); return false; } if( excludeFileState && excludeFileValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Exclude hosts file name not specified" )), i18n( "Exclude hosts file name error" )); + { KMessageBox::error( this, i18n( "Exclude hosts file name not specified" ), i18n( "Exclude hosts file name error" )); return false; } if( interfaceState && interfaceValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Interface name not specified" )), i18n( "Interface name error" )); + { KMessageBox::error( this, i18n( "Interface name not specified" ), i18n( "Interface name error" )); return false; } if( sourceIPState && sourceIPValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Source IP address not specified" )), i18n( "Source IP address error" )); + { KMessageBox::error( this, i18n( "Source IP address not specified" ), i18n( "Source IP address error" )); return false; } if( spoofMacState && spoofMacValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Spoof MAC address not specified" )), i18n( "Spoof MAC address error" )); + { KMessageBox::error( this, i18n( "Spoof MAC address not specified" ), i18n( "Spoof MAC address error" )); return false; } if( targetFileState && targetFileValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Target hosts file name not specified" )), i18n( "Target hosts file name error" )); + { KMessageBox::error( this, i18n( "Target hosts file name not specified" ), i18n( "Target hosts file name error" )); return false; } diff --git a/src/htmlwidget.cpp b/src/htmlwidget.cpp index 670de85..586651a 100644 --- a/src/htmlwidget.cpp +++ b/src/htmlwidget.cpp @@ -194,7 +194,7 @@ void HTMLWidget::slotGunzipProcessExited( ) m_htmlData = TQString::null; m_process->start( TDEProcess::NotifyOnExit, TDEProcess::Communication( TDEProcess::Stdin | TDEProcess::Stdout )); - m_process->writeStdin( m_manPageData, m_manPageData.length( )); + m_process->writeStdin( m_manPageData.local8Bit(), m_manPageData.local8Bit().length( )); m_process->closeStdin( ); } diff --git a/src/loggingoptions.cpp b/src/loggingoptions.cpp index 6c36ccc..ef31b88 100644 --- a/src/loggingoptions.cpp +++ b/src/loggingoptions.cpp @@ -184,37 +184,37 @@ bool LoggingOptions::getOptions( ) TQString xmlLogValue = m_xmlLogLineEdit->text( ); if( baseFileNameState && baseFileNameValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Base file name not specified" )), i18n( "Base file name error" )); + { KMessageBox::error( this, i18n( "Base file name not specified" ), i18n( "Base file name error" )); return false; } if( grepableLogState && grepableLogValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "grep'able log file name not specified" )), i18n( "grep'able log file name error" )); + { KMessageBox::error( this, i18n( "grep'able log file name not specified" ), i18n( "grep'able log file name error" )); return false; } if( normalLogState && normalLogValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Normal log file name not specified" )), i18n( "Normal log file name error" )); + { KMessageBox::error( this, i18n( "Normal log file name not specified" ), i18n( "Normal log file name error" )); return false; } if( resumeState && scriptKiddieValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Resume file name not specified" )), i18n( "Resume file name error" )); + { KMessageBox::error( this, i18n( "Resume file name not specified" ), i18n( "Resume file name error" )); return false; } if( scriptKiddieState && scriptKiddieValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "Script kiddie log file name not specified" )), i18n( "Script kiddie log file name error" )); + { KMessageBox::error( this, i18n( "Script kiddie log file name not specified" ), i18n( "Script kiddie log file name error" )); return false; } if( stylesheetState && stylesheetValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "XSL stylesheet file name not specified" )), i18n( "XSL stylesheet file name error" )); + { KMessageBox::error( this, i18n( "XSL stylesheet file name not specified" ), i18n( "XSL stylesheet file name error" )); return false; } if( xmlLogState && xmlLogValue.isEmpty( )) - { KMessageBox::error( this, i18n( TQString( "XML log file name not specified" )), i18n( "XML log file name error" )); + { KMessageBox::error( this, i18n( "XML log file name not specified" ), i18n( "XML log file name error" )); return false; } diff --git a/src/main.cpp b/src/main.cpp index 57c4b41..9eec7aa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ int main( int argc, string argv[]) { TQString version = TQString( "Version 2.1, %1 %2" ).arg( __TIME__ ).arg( __DATE__ ); TDEAboutData about( "knmap", I18N_NOOP( "Knmap" ), - version, + version.utf8(), description, TDEAboutData::License_GPL, "(C) 2005, 2006 Kevin Gilbert", diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index a6edc9d..42b7465 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -435,7 +435,7 @@ void MainWidget::slotWrapText( ) void MainWidget::slotZoomCustom( ) { bool ok; int zoom = KInputDialog::getInteger( i18n( "Zoom percentage" ), - i18n( TQString( "Enter zoom %'age (%1% - %2%)").arg( ZOOM_MIN_FACTOR ).arg( ZOOM_MAX_FACTOR)), + i18n( "Enter zoom %'age (%1% - %2%)" ).arg( ZOOM_MIN_FACTOR ).arg( ZOOM_MAX_FACTOR), int( m_htmlWidget->zoomFactor( )), ZOOM_MIN_FACTOR, ZOOM_MAX_FACTOR, diff --git a/src/scanwidget.cpp b/src/scanwidget.cpp index a704c2a..80a7536 100644 --- a/src/scanwidget.cpp +++ b/src/scanwidget.cpp @@ -479,23 +479,23 @@ bool ScanWidget::createPipe( const TQString type, const TQString& tempDir, TQFil delete pipe; } - if( mkfifo( pipe->name( ), 0600 )) + if( mkfifo( pipe->name( ).local8Bit(), 0600 )) { TQString text = TQString( i18n( "Couldn't create the named pipe \"%1\" for nmap output: %2\n" )).arg( pipe->name( )).arg( strerror( errno )); - m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + m_outputWidget->addOutput( OutputWidget::Stderr, text.local8Bit(), text.local8Bit().length( )); delete pipe; pipe = NULL; return false; } - pipeFD = ::open( pipe->name( ), O_RDONLY | O_NONBLOCK ); + pipeFD = ::open( pipe->name( ).local8Bit(), O_RDONLY | O_NONBLOCK ); if( pipeFD != -1 ) return true; TQString text = TQString( i18n( "Couldn't open the named pipe \"%1\" for nmap output: %2\n" )).arg( pipe->name( )) .arg( strerror( errno )); - m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + m_outputWidget->addOutput( OutputWidget::Stderr, text.local8Bit(), text.local8Bit().length( )); delete pipe; pipe = NULL; @@ -514,7 +514,7 @@ bool ScanWidget::createPipes( ) if( tempDir.isEmpty( )) { TQString text = TQString( i18n( "Couldn't create the named pipe for nmap output: no temp file dir\n" )); - m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + m_outputWidget->addOutput( OutputWidget::Stderr, text.local8Bit(), text.local8Bit().length( )); return false; } @@ -593,7 +593,7 @@ bool ScanWidget::getOptions( ) return false; if( m_commonWidget->host( ).isEmpty( ) && !m_compoundWidget->targetFileState( )) - { KMessageBox::error( this, i18n( TQString( "Target host(s) not specified by \"Target host(s)\" or \"Target hosts file\" options" )), i18n( "Target host(s) error" )); + { KMessageBox::error( this, i18n( "Target host(s) not specified by \"Target host(s)\" or \"Target hosts file\" options" ), i18n( "Target host(s) error" )); return false; } @@ -983,7 +983,7 @@ void ScanWidget::slotStartClicked( ) cmd.stripWhiteSpace( ); m_clearOutputButton->setEnabled( true ); - m_outputWidget->addOutput( OutputWidget::Stdin, cmd, cmd.length( )); + m_outputWidget->addOutput( OutputWidget::Stdin, cmd.local8Bit(), cmd.local8Bit().length( )); emit( outputAvailable( true, true )); connect( m_nmapProcess, SIGNAL( processExited( TDEProcess* )), SLOT( slotProcessExited( ))); diff --git a/src/timingwidget.cpp b/src/timingwidget.cpp index 4cdb218..dcb8107 100644 --- a/src/timingwidget.cpp +++ b/src/timingwidget.cpp @@ -253,22 +253,22 @@ bool TimingWidget::getOptions( ) uint scanDelayValue = m_scanDelayLineEdit->text( ).toUInt( ); if( minHostGroupValue > maxHostGroupValue ) - { KMessageBox::error( this, i18n( TQString( "Min host group not < Max host group" )), i18n( "Host group error" )); + { KMessageBox::error( this, i18n( "Min host group not < Max host group" ), i18n( "Host group error" )); return false; } if( minParallelismValue > maxParallelismValue ) - { KMessageBox::error( this, i18n( TQString( "Min parallelism not < Max parallelism" )), i18n( "Parallelism error" )); + { KMessageBox::error( this, i18n( "Min parallelism not < Max parallelism" ), i18n( "Parallelism error" )); return false; } if( minRTTTimeoutValue > maxRTTTimeoutValue ) - { KMessageBox::error( this, i18n( TQString( "Min RTT timeout not < Max RTT timeout" )), i18n( "RTT timeout error" )); + { KMessageBox::error( this, i18n( "Min RTT timeout not < Max RTT timeout" ), i18n( "RTT timeout error" )); return false; } if( scanDelayValue > maxScanDelayValue ) - { KMessageBox::error( this, i18n( TQString( "Min scan delay not < Max scan delay" )), i18n( "Scan delay error" )); + { KMessageBox::error( this, i18n( "Min scan delay not < Max scan delay" ), i18n( "Scan delay error" )); return false; } -- cgit v1.2.3