summaryrefslogtreecommitdiff
authorzecke <zecke>2005-02-18 00:06:17 (UTC)
committer zecke <zecke>2005-02-18 00:06:17 (UTC)
commit86b6f28a90bd18eea89366498a59c44685077ddc (patch) (unidiff)
treed5a232617655b7a0453eff07f9fc0ab3e2c14f0b
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 (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
@@ -155,29 +155,30 @@ bool Jornada::setDisplayBrightness( int bright )
155 if ( bright > 255 ) 155 if ( bright > 255 )
156 bright = 255; 156 bright = 255;
157 if ( bright < 0 ) 157 if ( bright < 0 )
158 bright = 0; 158 bright = 0;
159 159
160 QString cmdline; 160 QString cmdline;
161 161
162 if ( !bright ) 162 if ( !bright )
163 cmdline = QString().sprintf( "echo 4 > /sys/class/backlight/sa1100fb/power"); 163 cmdline = QString::fromLatin1( "echo 4 > /sys/class/backlight/sa1100fb/power");
164 else 164 else
165 cmdline = QString().sprintf( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %d > /sys/class/backlight/sa1100fb/brightness", bright ); 165 cmdline = QString::fromLatin1( "echo 0 > /sys/class/backlight/sa1100fb/power; echo %1 > /sys/class/backlight/sa1100fb/brightness" ).arg( bright );
166 166
167 res = ( ::system( (const char*) cmdline ) == 0 ); 167 // No Global::shellQuote as we gurantee it to be sane
168 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
168 169
169 return res; 170 return res;
170} 171}
171 172
172 173
173bool Jornada::setDisplayStatus ( bool on ) 174bool Jornada::setDisplayStatus ( bool on )
174{ 175{
175 bool res = false; 176 bool res = false;
176 177
177 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" ); 178 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" );
178 179
179 res = ( ::system( (const char*) cmdline ) == 0 ); 180 res = ( ::system( QFile::encodeName(cmdline) ) == 0 );
180 181
181 return res; 182 return res;
182} 183}
183 184