-- 
André Pönitz ........................................ [EMAIL PROTECTED]
? :w
? .array.C.swp
? mathed27.diff
? mathed39.diff
? delim.diff
? bigop.diff
? to_check.diff
? mathed37.diff
? mathed38.diff
? mathed40.diff
? .ChangeLog.swp
? mathed41.diff
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.54
diff -u -p -r1.54 ChangeLog
--- ChangeLog   2001/03/05 10:52:39     1.54
+++ ChangeLog   2001/03/06 09:29:11
@@ -1,5 +1,11 @@
 
-2001-02-14  André Pönitz  <[EMAIL PROTECTED]>
+2001-03-06  André Pönitz  <[EMAIL PROTECTED]>
+       * array.[Ch]: factor out deep_copy,
+         remove third argument from raw_pointer_insert 
+
+       * mathiter.[Ch]: remove unused function Clear() 
+
+2001-03-04  André Pönitz  <[EMAIL PROTECTED]>
   * math_macrotemplate.[Ch]:
     math_macro.C: move update() functionality to the macro
 
Index: array.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/array.C,v
retrieving revision 1.14
diff -u -p -r1.14 array.C
--- array.C     2001/03/01 13:31:14     1.14
+++ array.C     2001/03/06 09:29:11
@@ -60,13 +60,17 @@ MathedArray::MathedArray(MathedArray con
        last_ = array.last_;
 
        // deep copy
-       // we'll not yet get exeption safety
+       deep_copy();
+}
+
+void MathedArray::deep_copy()
+{
        MathedIter it(this);
        while (it.OK()) {
                if (it.IsInset()) {
                        MathedInset * inset = it.GetInset();
                        inset = inset->Clone();
-                       raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
+                       raw_pointer_insert(inset, it.getPos() + 1);
                }
                it.Next();
        }
@@ -200,18 +204,8 @@ void MathedArray::shrink(int pos1, int p
        a.last(dx);
        a[dx] = '\0';
 
-       MathedIter it(&a);
-       it.Reset();
-
-       while (it.OK()) {
-               if (it.IsInset()) {
-                       MathedInset * inset = it.GetInset();
-                       inset = inset->Clone();
-                       a.raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
-               }
-               it.Next();
-       }
        swap(a);
+       deep_copy();
 }
 
 
@@ -261,9 +255,9 @@ MathedInset * MathedArray::getInset(int 
 }
 
 #else
-void MathedArray::raw_pointer_insert(void * p, int pos, int len)
+void MathedArray::raw_pointer_insert(void * p, int pos)
 {
-       my_memcpy(&bf_[pos], &p, len);
+       my_memcpy(&bf_[pos], &p, sizeof(p));
 }
 #endif
 
Index: array.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/array.h,v
retrieving revision 1.21
diff -u -p -r1.21 array.h
--- array.h     2001/03/01 13:31:14     1.21
+++ array.h     2001/03/06 09:29:11
@@ -96,7 +96,7 @@ public:
        MathedInset * getInset(int pos);
 #else
        ///
-       void raw_pointer_insert(void * p, int pos, int len);
+       void raw_pointer_insert(void * p, int pos);
 #endif
        ///
        void strange_copy(MathedArray * dest, int dpos, int spos, int len);
@@ -113,6 +113,8 @@ public:
        void need_size(int needed);
        ///
        void dump(std::ostream &) const;
+       /// creates copies of all embedded insets
+       void deep_copy();
 private:
        /// Buffer
        buffer_type bf_;
Index: math_iter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_iter.C,v
retrieving revision 1.40
diff -u -p -r1.40 math_iter.C
--- math_iter.C 2001/03/01 20:25:38     1.40
+++ math_iter.C 2001/03/06 09:29:11
@@ -325,7 +325,7 @@ void MathedIter::insertInset(MathedInset
        split(shift);
 
        (*array)[pos] = type;
-       array->raw_pointer_insert(p, pos + 1, sizeof(p));
+       array->raw_pointer_insert(p, pos + 1);
        pos += SizeInset;
        (*array)[pos - 1] = type;
        (*array)[array->last()] = '\0';
@@ -375,27 +375,6 @@ bool MathedIter::Delete()
        } else
                return false;
 }
-
-
-void MathedIter::Clear()
-{
-       if (!array) {
-               lyxerr << "Math error: Attempting to clean a void array." << endl;
-               return;
-       }
-
-       Reset();
-       while (OK()) {
-               if (IsInset()) {
-                       MathedInset * inset = GetInset();
-                       if (inset->GetType()!= LM_OT_MACRO_ARG)
-                       delete inset;
-                       Delete();
-               } else
-                       Next();
-       }
-}
-
 
 // Check consistency of tabs and crs
 void MathedIter::checkTabs()
Index: math_iter.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_iter.h,v
retrieving revision 1.28
diff -u -p -r1.28 math_iter.h
--- math_iter.h 2001/03/01 20:25:38     1.28
+++ math_iter.h 2001/03/06 09:29:12
@@ -110,8 +110,6 @@ public:
        void setNumCols(int n) { ncols = n; }
        ///
        MathedArray * GetData() const;
-       /// Copy every object from position p1 to p2
-       void Clear();
 protected:
        ///
        void split(int);

Reply via email to