author | zecke <zecke> | 2005-02-18 00:06:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-18 00:06:17 (UTC) |
commit | 86b6f28a90bd18eea89366498a59c44685077ddc (patch) (side-by-side diff) | |
tree | d5a232617655b7a0453eff07f9fc0ab3e2c14f0b /libopie2/opiecore/device | |
parent | 9bf35a9978c8a9e8b9c2100abf9137ffefc73e17 (diff) | |
download | opie-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
-rw-r--r-- | libopie2/opiecore/device/odevice_jornada.cpp | 11 |
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 @@ -160,11 +160,12 @@ bool Jornada::setDisplayBrightness( int bright ) 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; } @@ -174,9 +175,9 @@ 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; } |