summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-01-14 02:37:59 +0100
committerSlávek Banko <slavek.banko@axis.cz>2021-01-14 02:37:59 +0100
commit355f00c2bd6f4b2870133d0423420ef8046b7156 (patch)
tree914337ce5bd4bd2bc984866f02c370c2a2788c7e
parent5962b7e681adb58055898f2e35665934bd08e235 (diff)
downloadtork-355f00c2bd6f4b2870133d0423420ef8046b7156.tar.gz
tork-355f00c2bd6f4b2870133d0423420ef8046b7156.zip
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>
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/crypto.cpp6
-rw-r--r--src/hidsrvwizard.ui.h4
-rw-r--r--src/konqplugin/tork_plug_in.cpp2
-rw-r--r--src/likeback.cpp8
-rw-r--r--src/newfirstrunwizard.ui.h16
-rw-r--r--src/torclient.cpp6
-rw-r--r--src/tork.cpp18
-rw-r--r--src/torkapplet/tork_mnu.cpp2
-rw-r--r--src/torkview.cpp12
-rw-r--r--src/update.cpp4
11 files changed, 40 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e87a31a..3547cfe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,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 "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
diff --git a/src/crypto.cpp b/src/crypto.cpp
index 0e6836f..31e7084 100644
--- a/src/crypto.cpp
+++ b/src/crypto.cpp
@@ -133,7 +133,7 @@ TQString getFPDigestFromFP(const TQString &fp)
TQString FP = fp;
FP.replace("$","");
- base16_decode(digest, DIGEST_LEN, FP, strlen(FP));
+ base16_decode(digest, DIGEST_LEN, FP.latin1(), strlen(FP.latin1()));
digest_to_base64(identity64, digest);
return identity64;
}
@@ -163,7 +163,7 @@ TQString getFPFromNickName(const TQString &nickname)
if (fp.isEmpty())
return TQString();
- if (!digest_from_base64(buf, fp))
+ if (!digest_from_base64(buf, fp.latin1()))
base16_encode(hexdigest, HEX_DIGEST_LEN+1, buf, DIGEST_LEN);
return hexdigest;
@@ -174,7 +174,7 @@ TQString getFPFromFPDigest(const TQString &fp)
char buf[256];
char hexdigest[HEX_DIGEST_LEN+1];
- digest_from_base64(buf, fp);
+ digest_from_base64(buf, fp.latin1());
base16_encode(hexdigest, HEX_DIGEST_LEN+1, buf, DIGEST_LEN);
return hexdigest;
diff --git a/src/hidsrvwizard.ui.h b/src/hidsrvwizard.ui.h
index a9ab197..47d4ef0 100644
--- a/src/hidsrvwizard.ui.h
+++ b/src/hidsrvwizard.ui.h
@@ -58,8 +58,8 @@ void HidSrvWizard::localWeb_toggled( bool state)
if (state){
const char *paths = ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin";
thttpd = getFullLocation(paths,"thttpd");
-
- if (thttpd)
+
+ if (!thttpd.isEmpty())
setAppropriate ( LocalWebService, !state );
else
setAppropriate ( LocalWebService, state );
diff --git a/src/konqplugin/tork_plug_in.cpp b/src/konqplugin/tork_plug_in.cpp
index 98dd755..6010b7d 100644
--- a/src/konqplugin/tork_plug_in.cpp
+++ b/src/konqplugin/tork_plug_in.cpp
@@ -147,7 +147,7 @@ void Tork_plug_in::openWithBrowser(const TQString &browser)
if (p_dcopServer->isApplicationRegistered ("tork")){
TQString function = TQString("anonymized%1").arg(browser);
DCOPRef("tork", "DCOPTork").send("startEverything");
- DCOPRef("tork", "DCOPTork").send(TQCString(function),url);
+ DCOPRef("tork", "DCOPTork").send(function.utf8(), url);
}else
KRun::runCommand( TQString("tork --anonymous%1 %2").arg(browser).arg(url), "tork", "tork" );
diff --git a/src/likeback.cpp b/src/likeback.cpp
index f0d11d0..80cf232 100644
--- a/src/likeback.cpp
+++ b/src/likeback.cpp
@@ -136,9 +136,9 @@ void LikeBackBar::autoMove()
if (window != lastWindow && m_likeBack->windowNamesListing() != LikeBack::NoListing) {
if (tqstricmp(window->name(), "") == 0 || tqstricmp(window->name(), "unnamed") == 0) {
- std::cout << "===== LikeBack ===== UNNAMED ACTIVE WINDOW OF TYPE " << window->className() << " ======" << LikeBack::activeWindowPath() << std::endl;
+ std::cout << "===== LikeBack ===== UNNAMED ACTIVE WINDOW OF TYPE " << window->className() << " ======" << LikeBack::activeWindowPath().local8Bit() << std::endl;
} else if (m_likeBack->windowNamesListing() == LikeBack::AllWindows) {
- std::cout << "LikeBack: Active Window: " << LikeBack::activeWindowPath() << std::endl;
+ std::cout << "LikeBack: Active Window: " << LikeBack::activeWindowPath().local8Bit() << std::endl;
}
}
lastWindow = window;
@@ -817,8 +817,8 @@ void LikeBackDialog::send()
"email=" + KURL::encode_string(emailAddress);
TQHttp *http = new TQHttp(m_likeBack->hostName(), m_likeBack->hostPort());
- std::cout << "http://" << m_likeBack->hostName() << ":" << m_likeBack->hostPort() << m_likeBack->remotePath() << std::endl;
- std::cout << data << std::endl;
+ std::cout << "http://" << m_likeBack->hostName().local8Bit() << ":" << m_likeBack->hostPort() << m_likeBack->remotePath().local8Bit() << std::endl;
+ std::cout << data.local8Bit() << std::endl;
connect( http, SIGNAL(requestFinished(int, bool)), this, SLOT(requestFinished(int, bool)) );
TQHttpRequestHeader header("POST", m_likeBack->remotePath());
diff --git a/src/newfirstrunwizard.ui.h b/src/newfirstrunwizard.ui.h
index db6b08e..3b612b8 100644
--- a/src/newfirstrunwizard.ui.h
+++ b/src/newfirstrunwizard.ui.h
@@ -295,9 +295,9 @@ FirstRunWizard::accept()
paths = ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin";
paths.replace("::",":");
- torknetstat = getFullLocation(paths,"torknetstat");;
+ torknetstat = getFullLocation(paths.local8Bit(), "torknetstat");
- if (torknetstat)
+ if (!torknetstat.isEmpty())
TorkConfig::setNetstatLocation("torknetstat");
else
TorkConfig::setNetstatLocation("netstat");
@@ -332,12 +332,12 @@ FirstRunWizard::accept()
TorkConfig::setOriginalHttpProxy(OriginalHttpProxy);
TorkConfig::setOriginalHttpsProxy(OriginalHttpsProxy);
TorkConfig::setOriginalProxyType(OriginalProxyType);
- TorkConfig::setOriginalCookies(OriginalCookies);
- TorkConfig::setOriginalUseCache(OriginalUseCache);
- TorkConfig::setOriginalSendUserAgent(OriginalSendUserAgent);
- TorkConfig::setOriginalEnableJavascript(OriginalEnableJavascript);
- TorkConfig::setOriginalEnableJava(OriginalEnableJava);
- TorkConfig::setOriginalEnablePlugins(OriginalEnablePlugins);
+ TorkConfig::setOriginalCookies(OriginalCookies == "true");
+ TorkConfig::setOriginalUseCache(OriginalUseCache == "true");
+ TorkConfig::setOriginalSendUserAgent(OriginalSendUserAgent == "true");
+ TorkConfig::setOriginalEnableJavascript(OriginalEnableJavascript == "true");
+ TorkConfig::setOriginalEnableJava(OriginalEnableJava == "true");
+ TorkConfig::setOriginalEnablePlugins(OriginalEnablePlugins == "true");
//Anon Proxy Settings
diff --git a/src/torclient.cpp b/src/torclient.cpp
index 27c9477..c3efc5a 100644
--- a/src/torclient.cpp
+++ b/src/torclient.cpp
@@ -378,7 +378,7 @@ void TorClient::authenticate()
if (TorkConfig::generateRandomPassword()){
crypto_seed_rng();
sendToServer(TQString("setconf HashedControlPassword=16:%2")
- .arg(hashPassword(crypto_rand_string(16))));
+ .arg(hashPassword(crypto_rand_string(16).latin1())));
}
}
@@ -839,7 +839,7 @@ void TorClient::parseServer(const TQString &info)
if (gi){
int country_id = 0;
- country_id = GeoIP_id_by_name(gi, ip);
+ country_id = GeoIP_id_by_name(gi, ip.latin1());
cc = GeoIP_country_name[country_id];
GeoIP_delete(gi);
}else
@@ -1258,7 +1258,7 @@ bool TorClient::noSpecialProcessing(const TDEConfigSkeletonItem* it)
crypto_seed_rng();
sendToServer(TQString("setconf %1=16:%2")
.arg((*it).name())
- .arg(hashPassword(crypto_rand_string(16))));
+ .arg(hashPassword(crypto_rand_string(16).latin1())));
return false;
}
return true;
diff --git a/src/tork.cpp b/src/tork.cpp
index d53df07..a59aa7f 100644
--- a/src/tork.cpp
+++ b/src/tork.cpp
@@ -2493,7 +2493,7 @@ bool tork::noSpecialProcessing(const TDEConfigSkeletonItem* it, TQTextStream &ts
if ((*it).name() == "HashedControlPassword"){
if (!TorkConfig::hashedControlPassword().isEmpty()){
- TQString hash = hashPassword(TorkConfig::hashedControlPassword());
+ TQString hash = hashPassword(TorkConfig::hashedControlPassword().latin1());
if(!hash.isEmpty())
ts << "HashedControlPassword 16:" << hash << "\n" ;
}
@@ -3053,7 +3053,7 @@ void tork::receivedOutput(KProcIO *)
message_t *msg = &_tork_messages[i];
if (item2.contains(msg->logmessage)){
if ((*this.*(msg->pt2Member))()){
- strncpy(msg->torsaid,item2,249);
+ strncpy(msg->torsaid, item2.latin1(), 249);
showWarning(msg->state, msg->headline, item2, msg->body, msg->type,
msg->icon, msg->always, msg->showstopper);
}
@@ -3066,7 +3066,7 @@ void tork::receivedOutput(KProcIO *)
if (item2.contains(msg->logquestion)){
if ((*this.*(msg->pt2Member2))()){
(*this.*msg->silentAction)();
- strncpy(msg->torsaid,item2,249);
+ strncpy(msg->torsaid, item2.latin1(), 249);
askQuestion(msg->state, msg->headline, msg->torsaid, msg->body,
msg->question,msg->pt2Member, msg->type, msg->icon,
msg->persistent, msg->showstopper);
@@ -3091,7 +3091,7 @@ void tork::infoUpdated(const TQString &type, const TQString &summary, const TQSt
message_t *msg = &_tork_messages[i];
if (summary.contains(msg->logmessage)){
if ((*this.*(msg->pt2Member))()){
- strncpy(msg->torsaid,summary,249);
+ strncpy(msg->torsaid, summary.latin1(), 249);
showWarning(msg->state, msg->headline, summary, msg->body,
msg->type,msg->icon, msg->always, msg->showstopper);
}
@@ -3104,7 +3104,7 @@ void tork::infoUpdated(const TQString &type, const TQString &summary, const TQSt
if (summary.contains(msg->logquestion)){
if ((*this.*(msg->pt2Member2))()){
(*this.*msg->silentAction)();
- strncpy(msg->torsaid,summary,249);
+ strncpy(msg->torsaid, summary.latin1(), 249);
askQuestion(msg->state, msg->headline, msg->torsaid, msg->body,
msg->question,msg->pt2Member, msg->type,msg->icon,
msg->persistent, msg->showstopper);
@@ -3604,7 +3604,7 @@ void tork::showWarning( display_status_t &msg, const TQString &headline,const TQ
m_toolTipShowing = true;
m_msg = &msg;
- m_tooltip = new KDE::PopupMessage(statusBar(), m_statusInfo, 40000, type );
+ m_tooltip = new KDE::PopupMessage(statusBar(), m_statusInfo, 40000, type.utf8() );
TQString text = i18n( "<b>%1</b>").arg(headline);
text += TQString( "<br>" ) + i18n( "<b>Message: </b> %1" ).arg(torsaid);
text += TQString( "<br>" ) + i18n( "<b>This means: </b> %1" ).arg(thismeans);
@@ -3666,7 +3666,7 @@ void tork::askQuestion(display_status_t &msg, const TQString &headline,const TQS
m_persistent = persistent;
m_pt2Func = pt2Func;
- m_tooltip = new KDE::PopupMessage(statusBar(), m_statusInfo, 40000, type );
+ m_tooltip = new KDE::PopupMessage(statusBar(), m_statusInfo, 40000, type.utf8() );
TQString text = i18n( "<b>%1</b>").arg(headline);
text += TQString( "<br>" ) + i18n( "<b>Message: </b> %1" ).arg(torsaid);
text += TQString( "<br>" ) + i18n( "<b>Reason: </b> %1" ).arg(body);
@@ -4075,7 +4075,7 @@ void tork::processWarning(const TQString& type, const TQString& text)
message_t *msg = &_tork_messages[i];
if (TQString(msg->logmessage).contains(type)){
if ((*this.*(msg->pt2Member))()){
- strncpy(msg->torsaid,text,249);
+ strncpy(msg->torsaid, text.latin1(), 249);
showWarning(msg->state, msg->headline, msg->torsaid,
msg->body, msg->type, msg->icon, msg->always, msg->showstopper);
m_view->infoUpdated("TorK",msg->headline,msg->body);
@@ -4096,7 +4096,7 @@ void tork::processQuestion(const TQString& type, const TQString& text)
if ((*this.*(msg->pt2Member2))()){
if (TQString(msg->logquestion).contains(type)){
(*this.*msg->silentAction)();
- strncpy(msg->torsaid,tmptext,249);
+ strncpy(msg->torsaid, tmptext.latin1(), 249);
askQuestion(msg->state, msg->headline, msg->torsaid, msg->body,
msg->question,msg->pt2Member, msg->type, msg->icon,
msg->persistent, msg->showstopper);
diff --git a/src/torkapplet/tork_mnu.cpp b/src/torkapplet/tork_mnu.cpp
index 1c72496..df9c07c 100644
--- a/src/torkapplet/tork_mnu.cpp
+++ b/src/torkapplet/tork_mnu.cpp
@@ -165,7 +165,7 @@ void TorkMenu::anonymousApp(int id)
if (m_torkrunning){
DCOPRef("tork*", "DCOPTork").send("startEverything");
- DCOPRef("tork*", "DCOPTork").send(TQCString(app));
+ DCOPRef("tork*", "DCOPTork").send(app.utf8());
}else
KRun::runCommand( TQString("tork --%1").arg(app), "tork", "tork" );
diff --git a/src/torkview.cpp b/src/torkview.cpp
index e03fe92..ff76276 100644
--- a/src/torkview.cpp
+++ b/src/torkview.cpp
@@ -933,12 +933,12 @@ TQString torkView::parseStreamPort(const TQString &str_port)
TQString path = "/proc/" +*it+"/fd";
- if ((pdir = opendir((const char*)path)) == NULL)
+ if ((pdir = opendir(path.local8Bit())) == NULL)
continue;
while ((pde = readdir(pdir)) != NULL) {
- snprintf(fdpath, MAX_PROC_STR_LEN, "/proc/%s/fd/%s", (const char*)*it, pde->d_name);
+ snprintf(fdpath, MAX_PROC_STR_LEN, "/proc/%s/fd/%s", (*it).local8Bit().data(), pde->d_name);
fdpath[MAX_PROC_STR_LEN - 1] = '\0';
int len = readlink(fdpath, lbuf, MAX_PROC_STR_LEN);
@@ -1013,12 +1013,12 @@ void torkView::ORStatusUpdated(const TQString &ORID, const TQString &status)
if (tmpstatus.contains("closed") || tmpstatus.contains("failed")){
delete ORline;
- if (entryGuards[ORID])
+ if (!entryGuards[ORID].isEmpty())
entryGuards.remove(ORID);
return;
}
- if (entryGuards[ORID]){
+ if (!entryGuards[ORID].isEmpty()){
guardStatusUpdated(ORID, status);
return;
}
@@ -1333,10 +1333,10 @@ void torkView::serverStatusUpdated(const TQString &ip,const TQString &fp,
#endif
if (gi){
- country_id = GeoIP_id_by_name(gi, ip);
+ country_id = GeoIP_id_by_name(gi, ip.latin1());
cc = GeoIP_country_code[country_id];
GeoIP_delete(gi);
-
+
if (!m_countryList.contains(country_id))
m_countryList << country_id;
}else
diff --git a/src/update.cpp b/src/update.cpp
index 359b0c9..da9d628 100644
--- a/src/update.cpp
+++ b/src/update.cpp
@@ -242,10 +242,10 @@ void TorkUpdate::downloadComponent(TQString component, TQString version, TQStrin
if (torkdir.exists() && configurefile.exists()){
- chmod((const char *)configure,0700);
+ chmod(configure.local8Bit(), 0700);
int result = KMessageBox::warningContinueCancel(0, i18n( "%1-%2 is ready for compiling and installation. Would you like the wizard to ask you for the root password so it can compile and install it for you? (If not, you can compile it yourself later at %3/%4-%5)").arg(component).arg(version).arg(location).arg(component).arg(version),i18n( "Install %1-%2" ).arg(component).arg(version),i18n( "Use the Wizard" ));
-
+
switch (result) {
case 2 :
KMessageBox::information (0,i18n("Installation of %1 Cancelled.").arg(component));