summaryrefslogtreecommitdiff
path: root/noncore
authorerik <erik>2007-01-24 19:54:07 (UTC)
committer erik <erik>2007-01-24 19:54:07 (UTC)
commit89e81059e832ff77c2f0ac8b9db12f80eafa03fc (patch) (unidiff)
tree99a130fc643d2aeefdecab452f644e7b61a5f50e /noncore
parent035bbc5bf689839c8d8e7be37f347b0dd900fccf (diff)
downloadopie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.zip
opie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.tar.gz
opie-89e81059e832ff77c2f0ac8b9db12f80eafa03fc.tar.bz2
Each file in this commit has an instance where a pointer is checked at
one point in the code and then not checked in another point in the code. If it needed to be checked once, it needs to be checked the other time. If not the application could segfault.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp6
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp7
-rw-r--r--noncore/apps/opie-console/procctl.cpp5
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp123
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp2
-rw-r--r--noncore/todayplugins/stockticker/libstocks/http.c2
6 files changed, 77 insertions, 68 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 187adc6..c639002 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -238,2 +238,8 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
238 } 238 }
239
240 if ( !theCard ) {
241 owarn << "pcmcia: Finished working through cards in PCMCIA system but I do not have a valid card handle" << oendl;
242 return;
243 }
244
239 if ( newCard ) 245 if ( newCard )
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index d9e2047..8e2e2e3 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -245,2 +245,3 @@ void MainWindow::openBook(QListViewItem *curritem)
245{ 245{
246 if ( !curritem ) return;
246 // find book in List 247 // find book in List
@@ -279,6 +280,4 @@ void MainWindow::openBook(QListViewItem *curritem)
279 // Update name if changed 280 // Update name if changed
280 if( curritem ) { 281 curritem->setText( posName, newname );
281 curritem->setText( posName, newname ); 282 cbList->sort();
282 cbList->sort();
283 }
284 _cfg.setLastBook( newname ); 283 _cfg.setLastBook( newname );
diff --git a/noncore/apps/opie-console/procctl.cpp b/noncore/apps/opie-console/procctl.cpp
index a44529b..5239e26 100644
--- a/noncore/apps/opie-console/procctl.cpp
+++ b/noncore/apps/opie-console/procctl.cpp
@@ -51,3 +51,6 @@ void ProcCtl::remove( pid_t pi ) {
51 if ( pi == con->pid ) { 51 if ( pi == con->pid ) {
52 forw->prev = con->prev; 52 if (forw)
53 forw->prev = con->prev;
54 else
55 forw = con->prev;
53 delete con; 56 delete con;
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index b82a86a..692fd46 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -2017,3 +2017,3 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2017 QChar ch; 2017 QChar ch;
2018 Attribute *a = 0L; 2018 Attribute *attrptr = 0L;
2019 int attr, nextAttr; 2019 int attr, nextAttr;
@@ -2042,12 +2042,12 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2042 } else { 2042 } else {
2043 a = &m_attribs[textLine->getAttr(z)]; 2043 attrptr = &m_attribs[textLine->getAttr(z)];
2044 2044
2045 if (a->bold && a->italic) 2045 if (attrptr->bold && attrptr->italic)
2046 x += myFontMetricsBI.width(ch); 2046 x += myFontMetricsBI.width(ch);
2047 else if (a->bold) 2047 else if (attrptr->bold)
2048 x += myFontMetricsBold.width(ch); 2048 x += myFontMetricsBold.width(ch);
2049 else if (a->italic) 2049 else if (attrptr->italic)
2050 x += myFontMetricsItalic.width(ch); 2050 x += myFontMetricsItalic.width(ch);
2051 else 2051 else
2052 x += myFontMetrics.width(ch); 2052 x += myFontMetrics.width(ch);
2053 } 2053 }
@@ -2081,9 +2081,9 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2081 { 2081 {
2082 a = &m_attribs[textLine->getAttr(z)]; 2082 attrptr = &m_attribs[textLine->getAttr(z)];
2083 2083
2084 if (a->bold && a->italic) 2084 if (attrptr->bold && attrptr->italic)
2085 x += myFontMetricsBI.width(ch); 2085 x += myFontMetricsBI.width(ch);
2086 else if (a->bold) 2086 else if (attrptr->bold)
2087 x += myFontMetricsBold.width(ch); 2087 x += myFontMetricsBold.width(ch);
2088 else if (a->italic) 2088 else if (attrptr->italic)
2089 x += myFontMetricsItalic.width(ch); 2089 x += myFontMetricsItalic.width(ch);
@@ -2116,10 +2116,10 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2116 2116
2117 if (a->bold && a->italic) 2117 if (attrptr && attrptr->bold && attrptr->italic)
2118 x += myFontMetricsBI.width(s); 2118 x += myFontMetricsBI.width(s);
2119 else if (a->bold) 2119 else if (attrptr && attrptr->bold)
2120 x += myFontMetricsBold.width(s); 2120 x += myFontMetricsBold.width(s);
2121 else if (a->italic) 2121 else if (attrptr && attrptr->italic)
2122 x += myFontMetricsItalic.width(s); 2122 x += myFontMetricsItalic.width(s);
2123 else 2123 else
2124 x += myFontMetrics.width(s); 2124 x += myFontMetrics.width(s);
2125 } 2125 }
@@ -2131,19 +2131,17 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2131 attr = nextAttr; 2131 attr = nextAttr;
2132 a = &m_attribs[attr & taAttrMask]; 2132 attrptr = &m_attribs[attr & taAttrMask];
2133 2133
2134 if (attr & taSelected) paint.setPen(a->selCol); 2134 if (attr & taSelected) paint.setPen(attrptr->selCol);
2135 else paint.setPen(a->col); 2135 else paint.setPen(attrptr->col);
2136 2136
2137 if (a->bold && a->italic) 2137 if (attrptr->bold && attrptr->italic)
2138 paint.setFont(myFontBI); 2138 paint.setFont(myFontBI);
2139 else if (a->bold) 2139 else if (attrptr->bold)
2140 paint.setFont(myFontBold); 2140 paint.setFont(myFontBold);
2141 else if (a->italic) 2141 else if (attrptr->italic)
2142 paint.setFont(myFontItalic); 2142 paint.setFont(myFontItalic);
2143 else 2143 else
2144 paint.setFont(myFont); 2144 paint.setFont(myFont);
2145 } 2145 }
2146 2146
2147// paint.drawLine(x - xStart, y -2, x - xStart, y);
2148// paint.drawLine(x - xStart, y, x - xStart + 2, y);
2149 paint.drawPoint(x - xStart, y); 2147 paint.drawPoint(x - xStart, y);
@@ -2161,10 +2159,10 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2161 2159
2162 if (a->bold && a->italic) 2160 if (attrptr->bold && attrptr->italic)
2163 x += myFontMetricsBI.width(s); 2161 x += myFontMetricsBI.width(s);
2164 else if (a->bold) 2162 else if (attrptr->bold)
2165 x += myFontMetricsBold.width(s); 2163 x += myFontMetricsBold.width(s);
2166 else if (a->italic) 2164 else if (attrptr->italic)
2167 x += myFontMetricsItalic.width(s); 2165 x += myFontMetricsItalic.width(s);
2168 else 2166 else
2169 x += myFontMetrics.width(s); 2167 x += myFontMetrics.width(s);
2170 zc = z; 2168 zc = z;
@@ -2172,15 +2170,15 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i
2172 attr = nextAttr; 2170 attr = nextAttr;
2173 a = &m_attribs[attr & taAttrMask]; 2171 attrptr = &m_attribs[attr & taAttrMask];
2174 2172
2175 if (attr & taSelected) paint.setPen(a->selCol); 2173 if (attr & taSelected) paint.setPen(attrptr->selCol);
2176 else paint.setPen(a->col); 2174 else paint.setPen(attrptr->col);
2177 2175
2178 if (a->bold && a->italic) 2176 if (attrptr->bold && attrptr->italic)
2179 paint.setFont(myFontBI); 2177 paint.setFont(myFontBI);
2180 else if (a->bold) 2178 else if (attrptr->bold)
2181 paint.setFont(myFontBold); 2179 paint.setFont(myFontBold);
2182 else if (a->italic) 2180 else if (attrptr->italic)
2183 paint.setFont(myFontItalic); 2181 paint.setFont(myFontItalic);
2184 else 2182 else
2185 paint.setFont(myFont); 2183 paint.setFont(myFont);
2186 } 2184 }
@@ -2229,3 +2227,5 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
2229 t = new QChar[bufLen]; 2227 t = new QChar[bufLen];
2230 } 2228 } else if (!t)
2229 t = new QChar[bufLen];
2230
2231 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2231 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
@@ -2290,3 +2290,4 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
2290 t = new QChar[bufLen]; 2290 t = new QChar[bufLen];
2291 } 2291 } else if (!t)
2292 t = new QChar[bufLen];
2292 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2293 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 164d608..428cfd4 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -267,3 +267,3 @@ void UsbCategory::populate()
267 } 267 }
268 else if ( line.startsWith( "S: Product" ) ) 268 else if ( dev && line.startsWith( "S: Product" ) )
269 { 269 {
diff --git a/noncore/todayplugins/stockticker/libstocks/http.c b/noncore/todayplugins/stockticker/libstocks/http.c
index 2f38f8a..cc78ab7 100644
--- a/noncore/todayplugins/stockticker/libstocks/http.c
+++ b/noncore/todayplugins/stockticker/libstocks/http.c
@@ -212,3 +212,3 @@ libstocks_return_code http_get(char *http_file, char *http_server, char **pdata)
212 { 212 {
213 if (*temp==0) return ERRRHEA; 213 if (!temp || *temp==0) return ERRRHEA;
214 214