summaryrefslogtreecommitdiff
authorerik <erik>2007-01-24 19:50:48 (UTC)
committer erik <erik>2007-01-24 19:50:48 (UTC)
commit035bbc5bf689839c8d8e7be37f347b0dd900fccf (patch) (side-by-side diff)
treecd668db7b1fedbf6fa2d54fb312a90e6f157e82a
parenta017bf21dd89159052f2f7a3fbc043a24956c08c (diff)
downloadopie-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.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/decompress.cpp7
-rw-r--r--noncore/games/solitaire/canvascard.cpp2
-rw-r--r--noncore/games/tetrix/ohighscoredlg.cpp7
3 files changed, 1 insertions, 15 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
@@ -1,54 +1,47 @@
#include <string.h>
#include "decompress.h"
#include <zlib.h>
#include <stdlib.h>
size_t UnZip(UInt8* compressedbuffer, size_t reclen, UInt8* tgtbuffer, size_t bsize)
{
z_stream zstream;
memset(&zstream,sizeof(zstream),0);
zstream.next_in = compressedbuffer;
zstream.next_out = tgtbuffer;
zstream.avail_out = bsize;
zstream.avail_in = reclen;
- int keylen = 0;
-
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
zstream.opaque = Z_NULL;
// printf("Initialising\n");
inflateInit(&zstream);
int err = 0;
do {
- if ( zstream.avail_in == 0 && 0 < keylen ) {
- zstream.next_in = compressedbuffer + keylen;
- zstream.avail_in = reclen - keylen;
- keylen = 0;
- }
zstream.next_out = tgtbuffer;
zstream.avail_out = bsize;
err = inflate( &zstream, Z_SYNC_FLUSH );
// //qDebug("err:%d - %u", err, zstream.avail_in);
} while ( err == Z_OK );
inflateEnd(&zstream);
return zstream.total_out;
}
#if defined(__STATIC) && defined(USENEF)
#include "Model.h"
size_t (*getdecompressor(char* _s))(UInt8*, size_t, UInt8*, size_t)
{
if (strcmp(_s, "PluckerDecompress3") == 0)
{
return PluckerDecompress3;
}
if (strcmp(_s, "PluckerDecompress4") == 0)
{
return PluckerDecompress4;
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
@@ -193,49 +193,49 @@ void CanvasCard::draw(QPainter &painter)
p->setPen( QColor( 0xFF, 0, 0 ) );
else
p->setPen( QColor( 0, 0, 0 ) );
if ( qt_screen->deviceWidth() < 200 ) {
p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 );
p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 );
p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 );
p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 );
} else {
p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 );
p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 );
p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 );
p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 );
}
} else {
p->drawPixmap( ix, iy, *cardsBacks );
}
- if (p != &painter)
+ if (p != &painter && unscaledCard)
{
p->end();
QPixmap *scaledCard = CreateScaledPixmap( unscaledCard, scaleX, scaleY );
int xoff = scaledCard->width() / 2;
int yoff = scaledCard->height() / 2;
painter.drawPixmap( (int)x() + xOff - xoff, (int)y() + yOff - yoff, *scaledCard );
delete p;
delete unscaledCard;
delete scaledCard;
}
}
static const double flipLift = 1.5;
void CanvasCard::flipTo(int x2, int y2, int steps)
{
flipSteps = steps;
#ifdef SLOW_HARDWARE
move(x2,y2);
Card::flipTo(x2,y2,steps);
#else
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
@@ -153,54 +153,47 @@ QString OHighscore::getName()
OHighscoreDialog::OHighscoreDialog(OHighscore *highscore, QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal)
{
hs_ = highscore;
setCaption( tr( "Highscores" ) );
vbox_layout = new QVBoxLayout( this, 4 , 4 );
list = new QListView( this );
list->setSorting( -1 );
list->addColumn( tr( "#" ));
list->addColumn( tr( "Name" ));
list->addColumn( tr( "Points" ));
list->addColumn( tr( "Level" ));
createHighscoreListView();
vbox_layout->addWidget( list );
QPEApplication::showDialog( this );
}
void OHighscoreDialog::createHighscoreListView()
{
int pos = 10;
int points_ = 0;
int level_ = 0;
- QListViewItem * Prev = 0;
for ( t_playerData * Run = hs_->playerData.first();
Run != 0;
Run=hs_->playerData.next() )
{
QListViewItem *item;
- if( Prev ) {
- // after previous
- item = new QListViewItem( list, Prev );
- Prev = item;
- } else {
item = new QListViewItem( list );
- }
item->setText( 0 , QString::number( pos ) ); //number
item->setText( 1 , Run->sName ); //name
if ( Run->points == -1 )
points_ = 0;
else points_ = Run->points;
if ( Run->level == -1 )
level_ = 0;
else level_ = Run->level;
item->setText( 2 , QString::number( points_ ) ); //points
item->setText( 3 , QString::number( level_ ) ); //level
pos--;
}
}