diff options
author | gcramer <remarcg@gmx.net> | 2018-10-22 12:40:52 (GMT) |
---|---|---|
committer | gcramer <remarcg@gmx.net> | 2018-10-22 12:40:52 (GMT) |
commit | fc5bfbe78aecf4b5918f44178c4d493109c162e6 (patch) | |
tree | 3ab28516d76d987d6b25506f74ca80054c731020 | |
parent | b3c6dbb65349b84aa78ef495743cdcf1b4d4375e (diff) | |
download | tk-fc5bfbe78aecf4b5918f44178c4d493109c162e6.zip tk-fc5bfbe78aecf4b5918f44178c4d493109c162e6.tar.gz tk-fc5bfbe78aecf4b5918f44178c4d493109c162e6.tar.bz2 |
A few fixes, especially for compile problems with Mac. Some more fixes for Windows will come soon.
-rw-r--r-- | generic/tkArray.h | 2 | ||||
-rw-r--r-- | generic/tkBind.c | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/generic/tkArray.h b/generic/tkArray.h index 0e7547a..be7fa66 100644 --- a/generic/tkArray.h +++ b/generic/tkArray.h @@ -518,7 +518,7 @@ AT##_Find(const struct AT *arr, const ElemType *elem) \ { \ assert(!arr || arr->size != 0xdeadbeef); \ if (arr) { \ - ElemType * const * buf = arr->buf; \ + ElemType *const *buf = arr->buf; \ size_t i; \ for (i = 0; i < arr->size; ++i) { \ if (buf[i] == elem) { \ diff --git a/generic/tkBind.c b/generic/tkBind.c index 4ae1274..0e1413b 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -17,11 +17,11 @@ #include "tkDList.h" #include "tkArray.h" -#ifdef _WIN32 +#if defined(_WIN32) #include "tkWinInt.h" #elif defined(MAC_OSX_TK) #include "tkMacOSXInt.h" -#else +#else /* if defined(__unix__) */ #include "tkUnixInt.h" #endif @@ -41,14 +41,17 @@ # define snprintf _snprintf #endif -#define SIZE_OF_ARRAY(arr) sizeof(arr)/sizeof(arr[0]) +#define SIZE_OF_ARRAY(arr) (sizeof(arr)/sizeof(arr[0])) /* * Simple boolean type support. */ #define bool int + +#ifndef MAC_OSX_TK /* Mac provides 'true' and 'false' */ enum { true = (bool) 1, false = (bool) 0 }; +#endif /* * File structure: @@ -764,7 +767,6 @@ GetCount( unsigned index) { assert(psPtr); - assert(psPtr->numPats >= 1); assert(index < psPtr->numPats); return psPtr->pats[index].count; @@ -1133,6 +1135,9 @@ TkBindInit( /* ensure that our matching algorithm is working (when testing detail) */ assert(sizeof(Detail) == sizeof(Tk_Uid)); + /* test boolean support for safety, because used for 1 bit fields */ + assert(false == 0 && true == 1); + /* test expected indices of Button1..Button5, otherwise our button handling is not working */ assert(Button1 == 1 && Button2 == 2 && Button3 == 3 && Button4 == 4 && Button5 == 5); assert(Button2Mask == (Button1Mask << 1)); @@ -4506,7 +4511,6 @@ FinalizeParseEventDescription( const char* errCode) { assert(patPtr); - assert(copy); if (errorObj) { Tcl_SetObjResult(interp, errorObj); @@ -5060,7 +5064,7 @@ TkpCancelWarp( *---------------------------------------------------------------------- */ -#if !NDEBUG +#if SUPPORT_DEBUGGING void TkpDumpPS( const PatSeq *psPtr) @@ -5096,7 +5100,7 @@ TkpDumpPS( *---------------------------------------------------------------------- */ -#if !NDEBUG +#if SUPPORT_DEBUGGING void TkpDumpPSList( const PSList *psList) |