diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-02-13 09:57:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-02-13 09:57:07 (GMT) |
commit | 4a1828d3e7f328cce5d6b770ffbb6ea5a5373d0c (patch) | |
tree | ee4d9a63fa953072901b6d76880e60f81266dd78 /generic/tkVisual.c | |
parent | 58dee83cb742162ddda8b91eb7a8132aebaa68b4 (diff) | |
download | tk-4a1828d3e7f328cce5d6b770ffbb6ea5a5373d0c.zip tk-4a1828d3e7f328cce5d6b770ffbb6ea5a5373d0c.tar.gz tk-4a1828d3e7f328cce5d6b770ffbb6ea5a5373d0c.tar.bz2 |
Make tk.h work unchanged with Tcl 9.0 (novem), account for possible missing TCL_STORAGE_CLASS definition. More internal use of size_t in stead of int.
Diffstat (limited to 'generic/tkVisual.c')
-rw-r--r-- | generic/tkVisual.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 8b0c155..6f6816d 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -46,7 +46,7 @@ static const VisualDictionary visualNames[] = { struct TkColormap { Colormap colormap; /* X's identifier for the colormap. */ Visual *visual; /* Visual for which colormap was allocated. */ - int refCount; /* How many uses of the colormap are still + size_t refCount; /* How many uses of the colormap are still * outstanding (calls to Tk_GetColormap minus * calls to Tk_FreeColormap). */ int shareable; /* 0 means this colormap was allocated by a @@ -137,7 +137,7 @@ Tk_GetVisual( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == *colormapPtr) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; break; } } @@ -324,7 +324,7 @@ Tk_GetVisual( cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->shareable && (cmapPtr->visual == visual)) { *colormapPtr = cmapPtr->colormap; - cmapPtr->refCount += 1; + cmapPtr->refCount++; goto done; } } @@ -427,7 +427,7 @@ Tk_GetColormap( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; } } return colormap; @@ -476,8 +476,7 @@ Tk_FreeColormap( for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount -= 1; - if (cmapPtr->refCount == 0) { + if (cmapPtr->refCount-- <= 1) { XFreeColormap(display, colormap); if (prevPtr == NULL) { dispPtr->cmapPtr = cmapPtr->nextPtr; @@ -534,7 +533,7 @@ Tk_PreserveColormap( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; return; } } |