[patch] audit of class method overrides and a buffer overrun
Erik Hovland <[email protected]>
| Newsgroups | gmane.comp.handhelds.opie.devel |
|---|---|
| Message-ID | <[email protected]> |
I was doing an audit of the opie head and noticed that some class overrides did not match their base class methods. I also noticed that there was a blatant buffer overrun. This patch should resolve all of those issues. Thanks E -- Erik Hovland mail: erik AT hovland DOT org web: http://hovland.org/ PGP/GPG public key available on request _______________________________________________ http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex Opie-devel mailing list [email protected] https://handhelds.org/mailman/listinfo/opie-devel
opie-stable-bad-override.patch
(text/plain, 8.8 KB)
? core/applets/aboutapplet/core.8170
? core/applets/aboutapplet/core.8205
? etc/opie-login.conf
? examples/opiecore/oinputsystemdemo/oinputsystemdemo
? examples/opiecore/onotifydemo/onotifydemo
? include/linux_pcmcia.h
? libopie2/opiecore/device/odevice_ipaq.cpp.fam-0.8.4-rc3
? libopie2/opiecore/device/odevice_ipaq.cpp.hx4700-keys
? noncore/applets/pcmcia/configdialogbase.cpp
? noncore/applets/pcmcia/configdialogbase.h
? noncore/applets/pcmcia/promptactiondialog.cpp
? noncore/applets/pcmcia/promptactiondialog.h
? noncore/comm/mobilemsg/.moc
? noncore/comm/mobilemsg/Makefile
? noncore/comm/mobilemsg/config.in
? noncore/comm/mobilemsg/mobilemsgbase.cpp
? noncore/comm/mobilemsg/mobilemsgbase.h
? noncore/net/opiestumbler/.moc
? noncore/net/opiestumbler/Makefile
? noncore/settings/tabmanager/.moc
? noncore/settings/tabmanager/Makefile
? noncore/settings/tabmanager/app.cpp
? noncore/settings/tabmanager/app.h
? noncore/settings/tabmanager/config.in
? noncore/settings/tabmanager/wait.cpp
? noncore/settings/tabmanager/wait.h
? plugins/reader/outcodecs
? plugins/reader/support
cvs diff: cannot find bin/NS2SetMac.sh
cvs diff: cannot find bin/smbfind
Index: core/pim/datebook/holiday/national/nationalcfg.cpp
===================================================================
RCS file: /cvs/opie/core/pim/datebook/holiday/national/nationalcfg.cpp,v
retrieving revision 1.3
diff -u -r1.3 nationalcfg.cpp
--- core/pim/datebook/holiday/national/nationalcfg.cpp 21 Mar 2005 14:31:01 -0000 1.3
+++ core/pim/datebook/holiday/national/nationalcfg.cpp 8 Aug 2006 18:35:43 -0000
@@ -276,7 +276,7 @@
return true;
}
-const QString&NHcfg::errorString()const
+QString NHcfg::errorString()
{
return err;
}
Index: core/pim/datebook/holiday/national/nationalcfg.h
===================================================================
RCS file: /cvs/opie/core/pim/datebook/holiday/national/nationalcfg.h,v
retrieving revision 1.2
diff -u -r1.2 nationalcfg.h
--- core/pim/datebook/holiday/national/nationalcfg.h 21 Mar 2005 14:31:01 -0000 1.2
+++ core/pim/datebook/holiday/national/nationalcfg.h 8 Aug 2006 18:35:43 -0000
@@ -57,7 +57,7 @@
virtual bool fatalError(const QXmlParseException& e);
virtual bool startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr);
virtual bool endElement(const QString&, const QString&,const QString& name);
- virtual const QString&errorString()const;
+ virtual QString errorString();
protected:
QString err,_contentname;
Index: inputmethods/handwriting/qimpenwidget.cpp
===================================================================
RCS file: /cvs/opie/inputmethods/handwriting/qimpenwidget.cpp,v
retrieving revision 1.2
diff -u -r1.2 qimpenwidget.cpp
--- inputmethods/handwriting/qimpenwidget.cpp 7 Jun 2002 18:53:15 -0000 1.2
+++ inputmethods/handwriting/qimpenwidget.cpp 8 Aug 2006 18:36:19 -0000
@@ -282,7 +282,7 @@
/*!
Hopefully returns a sensible size.
*/
-QSize QIMPenWidget::sizeHint()
+QSize QIMPenWidget::sizeHint() const
{
return QSize( TITLE_WIDTH * charSets.count(), 75 );
}
Index: inputmethods/handwriting/qimpenwidget.h
===================================================================
RCS file: /cvs/opie/inputmethods/handwriting/qimpenwidget.h,v
retrieving revision 1.2
diff -u -r1.2 qimpenwidget.h
--- inputmethods/handwriting/qimpenwidget.h 7 Jun 2002 18:53:15 -0000 1.2
+++ inputmethods/handwriting/qimpenwidget.h 8 Aug 2006 18:36:19 -0000
@@ -37,7 +37,7 @@
void changeCharSet( QIMPenCharSet *cs, int pos );
void clearCharSets();
void showCharacter( QIMPenChar *, int speed = 10 );
- virtual QSize sizeHint();
+ virtual QSize sizeHint() const;
public slots:
void removeStroke();
Index: libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
===================================================================
RCS file: /cvs/opie/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp,v
retrieving revision 1.17
diff -u -r1.17 odatebookaccessbackend_xml.cpp
--- libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp 18 Nov 2004 21:49:23 -0000 1.17
+++ libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp 8 Aug 2006 18:36:20 -0000
@@ -291,7 +291,7 @@
return ints;
}
-QArray<int> ODateBookAccessBackend_XML::queryByExample(const OPimEvent&, int, const QDateTime& ) {
+QArray<int> ODateBookAccessBackend_XML::queryByExample(const OPimEvent&, int, const QDateTime& ) const {
return QArray<int>();
}
void ODateBookAccessBackend_XML::clear() {
Index: libopie2/opiepim/backend/odatebookaccessbackend_xml.h
===================================================================
RCS file: /cvs/opie/libopie2/opiepim/backend/odatebookaccessbackend_xml.h,v
retrieving revision 1.8
diff -u -r1.8 odatebookaccessbackend_xml.h
--- libopie2/opiepim/backend/odatebookaccessbackend_xml.h 18 Nov 2004 21:49:23 -0000 1.8
+++ libopie2/opiepim/backend/odatebookaccessbackend_xml.h 8 Aug 2006 18:36:21 -0000
@@ -52,7 +52,7 @@
QArray<int> allRecords()const;
QArray<int> matchRegexp(const QRegExp &r) const;
- QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() );
+ QArray<int> queryByExample( const OPimEvent&, int, const QDateTime& d = QDateTime() ) const;
OPimEvent find( int uid )const;
void clear();
bool add( const OPimEvent& ev );
Index: library/lightstyle.cpp
===================================================================
RCS file: /cvs/opie/library/lightstyle.cpp,v
retrieving revision 1.4
diff -u -r1.4 lightstyle.cpp
--- library/lightstyle.cpp 14 Apr 2005 18:29:44 -0000 1.4
+++ library/lightstyle.cpp 8 Aug 2006 18:36:22 -0000
@@ -390,7 +390,7 @@
}
-void LightStyle::getButtonShift(int &x, int &y) const
+void LightStyle::getButtonShift(int &x, int &y)
{
x = y = 0;
}
@@ -425,7 +425,7 @@
}
-QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const
+QRect LightStyle::comboButtonRect( int x, int y, int w, int h )
{
QRect r(x + 3, y + 3, w - 6, h - 6);
int indent = ((y + h) / 2) - 3;
@@ -440,7 +440,7 @@
}
-QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const
+QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h )
{
return comboButtonRect(x, y, w, h);
}
@@ -801,7 +801,7 @@
void LightStyle::scrollBarMetrics(const QScrollBar *scrollbar,
int &sliderMin, int &sliderMax,
- int &sliderLength, int &buttonDim) const
+ int &sliderLength, int &buttonDim)
{
int maxLength;
int length = ((scrollbar->orientation() == Horizontal) ?
Index: library/lightstyle.h
===================================================================
RCS file: /cvs/opie/library/lightstyle.h,v
retrieving revision 1.3
diff -u -r1.3 lightstyle.h
--- library/lightstyle.h 21 Jan 2005 19:56:17 -0000 1.3
+++ library/lightstyle.h 8 Aug 2006 18:36:22 -0000
@@ -56,14 +56,14 @@
void drawBevelButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
const QBrush *fill = 0);
- void getButtonShift(int &x, int &y) const;
+ void getButtonShift(int &x, int &y);
void drawComboButton(QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken = FALSE,
bool editable = FALSE, bool = TRUE,
const QBrush *fill = 0);
- QRect comboButtonRect(int x, int y, int w, int h) const;
- QRect comboButtonFocusRect(int x, int y, int w, int h) const;
+ QRect comboButtonRect(int x, int y, int w, int h);
+ QRect comboButtonFocusRect(int x, int y, int w, int h);
void drawIndicator(QPainter *p, int x, int y ,int w, int h,
const QColorGroup &g, int state,
@@ -80,7 +80,7 @@
int = 1, const QBrush * = 0);
void scrollBarMetrics( const QScrollBar *,
- int &, int &, int &, int & ) const;
+ int &, int &, int &, int & );
void drawScrollBarControls(QPainter* p, const QScrollBar* sb,
int sliderStart, uint controls,
uint activeControl);
Index: noncore/games/wordgame/wordgame.cpp
===================================================================
RCS file: /cvs/opie/noncore/games/wordgame/wordgame.cpp,v
retrieving revision 1.9
diff -u -r1.9 wordgame.cpp
--- noncore/games/wordgame/wordgame.cpp 21 May 2005 20:11:55 -0000 1.9
+++ noncore/games/wordgame/wordgame.cpp 8 Aug 2006 18:36:29 -0000
@@ -588,7 +588,7 @@
QPoint d = across ? QPoint(1,0) : QPoint(0,1);
const Tile* tiles[99]; // ### max board size
uchar nletter[4095]; // QDawg only handles 0..4095
- memset(nletter,0,4096);
+ memset(nletter,0,4095);
for (int i=0; i<rack->count(); i++) {
const Tile* r = rack->tileRef(i);
if ( r->isBlank() )