author | erik <erik> | 2007-01-24 19:50:48 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-24 19:50:48 (UTC) |
commit | 035bbc5bf689839c8d8e7be37f347b0dd900fccf (patch) (unidiff) | |
tree | cd668db7b1fedbf6fa2d54fb312a90e6f157e82a | |
parent | a017bf21dd89159052f2f7a3fbc043a24956c08c (diff) | |
download | opie-035bbc5bf689839c8d8e7be37f347b0dd900fccf.zip opie-035bbc5bf689839c8d8e7be37f347b0dd900fccf.tar.gz opie-035bbc5bf689839c8d8e7be37f347b0dd900fccf.tar.bz2 |
Eac one the files in this commit had an instance where a code path is
never traversed because of conditionals operating on values that
never change.
-rw-r--r-- | noncore/apps/opie-reader/decompress.cpp | 7 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascard.cpp | 2 | ||||
-rw-r--r-- | noncore/games/tetrix/ohighscoredlg.cpp | 9 |
3 files changed, 2 insertions, 16 deletions
diff --git a/noncore/apps/opie-reader/decompress.cpp b/noncore/apps/opie-reader/decompress.cpp index 9bfec49..6034e01 100644 --- a/noncore/apps/opie-reader/decompress.cpp +++ b/noncore/apps/opie-reader/decompress.cpp | |||
@@ -3,40 +3,33 @@ | |||
3 | #include <zlib.h> | 3 | #include <zlib.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | 5 | ||
6 | size_t UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) | 6 | size_t UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize) |
7 | { | 7 | { |
8 | z_stream zstream; | 8 | z_stream zstream; |
9 | memset(&zstream,sizeof(zstream),0); | 9 | memset(&zstream,sizeof(zstream),0); |
10 | zstream.next_in = compressedbuffer; | 10 | zstream.next_in = compressedbuffer; |
11 | zstream.next_out = tgtbuffer; | 11 | zstream.next_out = tgtbuffer; |
12 | zstream.avail_out = bsize; | 12 | zstream.avail_out = bsize; |
13 | zstream.avail_in = reclen; | 13 | zstream.avail_in = reclen; |
14 | 14 | ||
15 | int keylen = 0; | ||
16 | |||
17 | zstream.zalloc = Z_NULL; | 15 | zstream.zalloc = Z_NULL; |
18 | zstream.zfree = Z_NULL; | 16 | zstream.zfree = Z_NULL; |
19 | zstream.opaque = Z_NULL; | 17 | zstream.opaque = Z_NULL; |
20 | 18 | ||
21 | // printf("Initialising\n"); | 19 | // printf("Initialising\n"); |
22 | 20 | ||
23 | inflateInit(&zstream); | 21 | inflateInit(&zstream); |
24 | int err = 0; | 22 | int err = 0; |
25 | do { | 23 | do { |
26 | if ( zstream.avail_in == 0 && 0 < keylen ) { | ||
27 | zstream.next_in = compressedbuffer + keylen; | ||
28 | zstream.avail_in = reclen - keylen; | ||
29 | keylen = 0; | ||
30 | } | ||
31 | zstream.next_out = tgtbuffer; | 24 | zstream.next_out = tgtbuffer; |
32 | zstream.avail_out = bsize; | 25 | zstream.avail_out = bsize; |
33 | 26 | ||
34 | err = inflate( &zstream, Z_SYNC_FLUSH ); | 27 | err = inflate( &zstream, Z_SYNC_FLUSH ); |
35 | 28 | ||
36 | ////qDebug("err:%d - %u", err, zstream.avail_in); | 29 | ////qDebug("err:%d - %u", err, zstream.avail_in); |
37 | 30 | ||
38 | } while ( err == Z_OK ); | 31 | } while ( err == Z_OK ); |
39 | 32 | ||
40 | inflateEnd(&zstream); | 33 | inflateEnd(&zstream); |
41 | return zstream.total_out; | 34 | return zstream.total_out; |
42 | } | 35 | } |
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp index cd298ef..3ed9ea0 100644 --- a/noncore/games/solitaire/canvascard.cpp +++ b/noncore/games/solitaire/canvascard.cpp | |||
@@ -205,25 +205,25 @@ void CanvasCard::draw(QPainter &painter) | |||
205 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); | 205 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); |
206 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); | 206 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); |
207 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); | 207 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); |
208 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); | 208 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); |
209 | } | 209 | } |
210 | 210 | ||
211 | } else { | 211 | } else { |
212 | 212 | ||
213 | p->drawPixmap( ix, iy, *cardsBacks ); | 213 | p->drawPixmap( ix, iy, *cardsBacks ); |
214 | 214 | ||
215 | } | 215 | } |
216 | 216 | ||
217 | if (p != &painter) | 217 | if (p != &painter && unscaledCard) |
218 | { | 218 | { |
219 | p->end(); | 219 | p->end(); |
220 | QPixmap *scaledCard = CreateScaledPixmap( unscaledCard, scaleX, scaleY ); | 220 | QPixmap *scaledCard = CreateScaledPixmap( unscaledCard, scaleX, scaleY ); |
221 | int xoff = scaledCard->width() / 2; | 221 | int xoff = scaledCard->width() / 2; |
222 | int yoff = scaledCard->height() / 2; | 222 | int yoff = scaledCard->height() / 2; |
223 | painter.drawPixmap( (int)x() + xOff - xoff, (int)y() + yOff - yoff, *scaledCard ); | 223 | painter.drawPixmap( (int)x() + xOff - xoff, (int)y() + yOff - yoff, *scaledCard ); |
224 | delete p; | 224 | delete p; |
225 | delete unscaledCard; | 225 | delete unscaledCard; |
226 | delete scaledCard; | 226 | delete scaledCard; |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
diff --git a/noncore/games/tetrix/ohighscoredlg.cpp b/noncore/games/tetrix/ohighscoredlg.cpp index 66f4917..504385f 100644 --- a/noncore/games/tetrix/ohighscoredlg.cpp +++ b/noncore/games/tetrix/ohighscoredlg.cpp | |||
@@ -165,40 +165,33 @@ OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const | |||
165 | 165 | ||
166 | createHighscoreListView(); | 166 | createHighscoreListView(); |
167 | 167 | ||
168 | vbox_layout->addWidget( list ); | 168 | vbox_layout->addWidget( list ); |
169 | QPEApplication::showDialog( this ); | 169 | QPEApplication::showDialog( this ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void OHighscoreDialog::createHighscoreListView() | 172 | void OHighscoreDialog::createHighscoreListView() |
173 | { | 173 | { |
174 | int pos = 10; | 174 | int pos = 10; |
175 | int points_ = 0; | 175 | int points_ = 0; |
176 | int level_ = 0; | 176 | int level_ = 0; |
177 | QListViewItem * Prev = 0; | ||
178 | 177 | ||
179 | for ( t_playerData * Run = hs_->playerData.first(); | 178 | for ( t_playerData * Run = hs_->playerData.first(); |
180 | Run != 0; | 179 | Run != 0; |
181 | Run=hs_->playerData.next() ) | 180 | Run=hs_->playerData.next() ) |
182 | { | 181 | { |
183 | QListViewItem *item; | 182 | QListViewItem *item; |
184 | 183 | ||
185 | if( Prev ) { | 184 | item = new QListViewItem( list ); |
186 | // after previous | ||
187 | item = new QListViewItem( list, Prev ); | ||
188 | Prev = item; | ||
189 | } else { | ||
190 | item = new QListViewItem( list ); | ||
191 | 185 | ||
192 | } | ||
193 | item->setText( 0 , QString::number( pos ) ); //number | 186 | item->setText( 0 , QString::number( pos ) ); //number |
194 | item->setText( 1 , Run->sName ); //name | 187 | item->setText( 1 , Run->sName ); //name |
195 | if ( Run->points == -1 ) | 188 | if ( Run->points == -1 ) |
196 | points_ = 0; | 189 | points_ = 0; |
197 | else points_ = Run->points; | 190 | else points_ = Run->points; |
198 | if ( Run->level == -1 ) | 191 | if ( Run->level == -1 ) |
199 | level_ = 0; | 192 | level_ = 0; |
200 | else level_ = Run->level; | 193 | else level_ = Run->level; |
201 | item->setText( 2 , QString::number( points_ ) ); //points | 194 | item->setText( 2 , QString::number( points_ ) ); //points |
202 | item->setText( 3 , QString::number( level_ ) ); //level | 195 | item->setText( 3 , QString::number( level_ ) ); //level |
203 | pos--; | 196 | pos--; |
204 | } | 197 | } |