Author: fabien
Date: 2009-07-03 16:32:47 -0700 (Fri, 03 Jul 2009)
New Revision: 6818
Log:
UTF8: Fl_Text_Display and related:
  + Made char * text() const., this method should be further checked for UTF8 
compat.
  + Added a fixme comment to remember we must check for the potential incorrect
  assumption that that a buffer size equals the string length + 1.
  + Correct a protected attrib. typo as we  don't need to care about ABI 
compat. for now.


Modified:
   branches/branch-1.3/FL/Fl_Text_Buffer.H
   branches/branch-1.3/src/Fl_Text_Buffer.cxx

Modified: branches/branch-1.3/FL/Fl_Text_Buffer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-02 09:42:17 UTC (rev 
6817)
+++ branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-03 23:32:47 UTC (rev 
6818)
@@ -102,7 +102,7 @@
 
   /**    Returns the number of characters in the buffer.  */
     int length() { return mLength; }
-    char* text();
+    char* text() const;
     void text(const char* text);
     char* text_range(int start, int end);
     char character(int pos);
@@ -297,7 +297,7 @@
                                    tabs for padding in rectangular operations 
*/
     int mNModifyProcs;          /**< number of modify-redisplay procs attached 
*/
     Fl_Text_Modify_Cb*          /**< procedures to call when buffer is */
-    mNodifyProcs;               /**< modified to redisplay contents */
+    mModifyProcs;               /**< modified to redisplay contents */
     void** mCbArgs;             /**< caller arguments for modifyProcs above */
     int mNPredeleteProcs;      /**< number of pre-delete procs attached */
     Fl_Text_Predelete_Cb*      /**< procedure to call before text is deleted */

Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-02 09:42:17 UTC (rev 
6817)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-03 23:32:47 UTC (rev 
6818)
@@ -122,7 +122,7 @@
   mHighlight.mSelected = 0;
   mHighlight.mStart = mHighlight.mEnd = 0;
   mHighlight.mRectangular = 0;
-  mNodifyProcs = NULL;
+  mModifyProcs = NULL;
   mCbArgs = NULL;
   mNModifyProcs = 0;
   mNPredeleteProcs = 0;
@@ -140,7 +140,7 @@
 Fl_Text_Buffer::~Fl_Text_Buffer() {
   free(mBuf);
   if (mNModifyProcs != 0) {
-    delete[] mNodifyProcs;
+    delete[] mModifyProcs;
     delete[] mCbArgs;
   }
   if (mNPredeleteProcs != 0) {
@@ -153,10 +153,10 @@
    Get the entire contents of a text buffer.  Memory is allocated to contain
    the returned string, which the caller must free.
 */
-char * Fl_Text_Buffer::text() {
+char * Fl_Text_Buffer::text() const {
   char *t;
 
-  t = (char *)malloc(mLength + 1);
+  t = (char *)malloc(mLength + 1);  // FIX ME UTF8: we alloc from a string 
len, is len the strlen or the string buffer size ?
   memcpy(t, mBuf, mGapStart);
   memcpy(&t[ mGapStart ], &mBuf[ mGapEnd ],
           mLength - mGapStart);
@@ -777,17 +777,17 @@
   newModifyProcs = new Fl_Text_Modify_Cb [ mNModifyProcs + 1 ];
   newCBArgs = new void * [ mNModifyProcs + 1 ];
   for (i = 0; i < mNModifyProcs; i++) {
-    newModifyProcs[ i + 1 ] = mNodifyProcs[ i ];
+    newModifyProcs[ i + 1 ] = mModifyProcs[ i ];
     newCBArgs[ i + 1 ] = mCbArgs[ i ];
   }
   if (mNModifyProcs != 0) {
-    delete [] mNodifyProcs;
+    delete [] mModifyProcs;
     delete [] mCbArgs;
   }
   newModifyProcs[ 0 ] = bufModifiedCB;
   newCBArgs[ 0 ] = cbArg;
   mNModifyProcs++;
-  mNodifyProcs = newModifyProcs;
+  mModifyProcs = newModifyProcs;
   mCbArgs = newCBArgs;
 }
 /**   Removes a modify callback.*/
@@ -799,7 +799,7 @@
 
   /* find the matching callback to remove */
   for (i = 0; i < mNModifyProcs; i++) {
-    if (mNodifyProcs[ i ] == bufModifiedCB && mCbArgs[ i ] == cbArg) {
+    if (mModifyProcs[ i ] == bufModifiedCB && mCbArgs[ i ] == cbArg) {
       toRemove = i;
       break;
     }
@@ -814,8 +814,8 @@
   mNModifyProcs--;
   if (mNModifyProcs == 0) {
     mNModifyProcs = 0;
-    delete[] mNodifyProcs;
-    mNodifyProcs = NULL;
+    delete[] mModifyProcs;
+    mModifyProcs = NULL;
     delete[] mCbArgs;
     mCbArgs = NULL;
     return;
@@ -825,16 +825,16 @@
 
   /* copy out the remaining members and free the old lists */
   for (i = 0; i < toRemove; i++) {
-    newModifyProcs[ i ] = mNodifyProcs[ i ];
+    newModifyProcs[ i ] = mModifyProcs[ i ];
     newCBArgs[ i ] = mCbArgs[ i ];
   }
   for (; i < mNModifyProcs; i++) {
-    newModifyProcs[ i ] = mNodifyProcs[ i + 1 ];
+    newModifyProcs[ i ] = mModifyProcs[ i + 1 ];
     newCBArgs[ i ] = mCbArgs[ i + 1 ];
   }
-  delete[] mNodifyProcs;
+  delete[] mModifyProcs;
   delete[] mCbArgs;
-  mNodifyProcs = newModifyProcs;
+  mModifyProcs = newModifyProcs;
   mCbArgs = newCBArgs;
 }
 
@@ -2102,7 +2102,7 @@
   int i;
 
   for (i = 0; i < mNModifyProcs; i++)
-    (*mNodifyProcs[ i ]) (pos, nInserted, nDeleted, nRestyled,
+    (*mModifyProcs[ i ]) (pos, nInserted, nDeleted, nRestyled,
                              deletedText, mCbArgs[ i ]);
 }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to