]> git.lyx.org Git - features.git/commitdiff
mathed7.diff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 9 Feb 2001 17:17:08 +0000 (17:17 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 9 Feb 2001 17:17:08 +0000 (17:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1473 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/array.h
src/mathed/math_write.C

index 6f0382b2b97963fb7a19006ec4d794e8d5aae407..da0505e9c4b497a9540fe8754be0775228f6973d 100644 (file)
@@ -1,5 +1,7 @@
-2001-02-09  Andre Poenitz  <poenitz@HTWM.De>
+2001-02-09  André Pönitz  <poenitz@htwm.de>
 
+       * array.h: replace array buffer  'byte bf[]'  by 'std::vector<byte> bf'
+       * several files: subsequent changes         
        * math_iter.h: remove unused prototype
        * array.h: ditto.
 
@@ -9,7 +11,7 @@
        compiling with lyxstring, but STL sstream).
        (Metrics): ditto.
 
-2001-02-08  Andre Poenitz  <poenitz@HTWM.De>
+2001-02-08  André Pönitz  <poenitz@htwm.de>
 
        * several files: get rid of reinterpret_cast.
 
index 4be93b9bfca5b82462863db3790c23d0a539c6a6..9f9bdd36f09111c042d31b486ef9737a48177e71 100644 (file)
@@ -14,7 +14,7 @@
  *   the GNU General Public Licence version 2 or later.
  */
 
-#include <string.h>
+#include <vector>
 
 #ifndef byte
 #define byte unsigned char
@@ -27,6 +27,8 @@
   */
 class LyxArrayBase  {
 public:
+       ///
+       typedef std::vector<byte> buffer_type;
        ///
        enum {
                ///
@@ -40,13 +42,6 @@ public:
        ///
        explicit
        LyxArrayBase(int size = ARRAY_STEP);
-       ///
-       LyxArrayBase(LyxArrayBase const &);
-       ///
-       ~LyxArrayBase();
-   
-       /// Constructs a new array with dx elements starting at pos 
-       LyxArrayBase & operator=(LyxArrayBase const &); 
 
        ///
        int empty() const { return (last == 0); }
@@ -54,9 +49,6 @@ public:
        ///
        int Last() { return last; }
    
-       /// Fills with 0 the entire array and set last to 0
-       void Init();     
-   
        /// Make the allocated memory fit the needed size
        void Fit();     
 
@@ -88,7 +80,7 @@ protected:
        bool Move(int p, int shift);
 
        /// Buffer
-       byte * bf;
+       buffer_type bf;
        /// Last position inserted.
        int last;
        /// Max size of the array.
@@ -102,25 +94,15 @@ private:
 
 /************************ Inline functions *****************************/
 
-inline
-void LyxArrayBase::Init()
-{
-       memset(bf, 0, maxsize);
-       last = 0;
-}
-
 inline // Hmmm, Hp-UX's CC can't handle this inline. Asger.
 void LyxArrayBase::Resize(int newsize)
 {
        if (newsize<ARRAY_MIN_SIZE)
                newsize = ARRAY_MIN_SIZE;
        newsize += ARRAY_STEP - (newsize % ARRAY_STEP);
-       byte *nwbf = new byte[newsize];
+       bf.resize(newsize);
        if (last >= newsize) last = newsize-1;
        maxsize = newsize;
-       memcpy(nwbf, bf, last);
-       delete[] bf;
-       bf = nwbf;
        bf[last] = 0;
 }
 
@@ -128,33 +110,8 @@ inline
 LyxArrayBase::LyxArrayBase(int size) 
 {
        maxsize = (size<ARRAY_MIN_SIZE) ? ARRAY_MIN_SIZE: size;
-       bf = new byte[maxsize]; // this leaks
-       Init();
-}
-
-inline   
-LyxArrayBase::~LyxArrayBase() 
-{
-       delete[] bf;
-}
-
-inline
-LyxArrayBase::LyxArrayBase(LyxArrayBase const & a) 
-{
-       maxsize = a.maxsize;
-       bf = new byte[maxsize];
-       memcpy(&bf[0], &a.bf[0], maxsize);
-       last = a.last;
-}
-
-inline
-LyxArrayBase & LyxArrayBase::operator=(LyxArrayBase const & a)
-{
-       if (this != &a) {
-               Resize(a.maxsize);
-               memcpy(&bf[0], &a.bf[0], maxsize);
-       }
-       return *this;
+       bf.resize(maxsize);
+       last = 0;
 }
 
 inline   
index e19aaf0ca8f6ba20c653eb07e4d3ed3de9cdab36..114584a2310566ae23f2f2851ba69efcf64252a7 100644 (file)
@@ -206,8 +206,9 @@ void MathParInset::Write(ostream & os, bool fragile)
                                        if (l) {
                                                os << '\\' << l->name << ' ';
                                        } else {
-                                               lyxerr << "Illegal symbol code[" << c
-                                                    << " " << str.end() - s << " " << data.FCode() << "]";
+#warning this does not compile on gcc 2.97
+                                               //lyxerr << "Illegal symbol code[" << c
+                                               //   << " " << str.end() - s << " " << data.FCode() << "]";
                                        }
                                } else {
                                        // Is there a standard logical XOR?