author | erik <erik> | 2007-01-10 17:31:08 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-10 17:31:08 (UTC) |
commit | 6825f30b665952864dbe35fe8329a0e4c264d4b8 (patch) (side-by-side diff) | |
tree | 7c8d178f835d4a7d294b6ef65e0040c40579e84e | |
parent | d8e580a239ab84fbe063b2f3779d417598d5ca0a (diff) | |
download | opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.zip opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.gz opie-6825f30b665952864dbe35fe8329a0e4c264d4b8.tar.bz2 |
All of the files included have instances where an array is new'ed but
the corresponding delete does not have the corresponding [] argument.
-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEScreen.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/Excel.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katedocument.cpp | 4 | ||||
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 6 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/version.cpp | 2 |
9 files changed, 14 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index 8e69a88..1db34d2 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp @@ -1125,34 +1125,34 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) } } s = (eol / columns + 1) * columns; } } QChar* qc = new QChar[d]; for (int i = 0; i < d; i++) { qc[i] = m[i]; } QString res(qc, d); - delete m; - delete qc; + delete [] m; + delete [] qc; return res; } /* above ... end of line processing for selection -- psilva cases: 1) (eol+1)%columns == 0 --> the whole line is filled. If the last char is a space, insert (preserve) space. otherwise leave the text alone, so that words that are broken by linewrap are preserved. FIXME: * this suppresses \n for command output that is sized to the exact column width of the screen. 2) eol%columns == 0 --> blank line. diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index e40377b..b297d69 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp @@ -223,33 +223,33 @@ void ListEdit::fixTypes(int iColumn) iChk++; } if( !bDup ) { *lst.at(iNext)=repl; break; } } } } lst.sort(); // copy back clean up col map for(int i=0; i<_typeTable->childCount(); i++) { colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue()); delete colMap[i]; } - delete colMap; + delete [] colMap; } void ListEdit::fixTypes() { int i; ColumnDef *pDef; for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { if( pDef->hasFlag(ColumnDef::typeUnique) ) fixTypes(i); } _typeTable->sort(); } // --- storeInList ------------------------------------------------------------ void ListEdit::storeInList(QStringList &lst) diff --git a/noncore/apps/opie-console/TEScreen.cpp b/noncore/apps/opie-console/TEScreen.cpp index 2675d31..8e91532 100644 --- a/noncore/apps/opie-console/TEScreen.cpp +++ b/noncore/apps/opie-console/TEScreen.cpp @@ -1102,34 +1102,34 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) } } s = (eol / columns + 1) * columns; } } QChar* qc = new QChar[d]; for (int i = 0; i < d; i++) { qc[i] = m[i]; } QString res(qc, d); - delete m; - delete qc; + delete [] m; + delete [] qc; return res; } QString TEScreen::getHistory() { sel_begin = 0; sel_BR = sel_begin; sel_TL = sel_begin; setSelExtentXY(columns-1,lines-1); QString tmp=getSelText(true); while (tmp.at(tmp.length()-2).unicode()==10 && tmp.at(tmp.length()-1).unicode()==10) tmp.truncate(tmp.length()-1); return tmp; } /* above ... end of line processing for selection -- psilva cases: diff --git a/noncore/apps/opie-sheet/Excel.cpp b/noncore/apps/opie-sheet/Excel.cpp index 338bc30..51fe707 100644 --- a/noncore/apps/opie-sheet/Excel.cpp +++ b/noncore/apps/opie-sheet/Excel.cpp @@ -325,33 +325,33 @@ QString* ExcelBook::GetString(int num) }; int ExcelBook::SeekBOF(void) { int opcode,version,streamtype,length,ret=0; char *data; while(!feof(File)) { opcode=Get2Bytes(); if(opcode==XL_BOF) { length=Get2Bytes(); data=Read(Position,length); version=Integer2Byte(data[0], data[1]); streamtype=Integer2Byte(data[2], data[3]); printf("SEEKBOF:opcode=XLBOF, %d ,version %d\r\n",Position,version); - delete data; data=NULL; + delete [] data; data=NULL; if (version==BIFF8) ret=8; else if(version==BIFF7) ret=7; printf("SEEKBOF:versionBIFF%d\r\n",ret); if(streamtype==WBKGLOBAL) return ret *2; else if(streamtype==WRKSHEET) return ret *1; return 1; }; }; return 0; }; ExcelBREC* ExcelBook::GetBREC(void) { ExcelBREC* rec; rec= new ExcelBREC; if(FileEOF()) return NULL; diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 6dc4fd2..a70f3aa 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -2206,33 +2206,33 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { line = sc.cursor.y; col = sc.cursor.x; if (!(sc.flags & KateView::sfBackward)) { //forward search if (sc.flags & KateView::sfSelected) { if (line < selectStart) { line = selectStart; col = 0; } searchEnd = selectEnd; } else searchEnd = lastLine(); while (line <= searchEnd) { textLine = getTextLine(line); tlen = textLine->length(); if (tlen > bufLen) { - delete t; + delete [] t; bufLen = (tlen + 255) & (~255); t = new QChar[bufLen]; } memcpy(t, textLine->getText(), tlen*sizeof(QChar)); if (sc.flags & KateView::sfSelected) { pos = 0; do { pos = textLine->findSelected(pos); newPos = textLine->findUnselected(pos); memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); pos = newPos; } while (pos < tlen); } QString text(t, tlen); if (sc.flags & KateView::sfWholeWords) { @@ -2267,33 +2267,33 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { line++; } } else { // backward search if (sc.flags & KateView::sfSelected) { if (line > selectEnd) { line = selectEnd; col = -1; } searchEnd = selectStart; } else searchEnd = 0; while (line >= searchEnd) { textLine = getTextLine(line); tlen = textLine->length(); if (tlen > bufLen) { - delete t; + delete [] t; bufLen = (tlen + 255) & (~255); t = new QChar[bufLen]; } memcpy(t, textLine->getText(), tlen*sizeof(QChar)); if (sc.flags & KateView::sfSelected) { pos = 0; do { pos = textLine->findSelected(pos); newPos = textLine->findUnselected(pos); memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); pos = newPos; } while (pos < tlen); } if (col < 0 || col > tlen) col = tlen; diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 837fcc5..27ae101 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -212,33 +212,33 @@ void KRFBDecoder::gotDesktopName() assert( currentState == AwaitingDesktopName ); owarn << "Got desktop name" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotDesktopName() ) ); char *buf = new char[ info->nameLength + 1 ]; CHECK_PTR( buf ); con->read( buf, info->nameLength ); buf[ info->nameLength ] = '\0'; info->name = buf; owarn << "Desktop: " << info->name.latin1() << "" << oendl; - delete buf; + delete [] buf; // Get the format we'll really use and tell the server decidePixelFormat(); sendPixelFormat(); sendAllowedEncodings(); currentState = Idle; QString msg; msg = tr( "Connected to %1" ); msg = msg.arg( info->name ); emit status( msg ); sendUpdateRequest( false ); } void KRFBDecoder::decidePixelFormat() @@ -522,33 +522,33 @@ void KRFBDecoder::gotRawRectChunk() assert( currentState == AwaitingRawRectChunk ); disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotRawRectChunk() ) ); // owarn << "Got raw rect chunk" << oendl; // // Read the rect data and copy it to the buffer. // // TODO: Replace this! int count = lines * w * format->bpp / 8; char *hack = new char[ count ]; con->read( hack, count ); buf->drawRawRectChunk( hack, x, y, w, lines ); - delete hack; + delete [] hack; // /TODO: h = h - lines; y = y + lines; if ( h > 0 ) { handleRawRect(); } else { noRects--; // owarn << "There are " << noRects << " rects left" << oendl; if ( noRects ) { currentState = AwaitingRectHeader; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); @@ -715,33 +715,33 @@ void KRFBDecoder::gotServerCutText() // char *cutbuf = new char[ serverCutTextLen + 1 ]; CHECK_PTR( cutbuf ); con->read( cutbuf, serverCutTextLen ); cutbuf[ serverCutTextLen ] = '\0'; /* For some reason QApplication::clipboard()->setText() segfaults when called * from within keypebble's mass of signals and slots owarn << "Server cut: " << cutbuf << "" << oendl; QString cutText( cutbuf ); // DANGER!! qApp->clipboard()->setText( cutText ); */ - delete cutbuf; + delete [] cutbuf; // Now wait for the update (again) if ( oldState == AwaitingUpdate ) { currentState = AwaitingUpdate; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); con->waitForData( UpdateHeaderLength ); } else if ( oldState == Idle ) { currentState = Idle; } else { owarn << "Async handled in weird state" << oendl; currentState = oldState; }; } void KRFBDecoder::gotBell() diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index a6c92a0..516dc93 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp @@ -985,33 +985,33 @@ void SFCave :: loadReplay() // print it out QStringList::Iterator it = list.begin(); currentSeed = (*it).toInt(); ++it; currentGameType = (*it).toInt(); ++it; currentGameDifficulty = (*it).toInt(); ++it; replayList.clear(); for ( ; it != list.end(); ++it ) { int v = (*it).toInt(); replayList.append( new int( v ) ); } - delete data; + delete [] data; fclose( in ); printf( "Replay loaded from %s\n", QFile::encodeName(replayFile).data() ); } //--------------- MENU CODE --------------------- void SFCave :: handleMenuKeys( QKeyEvent *e ) { switch( e->key() ) { case Qt::Key_Down: currentMenuOption[currentMenuNr] ++; if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" ) currentMenuOption[currentMenuNr] = 0; diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 7ffa1d6..0886e69 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -334,33 +334,33 @@ void SettingsImpl :: changeServerDetails() changed = true; QString newName = servername->text(); // Convert any spaces to underscores char *tmpStr = new char[newName.length() + 1]; for ( unsigned int i = 0 ; i < newName.length() ; ++i ) { if ( newName[i] == ' ' ) tmpStr[i] = '_'; else tmpStr[i] = newName[i].latin1(); } tmpStr[newName.length()] = '\0'; newName = tmpStr; - delete tmpStr; + delete [] tmpStr; if ( !newserver ) { Server *s = dataMgr->getServer( servers->currentText() ); if ( s ) { // Update url s->setServerUrl( serverurl->text() ); s->setActive( active->isChecked() ); // Check if server name has changed, if it has then we need to replace the key in the map if ( serverName != newName ) { // Update server name s->setServerName( newName ); } diff --git a/noncore/settings/aqpkg/version.cpp b/noncore/settings/aqpkg/version.cpp index 59e6f3f..ce2de7b 100644 --- a/noncore/settings/aqpkg/version.cpp +++ b/noncore/settings/aqpkg/version.cpp @@ -25,33 +25,33 @@ #include <qobject.h> //# define _(Text) Text class versionrevision { public: versionrevision() { version = 0; } ~versionrevision() { if ( version ) - delete version; + delete [] version; } void setVersion( const char *str ) { version = new char[(strlen(str)+1)]; strcpy( version, str ); } unsigned long epoch; char *version; const char *revision; const char *familiar_revision; }; static int verrevcmp(const char *val, const char *ref) { |