author | erik <erik> | 2007-01-26 20:22:50 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-26 20:22:50 (UTC) |
commit | 53d630c9c4813142ee13e6843c30476a5db26e78 (patch) (unidiff) | |
tree | 50a77a94cfeaccbb3d993bced8b7d0f498f74c7c /noncore/apps | |
parent | 152a8fe978851aea8dac6ae5cb11f73540746b83 (diff) | |
download | opie-53d630c9c4813142ee13e6843c30476a5db26e78.zip opie-53d630c9c4813142ee13e6843c30476a5db26e78.tar.gz opie-53d630c9c4813142ee13e6843c30476a5db26e78.tar.bz2 |
Each file in this commit exhibit an example of what prevent calls
'reverse inull'. All that means is that a pointer gets dereferenced. Then
a pointer gets checked for validity before being dereferenced again. This
almost always points to shenanigans.
For example, the konsole.cpp file has this konsoleInit() call which passes
in a const char** shell variable. Since it is a double pointer the programmer
who wrote the code made the mistake of mixing the checking of the pointer
and the pointer that points to the pointer. This commit attempts to correct
that.
Of course there are other instances of the same thing. But they all boil
down to a small mistake which might have produced strange side effects.
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 828f5a1..cf19ba8 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -475,49 +475,49 @@ void AdvancedFm::showFileMenu() { | |||
475 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); | 475 | n->insertItem(tr("Delete"),this,SLOT(doDelete())); |
476 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); | 476 | m->insertItem(tr("Add To Documents"),this,SLOT(addToDocs())); |
477 | 477 | ||
478 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); | 478 | m->insertItem(tr("Run Command"),this,SLOT(runCommand())); |
479 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); | 479 | m->insertItem(tr("File Info"),this,SLOT(fileStatus())); |
480 | 480 | ||
481 | m->insertSeparator(); | 481 | m->insertSeparator(); |
482 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); | 482 | m->insertItem(tr("Set Permissions"),this,SLOT(filePerms())); |
483 | 483 | ||
484 | #if defined(QT_QWS_OPIE) | 484 | #if defined(QT_QWS_OPIE) |
485 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); | 485 | m->insertItem(tr("Properties"),this,SLOT(doProperties())); |
486 | #endif | 486 | #endif |
487 | m->setCheckable(TRUE); | 487 | m->setCheckable(TRUE); |
488 | if (!b) | 488 | if (!b) |
489 | m->setItemChecked(m->idAt(0),TRUE); | 489 | m->setItemChecked(m->idAt(0),TRUE); |
490 | else | 490 | else |
491 | m->setItemChecked(m->idAt(0),FALSE); | 491 | m->setItemChecked(m->idAt(0),FALSE); |
492 | 492 | ||
493 | if(Ir::supported()) | 493 | if(Ir::supported()) |
494 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); | 494 | m->insertItem(tr("Beam File"),this,SLOT(doBeam())); |
495 | m->setFocus(); | 495 | m->setFocus(); |
496 | 496 | ||
497 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); | 497 | m->exec(QPoint(QCursor::pos().x(),QCursor::pos().y())); |
498 | 498 | ||
499 | if(m) delete m; | 499 | delete m; |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | QString AdvancedFm::checkDiskSpace(const QString &path) { | 503 | QString AdvancedFm::checkDiskSpace(const QString &path) { |
504 | struct statfs fss; | 504 | struct statfs fss; |
505 | if ( !statfs( path.latin1(), &fss ) ) { | 505 | if ( !statfs( path.latin1(), &fss ) ) { |
506 | int blkSize = fss.f_bsize; | 506 | int blkSize = fss.f_bsize; |
507 | // int totalBlks = fs.f_blocks; | 507 | // int totalBlks = fs.f_blocks; |
508 | int availBlks = fss.f_bavail; | 508 | int availBlks = fss.f_bavail; |
509 | 509 | ||
510 | long mult = blkSize / 1024; | 510 | long mult = blkSize / 1024; |
511 | long div = 1024 / blkSize; | 511 | long div = 1024 / blkSize; |
512 | if ( !mult ) mult = 1; | 512 | if ( !mult ) mult = 1; |
513 | if ( !div ) div = 1; | 513 | if ( !div ) div = 1; |
514 | 514 | ||
515 | 515 | ||
516 | return QString::number(availBlks * mult / div); | 516 | return QString::number(availBlks * mult / div); |
517 | } | 517 | } |
518 | return ""; | 518 | return ""; |
519 | } | 519 | } |
520 | 520 | ||
521 | void AdvancedFm::addToDocs() { | 521 | void AdvancedFm::addToDocs() { |
522 | QStringList strListPaths = getPath(); | 522 | QStringList strListPaths = getPath(); |
523 | QDir *thisDir = CurrentDir(); | 523 | QDir *thisDir = CurrentDir(); |