From ff1cc2223d68cf92119877ba525602a40ed0d7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 20 Feb 2001 18:32:18 +0000 Subject: [PATCH] mathed35.diff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1580 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/array.C | 4 ++-- src/mathed/array.h | 2 +- src/mathed/math_cursor.C | 4 ++-- src/mathed/math_xiter.C | 21 +++++---------------- src/mathed/math_xiter.h | 2 +- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/mathed/array.C b/src/mathed/array.C index 8056819563..eba96ab495 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -219,9 +219,9 @@ void MathedArray::insert(MathedArray::iterator pos, last_ = bf_.size() - 1; } #else -void MathedArray::mergeF(MathedArray * a, int p, int dx) +void MathedArray::merge(MathedArray const & a, int p) { - my_memcpy(&bf_[p], &a->bf_[0], dx); + my_memcpy(&bf_[p], &a.bf_[0], a.last()); } #endif diff --git a/src/mathed/array.h b/src/mathed/array.h index 1d19613f1f..35b205fb7d 100644 --- a/src/mathed/array.h +++ b/src/mathed/array.h @@ -84,7 +84,7 @@ public: #else /// Merge \a dx elements from array \a a at \apos. /// This doesn't changes the size (dangerous) - void mergeF(MathedArray * a, int pos, int dx); + void merge(MathedArray const & a, int pos); #endif /// void raw_pointer_copy(MathedInset ** p, int pos) const; diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index e547399f65..68d583db38 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -844,7 +844,7 @@ bool MathedCursor::pullArg() p->clear(); Delete(); if (!a.empty()) { - cursor->Merge(&a); + cursor->Merge(a); cursor->Adjust(); } @@ -947,7 +947,7 @@ void MathedCursor::SelPaste() SelDel(); if (!selarray.empty()) { - cursor->Merge(&selarray); + cursor->Merge(selarray); cursor->Adjust(); } } diff --git a/src/mathed/math_xiter.C b/src/mathed/math_xiter.C index 860dfe89a8..e14cc4c3e8 100644 --- a/src/mathed/math_xiter.C +++ b/src/mathed/math_xiter.C @@ -139,27 +139,18 @@ void MathedXIter::Clean(int pos2) } -void MathedXIter::Merge(MathedArray * a0) +void MathedXIter::Merge(MathedArray const & a) { - if (!a0) { - lyxerr[Debug::MATHED] - << "Math error: Attempting to merge a void array." << endl; - - return; - } - // All insets must be clonned - MathedArray * a = new MathedArray(*a0); - #if 0 array->insert(array->begin() + pos, - a->begin(), a->end()); + a.begin(), a.end()); #else // make room for the data - split(a->last()); - array->mergeF(a, pos, a->last()); + split(a.last()); + array->merge(a, pos); #endif int pos1 = pos; - int pos2 = pos + a->last(); + int pos2 = pos + a.last(); goPosAbs(pos1); @@ -186,8 +177,6 @@ void MathedXIter::Merge(MathedArray * a0) goPosAbs(pos1); checkTabs(); goPosAbs(pos2); - - delete a; } diff --git a/src/mathed/math_xiter.h b/src/mathed/math_xiter.h index 6a15654e3d..0999b8f311 100644 --- a/src/mathed/math_xiter.h +++ b/src/mathed/math_xiter.h @@ -71,7 +71,7 @@ public: /// void setTab(int, int); /// Merge the array at current position - void Merge(MathedArray *); + void Merge(MathedArray const &); /// Delete every object from current position to pos2 void Clean(int pos2); ///