summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-10-01 22:33:43 +0200
committerSlávek Banko <slavek.banko@axis.cz>2018-10-01 22:33:43 +0200
commit5adfcf05ce5ebffe7eeaf4f4526f520aeddec35a (patch)
tree4912d18d5f31cfe360016e05c841070d74262741
parent71f288193240340d0ac142f1f00900c2629a3f91 (diff)
downloadtdesudo-5adfcf05ce5ebffe7eeaf4f4526f520aeddec35a.tar.gz
tdesudo-5adfcf05ce5ebffe7eeaf4f4526f520aeddec35a.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--tdesudo/tdesudo.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da25406..09a95de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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" )
diff --git a/tdesudo/tdesudo.cpp b/tdesudo/tdesudo.cpp
index 957722d..c255d0f 100644
--- a/tdesudo/tdesudo.cpp
+++ b/tdesudo/tdesudo.cpp
@@ -134,7 +134,7 @@ TdeSudo::TdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
FILE *fout;
char iceauthority[200];
char *host, *auth;
- host = tqstrdup(dcopServer);
+ host = tqstrdup(dcopServer.ascii());
auth = tqstrdup(iceAuth);
int tempfile;
int oldumask = umask(077);
@@ -150,8 +150,8 @@ TdeSudo::TdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
}
iceauthorityFile = iceauthority;
//FIXME we should change owner of iceauthority file, but don't have permissions
- setenv("ICEAUTHORITY", iceauthorityFile, 1);
-
+ setenv("ICEAUTHORITY", iceauthorityFile.local8Bit(), 1);
+
fout = popen("iceauth >/dev/null 2>&1", "w");
if (!fout) {
kdError() << "error in tdesudo running iceauth" << endl;
@@ -191,8 +191,8 @@ TdeSudo::TdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
TQString c = "/usr/bin/xauth -q -f " + m_tmpname + " generate "
+ TQString::fromLocal8Bit(disp) + " . trusted timeout 60";
blockSigChild(); // pclose uses waitpid()
-
- if (!(f = popen(c, "r"))) {
+
+ if (!(f = popen(c.local8Bit(), "r"))) {
kdWarning() << k_lineinfo << "Cannot run: " << c << "\n";
unblockSigChild();
return;
@@ -251,7 +251,7 @@ TdeSudo::TdeSudo(TQWidget *parent, const char *name,const TQString& icon, const
else if (priority)
{
TQString n = args->getOption("p");
- int intn = atoi(n);
+ int intn = atoi(n.ascii());
intn = (intn * 40 / 100) - (20 + 0.5);
TQString strn;
@@ -334,7 +334,7 @@ void TdeSudo::receivedOut(TDEProcess*, char*buffer, int buflen)
pcTmp[buflen]='\0';
TQString strOut(pcTmp);
- std::cout << strOut << std::endl;
+ std::cout << strOut.local8Bit() << std::endl;
static int badpass = 0;