summaryrefslogtreecommitdiff
path: root/libopie2
authorerik <erik>2007-01-29 21:53:48 (UTC)
committer erik <erik>2007-01-29 21:53:48 (UTC)
commit02ef45be75a3024df11365956e1cce6392d9103c (patch) (unidiff)
tree42fd5c909d67a473f57a607e01d32e01b3dd2511 /libopie2
parentb2c306a99b8dc82c981390f02db859149fac8cf0 (diff)
downloadopie-02ef45be75a3024df11365956e1cce6392d9103c.zip
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.gz
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.bz2
Each file in this commit has an issue where the initial value of a variable
is assumed to be something but no initial value is given. This commit changes that by either assigning an initial value or removing the assumption on an initial value (usually the former).
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/device/odevice_htc.cpp3
-rw-r--r--libopie2/opiepim/private/opimeventsortvector.cpp9
2 files changed, 4 insertions, 8 deletions
diff --git a/libopie2/opiecore/device/odevice_htc.cpp b/libopie2/opiecore/device/odevice_htc.cpp
index c21e10d..4e5200b 100644
--- a/libopie2/opiecore/device/odevice_htc.cpp
+++ b/libopie2/opiecore/device/odevice_htc.cpp
@@ -417,22 +417,21 @@ bool HTC::setDisplayStatus( bool on )
417 return res; 417 return res;
418} 418}
419 419
420Transformation HTC::rotation() const 420Transformation HTC::rotation() const
421{ 421{
422 qDebug( "HTC::rotation()" ); 422 qDebug( "HTC::rotation()" );
423 Transformation rot; 423 Transformation rot = Rot270;
424 424
425 switch ( d->m_model ) { 425 switch ( d->m_model ) {
426 case Model_HTC_Universal: 426 case Model_HTC_Universal:
427 { 427 {
428 OHingeStatus hs = readHingeSensor(); 428 OHingeStatus hs = readHingeSensor();
429 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs ); 429 qDebug( "HTC::rotation() - hinge sensor = %d", (int) hs );
430 if ( hs == CASE_PORTRAIT ) rot = Rot0; 430 if ( hs == CASE_PORTRAIT ) rot = Rot0;
431 else if ( hs == CASE_UNKNOWN ) rot = Rot270; 431 else if ( hs == CASE_UNKNOWN ) rot = Rot270;
432 else rot = Rot270;
433 } 432 }
434 break; 433 break;
435 } 434 }
436 435
437 qDebug( "HTC::rotation() - returning '%d'", rot ); 436 qDebug( "HTC::rotation() - returning '%d'", rot );
438 return rot; 437 return rot;
diff --git a/libopie2/opiepim/private/opimeventsortvector.cpp b/libopie2/opiepim/private/opimeventsortvector.cpp
index 4220c63..b85f848 100644
--- a/libopie2/opiepim/private/opimeventsortvector.cpp
+++ b/libopie2/opiepim/private/opimeventsortvector.cpp
@@ -34,15 +34,13 @@
34 34
35#include <qvaluelist.h> 35#include <qvaluelist.h>
36 36
37namespace Opie { 37namespace Opie {
38namespace Internal { 38namespace Internal {
39 39
40namespace{ 40int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){
41
42inline int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPimNotifyManager& rightnotifiers ){
43 OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms(); 41 OPimNotifyManager::Alarms left_alarms = leftnotifiers.alarms();
44 OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms(); 42 OPimNotifyManager::Alarms right_alarms = rightnotifiers.alarms();
45 43
46 // Well.. How could we compare two lists of alarms? I think we should find the most early datetimes 44 // Well.. How could we compare two lists of alarms? I think we should find the most early datetimes
47 // and compare them.. (se) 45 // and compare them.. (se)
48 // Find the first alarm of the left list 46 // Find the first alarm of the left list
@@ -57,26 +55,25 @@ inline int testAlarmNotifiers( const OPimNotifyManager& leftnotifiers, const OPi
57 for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){ 55 for ( it = right_alarms.begin(); it != right_alarms.end(); ++it ){
58 if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){ 56 if ( !right_earliest.isValid() || right_earliest > (*it).dateTime() ){
59 right_earliest = (*it).dateTime(); 57 right_earliest = (*it).dateTime();
60 } 58 }
61 } 59 }
62 60
63 int ret; 61 int ret = 0;
64 62
65 // Now compare this found alarms 63 // Now compare this found alarms
66 if ( !left_earliest .isValid() ) ret++; 64 if ( !left_earliest .isValid() ) ret++;
67 if ( !right_earliest.isValid() ) ret--; 65 if ( !right_earliest.isValid() ) ret--;
68 66
69 if ( left_earliest.isValid() && right_earliest.isValid() ){ 67 if ( left_earliest.isValid() && right_earliest.isValid() ){
70 ret += left_earliest < right_earliest ? -1 : 1; 68 left_earliest < right_earliest ? ret-- : ret++;
71 } 69 }
72 70
73 return ret; 71 return ret;
74 72
75} 73}
76}
77 74
78OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort ) 75OPimEventSortVector::OPimEventSortVector( uint size, bool asc, int sort )
79 : OPimSortVector<OPimEvent>( size, asc, sort ) {} 76 : OPimSortVector<OPimEvent>( size, asc, sort ) {}
80 77
81int OPimEventSortVector::compareItems( const OPimEvent& left, 78int OPimEventSortVector::compareItems( const OPimEvent& left,
82 const OPimEvent& right ) { 79 const OPimEvent& right ) {