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/5/head
Slávek Banko 3 years ago
parent 5962b7e681
commit 355f00c2bd
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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" )

@ -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;

@ -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 );

@ -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" );

@ -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());

@ -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

@ -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;

@ -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);

@ -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" );

@ -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

@ -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));

Loading…
Cancel
Save