author | eilers <eilers> | 2005-03-19 17:13:47 (UTC) |
---|---|---|
committer | eilers <eilers> | 2005-03-19 17:13:47 (UTC) |
commit | 205bc8739f3f2c464b046bf8ea53f985a62c12a4 (patch) (side-by-side diff) | |
tree | 74d807160d4cbebbfef2bf26af975f11bed8da72 | |
parent | ea15abad0554edab0746f342fafddd461a0fb0eb (diff) | |
download | opie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.zip opie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.tar.gz opie-205bc8739f3f2c464b046bf8ea53f985a62c12a4.tar.bz2 |
Oops.. member variable m_read was not initialized.
This may cause crash as reported by #1608 (hopefully)
-rw-r--r-- | libopie2/opiepim/ChangeLog | 1 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opiepim/ChangeLog b/libopie2/opiepim/ChangeLog index a1b4db0..84517fb 100644 --- a/libopie2/opiepim/ChangeLog +++ b/libopie2/opiepim/ChangeLog @@ -1,33 +1,34 @@ 2005-03.19 Stefan Eilers <stefan@eilers-online.net> * Minor update for sorted(). Now ignoring any category search if "DoNotShowWithCategory" filter is activated. + * Fixing uninitialized member variable, caused crash of backend 2005-03-18 Stefan Eilers <stefan@eilers-online.net> * Rewrote generic sorted filter and added filter for "DoNotShowWithCategory", needed by addressbook (other filters need to be added!) 2005-01-16 Stefan Eilers <stefan@eilers-online.net> * Added new OPimEventSortVector class, improved OPimSortVector * OPimAccessBackend now supports generic sorting. 2005-01-03 Stefan Eilers <stefan@eilers-online.net> * Fixing bug in API documentation * Moving hasQuerySettings() and querySettings() to OPimAccessTemplate to be available for all frontends 2004-12-28 Stefan Eilers <stefan@eilers-online.net> * Make improved query by example accessable via frontend * Some API documentation improvement * Cleanup of backend api.. * Fixing bug #1501 2004-11-23 Stefan Eilers <stefan@eilers-online.net> * Implement fast and full featured version of sorted() for addressbook * Implement generic queryByExample for all Addressboook backends. It allows incremental search. * Update of API Documentation 2004-11-18 Holger Freyther <freyther@handhelds.org> * Every Access can give a set of Occurrences for a period or a datetime * QueryByExample, Find, Sort can be generically accessed by OPimBase pointer interface * OPimBackendOccurrence gets split up to OPimOccurrences by OPimTemplateBase * Add safeCast to various OPimRecords * Kill memleak in OPimTodo * Add SortVector implementations for OPimTodo and OPimContact 2004-??-?? The Opie Team <opie@handhelds.org> * Implemented some important modifications to allow to use OPimRecords as it is, without have to cast them. This makes it possible to write applications which handling pim data in a generic manner (see opimconvertion tool) (eilers)
\ No newline at end of file diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 6666fd6..71f81f4 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -49,192 +49,193 @@ class OPimAccessBackendPrivate; * For example we can use SQL queries instead of self made * query which is first more efficent and also uses less memory. */ template <class T = OPimRecord> class OPimAccessBackend { public: typedef OTemplateBase<T> Frontend; //@{ OPimAccessBackend(int access = 0); virtual ~OPimAccessBackend(); //@} //@{ virtual bool load() = 0; virtual bool reload() = 0; virtual bool save() = 0; virtual void clear() = 0; //@} //@{ // FIXME: Uncommented some of the abstract functions below. This should be removed as they are implemented in // all typespecifc backenends (eilers) /** * Return all possible settings for queryByExample() * @return All settings provided by the current backend * (i.e.: query_WildCards & query_IgnoreCase) * See implementation in the specific backends for contacts, todo and dates. */ virtual const uint querySettings() const = 0; /** * Check whether settings are correct for queryByExample() * See implementation in the specific backends for OPimContactAccess, OPimTodoAccess and ODateBookAccess. * @return <i>true</i> if the given settings are correct and possible. */ virtual bool hasQuerySettings (uint querySettings) const = 0; //@} //@{ virtual UIDArray allRecords()const = 0; virtual UIDArray matchRegexp(const QRegExp &r) const; virtual UIDArray queryByExample( const UIDArray&, const T& t, int settings, const QDateTime& d = QDateTime() )const = 0; virtual UIDArray queryByExample( const T& t, int settings, const QDateTime& d = QDateTime() )const; virtual UIDArray queryByExample( const OPimRecord* rec, int settings, const QDateTime& d = QDateTime() )const; virtual UIDArray sorted( const UIDArray&, bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const = 0; virtual UIDArray sorted( bool asc, int sortOrder, int sortFilter, const QArray<int>& cats )const; virtual OPimBackendOccurrence::List occurrences( const QDate& start, const QDate& end)const; virtual OPimBackendOccurrence::List occurrences( const QDateTime& dt )const; //@} //@{ virtual T find(UID uid )const = 0; virtual T find(UID uid, const QArray<UID>& items, uint current, typename Frontend::CacheDirection )const ; //@} //@{ virtual bool add( const T& t ) = 0; virtual bool remove( UID uid ) = 0; virtual bool replace( const T& t ) = 0; //@} void setFrontend( Frontend* front ); /** * set the read ahead count */ void setReadAhead( uint count ); protected: //@{ int access()const; void cache( const T& t )const; void setSaneCacheSize( int ); uint readAhead()const; //@} private: OPimAccessBackendPrivate *d; Frontend* m_front; uint m_read; int m_acc; }; template <class T> OPimAccessBackend<T>::OPimAccessBackend(int acc) : m_acc( acc ) { m_front = 0l; + m_read = 20; } template <class T> OPimAccessBackend<T>::~OPimAccessBackend() { } /* * Slow but default matchRegexp Implementation * Create a Big Enough QArray and then iterate * over all Records and matchRegexp them. * At the end we will resize the array to the actual * number of items */ template <class T> UIDArray OPimAccessBackend<T>::matchRegexp( const QRegExp& reg )const { UIDArray all_rec = allRecords(); UIDArray result( all_rec.count() ); uint used_records = 0, all_rec_count = all_rec.count(); for ( uint i = 0; i < all_rec_count; ++i ) if (find( all_rec[i], all_rec, i, Frontend::Forward ).match( reg ) ) result[used_records++] = all_rec[i]; /* shrink to fit */ result.resize( used_records ); return result; } template <class T> UIDArray OPimAccessBackend<T>::queryByExample( const T& rec, int settings, const QDateTime& datetime )const { return queryByExample( allRecords(), rec, settings, datetime ); } template <class T> UIDArray OPimAccessBackend<T>::queryByExample( const OPimRecord* rec, int settings, const QDateTime& datetime )const { T* tmp_rec = T::safeCast( rec ); UIDArray ar; if ( tmp_rec ) ar = queryByExample( *tmp_rec, settings, datetime ); return ar; } template <class T> UIDArray OPimAccessBackend<T>::sorted( bool asc, int order, int filter, const QArray<int>& cats )const { return sorted( allRecords(), asc, order, filter, cats ); } template<class T> OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDate&, const QDate& )const { return OPimBackendOccurrence::List(); } template<class T> OPimBackendOccurrence::List OPimAccessBackend<T>::occurrences( const QDateTime& dt )const { QDate date = dt.date(); return occurrences( date, date ); } template <class T> void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { m_front = fr; } template <class T> void OPimAccessBackend<T>::cache( const T& t )const { if ( m_front ) m_front->cache( t ); } template <class T> void OPimAccessBackend<T>::setSaneCacheSize( int size) { if ( m_front ) m_front->setSaneCacheSize( size ); } template <class T> T OPimAccessBackend<T>::find( int uid, const QArray<int>&, uint, typename Frontend::CacheDirection ) const{ qDebug( "*** Lookahead feature not supported. Fallback to default find!!" ); return find( uid ); } template <class T> void OPimAccessBackend<T>::setReadAhead( uint count ) { m_read = count; } template <class T> uint OPimAccessBackend<T>::readAhead()const { return m_read; } template <class T> int OPimAccessBackend<T>::access()const { return m_acc; |