diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2017-08-18 15:16:08 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2017-08-18 15:16:08 +0000 |
| commit | 2828cbde2c2a3dda5b2a4cc550dbf5f5ad12d8a5 (patch) | |
| tree | 70d994a89590ca741755e2a6444bcfabb125642a /FL | |
| parent | 638fba602018fe815321e33fa1cd26f1395b3cca (diff) | |
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 <FL/Fl.H> // moved to implementation (.cxx)
#include <FL/Fl_Box.H> // moved to implementation (.cxx)
#include <FL/Fl_Scrollbar.H> // moved to implementation (.cxx)
#include <sys/types.h>
#include <string.h> // memcpy
#include <malloc.h> // WINDOWS only: malloc/realloc
#include <stdlib.h> // UNIX: malloc/realloc
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12390 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Table.H | 27 | ||||
| -rw-r--r-- | FL/Fl_Table_Row.H | 22 |
2 files changed, 10 insertions, 39 deletions
diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 62872ca09..7658e3ff9 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -20,19 +20,8 @@ #ifndef _FL_TABLE_H #define _FL_TABLE_H -#include <sys/types.h> -#include <string.h> // memcpy -#ifdef WIN32 -#include <malloc.h> // WINDOWS: malloc/realloc -#else /*WIN32*/ -#include <stdlib.h> // UNIX: malloc/realloc -#endif /*WIN32*/ - -#include <FL/Fl.H> #include <FL/Fl_Group.H> #include <FL/Fl_Scroll.H> -#include <FL/Fl_Box.H> -#include <FL/Fl_Scrollbar.H> /** A table of widgets or other content. @@ -172,16 +161,13 @@ private: int *arr; unsigned int _size; void init() { - arr = NULL; + arr = 0; _size = 0; } - void copy(int *newarr, unsigned int newsize) { - size(newsize); - memcpy(arr, newarr, newsize * sizeof(int)); - } + void copy(int *newarr, unsigned int newsize); public: IntVector() { init(); } // CTOR - ~IntVector() { if ( arr ) free(arr); arr = NULL; } // DTOR + ~IntVector(); // DTOR IntVector(IntVector&o) { init(); copy(o.arr, o._size); } // COPY CTOR IntVector& operator=(IntVector&o) { // ASSIGN init(); @@ -191,12 +177,7 @@ private: int operator[](int x) const { return(arr[x]); } int& operator[](int x) { return(arr[x]); } unsigned int size() { return(_size); } - void size(unsigned int count) { - if ( count != _size ) { - arr = (int*)realloc(arr, count * sizeof(int)); - _size = count; - } - } + void size(unsigned int count); int pop_back() { int tmp = arr[_size-1]; _size--; return(tmp); } void push_back(int val) { unsigned int x = _size; size(_size+1); arr[x] = val; } int back() { return(arr[_size-1]); } diff --git a/FL/Fl_Table_Row.H b/FL/Fl_Table_Row.H index 891c58526..0a8fcca8f 100644 --- a/FL/Fl_Table_Row.H +++ b/FL/Fl_Table_Row.H @@ -22,7 +22,7 @@ // Please report all bugs and problems to "erco at seriss dot com". // -#include "Fl_Table.H" +#include <FL/Fl_Table.H> /** A table with row selection capabilities. @@ -54,21 +54,15 @@ private: char *arr; int _size; void init() { - arr = NULL; + arr = 0; _size = 0; } - void copy(char *newarr, int newsize) { - size(newsize); - memcpy(arr, newarr, newsize * sizeof(char)); - } + void copy(char *newarr, int newsize); public: CharVector() { // CTOR init(); } - ~CharVector() { // DTOR - if ( arr ) free(arr); - arr = NULL; - } + ~CharVector(); // DTOR CharVector(CharVector&o) { // COPY CTOR init(); copy(o.arr, o._size); @@ -87,12 +81,7 @@ private: int size() { return(_size); } - void size(int count) { - if ( count != _size ) { - arr = (char*)realloc(arr, count * sizeof(char)); - _size = count; - } - } + void size(int count); char pop_back() { char tmp = arr[_size-1]; _size--; @@ -107,6 +96,7 @@ private: return(arr[_size-1]); } }; + CharVector _rowselect; // selection flag for each row // handle() state variables. |
