Author: matt
Date: 2010-11-06 16:58:57 -0700 (Sat, 06 Nov 2010)
New Revision: 7807
Log:
Better alignment testing

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

Modified: branches/branch-1.3/FL/Fl_Text_Buffer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Buffer.H     2010-11-06 23:16:07 UTC (rev 
7806)
+++ branches/branch-1.3/FL/Fl_Text_Buffer.H     2010-11-06 23:58:57 UTC (rev 
7807)
@@ -39,8 +39,10 @@
 #ifdef ASSERT_UTF8
 # include <assert.h>
 # define IS_UTF8_ALIGNED(a) if (a && *a) assert(fl_utf8len(*(a))>0);
+# define IS_UTF8_ALIGNED2(a, b) if (b>=0 && b<a->length()) 
assert(fl_utf8len(a->byte_at(b))>0);
 #else
 # define IS_UTF8_ALIGNED(a)
+# define IS_UTF8_ALIGNED2(a, b)
 #endif
 
 

Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx  2010-11-06 23:16:07 UTC (rev 
7806)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx  2010-11-06 23:58:57 UTC (rev 
7807)
@@ -1287,7 +1287,7 @@
 void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
                                           int nInserted, int nRestyled,
                                           const char *deletedText) const {
-  IS_UTF8_ALIGNED(address(pos))
+  IS_UTF8_ALIGNED2(this, pos)
   for (int i = 0; i < mNModifyProcs; i++)
     (*mModifyProcs[i]) (pos, nInserted, nDeleted, nRestyled,
                        deletedText, mCbArgs[i]);

Modified: branches/branch-1.3/test/editor.cxx
===================================================================
--- branches/branch-1.3/test/editor.cxx 2010-11-06 23:16:07 UTC (rev 7806)
+++ branches/branch-1.3/test/editor.cxx 2010-11-06 23:58:57 UTC (rev 7807)
@@ -805,6 +805,7 @@
 
 int main(int argc, char **argv) {
   textbuf = new Fl_Text_Buffer;
+#if 1
   textbuf->text(
                 "void saveas_cb() {\n"
                 "  Fl_Native_File_Chooser fnfc;\n"
@@ -848,6 +849,7 @@
                 "And superficial dreams / Shall no longer delude you.\n"
                 "(from Iroha-uta)"
                 );
+#endif
   style_init();
 
   Fl_Window* window = new_view();

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

Reply via email to