summaryrefslogtreecommitdiffstats
path: root/generic/tkColor.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkColor.c')
-rw-r--r--generic/tkColor.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/generic/tkColor.c b/generic/tkColor.c
index f6650f9..6b6405a 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -128,7 +128,7 @@ Tk_AllocColorFromObj(
*/
if (tkColPtr != NULL) {
- TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+ TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
FreeColorObj(objPtr);
for (tkColPtr = firstColorPtr; tkColPtr != NULL;
@@ -203,7 +203,7 @@ Tk_GetColor(
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
if (!isNew) {
- existingColPtr = Tcl_GetHashValue(nameHashPtr);
+ existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr);
for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
if ((tkColPtr->screen == Tk_Screen(tkwin))
@@ -314,7 +314,7 @@ Tk_GetColorByValue(
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
(char *) &valueKey, &isNew);
if (!isNew) {
- tkColPtr = Tcl_GetHashValue(valueHashPtr);
+ tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
}
@@ -363,12 +363,12 @@ const char *
Tk_NameOfColor(
XColor *colorPtr) /* Color whose name is desired. */
{
- register TkColor *tkColPtr = (TkColor *) colorPtr;
+ TkColor *tkColPtr = (TkColor *) colorPtr;
if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) {
return tkColPtr->hashPtr->key.string;
} else {
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red,
@@ -480,8 +480,7 @@ Tk_FreeColor(
Tcl_Panic("Tk_FreeColor called with bogus color");
}
- tkColPtr->resourceRefCount--;
- if (tkColPtr->resourceRefCount > 0) {
+ if (tkColPtr->resourceRefCount-- > 1) {
return;
}
@@ -497,7 +496,7 @@ Tk_FreeColor(
}
TkpFreeColor(tkColPtr);
- prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr);
+ prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr);
if (prevPtr == tkColPtr) {
if (tkColPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(tkColPtr->hashPtr);
@@ -584,11 +583,10 @@ static void
FreeColorObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if (tkColPtr != NULL) {
- tkColPtr->objRefCount--;
- if ((tkColPtr->objRefCount == 0)
+ if ((tkColPtr->objRefCount-- <= 1)
&& (tkColPtr->resourceRefCount == 0)) {
ckfree(tkColPtr);
}
@@ -619,7 +617,7 @@ DupColorObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr;
@@ -669,7 +667,7 @@ Tk_GetColorFromObj(
* map. If it is, we are done.
*/
- tkColPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1;
if ((tkColPtr != NULL)
&& (tkColPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == tkColPtr->screen)
@@ -695,7 +693,7 @@ Tk_GetColorFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (tkColPtr = Tcl_GetHashValue(hashPtr);
+ for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
(tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) {
if ((Tk_Screen(tkwin) == tkColPtr->screen)
&& (Tk_Colormap(tkwin) == tkColPtr->colormap)) {
@@ -811,7 +809,7 @@ TkDebugColor(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name);
if (hashPtr != NULL) {
- TkColor *tkColPtr = Tcl_GetHashValue(hashPtr);
+ TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr);
if (tkColPtr == NULL) {
Tcl_Panic("TkDebugColor found empty hash table entry");