Added controlled conversions to char* instead of automatic ascii conversions.

The definition of -UTQT_NO_ASCII_CAST is no longer needed.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 6 years ago
parent 9bd6d8c432
commit e543ebc936
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -58,7 +58,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" )

@ -121,8 +121,9 @@ void CiscoCertificateEnrollment::setupPages()
for ( TQStringList::Iterator it = CiscoCaCerts.begin(); it != CiscoCaCerts.end(); ++it )
{
if ( GlobalConfig->KvpncDebugLevel > 2 )
std::cout << "insert item (cisco ca certs): " << TQString ( *it ) << std::endl;
if ( GlobalConfig->KvpncDebugLevel > 2 ) {
std::cout << "insert item (cisco ca certs): " << TQString ( *it ).local8Bit() << std::endl;
}
selectionpage->CAComboBox->insertItem ( *it );
}

@ -23,8 +23,8 @@
#include <tqstringlist.h>
#include <iostream>
DisplayCertDialog::DisplayCertDialog(TQWidget *parent, const char* caption, KVpncConfig *GlobalConfig)
: KDialogBase ( parent, i18n ( "Certificate data" ).ascii(), true, caption,
DisplayCertDialog::DisplayCertDialog(TQWidget *parent, const TQString& caption, KVpncConfig *GlobalConfig)
: KDialogBase ( parent, i18n ( "Certificate data" ).utf8(), true, caption,
KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
{
main = new DisplayCertDialogBase ( this );
@ -41,7 +41,7 @@ DisplayCertDialog::~DisplayCertDialog()
void DisplayCertDialog::parseCertData()
{
std::cout << "certdatalist" << CertDataList.join (" ") << std::endl;
std::cout << "certdatalist" << CertDataList.join (" ").local8Bit() << std::endl;
for ( TQStringList::Iterator it = CertDataList.begin(); it != CertDataList.end(); ++it ) {
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("[cert data]: "+*it,GlobalConfig->debug);

@ -33,7 +33,7 @@
class DisplayCertDialog : public KDialogBase
{
public:
DisplayCertDialog ( TQWidget *parent, const char* caption, KVpncConfig *GlobalConfig );
DisplayCertDialog ( TQWidget *parent, const TQString& caption, KVpncConfig *GlobalConfig );
~DisplayCertDialog();

@ -562,12 +562,12 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString LeftNextHop=line2.section ( "leftnexthop=",1,-1 );
std::cout << "left next hop (local) found: " << LeftNextHop << std::endl;
std::cout << "left next hop (local) found: " << LeftNextHop.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: left next hop (local) found: " +LeftNextHop ,GlobalConfig->debug);
profiledata->setLeftNextHop(LeftNextHop);
profiledata->setUseLeftNextHop(true);
std::cout << " => set it for profile " << IpsecConfigSection << " ." << std::endl;
std::cout << " => set it for profile " << IpsecConfigSection.local8Bit() << " ." << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: => set it for profile " + IpsecConfigSection + " ." ,GlobalConfig->debug);
}
@ -763,7 +763,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString leftsourceip=line2.section ( "leftsourceip=",1,-1 );
std::cout << "left (local) have to use IP address " << leftsourceip << std::endl;
std::cout << "left (local) have to use IP address " << leftsourceip.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: left (local) have to use IP address " + leftsourceip ,GlobalConfig->debug);
profiledata->setLocalVirtualIP(leftsourceip);
@ -775,7 +775,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString virtualprivate=line2.section ( "virtual_private=",1,-1 );
std::cout << "virtual private networks " << virtualprivate << std::endl;
std::cout << "virtual private networks " << virtualprivate.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: virtual private networks " +virtualprivate ,GlobalConfig->debug);
profiledata->setLocalVirtualIP(virtualprivate);
@ -788,7 +788,7 @@ void ImportIpsecProfileDialog::canAccept()
{
validLineFound=true;
TQString rightsourceip=line2.section ( "rightsourceip=",1,-1 );
std::cout << "right (remote) have to use IP address " << rightsourceip << std::endl;
std::cout << "right (remote) have to use IP address " << rightsourceip.local8Bit() << std::endl;
if (GlobalConfig->KvpncDebugLevel > 2)
GlobalConfig->appendLogEntry("import ipsec config: right (remote) have to use IP address " + rightsourceip ,GlobalConfig->debug);
profiledata->setRightSourceIp(rightsourceip);

@ -20000,7 +20000,7 @@ void KVpnc::setGuiStatus ( int status )
ConnectMsg = i18n("Connected: %2@%1, %3").arg(GlobalConfig->currentProfile->getGateway()).arg(Username).arg(durationString);
TQString TypeString2 = " [" + i18n("%1" , PrettyTypeString) + TQString("]");
TQString TypeString2 = " [" + PrettyTypeString + TQString("]");
LogMsg = i18n("Successful connected to server \"%1\"\nuser: \"%2\" at %3").arg(GlobalConfig->currentProfile->getGateway()).arg(Username).arg(TQString(TQDateTime::currentDateTime().toString(Qt::TextDate)) + TypeString2);
}
else if (GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::racoon || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::l2tpd_racoon || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::freeswan || GlobalConfig->currentProfile->getConnectionType() == VpnAccountData::l2tpd_freeswan)
@ -22881,7 +22881,7 @@ void KVpnc::doQuickConnect ( int id )
if ( itemtext != GlobalConfig->currentProfile->getName() )
{
if ( GlobalConfig->KvpncDebugLevel > 3 )
GlobalConfig->appendLogEntry ( i18n ( "Switching to %1" , TQString ( itemtext ) ), GlobalConfig->debug );
GlobalConfig->appendLogEntry ( i18n("Switching to %1").arg(itemtext), GlobalConfig->debug );
bool profileInList = false;
for ( uint i = 0; i < GlobalConfig->AccountList->count();i++ )
{

@ -2160,13 +2160,13 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().tagName() == "app")
{
if (KvpncDebugLevel > 5)
std::cout << " doc was created from kvpnc ver " << n1.toElement().text() << std::endl;
std::cout << " doc was created from kvpnc ver " << n1.toElement().text().local8Bit() << std::endl;
}
if (n1.toElement().tagName() == "exportversion")
{
kvpncexportversion = n1.toElement().text();
if (KvpncDebugLevel > 5)
std::cout << " doc was created from kvpnc with exportver " << n1.toElement().text() << std::endl;
std::cout << " doc was created from kvpnc with exportver " << n1.toElement().text().local8Bit() << std::endl;
}
}
}
@ -2182,7 +2182,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().tagName() != "")
{
if (KvpncDebugLevel > 5)
std::cout << " => option: " << ", value: " << n1.toElement().text() << std::endl;
std::cout << " => option: " << ", value: " << n1.toElement().text().local8Bit() << std::endl;
}
if ( n1.toElement().tagName() == "Minimize after connect" ) { minimizeAfterConnect = n1.toElement().text().toInt(); }
else if ( n1.toElement().tagName() == "Hide on startup" ) { hideMainWindow = n1.toElement().text().toInt(); }
@ -2287,7 +2287,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
if (n1.toElement().attribute("name") != "")
{
if (KvpncDebugLevel > 5)
std::cout << "profile: " << n1.toElement().attribute("name") << std::endl;
std::cout << "profile: " << n1.toElement().attribute("name").local8Bit() << std::endl;
TQString name = n1.toElement().attribute("name");
VpnAccountData *data = new VpnAccountData( VpnAccountData::cisco, name); // cisco is a dummy here, it will be set later
data->setDescription(i18n("import from ")+filename);
@ -2301,7 +2301,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
TQString elementname= n2.toElement().attribute("name");
TQString elementvalue = n2.toElement().text();
if (KvpncDebugLevel > 5)
std::cout << " => option: " << elementname << ", value: " << elementvalue << std::endl;
std::cout << " => option: " << elementname.local8Bit() << ", value: " << elementvalue.local8Bit() << std::endl;
// normal config
if (elementname == "Connection type")
{
@ -2664,7 +2664,7 @@ bool KVpncConfig::importKvpncConfig(TQString filename, TQString& RetName, bool&
TQDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) {
std::cout << e.tagName() << std::endl; // the node really is an element.
std::cout << e.tagName().local8Bit() << std::endl; // the node really is an element.
}
n = n.nextSibling();
}
@ -3226,12 +3226,12 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString LeftNextHop=line2.section ( "leftnexthop=",1,-1 );
std::cout << "left next hop (local) found: " << LeftNextHop << std::endl;
std::cout << "left next hop (local) found: " << LeftNextHop.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: left next hop (local) found: " +LeftNextHop ,debug);
profiledata->setLeftNextHop(LeftNextHop);
profiledata->setUseLeftNextHop(true);
std::cout << " => set it for profile " << IpsecConfigSection << " ." << std::endl;
std::cout << " => set it for profile " << IpsecConfigSection.local8Bit() << " ." << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: => set it for profile " + IpsecConfigSection + " ." ,debug);
}
@ -3428,7 +3428,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString leftsourceip=line2.section ( "leftsourceip=",1,-1 );
std::cout << "left (local) have to use IP address " << leftsourceip << std::endl;
std::cout << "left (local) have to use IP address " << leftsourceip.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: left (local) have to use IP address " + leftsourceip ,debug);
profiledata->setLocalVirtualIP(leftsourceip);
@ -3440,7 +3440,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString virtualprivate=line2.section ( "virtual_private=",1,-1 );
std::cout << "virtual private networks " << virtualprivate << std::endl;
std::cout << "virtual private networks " << virtualprivate.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: virtual private networks " +virtualprivate ,debug);
profiledata->setLocalVirtualIP(virtualprivate);
@ -3453,7 +3453,7 @@ bool KVpncConfig::importIpsecConfig(TQString filename, TQString& RetName, bool&
{
validLineFound=true;
TQString rightsourceip=line2.section ( "rightsourceip=",1,-1 );
std::cout << "right (remote) have to use IP address " << rightsourceip << std::endl;
std::cout << "right (remote) have to use IP address " << rightsourceip.local8Bit() << std::endl;
if (KvpncDebugLevel > 2)
appendLogEntry("import ipsec config: right (remote) have to use IP address " + rightsourceip ,debug);
profiledata->setRightSourceIp(rightsourceip);

@ -230,7 +230,7 @@ void ManageCiscoCert::showProcessFinished()
delete ShowProcess;
ShowProcess=0L;
std::cout << "certdatalist" << CertDataList.join (" ") << std::endl;
std::cout << "certdatalist" << CertDataList.join (" ").local8Bit() << std::endl;
DisplayCertDialog dlg(0,i18n("Certificate data"),GlobalConfig);
dlg.main->CertNameTextLabel->setText(CertDataName);
dlg.main->CertTypeTextLabel->setText(CertType);
@ -272,14 +272,14 @@ void ManageCiscoCert::checkList()
for ( TQStringList::Iterator it = CiscoCerts.begin(); it != CiscoCerts.end(); ++it )
{
if (GlobalConfig->KvpncDebugLevel > 2)
std::cout << "insert item (cisco certs): " << TQString(*it) << std::endl;
std::cout << "insert item (cisco certs): " << TQString(*it).local8Bit() << std::endl;
main->CertListView->insertItem( new TQListViewItem(main->CertListView, TQString().setNum(current_user_idx),TQString(*it),i18n("User")));
current_user_idx++;
}
for ( TQStringList::Iterator it = CiscoCaCerts.begin(); it != CiscoCaCerts.end(); ++it )
{
if (GlobalConfig->KvpncDebugLevel > 2)
std::cout << "insert item (cisco certs): " << TQString(*it) << std::endl;
std::cout << "insert item (cisco certs): " << TQString(*it).local8Bit() << std::endl;
main->CertListView->insertItem( new TQListViewItem(main->CertListView, TQString().setNum(current_ca_idx),TQString(*it),i18n("CA")));
current_ca_idx++;
}

@ -379,7 +379,7 @@ TQString NetworkInterface::getGatewayOfDefaultInterface()
while ( !stream.atEnd() )
{
line = stream.readLine(); // line of text excluding '\n' and replace all white chars with one blank
std::cout << "line: \"" << line << "\"" << "\n";
std::cout << "line: \"" << line.local8Bit() << "\"" << "\n";
if (line.simplifyWhiteSpace().section( ' ', 1, 1 ) == "00000000" )
{
struct sockaddr_in name;
@ -436,7 +436,7 @@ bool NetworkInterface::inSameNetwork(TQString ip1,TQString Netmask1,TQString ip2
}
else
{
std::cout << "ip1: " << ip1.section( '.', 0, 2 ) << " , ip2: " << ip2.section( '.', 0, 2 ) << std::endl;
std::cout << "ip1: " << ip1.section( '.', 0, 2 ).local8Bit() << " , ip2: " << ip2.section( '.', 0, 2 ).local8Bit() << std::endl;
if (ip1.section( '.', 0, 2 ) == ip2.section( '.', 0, 2 ))
{
if (Netmask1 == Netmask2)

@ -3205,7 +3205,7 @@ void PreferencesDialog::profileChanged( const TQString& itemtext )
for ( TQStringList::Iterator ikeit = IkeList.begin(); ikeit != IkeList.end(); ++ikeit )
{
std::cout << "ike: " << *ikeit << ":" << std::endl;
std::cout << "ike: " << (*ikeit).local8Bit() << ":" << std::endl;
if (*ikeit == "aes256-sha1")
ProfileIpsecOptionsWidget->IkeAes256Sha1CheckBox->setChecked(true);
@ -3229,7 +3229,7 @@ void PreferencesDialog::profileChanged( const TQString& itemtext )
for ( TQStringList::Iterator espit = EspList.begin(); espit != EspList.end(); ++espit )
{
std::cout << "esp: " << *espit << ":" << std::endl;
std::cout << "esp: " << (*espit).local8Bit() << ":" << std::endl;
if (*espit == "3des-md5")
ProfileIpsecOptionsWidget->Esp3desMd5CheckBox->setChecked(true);
@ -4923,10 +4923,10 @@ void PreferencesDialog::saveSessionClicked()
profile->setIpsecIke(IkeList.join(","));
for ( TQStringList::Iterator ikeit = IkeList.begin(); ikeit != IkeList.end(); ++ikeit )
std::cout << "ike: " << *ikeit << ":" << std::endl;
std::cout << "ike: " << (*ikeit).local8Bit() << ":" << std::endl;
for ( TQStringList::Iterator espit = EspList.begin(); espit != EspList.end(); ++espit )
std::cout << "esp: " << *espit << ":" << std::endl;
std::cout << "esp: " << (*espit).local8Bit() << ":" << std::endl;
if(ProfileIpsecOptionsWidget->UseCustomEspCheckBox->isChecked() && !EspList.isEmpty())
profile->setUseCustomEsp(true);

@ -344,7 +344,7 @@ ToolsInfoDialog::ToolsInfoDialog(KVpncConfig *GlobalConfig, TQWidget *parent, co
if ( major < 4 )
//else
usability=i18n("unuseable");
comment=+i18n("no vpn support");
comment+=i18n("no vpn support");
}
}

@ -1471,7 +1471,7 @@ void Utils::readStdOutRetriveIpsecAlgos()
TQString Algo = msg.stripWhiteSpace().section(":",1,1).section(",",1,1).section("=",1,1);
TQString MinKeySize = msg.stripWhiteSpace().section(":",1,1).section(",",3,3).section("=",1,1);
TQString MaxKeySize = msg.stripWhiteSpace().section(":",1,1).section(",",4,4).section("=",1,1);
std::cout << "IKE encryption algo found: \"" << Algo << "\", Min: " << MinKeySize << ", Max: " << MaxKeySize << std::endl;
std::cout << "IKE encryption algo found: \"" << Algo.local8Bit() << "\", Min: " << MinKeySize.local8Bit() << ", Max: " << MaxKeySize.local8Bit() << std::endl;
// TQStringList AlgoOptList = TQStringList::split("-",AlgoOpt);
// for (TQStringList::Iterator it = AlgoOptList.begin(); it != AlgoOptList.end(); ++it)
// {
@ -1896,12 +1896,12 @@ int Utils::dottedIpv4Netmask2NetmaskBytes(TQString dottedIpv4Netmask)
TQString block2 = dec2bin(part2);
TQString block3 = dec2bin(part3);
std::cout << "block0: " << block0 << std::endl;
std::cout << "block1: " << block1 << std::endl;
std::cout << "block2: " << block2 << std::endl;
std::cout << "block3: " << block3 << std::endl;
std::cout << "block0: " << block0.local8Bit() << std::endl;
std::cout << "block1: " << block1.local8Bit() << std::endl;
std::cout << "block2: " << block2.local8Bit() << std::endl;
std::cout << "block3: " << block3.local8Bit() << std::endl;
block = block0 + block1 +block2 + block3;
std::cout << "block: " << block.ascii() << std::endl;
std::cout << "block: " << block.local8Bit() << std::endl;
for (int i=0; i< 31;i++)
{

Loading…
Cancel
Save