diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkAtom.c | 6 | ||||
-rw-r--r-- | generic/tkBind.c | 6 | ||||
-rw-r--r-- | generic/tkBitmap.c | 50 | ||||
-rw-r--r-- | generic/tkBusy.c | 2 | ||||
-rw-r--r-- | generic/tkClipboard.c | 12 | ||||
-rw-r--r-- | generic/tkColor.c | 26 | ||||
-rw-r--r-- | generic/tkConfig.c | 2 | ||||
-rw-r--r-- | generic/tkCursor.c | 30 | ||||
-rw-r--r-- | generic/tkError.c | 2 | ||||
-rw-r--r-- | generic/tkFocus.c | 14 | ||||
-rw-r--r-- | generic/tkFont.c | 2 | ||||
-rw-r--r-- | generic/tkGC.c | 11 | ||||
-rw-r--r-- | generic/tkObj.c | 6 | ||||
-rw-r--r-- | generic/tkSelect.c | 2 | ||||
-rw-r--r-- | generic/tkStubLib.c | 2 | ||||
-rw-r--r-- | generic/tkStyle.c | 8 | ||||
-rw-r--r-- | generic/tkTextImage.c | 4 | ||||
-rw-r--r-- | generic/tkTextWind.c | 2 | ||||
-rw-r--r-- | generic/tkUndo.c | 10 | ||||
-rw-r--r-- | generic/tkVisual.c | 58 |
20 files changed, 121 insertions, 134 deletions
diff --git a/generic/tkAtom.c b/generic/tkAtom.c index 2491fb2..475f9d2 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -154,11 +154,11 @@ Tk_GetAtomName( if (mustFree) { XFree(mustFree); } - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, name); } - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } /* @@ -200,7 +200,7 @@ AtomInit( name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, name); } diff --git a/generic/tkBind.c b/generic/tkBind.c index ad59299..da52c61 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -4490,13 +4490,13 @@ NameToWindow( * * DoWarp -- * - * Perform Warping of X pointer. Executed as an idle handler only. + * Perform warping of mouse pointer. Executed as an idle handler only. * * Results: * None * * Side effects: - * X Pointer will move to a new location. + * Mouse pointer moves to a new location. * *------------------------------------------------------------------------- */ @@ -4505,7 +4505,7 @@ static void DoWarp( ClientData clientData) { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; assert(clientData); diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 54bab69..ccc97a4 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj( if (objPtr->typePtr != &tkBitmapObjType) { InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBitmap, see if it's the one we @@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj( */ if (bitmapPtr != NULL) { - TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); FreeBitmapObj(objPtr); for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL; @@ -307,7 +307,7 @@ GetBitmap( Pixmap bitmap; int isNew, width = 0, height = 0, dummy2; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!dispPtr->bitmapInit) { @@ -317,7 +317,7 @@ GetBitmap( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &isNew); if (!isNew) { - existingBitmapPtr = Tcl_GetHashValue(nameHashPtr); + existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr); for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if ((Tk_Display(tkwin) == bitmapPtr->display) && @@ -395,7 +395,7 @@ GetBitmap( goto error; } } else { - predefPtr = Tcl_GetHashValue(predefHashPtr); + predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr); width = predefPtr->width; height = predefPtr->height; if (predefPtr->native) { @@ -407,7 +407,7 @@ GetBitmap( } else { bitmap = XCreateBitmapFromData(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), - predefPtr->source, (unsigned)width, (unsigned)height); + (const char *)predefPtr->source, (unsigned)width, (unsigned)height); } } } @@ -416,7 +416,7 @@ GetBitmap( * Add information about this bitmap to our database. */ - bitmapPtr = ckalloc(sizeof(TkBitmap)); + bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap)); bitmapPtr->bitmap = bitmap; bitmapPtr->width = width; bitmapPtr->height = height; @@ -474,7 +474,7 @@ Tk_DefineBitmap( int isNew; Tcl_HashEntry *predefHashPtr; TkPredefBitmap *predefPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -497,7 +497,7 @@ Tk_DefineBitmap( Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL); return TCL_ERROR; } - predefPtr = ckalloc(sizeof(TkPredefBitmap)); + predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = source; predefPtr->width = width; predefPtr->height = height; @@ -540,7 +540,7 @@ Tk_NameOfBitmap( if (idHashPtr == NULL) { goto unknown; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); return bitmapPtr->nameHashPtr->key.string; } @@ -582,7 +582,7 @@ Tk_SizeOfBitmap( if (idHashPtr == NULL) { goto unknownBitmap; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); *widthPtr = bitmapPtr->width; *heightPtr = bitmapPtr->height; } @@ -612,14 +612,13 @@ FreeBitmap( { TkBitmap *prevPtr; - bitmapPtr->resourceRefCount--; - if (bitmapPtr->resourceRefCount > 0) { + if (bitmapPtr->resourceRefCount-- > 1) { return; } Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap); Tcl_DeleteHashEntry(bitmapPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); if (prevPtr == bitmapPtr) { if (bitmapPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr); @@ -671,7 +670,7 @@ Tk_FreeBitmap( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } - FreeBitmap(Tcl_GetHashValue(idHashPtr)); + FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr)); } /* @@ -735,7 +734,7 @@ static void FreeBitmapObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { bitmapPtr->objRefCount--; @@ -770,7 +769,7 @@ DupBitmapObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -806,7 +805,6 @@ DupBitmapObjProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ Pixmap Tk_GetBitmapFromData( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ @@ -820,20 +818,20 @@ Tk_GetBitmapFromData( char string[16 + TCL_INTEGER_SPACE]; char *name; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { BitmapInit(dispPtr); } - nameKey.source = source; + nameKey.source = (const char *)source; nameKey.width = width; nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { - name = Tcl_GetHashValue(dataHashPtr); + name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber); @@ -911,7 +909,7 @@ GetBitmapFromObj( InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { if ((bitmapPtr->resourceRefCount > 0) && (Tk_Display(tkwin) == bitmapPtr->display)) { @@ -932,7 +930,7 @@ GetBitmapFromObj( * more TkBitmap structures. See if any of them will work. */ - for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; + for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if (Tk_Display(tkwin) == bitmapPtr->display) { objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -1012,7 +1010,7 @@ BitmapInit( * or NULL if unavailable. */ { Tcl_Interp *dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1150,7 +1148,7 @@ TkDebugBitmap( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name); if (hashPtr != NULL) { - bitmapPtr = Tcl_GetHashValue(hashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } @@ -1190,7 +1188,7 @@ TkDebugBitmap( Tcl_HashTable * TkGetBitmapPredefTable(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return &tsdPtr->predefBitmapTable; diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 1e4e91f..6f58c52 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -340,7 +340,7 @@ DestroyBusy( RefWinEventProc, busyPtr); if (busyPtr->tkBusy != NULL) { - Tk_FreeConfigOptions(data, busyPtr->optionTable, busyPtr->tkBusy); + Tk_FreeConfigOptions((char *)data, busyPtr->optionTable, busyPtr->tkBusy); Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); Tk_ManageGeometry(busyPtr->tkBusy, NULL, busyPtr); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 8bc4237..e800da9 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -134,22 +134,22 @@ ClipboardAppHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkDisplay *dispPtr = clientData; - size_t length; + TkDisplay *dispPtr = (TkDisplay *)clientData; + int length; const char *p; p = dispPtr->clipboardAppPtr->winPtr->nameUid; length = strlen(p); - length -= offset; - if (length <= 0) { + if (length <= offset) { return 0; } - if (length > (size_t) maxBytes) { + length -= offset; + if (length > maxBytes) { length = maxBytes; } memcpy(buffer, p, length); buffer[length] = 0; - return (int)length; + return length; } /* diff --git a/generic/tkColor.c b/generic/tkColor.c index 48d17ac..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; } @@ -368,7 +368,7 @@ Tk_NameOfColor( 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"); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 8381a0a..6a0ffd8 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -664,7 +664,7 @@ DoObjConfig( if (internalPtr != NULL) { if (valuePtr != NULL) { value = Tcl_GetStringFromObj(valuePtr, &length); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 1e49c64..902472b 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -100,7 +100,7 @@ Tk_AllocCursorFromObj( if (objPtr->typePtr != &tkCursorObjType) { InitCursorObj(objPtr); } - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we @@ -129,7 +129,7 @@ Tk_AllocCursorFromObj( */ if (cursorPtr != NULL) { - TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); FreeCursorObj(objPtr); for (cursorPtr = firstCursorPtr; cursorPtr != NULL; @@ -241,7 +241,7 @@ TkcGetCursor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable, string, &isNew); if (!isNew) { - existingCursorPtr = Tcl_GetHashValue(nameHashPtr); + existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr); for (cursorPtr = existingCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { @@ -341,7 +341,7 @@ Tk_GetCursorFromData( dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable, (char *) &dataKey, &isNew); if (!isNew) { - cursorPtr = Tcl_GetHashValue(dataHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr); cursorPtr->resourceRefCount++; return cursorPtr->cursor; } @@ -432,7 +432,7 @@ Tk_NameOfCursor( if (idHashPtr == NULL) { goto printid; } - cursorPtr = Tcl_GetHashValue(idHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } @@ -463,13 +463,12 @@ FreeCursor( { TkCursor *prevPtr; - cursorPtr->resourceRefCount--; - if (cursorPtr->resourceRefCount > 0) { + if (cursorPtr->resourceRefCount-- > 1) { return; } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); @@ -522,7 +521,7 @@ Tk_FreeCursor( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } - FreeCursor(Tcl_GetHashValue(idHashPtr)); + FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr)); } /* @@ -587,11 +586,10 @@ static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { - cursorPtr->objRefCount--; - if ((cursorPtr->objRefCount == 0) + if ((cursorPtr->objRefCount-- <= 1) && (cursorPtr->resourceRefCount == 0)) { ckfree(cursorPtr); } @@ -622,7 +620,7 @@ DupCursorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; @@ -707,7 +705,7 @@ GetCursorFromObj( * cached is the one that is needed. */ - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { return cursorPtr; } @@ -722,7 +720,7 @@ GetCursorFromObj( if (hashPtr == NULL) { goto error; } - for (cursorPtr = Tcl_GetHashValue(hashPtr); + for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { FreeCursorObj(objPtr); @@ -857,7 +855,7 @@ TkDebugCursor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name); if (hashPtr != NULL) { - cursorPtr = Tcl_GetHashValue(hashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } diff --git a/generic/tkError.c b/generic/tkError.c index 277d7f0..6ff5475 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -107,7 +107,7 @@ Tk_CreateErrorHandler( * Create the handler record. */ - errorPtr = ckalloc(sizeof(TkErrorHandler)); + errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); errorPtr->lastRequest = (unsigned) -1; diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 42ac6bf..8066afd 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -113,8 +113,8 @@ Tk_FocusObjCmd( static const char *const focusOptions[] = { "-displayof", "-force", "-lastfor", NULL }; - Tk_Window tkwin = clientData; - TkWindow *winPtr = clientData; + Tk_Window tkwin = (Tk_Window)clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *newPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; const char *windowName; @@ -415,7 +415,7 @@ TkFocusFilterEvent( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -622,7 +622,7 @@ TkSetFocusWin( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -961,7 +961,7 @@ FocusMapProc( ClientData clientData, /* Toplevel window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; DisplayFocusInfo *displayFocusPtr; if (eventPtr->type == VisibilityNotify) { @@ -1015,7 +1015,7 @@ FindDisplayFocusInfo( * The record doesn't exist yet. Make a new one. */ - displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo)); + displayFocusPtr = (DisplayFocusInfo *)ckalloc(sizeof(DisplayFocusInfo)); displayFocusPtr->dispPtr = dispPtr; displayFocusPtr->focusWinPtr = NULL; displayFocusPtr->focusOnMapPtr = NULL; @@ -1143,7 +1143,7 @@ TkFocusSplit( * Move focus to new toplevel. */ - ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); newTlFocusPtr->topLevelPtr = winPtr; newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr; diff --git a/generic/tkFont.c b/generic/tkFont.c index 3e4044f..9c157db 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -3780,7 +3780,7 @@ NewChunk( if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk)); - layoutPtr = ckrealloc(layoutPtr, s); + layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; diff --git a/generic/tkGC.c b/generic/tkGC.c index a03c156..8744ec4 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -218,7 +218,7 @@ Tk_GetGC( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable, (char *) &valueKey, &isNew); if (!isNew) { - gcPtr = Tcl_GetHashValue(valueHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(valueHashPtr); gcPtr->refCount++; return gcPtr->gc; } @@ -228,7 +228,7 @@ Tk_GetGC( * and add a new structure to the database. */ - gcPtr = ckalloc(sizeof(TkGC)); + gcPtr = (TkGC *)ckalloc(sizeof(TkGC)); /* * Find or make a drawable to use to specify the screen and depth of the @@ -311,9 +311,8 @@ Tk_FreeGC( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } - gcPtr = Tcl_GetHashValue(idHashPtr); - gcPtr->refCount--; - if (gcPtr->refCount == 0) { + gcPtr = (TkGC *)Tcl_GetHashValue(idHashPtr); + if (gcPtr->refCount-- <= 1) { XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); Tcl_DeleteHashEntry(idHashPtr); @@ -348,7 +347,7 @@ TkGCCleanup( for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { - gcPtr = Tcl_GetHashValue(entryPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(entryPtr); XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index db2e501..1552d11 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -934,8 +934,8 @@ DupWindowInternalRep( { WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(WindowRep)); + oldPtr = (WindowRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; @@ -997,7 +997,7 @@ TkNewWindowObj( SetWindowFromAny(NULL, objPtr); - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr->deletionEpoch; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 55fa473..f187f83 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1325,7 +1325,7 @@ HandleTclCommand( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - CommandInfo *cmdInfoPtr = clientData; + CommandInfo *cmdInfoPtr = (CommandInfo *)clientData; int length; Tcl_Obj *command; const char *string; diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index ea48894..0400bfa 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -80,7 +80,7 @@ Tk_InitStubs( ClientData clientData = NULL; const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); - const TkStubs *stubsPtr = clientData; + const TkStubs *stubsPtr = (const TkStubs *)clientData; if (actualVersion == NULL) { return NULL; diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 1289f14..14bae66 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1402,14 +1402,10 @@ Tk_AllocStyleFromObj( Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { - Style *stylePtr; - if (objPtr->typePtr != &styleObjType) { SetStyleFromAny(interp, objPtr); } - stylePtr = objPtr->internalRep.twoPtrValue.ptr1; - - return (Tk_Style) stylePtr; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* @@ -1439,7 +1435,7 @@ Tk_GetStyleFromObj( SetStyleFromAny(NULL, objPtr); } - return objPtr->internalRep.twoPtrValue.ptr1; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index b396314..776eb04 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -284,7 +284,7 @@ TkTextImageCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -796,7 +796,7 @@ TkTextImageIndex( indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); - /* + /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the image indeed is not * reachable from this text widget (it may be reachable from a peer). diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index cb8e533..fdd5378 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -1352,7 +1352,7 @@ TkTextWindowIndex( indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); - + /* * If indexPtr refers to somewhere outside the -startline/-endline * range limits of the widget, error out since the window indeed is not diff --git a/generic/tkUndo.c b/generic/tkUndo.c index c66905d..7494332 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -94,7 +94,7 @@ TkUndoInsertSeparator( TkUndoAtom *separator; if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) { - separator = ckalloc(sizeof(TkUndoAtom)); + separator = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); separator->type = TK_UNDO_SEPARATOR; TkUndoPushStack(stack,separator); return 1; @@ -181,7 +181,7 @@ TkUndoPushAction( { TkUndoAtom *atom; - atom = ckalloc(sizeof(TkUndoAtom)); + atom = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); atom->type = TK_UNDO_ACTION; atom->apply = apply; atom->revert = revert; @@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom( Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = command; atom->funcPtr = NULL; atom->clientData = NULL; @@ -299,7 +299,7 @@ TkUndoMakeSubAtom( Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = NULL; atom->funcPtr = funcPtr; atom->clientData = clientData; @@ -341,7 +341,7 @@ TkUndoInitStack( { TkUndoRedoStack *stack; /* An Undo/Redo stack */ - stack = ckalloc(sizeof(TkUndoRedoStack)); + stack = (TkUndoRedoStack *)ckalloc(sizeof(TkUndoRedoStack)); stack->undoStack = NULL; stack->redoStack = NULL; stack->interp = interp; diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 567c552..9324499 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -96,10 +96,10 @@ Tk_GetVisual( * Tk_FreeColormap. */ { Tk_Window tkwin2; - XVisualInfo template, *visInfoList, *bestPtr; + XVisualInfo templ, *visInfoList, *bestPtr; long mask; Visual *visual; - ptrdiff_t length; + size_t length; int c, numVisuals, prio, bestPrio, i; const char *p; const VisualDictionary *dictPtr; @@ -137,20 +137,20 @@ Tk_GetVisual( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == *colormapPtr) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; break; } } } return visual; } - template.depth = Tk_Depth(tkwin2); - template.c_class = visual->c_class; - template.red_mask = visual->red_mask; - template.green_mask = visual->green_mask; - template.blue_mask = visual->blue_mask; - template.colormap_size = visual->map_entries; - template.bits_per_rgb = visual->bits_per_rgb; + templ.depth = Tk_Depth(tkwin2); + templ.c_class = visual->c_class; + templ.red_mask = visual->red_mask; + templ.green_mask = visual->green_mask; + templ.blue_mask = visual->blue_mask; + templ.colormap_size = visual->map_entries; + templ.bits_per_rgb = visual->bits_per_rgb; mask = VisualDepthMask|VisualClassMask|VisualRedMaskMask |VisualGreenMaskMask|VisualBlueMaskMask|VisualColormapSizeMask |VisualBitsPerRGBMask; @@ -178,7 +178,7 @@ Tk_GetVisual( Tcl_SetErrorCode(interp, "TK", "VALUE", "VISUALID", NULL); return NULL; } - template.visualid = visualId; + templ.visualid = visualId; mask = VisualIDMask; } else { /* @@ -192,16 +192,15 @@ Tk_GetVisual( } } length = p - string; - template.c_class = -1; + templ.c_class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { - if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) - && (strncmp(string, dictPtr->name, - (size_t) length) == 0)) { - template.c_class = dictPtr->c_class; + if ((dictPtr->name[0] == c) && (length >= (size_t)dictPtr->minLength) + && (strncmp(string, dictPtr->name, length) == 0)) { + templ.c_class = dictPtr->c_class; break; } } - if (template.c_class == -1) { + if (templ.c_class == -1) { Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); @@ -218,8 +217,8 @@ Tk_GetVisual( p++; } if (*p == 0) { - template.depth = 10000; - } else if (Tcl_GetInt(interp, p, &template.depth) != TCL_OK) { + templ.depth = 10000; + } else if (Tcl_GetInt(interp, p, &templ.depth) != TCL_OK) { return NULL; } if (c == 'b') { @@ -234,9 +233,9 @@ Tk_GetVisual( * an error if there are none that match. */ - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; - visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &template, + visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -286,11 +285,11 @@ Tk_GetVisual( goto newBest; } if (visInfoList[i].depth < bestPtr->depth) { - if (visInfoList[i].depth >= template.depth) { + if (visInfoList[i].depth >= templ.depth) { goto newBest; } } else if (visInfoList[i].depth > bestPtr->depth) { - if (bestPtr->depth < template.depth) { + if (bestPtr->depth < templ.depth) { goto newBest; } } else { @@ -324,11 +323,11 @@ Tk_GetVisual( cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->shareable && (cmapPtr->visual == visual)) { *colormapPtr = cmapPtr->colormap; - cmapPtr->refCount += 1; + cmapPtr->refCount++; goto done; } } - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), visual, AllocNone); @@ -383,7 +382,7 @@ Tk_GetColormap( */ if (strcmp(string, "new") == 0) { - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin), AllocNone); @@ -427,7 +426,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 +475,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 +532,7 @@ Tk_PreserveColormap( for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { - cmapPtr->refCount += 1; + cmapPtr->refCount++; return; } } |