summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2005-02-18 00:06:17 (UTC)
committer zecke <zecke>2005-02-18 00:06:17 (UTC)
commit86b6f28a90bd18eea89366498a59c44685077ddc (patch) (side-by-side diff)
treed5a232617655b7a0453eff07f9fc0ab3e2c14f0b /libopie2
parent9bf35a9978c8a9e8b9c2100abf9137ffefc73e17 (diff)
downloadopie-86b6f28a90bd18eea89366498a59c44685077ddc.zip
opie-86b6f28a90bd18eea89366498a59c44685077ddc.tar.gz
opie-86b6f28a90bd18eea89366498a59c44685077ddc.tar.bz2
-Check if the string is safe (omitted Global::shellQuote as we construct
the string) -Use QFile::encodeName and avoid ascii constructors
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_jornada.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libopie2/opiecore/device/odevice_jornada.cpp b/libopie2/opiecore/device/odevice_jornada.cpp
index 5f95e42..7d080ba 100644
--- a/libopie2/opiecore/device/odevice_jornada.cpp
+++ b/libopie2/opiecore/device/odevice_jornada.cpp
@@ -147,37 +147,38 @@ int Jornada::displayBrightnessResolution() const
return 255;
}
bool Jornada::setDisplayBrightness( int bright )
{
bool res = false;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
QString cmdline;
if ( !bright )
- cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power");
+ cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power");
else
- cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright );
+ cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright );
- res = ( ::system( (const char*) cmdline ) == 0 );
+ // No Global::shellQuote as we gurantee it to be sane
+ res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
return res;
}
bool Jornada::setDisplayStatus ( bool on )
{
bool res = false;
- QString cmdline = QString( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
+ QString cmdline = QString::fromLatin1( "echo %1 > /sys/class/lcd/sa1100fb/power; echo %2 > /sys/class/backlight/sa1100fb/power").arg( on ? "0" : "4" ).arg( on ? "0" : "4" );
- res = ( ::system( (const char*) cmdline ) == 0 );
+ res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
return res;
}