diff options
Diffstat (limited to 'generic/tkTextImage.c')
-rw-r--r-- | generic/tkTextImage.c | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index defda56..ccdfda6 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -18,7 +18,7 @@ */ #define EI_SEG_SIZE \ - (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)) + (offsetof(TkTextSegment, body) + sizeof(TkTextEmbImage)) /* * Prototypes for functions defined in this file: @@ -83,17 +83,17 @@ typedef enum { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, - "center", -1, Tk_Offset(TkTextEmbImage, align), + "center", TCL_INDEX_NONE, offsetof(TkTextEmbImage, align), 0, alignStrings, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbImage, padX), 0, 0, 0}, + "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - "0", -1, Tk_Offset(TkTextEmbImage, padY), 0, 0, 0}, + "0", TCL_INDEX_NONE, offsetof(TkTextEmbImage, padY), 0, 0, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbImage, imageString), + NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-name", NULL, NULL, - NULL, -1, Tk_Offset(TkTextEmbImage, imageName), + NULL, TCL_INDEX_NONE, offsetof(TkTextEmbImage, imageName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextImageCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -125,7 +125,7 @@ TkTextImageCmd( * objv[1] is "image". */ { int idx; - register TkTextSegment *eiPtr; + TkTextSegment *eiPtr; TkTextIndex index; static const char *const optionStrings[] = { "cget", "configure", "create", "names", NULL @@ -242,7 +242,7 @@ TkTextImageCmd( * Create the new image segment and initialize it. */ - eiPtr = ckalloc(EI_SEG_SIZE); + eiPtr = (TkTextSegment *)ckalloc(EI_SEG_SIZE); eiPtr->typePtr = &tkTextEmbImageType; eiPtr->size = 1; eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr; @@ -287,7 +287,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), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -389,7 +389,7 @@ EmbImageConfigure( len = strlen(name); for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - char *haveName = + char *haveName = (char *) Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr); if (strncmp(name, haveName, len) == 0) { @@ -419,7 +419,7 @@ EmbImageConfigure( &dummy); Tcl_SetHashValue(hPtr, eiPtr); Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, -1)); - eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1); + eiPtr->body.ei.name = (char *)ckalloc(Tcl_DStringLength(&newName) + 1); strcpy(eiPtr->body.ei.name, name); Tcl_DStringFree(&newName); @@ -444,7 +444,6 @@ EmbImageConfigure( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int EmbImageDeleteProc( TkTextSegment *eiPtr, /* Segment being deleted. */ @@ -454,6 +453,8 @@ EmbImageDeleteProc( * up. */ { Tcl_HashEntry *hPtr; + (void)linePtr; + (void)treeGone; if (eiPtr->body.ei.image != NULL) { hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable, @@ -527,7 +528,6 @@ EmbImageCleanupProc( *-------------------------------------------------------------- */ - /*ARGSUSED*/ static int EmbImageLayoutProc( TkText *textPtr, /* Text widget being layed out. */ @@ -544,12 +544,15 @@ EmbImageLayoutProc( TkWrapMode wrapMode, /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { int width, height; + (void)indexPtr; + (void)maxChars; + (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbImageLayoutProc"); @@ -621,6 +624,8 @@ EmbImageCheckProc( TkTextSegment *eiPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + if (eiPtr->nextPtr == NULL) { Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line"); } @@ -665,9 +670,11 @@ EmbImageDisplayProc( int screenY) /* Y-coordinate in text window that * corresponds to y. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; int lineX, imageX, imageY, width, height; Tk_Image image; + (void)display; + (void)screenY; image = eiPtr->body.ei.image; if (image == NULL) { @@ -729,8 +736,10 @@ EmbImageBboxProc( int *heightPtr) /* Gets filled in with height of image, in * pixels. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; Tk_Image image; + (void)textPtr; + (void)index; image = eiPtr->body.ei.image; if (image != NULL) { @@ -794,7 +803,7 @@ TkTextImageIndex( if (hPtr == NULL) { return 0; } - eiPtr = Tcl_GetHashValue(hPtr); + eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); @@ -828,8 +837,14 @@ EmbImageProc( int imgWidth, int imgHeight)/* New dimensions of image. */ { - TkTextSegment *eiPtr = clientData; + TkTextSegment *eiPtr = (TkTextSegment *)clientData; TkTextIndex index; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; index.tree = eiPtr->body.ei.sharedTextPtr->tree; index.linePtr = eiPtr->body.ei.linePtr; |