TCL9: ClientData macro header file changes

Header files documentation indicates the macros are of type ClientData
but previously did not cast to ensure that. So now follow this intention.
This commit is contained in:
Darryl L. Miles 2024-10-21 09:12:57 +01:00 committed by Tim Edwards
parent 17fe81107a
commit 79f2ab0f4b
4 changed files with 15 additions and 11 deletions

View File

@ -39,6 +39,10 @@
* the head of that function. * the head of that function.
*/ */
#ifndef _MAGIC_H
#include "utils/magic.h"
#endif
#ifndef _MZROUTER_H #ifndef _MZROUTER_H
#include "mzrouter/mzrouter.h" #include "mzrouter/mzrouter.h"
#endif #endif
@ -86,8 +90,8 @@ extern ClientData mzDebugID;
* electrically connected to specified start or dest regions. * electrically connected to specified start or dest regions.
*/ */
#define DEF_EXPAND_ENDPOINTS 1 #define DEF_EXPAND_ENDPOINTS 1
#define MZ_EXPAND_START 1 /* ClientData type for start tiles */ #define MZ_EXPAND_START INT2CD(1) /* ClientData type for start tiles */
#define MZ_EXPAND_DEST 0 /* ClientData type for dest tiles */ #define MZ_EXPAND_DEST INT2CD(0) /* ClientData type for dest tiles */
#define MZ_EXPAND_NONE CLIENTDEFAULT /* Normal ClientData type */ #define MZ_EXPAND_NONE CLIENTDEFAULT /* Normal ClientData type */
/* If set only hints in toplevel cell are recognized - speeds up processing /* If set only hints in toplevel cell are recognized - speeds up processing

View File

@ -161,11 +161,11 @@ typedef struct
* of the tile to its right. * of the tile to its right.
*/ */
#define TRAIL_UNINIT CLIENTDEFAULT #define TRAIL_UNINIT CLIENTDEFAULT
#define TRAILING(tp) (((tp)->ti_client == (ClientData)TRAIL_UNINIT) \ #define TRAILING(tp) (((tp)->ti_client == INT2CD(TRAIL_UNINIT)) \
? LEFT(tp) : ((int)(tp)->ti_client)) ? LEFT(tp) : ((int)CD2INT((tp)->ti_client)))
#define LEADING(tp) TRAILING(TR(tp)) #define LEADING(tp) TRAILING(TR(tp))
#define plowSetTrailing(tp, n) ((tp)->ti_client = (ClientData) (n)) #define plowSetTrailing(tp, n) ((tp)->ti_client = INT2CD((n)))
/* ------------------ Design rules used by plowing -------------------- */ /* ------------------ Design rules used by plowing -------------------- */

View File

@ -49,19 +49,19 @@
/* rtrMARKED(t,s) Tile * t; int s; /* rtrMARKED(t,s) Tile * t; int s;
* Return 1 if the indicated horizontal boundary of a tile is marked. * Return 1 if the indicated horizontal boundary of a tile is marked.
*/ */
#define rtrMARKED(t,s) (((int) (t)->ti_client) & (s)) #define rtrMARKED(t,s) (((int) CD2INT((t)->ti_client)) & (s))
/* rtrMARK(t,s) Tile * t; int s; /* rtrMARK(t,s) Tile * t; int s;
* Mark the indicated horizontal tile edge as a valid channel boundary. * Mark the indicated horizontal tile edge as a valid channel boundary.
*/ */
#define rtrMARK(t,s) \ #define rtrMARK(t,s) \
((t)->ti_client = (ClientData) (((int) (t)->ti_client)&(s))) ((t)->ti_client = INT2CD((((int) CD2INT((t)->ti_client))&(s))))
/* rtrCLEAR(t,s) Tile * t; int s; /* rtrCLEAR(t,s) Tile * t; int s;
* Clear the indicated horizontal tile edge as a valid channel boundary. * Clear the indicated horizontal tile edge as a valid channel boundary.
*/ */
#define rtrCLEAR(t,s) \ #define rtrCLEAR(t,s) \
((t)->ti_client = (ClientData) (((int) (t)->ti_client)&(!s))) ((t)->ti_client = INT2CD((((int) CD2INT((t)->ti_client))&(!s))))
/* Private Procedures */ /* Private Procedures */
int rtrSrPaint(); int rtrSrPaint();

View File

@ -163,7 +163,7 @@ typedef struct
/* depending on whether it is cast into a 32 or a 64 bit word. */ /* depending on whether it is cast into a 32 or a 64 bit word. */
#define CLIENTMAX (((pointertype)1 << (8 * sizeof(pointertype) - 2)) - 4) #define CLIENTMAX (((pointertype)1 << (8 * sizeof(pointertype) - 2)) - 4)
#define CLIENTDEFAULT (-CLIENTMAX) #define CLIENTDEFAULT INT2CD(-CLIENTMAX)
/* ------------------------ Flags, etc -------------------------------- */ /* ------------------------ Flags, etc -------------------------------- */
@ -239,9 +239,9 @@ extern Tile *TiSrPoint(Tile *, Plane *, Point *);
#define TiGetBody(tp) ((tp)->ti_body) #define TiGetBody(tp) ((tp)->ti_body)
/* See diagnostic subroutine version in tile.c */ /* See diagnostic subroutine version in tile.c */
#define TiSetBody(tp, b) ((tp)->ti_body = (ClientData)(pointertype) (b)) #define TiSetBody(tp, b) ((tp)->ti_body = INT2CD((b)))
#define TiGetClient(tp) ((tp)->ti_client) #define TiGetClient(tp) ((tp)->ti_client)
#define TiSetClient(tp,b) ((tp)->ti_client = (ClientData)(pointertype) (b)) #define TiSetClient(tp,b) ((tp)->ti_client = INT2CD((b)))
Tile *TiAlloc(void); Tile *TiAlloc(void);
void TiFree(Tile *); void TiFree(Tile *);