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 /noncore/apps | |
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-- | 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 |
4 files changed, 6 insertions, 6 deletions
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 @@ -191,97 +191,97 @@ void ListEdit::fixTypes(int iColumn) cur=cur->nextSibling(); } // fix empty entries int i=0; for(QString *ptr=lst.first(); ptr; ptr=lst.next()) { *ptr=ptr->stripWhiteSpace(); if( ptr->isEmpty() ) { i++; if( i==1 ) *ptr=pDef->getNewValue(); else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i); } } // fix dups lst.sort(); QString repl; for(uint iCur=0; iCur<lst.count()-1; iCur++) { QString *current=lst.at(iCur); for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) { if( *current!=*lst.at(iNext) ) continue; for(int i=2; ; i++) { repl.sprintf("%s %d", (const char *)*current, i); bool bDup=false; uint iChk=iNext+1; while( iChk<lst.count() ) { QString *chk=lst.at(iChk); if( !chk->startsWith(*current) ) break; if( *chk==repl ) { bDup=true; break; } 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) { // delete old content lst.clear(); // add new one fixTypes(); QListViewItem *itm=_typeTable->firstChild(); while( itm ) { int i=0; QString sAdd; ColumnDef *pDef; for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { if( i>=1 ) sAdd+=";"; sAdd += itm->text(i); } lst.append( sAdd ); itm=itm->nextSibling(); } } // --- slotClicked ------------------------------------------------------------ void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) { (void)pnt; // get rid of unused warning; // save values _currentItem=itm; _currentColumn=col; if( itm==NULL ) { _typeEdit->setText(""); _stack->raiseWidget(_typeEdit); 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 @@ -1070,98 +1070,98 @@ QString TEScreen::getSelText(const BOOL preserve_line_breaks) { while ((eol > s) && isspace(image[eol - hist_BR].c)) { eol--; } } else { eol = sel_BR; } while (s <= eol) { m[d++] = image[s++ - hist_BR].c; } if (eol < sel_BR) { // eol processing see below ... if ((eol + 1) % columns == 0) { if (image[eol - hist_BR].c == ' ') { m[d++] = ' '; } } else { m[d++] = ((preserve_line_breaks || ((eol % columns) == 0)) ? '\n' : ' '); } } 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: 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. insert a \n unconditionally. Do it either you would because you are in preserve_line_break mode, or because it's an ASCII paragraph delimiter, so even when not preserving line_breaks, you want to preserve paragraph breaks. 3) else --> partially filled line insert a \n in preserve line break mode, else a space The space prevents concatenation of the last word of one line with the first of the next. */ void TEScreen::addHistLine() { assert(hasScroll() || histCursor == 0); // add to hist buffer // we have to take care about scrolling, too... if (hasScroll()) { ca dft; 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 @@ -293,97 +293,97 @@ char* ExcelBook::Read(int pos, int length) for(i=0; i<length; i++) { if(!feof(File)) data[i]=fgetc(File); }; Position= Position+length; return data; }; QString ExcelBook::ReadUnicodeChar(int pos, int length) { int i; QString data; int i1=' ',i2=' ',ii; SeekPosition(pos); for(i=0; i<length; i++) { if(!feof(File)) i1=fgetc(File); if(!feof(File)) i2=fgetc(File); ii=Integer2Byte(i1,i2); data.append(ii); Position+=2; }; return data; }; QString* ExcelBook::GetString(int num) { if(num>=0 && num<(int)SharedStrings.count()) { return SharedStrings[num]; }; return new QString(""); }; 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; rec->data=NULL; rec->code=Get2Bytes(); rec->length=Get2Bytes(); rec->position=Position; SeekSkip(rec->length); return rec; }; ExcelBREC* ExcelBook::PeekBREC(void) { int oldpos; ExcelBREC* NextRec; oldpos=Position; NextRec=GetBREC(); SeekPosition(oldpos); return NextRec; }; char* ExcelBook::GetDataOfBREC(ExcelBREC* record) { if(record->data==NULL) { ConvertCharToArray(record,Read(record->position,record->length),record->length); }; return record->data;//new? }; void ExcelBook::ConvertCharToArray(ExcelBREC* record, char* chars, int length) { record->data=new char[length]; for(int w1=0;w1<=length-1;w1++) record->data[w1]=chars[w1]; 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 @@ -2174,158 +2174,158 @@ void KateDocument::paintTextLine(QPainter &paint, int line, int y, int xStart, i paint.setFont(myFontBI); else if (a->bold) paint.setFont(myFontBold); else if (a->italic) paint.setFont(myFontItalic); else paint.setFont(myFont); } } z++; } if (z > zc) { QConstString str((QChar *) &s[zc], z - zc /*+1*/); paint.drawText(x - xStart, y, str.string()); } } // Applies the search context, and returns whether a match was found. If one is, // the length of the string matched is also returned. bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) { int line, col; int searchEnd; int bufLen, tlen; QChar *t; TextLine::Ptr textLine; int pos, newPos; if (searchFor.isEmpty()) return false; bufLen = 0; t = 0L; 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) { // Until the end of the line... while (col < tlen) { // ...find the next match. col = sc.search(text, col); if (col != -1) { // Is the match delimited correctly? if (((col == 0) || (!m_highlight->isInWord(t[col]))) && ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { goto found; } else { // Start again from the next character. col++; } } else { // No match. break; } } } else { // Non-whole-word search. col = sc.search(text, col); if (col != -1) goto found; } col = 0; 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; QString text(t, tlen); if (sc.flags & KateView::sfWholeWords) { // Until the beginning of the line... while (col >= 0) { // ...find the next match. col = sc.search(text, col); if (col != -1) { // Is the match delimited correctly? if (((col == 0) || (!m_highlight->isInWord(t[col]))) && ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { goto found; } else { // Start again from the previous character. col--; } } else { // No match. break; } } } else { // Non-whole-word search. col = sc.search(text, col); if (col != -1) goto found; } col = -1; line--; } |