From 2828cbde2c2a3dda5b2a4cc550dbf5f5ad12d8a5 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 18 Aug 2017 15:16:08 +0000 Subject: Avoid #include's of unrelated system headers in Fl_Table*.H. Possible side effect: programs that relied upon inclusion of unrelated system headers by FL/Fl_Table.H or FL/Fl_Table_Row.H may fail to compile. Removed include files (some only on certain platforms, list may be incomplete): #include // moved to implementation (.cxx) #include // moved to implementation (.cxx) #include // moved to implementation (.cxx) #include #include // memcpy #include // WINDOWS only: malloc/realloc #include // UNIX: malloc/realloc git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12390 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Table.cxx | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'src/Fl_Table.cxx') diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx index a51d8d058..0dc95e135 100644 --- a/src/Fl_Table.cxx +++ b/src/Fl_Table.cxx @@ -17,13 +17,42 @@ // http://www.fltk.org/str.php // -#include // fprintf -#include #include -#if defined(USE_UTF8) && ( defined(MICROSOFT) || defined(LINUX) ) -#include // currently only Windows and Linux -#endif +#include +#include + +#include +#include // memcpy +#include // fprintf + +#ifdef WIN32 +#include // WINDOWS: malloc/realloc +#else /*WIN32*/ +#include // UNIX: malloc/realloc +#endif /*WIN32*/ + + +// An STL-ish vector without templates (private to Fl_Table) + +void Fl_Table::IntVector::copy(int *newarr, unsigned int newsize) { + size(newsize); + memcpy(arr, newarr, newsize * sizeof(int)); +} + +Fl_Table::IntVector::~IntVector() { // DTOR + if (arr) + free(arr); + arr = 0; +} + +void Fl_Table::IntVector::size(unsigned int count) { + if (count != _size) { + arr = (int*)realloc(arr, count * sizeof(int)); + _size = count; + } +} + /** Sets the vertical scroll position so 'row' is at the top, and causes the screen to redraw. -- cgit v1.2.3