diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-01-11 15:35:39 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-01-11 15:35:39 (GMT) |
commit | a7b45de808c4bca805fab7b4eb90aa6e6f09e2ac (patch) | |
tree | 9afda096b9165b4f20fb70975876d2bf0c1c2c29 | |
parent | a46a8df372318c40d2d0c346578eef7412a7b257 (diff) | |
download | tk-a7b45de808c4bca805fab7b4eb90aa6e6f09e2ac.zip tk-a7b45de808c4bca805fab7b4eb90aa6e6f09e2ac.tar.gz tk-a7b45de808c4bca805fab7b4eb90aa6e6f09e2ac.tar.bz2 |
Many minute fixes to reduce number of minor warnings from GCC.
32 files changed, 319 insertions, 285 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index b0dbcef..970c253 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -32,7 +32,7 @@ * This file also contains code from miGIF. See lower down in file for the * applicable copyright notice for that portion. * - * RCS: @(#) $Id: tkImgGIF.c,v 1.33 2006/07/20 06:24:16 das Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.34 2007/01/11 15:35:39 dkf Exp $ */ /* @@ -1857,10 +1857,10 @@ writeBlock( static void blockOut( miGIFState_t *statePtr, - unsigned char c) + unsigned c) { DEBUGMSG(("blockOut %s\n", binformat(c, 8))); - statePtr->oblock[statePtr->oblen++] = c; + statePtr->oblock[statePtr->oblen++] = (unsigned char) c; if (statePtr->oblen >= 255) { writeBlock(statePtr); } @@ -1887,7 +1887,7 @@ output( statePtr->obuf |= val << statePtr->obits; statePtr->obits += statePtr->outputBits; while (statePtr->obits >= 8) { - blockOut(statePtr, UCHAR(statePtr->obuf & 0xff)); + blockOut(statePtr, statePtr->obuf & 0xff); statePtr->obuf >>= 8; statePtr->obits -= 8; } @@ -1901,7 +1901,7 @@ outputFlush( { DEBUGMSG(("outputFlush\n")); if (statePtr->obits > 0) { - blockOut(statePtr, UCHAR(statePtr->obuf)); + blockOut(statePtr, statePtr->obuf); } blockFlush(statePtr); } @@ -1958,7 +1958,7 @@ isqrt( } } -static unsigned int +static int computeTriangleCount( unsigned int count, unsigned int nrepcodes) @@ -1983,7 +1983,7 @@ computeTriangleCount( } cost += n; } - return cost; + return (int) cost + 1; } static void @@ -2052,7 +2052,8 @@ runlengthFlushClearOrRep( int withclr; DEBUGMSG(("runlengthFlushClearOrRep %d\n", count)); - withclr = 1 + computeTriangleCount(count, statePtr->maxOcodes); + withclr = computeTriangleCount((unsigned) count, + (unsigned) statePtr->maxOcodes); if (withclr < count) { output(statePtr, statePtr->codeClear); didClear(statePtr); @@ -2080,11 +2081,12 @@ runlengthFlushWithTable( if (statePtr->outputCount+repmax+repleft > statePtr->maxOcodes) { repmax = statePtr->maxOcodes - statePtr->outputCount; leftover = count - (repmax * statePtr->runlengthTableMax); - repleft = 1 + computeTriangleCount(leftover, statePtr->maxOcodes); + repleft = computeTriangleCount((unsigned) leftover, + (unsigned) statePtr->maxOcodes); } DEBUGMSG(("runlengthFlushWithTable repmax=%d leftover=%d repleft=%d\n", repmax, leftover, repleft)); - if (1+(int)computeTriangleCount(count, statePtr->maxOcodes) + if (computeTriangleCount((unsigned) count, (unsigned) statePtr->maxOcodes) < repmax+repleft) { output(statePtr, statePtr->codeClear); didClear(statePtr); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index f5c3e2b..5838ef5 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.67 2007/01/03 04:10:54 nijtmans Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.68 2007/01/11 15:35:39 dkf Exp $ */ #include "tkInt.h" @@ -4907,9 +4907,10 @@ Tk_PhotoPutZoomedBlock( TkDestroyRegion(workRgn); } - TkpBuildRegionFromAlphaData(masterPtr->validRegion, x,y, width,height, + TkpBuildRegionFromAlphaData(masterPtr->validRegion, + (unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height, &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4, - masterPtr->width * 4); + (unsigned) masterPtr->width * 4); } else { rect.x = x; rect.y = y; diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c index 708a374..3c1accf 100644 --- a/generic/tkImgUtil.c +++ b/generic/tkImgUtil.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkImgUtil.c,v 1.4 2005/11/15 15:18:21 dkf Exp $ + * RCS: @(#) $Id: tkImgUtil.c,v 1.5 2007/01/11 15:35:39 dkf Exp $ */ #include "tkInt.h" @@ -58,7 +58,7 @@ TkAlignImageData( dataWidth += (alignment - (dataWidth % alignment)); } - data = ckalloc(dataWidth * image->height); + data = ckalloc((unsigned) dataWidth * image->height); destPtr = data; for (i = 0; i < image->height; i++) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index d626520..b96542e 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.60 2006/10/17 23:44:45 hobbs Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.61 2007/01/11 15:35:39 dkf Exp $ */ #include "tkPort.h" @@ -5738,8 +5738,8 @@ TkTextYviewCmd( register CONST char *switchStr = Tcl_GetStringFromObj(objv[2], &switchLength); - if ((switchLength >= 2) - && (strncmp(switchStr, "-pickplace", switchLength) == 0)) { + if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", + (unsigned) switchLength) == 0)) { pickPlace = 1; if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "lineNum|index"); @@ -7058,13 +7058,10 @@ TkTextCharLayoutProc( bciPtr->width = 0; ciPtr = &bciPtr->ci; - } else { - bciPtr = (BaseCharInfo*) baseCharChunkPtr->clientData; ciPtr = (CharInfo*) ckalloc(sizeof(CharInfo)); baseString = &bciPtr->baseChars; - } lineOffset = Tcl_DStringLength(baseString); @@ -7076,20 +7073,19 @@ TkTextCharLayoutProc( ciPtr->chars = NULL; ciPtr->numBytes = 0; - bytesThatFit = CharChunkMeasureChars( - chunkPtr, line, lineOffset + maxBytes, lineOffset, -1, - chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); + bytesThatFit = CharChunkMeasureChars(chunkPtr, line, + lineOffset + maxBytes, lineOffset, -1, chunkPtr->x, maxX, + TK_ISOLATE_END, &nextX); #else /* !TK_LAYOUT_WITH_BASE_CHUNKS */ - bytesThatFit = CharChunkMeasureChars( - chunkPtr, p, maxBytes, 0, -1, - chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); + bytesThatFit = CharChunkMeasureChars(chunkPtr, p, maxBytes, 0, -1, + chunkPtr->x, maxX, TK_ISOLATE_END, &nextX); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (bytesThatFit < maxBytes) { if ((bytesThatFit == 0) && noCharsYet) { Tcl_UniChar ch; int chLen = Tcl_UtfToUniChar(p, &ch); - + #if TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars( chunkPtr, line, lineOffset + chLen, lineOffset, -1, @@ -7154,10 +7150,10 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = (CharInfo *) ckalloc( - bytesThatFit + Tk_Offset(CharInfo,chars) +1); + ciPtr = (CharInfo *) + ckalloc((unsigned) bytesThatFit + Tk_Offset(CharInfo, chars) + 1); chunkPtr->clientData = (ClientData) ciPtr; - memcpy(ciPtr->chars, p, bytesThatFit); + memcpy(ciPtr->chars, p, (unsigned) bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ ciPtr->numBytes = bytesThatFit; diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 188e8a0..0638e52 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClamTheme.c,v 1.3 2006/12/13 17:06:32 jenglish Exp $ + * $Id: ttkClamTheme.c,v 1.4 2007/01/11 15:35:39 dkf Exp $ * * Copyright (C) 2004 Joe English * @@ -324,16 +324,22 @@ RadioIndicatorElementDraw( Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); - XFillArc(Tk_Display(tkwin),d,gcb, b.x,b.y,b.width,b.height, 0,360*64); - XDrawArc(Tk_Display(tkwin),d,gcl, b.x,b.y,b.width,b.height, 225*64,180*64); - XDrawArc(Tk_Display(tkwin),d,gcu, b.x,b.y,b.width,b.height, 45*64,180*64); + XFillArc(Tk_Display(tkwin),d,gcb, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 0,360*64); + XDrawArc(Tk_Display(tkwin),d,gcl, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 225*64,180*64); + XDrawArc(Tk_Display(tkwin),d,gcu, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 45*64,180*64); if (state & TTK_STATE_SELECTED) { b = Ttk_PadBox(b,Ttk_UniformPadding(3)); - XFillArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); - XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); + XFillArc(Tk_Display(tkwin),d,gcf, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 0,360*64); + XDrawArc(Tk_Display(tkwin),d,gcf, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 0,360*64); #if WIN32_XDRAWLINE_HACK - XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 300*64,360*64); + XDrawArc(Tk_Display(tkwin),d,gcf, + b.x,b.y,(unsigned)b.width,(unsigned)b.height, 300*64,360*64); #endif } } @@ -355,9 +361,10 @@ CheckIndicatorElementDraw( Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); - XFillRectangle(display,d,gcb, b.x,b.y,b.width,b.height); - XDrawLine(display,d,gcl,b.x,b.y+b.height,b.x+b.width+w,b.y+b.height);/*S*/ - XDrawLine(display,d,gcl,b.x+b.width,b.y,b.x+b.width,b.y+b.height+w); /*E*/ + XFillRectangle(display,d,gcb, b.x,b.y, + (unsigned)b.width,(unsigned)b.height); + XDrawLine(display,d,gcl, b.x,b.y+b.height,b.x+b.width+w,b.y+b.height);/*S*/ + XDrawLine(display,d,gcl, b.x+b.width,b.y,b.x+b.width,b.y+b.height+w); /*E*/ XDrawLine(display,d,gcu,b.x,b.y, b.x,b.y+b.height+w); /*W*/ XDrawLine(display,d,gcu,b.x,b.y, b.x+b.width+w,b.y); /*N*/ @@ -586,8 +593,10 @@ static void TroughElementDraw( ScrollbarElement *sb = elementRecord; GC gcb = Ttk_GCForColor(tkwin,sb->borderColorObj,d); GC gct = Ttk_GCForColor(tkwin,sb->troughColorObj,d); - XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, b.width-1, b.height-1); - XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, b.width-1, b.height-1); + XFillRectangle(Tk_Display(tkwin), d, gct, b.x, b.y, + (unsigned)b.width-1, (unsigned)b.height-1); + XDrawRectangle(Tk_Display(tkwin), d, gcb, b.x, b.y, + (unsigned)b.width-1, (unsigned)b.height-1); } static Ttk_ElementSpec TroughElementSpec = { @@ -619,10 +628,10 @@ static void ThumbElementDraw( const int w = WIN32_XDRAWLINE_HACK; DrawSmoothBorder(tkwin, d, b, - sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); - XFillRectangle( - Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), - b.x+2, b.y+2, b.width-4, b.height-4); + sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); + XFillRectangle(Tk_Display(tkwin), d, + BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, + (unsigned)b.width-4, (unsigned)b.height-4); /* * Draw grip: @@ -631,7 +640,7 @@ static void ThumbElementDraw( Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); - + if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + b.width / 2 - gripCount; @@ -709,14 +718,14 @@ static void PbarElementDraw( Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; - + b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, - sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); - XFillRectangle(Tk_Display(tkwin), d, - BackgroundGC(tkwin, sb->backgroundObj), - b.x+2, b.y+2, b.width-4, b.height-4); + sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); + XFillRectangle(Tk_Display(tkwin), d, + BackgroundGC(tkwin, sb->backgroundObj), + b.x+2, b.y+2, (unsigned)b.width-4, (unsigned)b.height-4); } } @@ -754,11 +763,11 @@ static void ArrowElementDraw( int h, cx, cy; DrawSmoothBorder(tkwin, d, b, - sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); + sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle( - Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), - b.x+2, b.y+2, b.width-4, b.height-4); + Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), + b.x+2, b.y+2, (unsigned)b.width-4, (unsigned)b.height-4); b = Ttk_PadBox(b, Ttk_UniformPadding(3)); h = b.width < b.height ? b.width : b.height; diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 966451e..c27591c 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1,4 +1,4 @@ -/* $Id: ttkDefaultTheme.c,v 1.5 2006/11/21 02:21:27 jenglish Exp $ +/* $Id: ttkDefaultTheme.c,v 1.6 2007/01/11 15:35:40 dkf Exp $ * * Copyright (c) 2003, Joe English * @@ -297,8 +297,8 @@ BorderElementDraw( if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); - XDrawRectangle(Tk_Display(tkwin), d, gc, - b.x, b.y, b.width-1, b.height-1); + XDrawRectangle(Tk_Display(tkwin), d, gc, + b.x, b.y, (unsigned)b.width-1, (unsigned)b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { /* Space for default ring: */ @@ -578,11 +578,12 @@ static void IndicatorElementDraw( /* * Copy onto our target drawable surface. */ + memset(&gcValues, 0, sizeof(gcValues)); copyGC = Tk_GetGC(tkwin, 0, &gcValues); TkPutImage(NULL, 0, display, d, copyGC, img, 0, 0, b.x, b.y, - spec->width, spec->height); + (unsigned)spec->width, (unsigned)spec->height); /* * Tidy up. @@ -1084,7 +1085,7 @@ static void TreeitemIndicatorDraw( b = Ttk_PadBox(b, padding); XDrawRectangle(Tk_Display(tkwin), d, gc, - b.x, b.y, b.width - 1, b.height - 1); + b.x, b.y, (unsigned)b.width - 1, (unsigned)b.height - 1); cx = b.x + (b.width - 1) / 2; cy = b.y + (b.height - 1) / 2; diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 171058a..cb2c5b5 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -1,4 +1,4 @@ -/* $Id: ttkElements.c,v 1.4 2006/12/14 19:51:03 jenglish Exp $ +/* $Id: ttkElements.c,v 1.5 2007/01/11 15:35:40 dkf Exp $ * * Copyright (c) 2003, Joe English * @@ -84,7 +84,7 @@ BackgroundElementDraw( XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), - 0,0, Tk_Width(tkwin), Tk_Height(tkwin)); + 0,0, (unsigned)Tk_Width(tkwin), (unsigned)Tk_Height(tkwin)); } static Ttk_ElementSpec BackgroundElementSpec = @@ -297,7 +297,8 @@ static void DrawFocusRing( mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; gc = Tk_GetGC(tkwin, mask, &gcvalues); - XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); + XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, + (unsigned)b.width-1, (unsigned)b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 1d4d765..6ac910a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1,5 +1,5 @@ /* - * $Id: ttkEntry.c,v 1.6 2007/01/11 14:49:47 jenglish Exp $ + * $Id: ttkEntry.c,v 1.7 2007/01/11 15:35:40 dkf Exp $ * * DERIVED FROM: tk/generic/tkEntry.c r1.35. * @@ -293,7 +293,7 @@ static char *EntryDisplayString(const char *showChar, int numChars) Tcl_UtfToUniChar(showChar, &ch); size = Tcl_UniCharToUtf(ch, buf); - p = displayString = ckalloc(numChars * size + 1); + p = displayString = ckalloc((unsigned)numChars * size + 1); while (numChars--) { p += Tcl_UniCharToUtf(ch, p); @@ -710,7 +710,7 @@ static void EntryStoreValue(Entry *entryPtr, const char *value) { size_t numBytes = strlen(value); - int numChars = Tcl_NumUtfChars(value, numBytes); + int numChars = Tcl_NumUtfChars(value, (int)numBytes); if (entryPtr->core.flags & VALIDATING) entryPtr->core.flags |= VALIDATION_SET_VALUE; @@ -811,7 +811,7 @@ InsertChars( char *string = entryPtr->entry.string; size_t byteIndex = Tcl_UtfAtIndex(string, index) - string; size_t byteCount = strlen(value); - int charsAdded = Tcl_NumUtfChars(value, byteCount); + int charsAdded = Tcl_NumUtfChars(value, (int)byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; char *new; int code; @@ -1245,8 +1245,9 @@ static void EntryDisplay(void *clientData, Drawable d) Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight); gc = EntryGetGC(entryPtr, es.insertColorObj); - XFillRectangle(Tk_Display(tkwin), d, gc, - cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight); + XFillRectangle(Tk_Display(tkwin), d, gc, + cursorX-cursorWidth/2, cursorY, + (unsigned)cursorWidth, (unsigned)cursorHeight); Tk_FreeGC(Tk_Display(tkwin), gc); } @@ -1297,13 +1298,13 @@ EntryIndex( int length; const char *string = Tcl_GetStringFromObj(indexObj, &length); - if (strncmp(string, "end", length) == 0) { + if (strncmp(string, "end", (unsigned) length) == 0) { *indexPtr = entryPtr->entry.numChars; - } else if (strncmp(string, "insert", length) == 0) { + } else if (strncmp(string, "insert", (unsigned) length) == 0) { *indexPtr = entryPtr->entry.insertPos; - } else if (strncmp(string, "left", length) == 0) { /* for debugging */ + } else if (strncmp(string, "left", (unsigned) length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.first; - } else if (strncmp(string, "right", length) == 0) { /* for debugging */ + } else if (strncmp(string, "right", (unsigned) length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.last; } else if (strncmp(string, "sel.", 4) == 0) { if (entryPtr->entry.selectFirst < 0) { @@ -1312,9 +1313,9 @@ EntryIndex( Tk_PathName(entryPtr->core.tkwin), NULL); return TCL_ERROR; } - if (strncmp(string, "sel.first", length) == 0) { + if (strncmp(string, "sel.first", (unsigned) length) == 0) { *indexPtr = entryPtr->entry.selectFirst; - } else if (strncmp(string, "sel.last", length) == 0) { + } else if (strncmp(string, "sel.last", (unsigned) length) == 0) { *indexPtr = entryPtr->entry.selectLast; } else { goto badIndex; diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 777c10b..debe10c 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -1,4 +1,4 @@ -/* $Id: ttkLabel.c,v 1.5 2006/12/25 17:16:28 jenglish Exp $ +/* $Id: ttkLabel.c,v 1.6 2007/01/11 15:35:40 dkf Exp $ * * text, image, and label elements. * @@ -233,7 +233,8 @@ static void ImageTextElementDraw( return; XFillRectangle(Tk_Display(tkwin), d, - Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); + Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC), b.x, b.y, + (unsigned)b.width, (unsigned)b.height); TextDraw(text, tkwin, d, b); TextCleanup(text); @@ -334,7 +335,8 @@ static void StippleOver( gcvalues.fill_style = FillStippled; gcvalues.stipple = stipple; gc = Tk_GetGC(tkwin, mask, &gcvalues); - XFillRectangle(Tk_Display(tkwin),d,gc,x,y,image->width,image->height); + XFillRectangle(Tk_Display(tkwin),d,gc,x,y, + (unsigned)image->width,(unsigned)image->height); Tk_FreeGC(Tk_Display(tkwin), gc); Tk_FreeBitmapFromObj(tkwin, image->stippleObj); } diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index ef4f7b1..55e29f2 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -5,7 +5,7 @@ * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkLayout.c,v 1.5 2006/12/10 19:19:44 jenglish Exp $ + * $Id: ttkLayout.c,v 1.6 2007/01/11 15:35:40 dkf Exp $ */ #include <string.h> @@ -1073,7 +1073,7 @@ static void Ttk_DrawNodeList( for (; node; node = node->next) { int border = node->flags & TTK_BORDER; - int substate = state; + Ttk_State substate = state; if (node->flags & TTK_UNIT) substate |= node->state; diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index e41b36d..378e3cc 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -1,4 +1,4 @@ -/* $Id: ttkManager.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkManager.c,v 1.2 2007/01/11 15:35:40 dkf Exp $ * * Copyright 2005, Joe English. Freely redistributable. * @@ -121,7 +121,7 @@ static void ManagerIdleProc(ClientData clientData) * Recompute slave layout when master widget is resized. * Keep the slave's map state in sync with the master's. */ -static const int ManagerEventMask = StructureNotifyMask; +static const unsigned ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) { Ttk_Manager *mgr = clientData; @@ -221,16 +221,16 @@ Ttk_Manager *Ttk_CreateManager( mgr->slaves = NULL; mgr->flags = 0; - Tk_CreateEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + Tk_CreateEventHandler(mgr->masterWindow, ManagerEventMask, + ManagerEventHandler, mgr); return mgr; } void Ttk_DeleteManager(Ttk_Manager *mgr) { - Tk_DeleteEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + Tk_DeleteEventHandler(mgr->masterWindow, ManagerEventMask, + ManagerEventHandler, mgr); while (mgr->nSlaves > 0) { Ttk_ForgetSlave(mgr, mgr->nSlaves - 1); @@ -386,12 +386,12 @@ int Ttk_ConfigureSlave( /* ASSERT: mgr->slaveOptionTable != NULL */ if (Tk_SetOptions(interp, slave->slaveData, mgr->slaveOptionTable, - objc, objv, slave->slaveWindow, &savedOptions, &mask) != TCL_OK) - { + objc, objv, slave->slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } - if (mgr->managerSpec->SlaveConfigured(interp,mgr,slave,mask) != TCL_OK) { + if (mgr->managerSpec->SlaveConfigured(interp, mgr, slave, + (unsigned)mask) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index cd5847e..43aa541 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1,4 +1,4 @@ -/* $Id: ttkNotebook.c,v 1.6 2007/01/11 14:49:47 jenglish Exp $ +/* $Id: ttkNotebook.c,v 1.7 2007/01/11 15:35:40 dkf Exp $ * Copyright (c) 2004, Joe English * * NOTE-ACTIVE: activeTabIndex is not always correct (it's @@ -672,18 +672,15 @@ static Ttk_ManagerSpec NotebookManagerSpec = /* NotebookEventHandler -- * Tracks the active tab. */ -static const int NotebookEventMask - = StructureNotifyMask - | PointerMotionMask - | LeaveWindowMask - ; +static const unsigned NotebookEventMask = + StructureNotifyMask | PointerMotionMask | LeaveWindowMask; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { Notebook *nb = clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ - Tk_DeleteEventHandler(nb->core.tkwin, - NotebookEventMask, NotebookEventHandler, clientData); + Tk_DeleteEventHandler(nb->core.tkwin, NotebookEventMask, + NotebookEventHandler, clientData); } else if (eventPtr->type == MotionNotify) { int index = IdentifyTab(nb, eventPtr->xmotion.x, eventPtr->xmotion.y); ActivateTab(nb, index); diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index dd4d3a4..ce776b6 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -1,4 +1,4 @@ -/* $Id: ttkTagSet.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkTagSet.c,v 1.2 2007/01/11 15:35:40 dkf Exp $ * * Ttk widget set: tag tables. Half-baked, work in progress. * @@ -31,8 +31,8 @@ struct TtkTagTable { static Ttk_Tag NewTag(Ttk_TagTable tagTable) { Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag)); - tag->tagRecord = (Tcl_Obj **)ckalloc(tagTable->tagRecordSize); - memset(tag->tagRecord, 0, tagTable->tagRecordSize); + tag->tagRecord = (Tcl_Obj **)ckalloc((unsigned) tagTable->tagRecordSize); + memset(tag->tagRecord, 0, (unsigned) tagTable->tagRecordSize); return tag; } diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 305445d..f1c4e9f 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * $Id: ttkTheme.c,v 1.4 2006/12/10 19:19:44 jenglish Exp $ + * $Id: ttkTheme.c,v 1.5 2007/01/11 15:35:40 dkf Exp $ */ #include <stdlib.h> @@ -1015,7 +1015,7 @@ int InitializeElementRecord( *dest = styleDefault ? styleDefault : elementDefault; } - if (!AllocateResource(cache, tkwin, dest, elementOption->type)) { + if (!AllocateResource(cache, tkwin, dest, (int) elementOption->type)) { return 0; } } diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 07a1b71..a7a9b18 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,4 +1,4 @@ -/* $Id: ttkTreeview.c,v 1.12 2007/01/11 14:49:47 jenglish Exp $ +/* $Id: ttkTreeview.c,v 1.13 2007/01/11 15:35:40 dkf Exp $ * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. @@ -1012,7 +1012,7 @@ static int TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) tv->tree.nColumns = tv->tree.nDisplayColumns = 0; tv->tree.columns = NULL; tv->tree.displayColumns = NULL; - tv->tree.showFlags = ~0; + tv->tree.showFlags = ~(unsigned)0; InitColumn(&tv->tree.column0); Tk_InitOptions( @@ -3180,7 +3180,7 @@ static void RowElementDraw( XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj); GC gc = Tk_GCForColor(color, d); XFillRectangle(Tk_Display(tkwin), d, gc, - b.x, b.y, b.width, b.height); + b.x, b.y, (unsigned)b.width, (unsigned)b.height); } static Ttk_ElementSpec RowElementSpec = diff --git a/win/tkWinButton.c b/win/tkWinButton.c index c79aff8..7a1ed35 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinButton.c,v 1.30 2006/12/19 19:51:06 hobbs Exp $ + * RCS: @(#) $Id: tkWinButton.c,v 1.31 2007/01/11 15:35:40 dkf Exp $ */ #define OEMRESOURCE @@ -725,9 +725,10 @@ TkpDisplayButton( border, TK_3D_FLAT_GC)); dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state); - StretchDIBits(dc, x, y, tsdPtr->boxWidth, tsdPtr->boxHeight, xSrc, - ySrc, tsdPtr->boxWidth, tsdPtr->boxHeight, tsdPtr->boxesBits, - (LPBITMAPINFO) tsdPtr->boxesPtr, DIB_RGB_COLORS, SRCCOPY); + StretchDIBits(dc, x, y, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight, + xSrc, ySrc, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight, + tsdPtr->boxesBits, (LPBITMAPINFO) tsdPtr->boxesPtr, + DIB_RGB_COLORS, SRCCOPY); TkWinReleaseDrawableDC(pixmap, dc, &state); } @@ -781,15 +782,15 @@ TkpDisplayButton( if (defaultWidth != 0) { dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state); TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth, - butPtr->highlightColorPtr->pixel); + (int) butPtr->highlightColorPtr->pixel); TkWinFillRect(dc, 0, 0, defaultWidth, Tk_Height(tkwin), - butPtr->highlightColorPtr->pixel); + (int) butPtr->highlightColorPtr->pixel); TkWinFillRect(dc, 0, Tk_Height(tkwin) - defaultWidth, Tk_Width(tkwin), defaultWidth, - butPtr->highlightColorPtr->pixel); + (int) butPtr->highlightColorPtr->pixel); TkWinFillRect(dc, Tk_Width(tkwin) - defaultWidth, 0, defaultWidth, Tk_Height(tkwin), - butPtr->highlightColorPtr->pixel); + (int) butPtr->highlightColorPtr->pixel); TkWinReleaseDrawableDC(pixmap, dc, &state); } @@ -1083,6 +1084,8 @@ TkpComputeButtonGeometry( height = imgHeight; } break; + case COMPOUND_NONE: + break; } /* switch */ /* diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index bb91f4d..093280c 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinClipboard.c,v 1.8 2005/12/02 00:19:04 dkf Exp $ + * RCS: @(#) $Id: tkWinClipboard.c,v 1.9 2007/01/11 15:35:40 dkf Exp $ */ #include "tkWinInt.h" @@ -275,7 +275,7 @@ TkWinClipboardRender( * Copy the data and change EOL characters. */ - buffer = rawText = ckalloc(length + 1); + buffer = rawText = ckalloc((unsigned)length + 1); if (targetPtr != NULL) { for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL; cbPtr = cbPtr->nextPtr) { @@ -300,13 +300,14 @@ TkWinClipboardRender( Tcl_UtfToUniCharDString(rawText, -1, &ds); ckfree(rawText); handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, - Tcl_DStringLength(&ds)+2); + (unsigned) Tcl_DStringLength(&ds) + 2); if (!handle) { Tcl_DStringFree(&ds); return; } buffer = GlobalLock(handle); - memcpy(buffer, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds) + 2); + memcpy(buffer, Tcl_DStringValue(&ds), + (unsigned) Tcl_DStringLength(&ds) + 2); GlobalUnlock(handle); Tcl_DStringFree(&ds); SetClipboardData(CF_UNICODETEXT, handle); @@ -314,13 +315,14 @@ TkWinClipboardRender( Tcl_UtfToExternalDString(NULL, rawText, -1, &ds); ckfree(rawText); handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, - Tcl_DStringLength(&ds)+1); + (unsigned) Tcl_DStringLength(&ds) + 1); if (!handle) { Tcl_DStringFree(&ds); return; } buffer = GlobalLock(handle); - memcpy(buffer, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds) + 1); + memcpy(buffer, Tcl_DStringValue(&ds), + (unsigned) Tcl_DStringLength(&ds) + 1); GlobalUnlock(handle); Tcl_DStringFree(&ds); SetClipboardData(CF_TEXT, handle); diff --git a/win/tkWinColor.c b/win/tkWinColor.c index 911a4d1..1972695 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinColor.c,v 1.10 2005/12/02 13:42:29 dkf Exp $ + * RCS: @(#) $Id: tkWinColor.c,v 1.11 2007/01/11 15:35:40 dkf Exp $ */ #include "tkWinInt.h" @@ -38,33 +38,33 @@ typedef struct { } SystemColorEntry; static SystemColorEntry sysColors[] = { - "3dDarkShadow", COLOR_3DDKSHADOW, - "3dLight", COLOR_3DLIGHT, - "ActiveBorder", COLOR_ACTIVEBORDER, - "ActiveCaption", COLOR_ACTIVECAPTION, - "AppWorkspace", COLOR_APPWORKSPACE, - "Background", COLOR_BACKGROUND, - "ButtonFace", COLOR_BTNFACE, - "ButtonHighlight", COLOR_BTNHIGHLIGHT, - "ButtonShadow", COLOR_BTNSHADOW, - "ButtonText", COLOR_BTNTEXT, - "CaptionText", COLOR_CAPTIONTEXT, - "DisabledText", COLOR_GRAYTEXT, - "GrayText", COLOR_GRAYTEXT, - "Highlight", COLOR_HIGHLIGHT, - "HighlightText", COLOR_HIGHLIGHTTEXT, - "InactiveBorder", COLOR_INACTIVEBORDER, - "InactiveCaption", COLOR_INACTIVECAPTION, - "InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT, - "InfoBackground", COLOR_INFOBK, - "InfoText", COLOR_INFOTEXT, - "Menu", COLOR_MENU, - "MenuText", COLOR_MENUTEXT, - "Scrollbar", COLOR_SCROLLBAR, - "Window", COLOR_WINDOW, - "WindowFrame", COLOR_WINDOWFRAME, - "WindowText", COLOR_WINDOWTEXT, - NULL, 0 + {"3dDarkShadow", COLOR_3DDKSHADOW}, + {"3dLight", COLOR_3DLIGHT}, + {"ActiveBorder", COLOR_ACTIVEBORDER}, + {"ActiveCaption", COLOR_ACTIVECAPTION}, + {"AppWorkspace", COLOR_APPWORKSPACE}, + {"Background", COLOR_BACKGROUND}, + {"ButtonFace", COLOR_BTNFACE}, + {"ButtonHighlight", COLOR_BTNHIGHLIGHT}, + {"ButtonShadow", COLOR_BTNSHADOW}, + {"ButtonText", COLOR_BTNTEXT}, + {"CaptionText", COLOR_CAPTIONTEXT}, + {"DisabledText", COLOR_GRAYTEXT}, + {"GrayText", COLOR_GRAYTEXT}, + {"Highlight", COLOR_HIGHLIGHT}, + {"HighlightText", COLOR_HIGHLIGHTTEXT}, + {"InactiveBorder", COLOR_INACTIVEBORDER}, + {"InactiveCaption", COLOR_INACTIVECAPTION}, + {"InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT}, + {"InfoBackground", COLOR_INFOBK}, + {"InfoText", COLOR_INFOTEXT}, + {"Menu", COLOR_MENU}, + {"MenuText", COLOR_MENUTEXT}, + {"Scrollbar", COLOR_SCROLLBAR}, + {"Window", COLOR_WINDOW}, + {"WindowFrame", COLOR_WINDOWFRAME}, + {"WindowText", COLOR_WINDOWTEXT}, + {NULL, 0} }; typedef struct ThreadSpecificData { diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 9183f20..1da6aae 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinDialog.c,v 1.43 2005/12/02 00:19:04 dkf Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.44 2007/01/11 15:35:40 dkf Exp $ * */ @@ -1460,7 +1460,7 @@ MakeFilter( if (valuePtr == NULL) { len = 0; } else { - CONST char* string = Tcl_GetStringFromObj(valuePtr, &len); + (void) Tcl_GetStringFromObj(valuePtr, &len); } /* diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index d351a0f..8c736ab 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinDraw.c,v 1.17 2005/12/02 13:42:29 dkf Exp $ + * RCS: @(#) $Id: tkWinDraw.c,v 1.18 2007/01/11 15:35:40 dkf Exp $ */ #include "tkWinInt.h" @@ -325,8 +325,8 @@ XCopyArea( OffsetClipRgn(destDC, gc->clip_x_origin, gc->clip_y_origin); } - BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y, - tkpWinBltModes[gc->function]); + BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC, + src_x, src_y, (DWORD) tkpWinBltModes[gc->function]); SelectClipRgn(destDC, NULL); @@ -399,8 +399,8 @@ XCopyPlane( SetBkMode(destDC, OPAQUE); SetBkColor(destDC, gc->foreground); SetTextColor(destDC, gc->background); - BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y, - SRCCOPY); + BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC, + src_x, src_y, SRCCOPY); SelectClipRgn(destDC, NULL); } else if (clipPtr->type == TKP_CLIP_PIXMAP) { @@ -414,8 +414,8 @@ XCopyPlane( fgBrush = CreateSolidBrush(gc->foreground); oldBrush = SelectObject(destDC, fgBrush); - BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y, - MASKPAT); + BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC, + src_x, src_y, MASKPAT); SelectObject(destDC, oldBrush); DeleteObject(fgBrush); } else { @@ -435,7 +435,7 @@ XCopyPlane( maskDC = TkWinGetDrawableDC(display, clipPtr->value.pixmap, &maskState); memDC = CreateCompatibleDC(destDC); - bitmap = CreateBitmap(width, height, 1, 1, NULL); + bitmap = CreateBitmap((int) width, (int) height, 1, 1, NULL); SelectObject(memDC, bitmap); /* @@ -444,27 +444,28 @@ XCopyPlane( * destination. */ - BitBlt(memDC, 0, 0, width, height, srcDC, src_x, src_y, SRCCOPY); - BitBlt(memDC, 0, 0, width, height, maskDC, + BitBlt(memDC, 0, 0, (int) width, (int) height, srcDC, src_x, src_y, + SRCCOPY); + BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC, dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin, SRCAND); oldBrush = SelectObject(destDC, fgBrush); - BitBlt(destDC, dest_x, dest_y, width, height, memDC, 0, 0, - MASKPAT); + BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC, + 0, 0, MASKPAT); /* * Set background bits. Same as foreground, except we use ((NOT * source) AND mask) and the background brush. */ - BitBlt(memDC, 0, 0, width, height, srcDC, src_x, src_y, + BitBlt(memDC, 0, 0, (int) width, (int) height, srcDC, src_x, src_y, NOTSRCCOPY); - BitBlt(memDC, 0, 0, width, height, maskDC, + BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC, dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin, SRCAND); SelectObject(destDC, bgBrush); - BitBlt(destDC, dest_x, dest_y, width, height, memDC, 0, 0, - MASKPAT); + BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC, + 0, 0, MASKPAT); TkWinReleaseDrawableDC(clipPtr->value.pixmap, maskDC, &maskState); SelectObject(destDC, oldBrush); @@ -589,7 +590,8 @@ TkPutImage( return; } bitmap = SelectObject(dcMem, bitmap); - BitBlt(dc, dest_x, dest_y, width, height, dcMem, src_x, src_y, SRCCOPY); + BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y, + SRCCOPY); DeleteObject(SelectObject(dcMem, bitmap)); DeleteDC(dcMem); TkWinReleaseDrawableDC(d, dc, &state); @@ -972,7 +974,7 @@ XDrawRectangle( oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH)); SetROP2(dc, tkpWinRopModes[gc->function]); - Rectangle(dc, x, y, x+width+1, y+height+1); + Rectangle(dc, x, y, (int) x+width+1, (int) y+height+1); DeleteObject(SelectObject(dc, oldPen)); SelectObject(dc, oldBrush); @@ -1133,14 +1135,17 @@ DrawOrFillArc( */ SetBkMode(dc, TRANSPARENT); - Arc(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend); + Arc(dc, x, y, (int) (x+width+1), (int) (y+height+1), xstart, ystart, + xend, yend); } else { brush = CreateSolidBrush(gc->foreground); oldBrush = SelectObject(dc, brush); if (gc->arc_mode == ArcChord) { - Chord(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend); - } else if ( gc->arc_mode == ArcPieSlice ) { - Pie(dc, x, y, x+width+1, y+height+1, xstart, ystart, xend, yend); + Chord(dc, x, y, (int) (x+width+1), (int) (y+height+1), + xstart, ystart, xend, yend); + } else if (gc->arc_mode == ArcPieSlice) { + Pie(dc, x, y, (int) (x+width+1), (int) (y+height+1), + xstart, ystart, xend, yend); } DeleteObject(SelectObject(dc, oldBrush)); } @@ -1197,7 +1202,7 @@ SetUpGraphicsPort( style = PS_SOLID; } if (gc->line_width < 2) { - return CreatePen(style, gc->line_width, gc->foreground); + return CreatePen((int) style, gc->line_width, gc->foreground); } else { LOGBRUSH lb; @@ -1229,7 +1234,7 @@ SetUpGraphicsPort( style |= PS_JOIN_BEVEL; break; } - return ExtCreatePen(style, gc->line_width, &lb, 0, NULL); + return ExtCreatePen(style, (DWORD) gc->line_width, &lb, 0, NULL); } } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 564471d..7ae3db7 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinFont.c,v 1.28 2006/12/01 20:14:24 kennykb Exp $ + * RCS: @(#) $Id: tkWinFont.c,v 1.29 2007/01/11 15:35:40 dkf Exp $ */ #include "tkWinInt.h" @@ -1047,7 +1047,7 @@ Tk_DrawChars( MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent); BitBlt(dc, x, y - tm.tmAscent, size.cx, size.cy, dcMem, - 0, 0, tkpWinBltModes[gc->function]); + 0, 0, (DWORD) tkpWinBltModes[gc->function]); /* * Destroy the temporary bitmap and restore the device context. @@ -2463,7 +2463,8 @@ LoadFontRanges( } for (i = 0; i < cmapTable.numTables; i++) { offset = sizeof(cmapTable) + i * sizeof(encTable); - GetFontData(hdc, cmapKey, offset, &encTable, sizeof(encTable)); + GetFontData(hdc, cmapKey, (DWORD) offset, &encTable, + sizeof(encTable)); if (swapped) { SwapShort(&encTable.platform); SwapShort(&encTable.encoding); @@ -2482,7 +2483,7 @@ LoadFontRanges( continue; } - GetFontData(hdc, cmapKey, encTable.offset, &subTable, + GetFontData(hdc, cmapKey, (DWORD) encTable.offset, &subTable, sizeof(subTable)); if (swapped) { SwapShort(&subTable.any.format); @@ -2494,13 +2495,13 @@ LoadFontRanges( segCount = subTable.segment.segCountX2 / 2; cbData = segCount * sizeof(USHORT); - startCount = (USHORT *) ckalloc(cbData); - endCount = (USHORT *) ckalloc(cbData); + startCount = (USHORT *) ckalloc((unsigned)cbData); + endCount = (USHORT *) ckalloc((unsigned)cbData); offset = encTable.offset + sizeof(subTable.segment); - GetFontData(hdc, cmapKey, offset, endCount, cbData); + GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData); offset += cbData + sizeof(USHORT); - GetFontData(hdc, cmapKey, offset, startCount, cbData); + GetFontData(hdc, cmapKey, (DWORD) offset, startCount, cbData); if (swapped) { for (i = 0; i < segCount; i++) { SwapShort(&endCount[i]); @@ -2538,8 +2539,8 @@ LoadFontRanges( segCount = 1; cbData = segCount * sizeof(USHORT); - startCount = (USHORT *) ckalloc(cbData); - endCount = (USHORT *) ckalloc(cbData); + startCount = (USHORT *) ckalloc((unsigned) cbData); + endCount = (USHORT *) ckalloc((unsigned) cbData); startCount[0] = 0x0000; endCount[0] = 0x00ff; } diff --git a/win/tkWinImage.c b/win/tkWinImage.c index e07fcdf..dbced49 100644 --- a/win/tkWinImage.c +++ b/win/tkWinImage.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinImage.c,v 1.9 2005/12/02 00:19:04 dkf Exp $ + * RCS: @(#) $Id: tkWinImage.c,v 1.10 2007/01/11 15:35:40 dkf Exp $ */ #include "tkWinInt.h" @@ -315,7 +315,7 @@ XGetImageZPixmap( * Need to do a Blt operation to copy into a new bitmap. */ - hbmp = CreateCompatibleBitmap(hdc, width, height); + hbmp = CreateCompatibleBitmap(hdc, (int) width, (int) height); hdcMem = CreateCompatibleDC(hdc); hbmpPrev = SelectObject(hdcMem, hbmp); hPal = state.palette; @@ -332,7 +332,7 @@ XGetImageZPixmap( } } - ret = BitBlt(hdcMem, 0, 0, width, height, hdc, x, y, SRCCOPY); + ret = BitBlt(hdcMem, 0, 0, (int) width, (int) height, hdc, x, y, SRCCOPY); if (hPal) { SelectPalette(hdc, hPalPrev2, FALSE); } @@ -351,7 +351,7 @@ XGetImageZPixmap( if (depth <= 8) { size += sizeof(unsigned short) * (1 << depth); } - bmInfo = (BITMAPINFO *) ckalloc(size); + bmInfo = (BITMAPINFO *) ckalloc((unsigned)size); bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmInfo->bmiHeader.biWidth = width; @@ -376,7 +376,7 @@ XGetImageZPixmap( goto cleanup; } ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, data, - width, height, 32, ((width + 31) >> 3) & ~1); + width, height, 32, (int) ((width + 31) >> 3) & ~1); if (ret_image == NULL) { ckfree(data); goto cleanup; @@ -412,7 +412,7 @@ XGetImageZPixmap( goto cleanup; } ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, data, - width, height, 8, width); + width, height, 8, (int) width); if (ret_image == NULL) { ckfree((char *) data); goto cleanup; @@ -469,7 +469,7 @@ XGetImageZPixmap( goto cleanup; } ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, data, - width, height, 0, width * 4); + width, height, 0, (int) width * 4); if (ret_image == NULL) { ckfree((char *) data); goto cleanup; @@ -484,7 +484,7 @@ XGetImageZPixmap( unsigned char *smallBitData, *smallBitBase, *bigBitData; unsigned int byte_width, h, w; - byte_width = ((width * 3 + 3) & ~3); + byte_width = ((width * 3 + 3) & ~(unsigned)3); smallBitBase = ckalloc(byte_width * height); if (!smallBitBase) { ckfree((char *) ret_image->data); @@ -624,7 +624,7 @@ XGetImage( if (pixel == CLR_INVALID) { break; } - PutPixel(imagePtr, xx, yy, pixel); + PutPixel(imagePtr, (int) xx, (int) yy, pixel); } } @@ -662,7 +662,8 @@ XGetImage( imagePtr = XCreateImage(display, NULL, 1, XYBitmap, 0, NULL, width, height, 32, 0); - imagePtr->data = ckalloc(imagePtr->bytes_per_line * imagePtr->height); + imagePtr->data = + ckalloc((unsigned) imagePtr->bytes_per_line*imagePtr->height); dc = GetDC(NULL); diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 0424563..bacfb70 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinMenu.c,v 1.51 2006/11/24 18:11:32 hobbs Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.52 2007/01/11 15:35:40 dkf Exp $ */ #define OEMRESOURCE @@ -497,7 +497,7 @@ GetEntryText(mePtr) } } - itemText = ckalloc(Tcl_DStringLength(&itemString) + 1); + itemText = ckalloc((unsigned)Tcl_DStringLength(&itemString) + 1); strcpy(itemText, Tcl_DStringValue(&itemString)); Tcl_DStringFree(&itemString); } @@ -940,7 +940,7 @@ TkWinEmbeddedMenuProc(hwnd, message, wParam, lParam) WPARAM wParam; LPARAM lParam; { - static nIdles = 0; + static int nIdles = 0; LRESULT lResult = 1; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -1987,32 +1987,33 @@ TkWinMenuKeyObjCmd(clientData, interp, objc, objv) case XK_Alt_L: scanCode = MapVirtualKey(VK_LMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYDOWN, VK_MENU, (scanCode << 16) | (1 << 29)); + WM_SYSKEYDOWN, VK_MENU, + (int) (scanCode << 16) | (1 << 29)); break; case XK_Alt_R: scanCode = MapVirtualKey(VK_RMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYDOWN, VK_MENU, (scanCode << 16) - | (1 << 29) | (1 << 24)); + WM_SYSKEYDOWN, VK_MENU, + (int) (scanCode << 16) | (1 << 29) | (1 << 24)); break; case XK_F10: scanCode = MapVirtualKey(VK_F10, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYDOWN, VK_F10, (scanCode << 16)); + WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); scanCode = MapVirtualKey(virtualKey, 0); if (0 != scanCode) { CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYDOWN, virtualKey, ((scanCode << 16) - | (1 << 29))); + WM_SYSKEYDOWN, virtualKey, + (int) ((scanCode << 16) | (1 << 29))); if (eventPtr->xkey.nbytes > 0) { for (i = 0; i < eventPtr->xkey.nbytes; i++) { CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR, eventPtr->xkey.trans_chars[i], - ((scanCode << 16) | (1 << 29))); + (int) ((scanCode << 16) | (1 << 29))); } } } @@ -2022,27 +2023,27 @@ TkWinMenuKeyObjCmd(clientData, interp, objc, objv) case XK_Alt_L: scanCode = MapVirtualKey(VK_LMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYUP, VK_MENU, (scanCode << 16) + WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31)); break; case XK_Alt_R: scanCode = MapVirtualKey(VK_RMENU, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYUP, VK_MENU, (scanCode << 16) | (1 << 24) + WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24) | (0x111 << 29) | (1 << 30) | (1 << 31)); break; case XK_F10: scanCode = MapVirtualKey(VK_F10, 0); CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYUP, VK_F10, (scanCode << 16) - | (1 << 30) | (1 << 31)); + WM_SYSKEYUP, VK_F10, + (int) (scanCode << 16) | (1 << 30) | (1 << 31)); break; default: virtualKey = XKeysymToKeycode(winPtr->display, keySym); scanCode = MapVirtualKey(virtualKey, 0); if (0 != scanCode) { CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)), - WM_SYSKEYUP, virtualKey, ((scanCode << 16) + WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16) | (1 << 29) | (1 << 30) | (1 << 31))); } } @@ -2580,7 +2581,7 @@ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, widthPtr, heightPtr) * portion */ { TkMenu *menuPtr = mePtr->menuPtr; - int haveImage = 0, haveText = 0; + int haveImage = 0; if (mePtr->image != NULL) { Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr); diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index ee07e7c..369c25c 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinPixmap.c,v 1.6 2005/12/02 13:42:29 dkf Exp $ + * RCS: @(#) $Id: tkWinPixmap.c,v 1.7 2007/01/11 15:35:41 dkf Exp $ */ #include "tkWinInt.h" @@ -66,7 +66,7 @@ Tk_GetPixmap( depth /= planes; } newTwdPtr->bitmap.handle = - CreateBitmap(width, height, planes, depth, NULL); + CreateBitmap(width, height, (DWORD) planes, (DWORD) depth, NULL); if (newTwdPtr->bitmap.handle == NULL) { ckfree((char *) newTwdPtr); diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c index 7cbdb9d..3de6d35 100644 --- a/win/tkWinRegion.c +++ b/win/tkWinRegion.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinRegion.c,v 1.6 2005/12/02 00:19:04 dkf Exp $ + * RCS: @(#) $Id: tkWinRegion.c,v 1.7 2007/01/11 15:35:41 dkf Exp $ */ #include "tkWinInt.h" @@ -206,7 +206,8 @@ TkpBuildRegionFromAlphaData( * Manipulate Win32 regions directly; it's more efficient. */ - SetRectRgn(rectRgn, x+x1, y+y1, x+end, y+y1+1); + SetRectRgn(rectRgn, (int) (x+x1), (int) (y+y1), + (int) (x+end), (int) (y+y1+1)); CombineRgn((HRGN) region, (HRGN) region, rectRgn, RGN_OR); } } diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 2269512..3a064be 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinSend.c,v 1.11 2005/12/02 00:19:04 dkf Exp $ + * RCS: @(#) $Id: tkWinSend.c,v 1.12 2007/01/11 15:35:41 dkf Exp $ */ #include "tkWinSendCom.h" @@ -51,10 +51,12 @@ typedef struct SendEvent { Tcl_Obj *cmdPtr; } SendEvent; +#ifdef TK_SEND_ENABLED_ON_WINDOWS typedef struct { int initialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; +#endif /* * Functions internal to this file. @@ -116,14 +118,6 @@ Tk_SetAppName( * interpreter in later "send" commands. Must * be globally unique. */ { - ThreadSpecificData *tsdPtr = NULL; - TkWindow *winPtr = (TkWindow *)tkwin; - RegisteredInterp *riPtr = NULL; - Tcl_Interp *interp; - HRESULT hr = S_OK; - - interp = winPtr->mainPtr->interp; - #ifndef TK_SEND_ENABLED_ON_WINDOWS /* * Temporarily disabled for bug #858822 @@ -132,6 +126,14 @@ Tk_SetAppName( return name; #else /* TK_SEND_ENABLED_ON_WINDOWS */ + ThreadSpecificData *tsdPtr = NULL; + TkWindow *winPtr = (TkWindow *)tkwin; + RegisteredInterp *riPtr = NULL; + Tcl_Interp *interp; + HRESULT hr = S_OK; + + interp = winPtr->mainPtr->interp; + tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -207,12 +209,6 @@ TkGetInterpNames( Tk_Window tkwin) /* Window whose display is to be used for the * lookup. */ { - LPRUNNINGOBJECTTABLE pROT = NULL; - LPCOLESTR oleszStub = TKWINSEND_REGISTRATION_BASE; - HRESULT hr = S_OK; - Tcl_Obj *objList = NULL; - int result = TCL_OK; - #ifndef TK_SEND_ENABLED_ON_WINDOWS /* * Temporarily disabled for bug #858822 @@ -221,6 +217,12 @@ TkGetInterpNames( return TCL_OK; #else /* TK_SEND_ENABLED_ON_WINDOWS */ + LPRUNNINGOBJECTTABLE pROT = NULL; + LPCOLESTR oleszStub = TKWINSEND_REGISTRATION_BASE; + HRESULT hr = S_OK; + Tcl_Obj *objList = NULL; + int result = TCL_OK; + hr = GetRunningObjectTable(0, &pROT); if (SUCCEEDED(hr)) { IBindCtx* pBindCtx = NULL; diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 2f6ab18..4fc6a0e 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWindow.c,v 1.12 2005/12/02 13:42:29 dkf Exp $ + * RCS: @(#) $Id: tkWinWindow.c,v 1.13 2007/01/11 15:35:41 dkf Exp $ */ #include "tkWinInt.h" @@ -250,8 +250,7 @@ TkpScanWindowId( */ Window -TkpMakeWindow( - TkWindow *winPtr, +TkpMakeWindow( TkWindow *winPtr, Window parent) { HWND parentWin; @@ -272,7 +271,7 @@ TkpMakeWindow( */ hwnd = CreateWindowEx(WS_EX_NOPARENTNOTIFY, TK_WIN_CHILD_CLASS_NAME, NULL, - style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr), + (DWORD) style, Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr), Tk_Height(winPtr), parentWin, NULL, Tk_GetHINSTANCE(), NULL); SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); @@ -512,7 +511,7 @@ XMoveResizeWindow( unsigned int width, unsigned int height) { display->request++; - MoveWindow(Tk_GetHWND(w), x, y, width, height, TRUE); + MoveWindow(Tk_GetHWND(w), x, y, (int) width, (int) height, TRUE); } /* @@ -571,8 +570,8 @@ XResizeWindow( display->request++; - MoveWindow(Tk_GetHWND(w), winPtr->changes.x, winPtr->changes.y, width, - height, TRUE); + MoveWindow(Tk_GetHWND(w), winPtr->changes.x, winPtr->changes.y, (int)width, + (int)height, TRUE); } /* diff --git a/win/tkWinWm.c b/win/tkWinWm.c index ce53b89..4118b17 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.111 2007/01/05 00:00:52 nijtmans Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.112 2007/01/11 15:35:41 dkf Exp $ */ #include "tkWinInt.h" @@ -1215,7 +1215,7 @@ TkWinGetIcon( * return default toplevel icon */ - return GetIcon(tsdPtr->iconPtr, iconsize); + return GetIcon(tsdPtr->iconPtr, (int)iconsize); } /* @@ -1239,7 +1239,7 @@ TkWinGetIcon( * return window toplevel icon */ - return GetIcon(wmPtr->iconPtr, iconsize); + return GetIcon(wmPtr->iconPtr, (int)iconsize); } /* @@ -1341,7 +1341,7 @@ ReadIconFromFile( if (res != 0) { SHFILEINFO sfi; - int size; + unsigned size; Tcl_ResetResult(interp); res = (*shgetfileinfoProc)(Tcl_DStringValue(&ds2), 0, &sfi, @@ -1716,7 +1716,7 @@ ReadIconOrCursorFromFile( */ dwBytesRead = Tcl_Read(channel, (char*) lpIDE, - lpIR->nNumImages * sizeof(ICONDIRENTRY)); + (int)(lpIR->nNumImages * sizeof(ICONDIRENTRY))); if (dwBytesRead != lpIR->nNumImages * sizeof(ICONDIRENTRY)) { Tcl_AppendResult(interp, "Error reading file", NULL); Tcl_Close(NULL, channel); @@ -1758,8 +1758,8 @@ ReadIconOrCursorFromFile( * Read it in. */ - dwBytesRead = Tcl_Read( channel, lpIR->IconImages[i].lpBits, - lpIDE[i].dwBytesInRes); + dwBytesRead = Tcl_Read(channel, lpIR->IconImages[i].lpBits, + (int) lpIDE[i].dwBytesInRes); if (dwBytesRead != lpIDE[i].dwBytesInRes) { Tcl_AppendResult(interp, "Error reading file", NULL); goto readError; @@ -2272,7 +2272,7 @@ UpdateWrapper( setLayeredWindowAttributesProc((HWND) wmPtr->wrapper, wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5), - LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0)); + (unsigned)(LWA_ALPHA | (wmPtr->crefObj?LWA_COLORKEY:0))); } else { /* * Layering not used or supported. @@ -2630,7 +2630,6 @@ TkpWmSetFullScreen( int changed = 0; int full_screen = False; WmInfo *wmPtr = winPtr->wmInfoPtr; - TkWindow *focusWinPtr; if (full_screen_state) { if (! (wmPtr->flags & WM_FULLSCREEN)) { @@ -2663,9 +2662,12 @@ TkpWmSetFullScreen( if (!(wmPtr->flags & (WM_NEVER_MAPPED) && !(winPtr->flags & TK_EMBEDDED))) { + TkWindow *focusWinPtr; + UpdateWrapper(winPtr); - if (focusWinPtr = TkGetFocusWin(winPtr)) { + focusWinPtr = TkGetFocusWin(winPtr); + if (focusWinPtr) { TkSetFocusWin(focusWinPtr, 1); } } @@ -2940,7 +2942,7 @@ Tk_WmObjCmd( } argv1 = Tcl_GetStringFromObj(objv[1], &length); - if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0) + if ((argv1[0] == 't') && !strncmp(argv1, "tracing", (unsigned) length) && (length >= 3)) { int wmTracing; @@ -3197,23 +3199,23 @@ WmAttributesCmd( if ((length < 2) || (string[0] != '-')) { goto configArgs; } - if (strncmp(string, "-disabled", length) == 0) { + if (strncmp(string, "-disabled", (unsigned) length) == 0) { stylePtr = &style; styleBit = WS_DISABLED; - } else if ((strncmp(string, "-alpha", length) == 0) + } else if ((strncmp(string, "-alpha", (unsigned) length) == 0) || ((length > 2) && (strncmp(string, "-transparentcolor", - length) == 0))) { + (unsigned) length) == 0))) { stylePtr = &exStyle; styleBit = WS_EX_LAYERED; - } else if (strncmp(string, "-fullscreen", length) == 0) { + } else if (strncmp(string, "-fullscreen", (unsigned) length) == 0) { config_fullscreen = 1; styleBit = 0; } else if ((length > 3) - && (strncmp(string, "-toolwindow", length) == 0)) { + && (strncmp(string, "-toolwindow", (unsigned) length) == 0)) { stylePtr = &exStyle; styleBit = WS_EX_TOOLWINDOW; } else if ((length > 3) - && (strncmp(string, "-topmost", length) == 0)) { + && (strncmp(string, "-topmost", (unsigned) length) == 0)) { stylePtr = &exStyle; styleBit = WS_EX_TOPMOST; if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) { @@ -3291,11 +3293,13 @@ WmAttributesCmd( * Set the window directly regardless of UpdateWrapper. * The user supplies a double from [0..1], but Windows * wants an int (transparent) 0..255 (opaque), so do the - * translation. Add the 0.5 to round the value. + * translation. Add the 0.5 to round the value. */ + setLayeredWindowAttributesProc((HWND) wmPtr->wrapper, wmPtr->colorref, (BYTE) (wmPtr->alpha * 255 + 0.5), - LWA_ALPHA | (wmPtr->crefObj ? LWA_COLORKEY : 0)); + (unsigned) (LWA_ALPHA | + (wmPtr->crefObj ? LWA_COLORKEY : 0))); } } } else { @@ -4321,10 +4325,11 @@ WmIconphotoCmd( TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ Tk_PhotoHandle photo; Tk_PhotoImageBlock block; - int i, size, width, height, startObj = 3; + int i, width, height, startObj = 3; BlockOfIconImagesPtr lpIR; WinIconPtr titlebaricon = NULL; HICON hIcon; + unsigned size; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, diff --git a/win/tkWinX.c b/win/tkWinX.c index 5614385..145eb6d 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.54 2006/08/30 21:55:51 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.55 2007/01/11 15:35:41 dkf Exp $ */ /* @@ -173,8 +173,8 @@ TkGetServerInfo( os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&os); - sprintf(buffer, "Windows %d.%d %d %s", os.dwMajorVersion, - os.dwMinorVersion, os.dwBuildNumber, + sprintf(buffer, "Windows %d.%d %d %s", (int)os.dwMajorVersion, + (int)os.dwMinorVersion, (int)os.dwBuildNumber, #ifdef _WIN64 "Win64" #else @@ -316,7 +316,7 @@ TkWinXInit( LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR)) && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) { - UpdateInputLanguage(lpCs.ciCharset); + UpdateInputLanguage((int) lpCs.ciCharset); } /* @@ -818,7 +818,7 @@ TkWinChildProc( switch (message) { case WM_INPUTLANGCHANGE: - UpdateInputLanguage(wParam); + UpdateInputLanguage((int) wParam); result = 1; break; @@ -1263,7 +1263,7 @@ GenerateXEvent( event.type = KeyPress; event.xany.send_event = -3; event.xkey.keycode = wParam; - event.xkey.nbytes = Tcl_UniCharToUtf(wParam, buffer); + event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer); for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) { event.xkey.trans_chars[i] = buffer[i]; } @@ -1600,18 +1600,20 @@ HandleIMEComposition( } if (n > 0) { - char *buff = ckalloc(n); + char *buff = ckalloc((unsigned) n); TkWindow *winPtr; XEvent event; int i; if (isWinNT) { - n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n); + n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, + (unsigned) n); } else { Tcl_DString utfString, unicodeString; Tcl_Encoding unicodeEncoding = TkWinGetUnicodeEncoding(); - n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, buff, n); + n = ImmGetCompositionStringA(hIMC, GCS_RESULTSTR, buff, + (unsigned) n); Tcl_DStringInit(&utfString); Tcl_ExternalToUtfDString(keyInputEncoding, buff, n, &utfString); Tcl_UtfToExternalDString(unicodeEncoding, @@ -1625,10 +1627,10 @@ HandleIMEComposition( */ ckfree((char *) buff); - buff = (char *) ckalloc(i); + buff = (char *) ckalloc((unsigned) i); } n = i; - memcpy(buff, Tcl_DStringValue(&unicodeString), n); + memcpy(buff, Tcl_DStringValue(&unicodeString), (unsigned) n); Tcl_DStringFree(&utfString); Tcl_DStringFree(&unicodeString); } diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index 11f2dda..2fa63b0 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -1,4 +1,4 @@ -/* $Id: ttkWinMonitor.c,v 1.4 2006/11/03 15:42:42 patthoyts Exp $ +/* $Id: ttkWinMonitor.c,v 1.5 2007/01/11 15:35:41 dkf Exp $ */ #ifdef _MSC_VER @@ -80,7 +80,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) HWND hwnd = NULL; CHAR title[32] = "TtkMonitorWindow"; CHAR name[32] = "TtkMonitorClass"; - + wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WndProc; @@ -93,11 +93,11 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.lpszMenuName = name; wc.lpszClassName = name; - + if (RegisterClassEx(&wc)) { - hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, hinst, NULL ); + hwnd = CreateWindow(name, title, WS_OVERLAPPEDWINDOW, + (int) CW_USEDEFAULT, (int) CW_USEDEFAULT, (int) CW_USEDEFAULT, + (int) CW_USEDEFAULT, NULL, NULL, hinst, NULL); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp); ShowWindow(hwnd, SW_HIDE); UpdateWindow(hwnd); diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 73010f3..b2f8c0b 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -1,6 +1,6 @@ /* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> * - * $Id: ttkWinTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ + * $Id: ttkWinTheme.c,v 1.3 2007/01/11 15:35:41 dkf Exp $ */ #ifdef _MSC_VER @@ -146,8 +146,8 @@ static void FrameControlElementDraw( HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFrameControl(hdc, &rc, - elementData->classId, - elementData->partId|Ttk_StateTableLookup(elementData->stateMap, state)); + (DWORD) elementData->classId, (DWORD) elementData->partId + | Ttk_StateTableLookup(elementData->stateMap, state)); TkWinReleaseDrawableDC(d, hdc, &dcState); } @@ -292,7 +292,7 @@ static void ButtonBorderElementGeometry( ButtonBorderElement *bd = elementRecord; int relief = TK_RELIEF_RAISED; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; - short int cx, cy; + int cx, cy; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -329,9 +329,10 @@ static void ButtonBorderElementDraw( if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { XColor *highlightColor = - Tk_GetColorFromObj(tkwin, bd->highlightColorObj); + Tk_GetColorFromObj(tkwin, bd->highlightColorObj); GC gc = Tk_GCForColor(highlightColor, d); - XDrawRectangle(Tk_Display(tkwin), d, gc, b.x,b.y,b.width-1,b.height-1); + XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, + (unsigned)b.width-1, (unsigned)b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { ++b.x; ++b.y; b.width -= 2; b.height -= 2; @@ -341,13 +342,13 @@ static void ButtonBorderElementDraw( rc = BoxToRect(b); DrawFrameControl(hdc, &rc, - DFC_BUTTON, /* classId */ - DFCS_BUTTONPUSH | Ttk_StateTableLookup(pushbutton_statemap, state)); + (DWORD) DFC_BUTTON, /* classId */ (DWORD) DFCS_BUTTONPUSH + | Ttk_StateTableLookup(pushbutton_statemap, state)); /* Draw focus ring: */ if (state & TTK_STATE_FOCUS) { - short int borderWidth = 3; /* @@@ Use GetSystemMetrics?*/ + int borderWidth = 3; /* @@@ Use GetSystemMetrics?*/ rc = BoxToRect(Ttk_PadBox(b, Ttk_UniformPadding(borderWidth))); DrawFocusRect(hdc, &rc); } @@ -424,7 +425,8 @@ static void FillFocusElementDraw( GC gc = Tk_GCForColor(fillColor, d); HDC hdc; - XFillRectangle(Tk_Display(tkwin),d,gc, b.x,b.y,b.width,b.height); + XFillRectangle(Tk_Display(tkwin),d,gc, + b.x,b.y,(unsigned)b.width,(unsigned)b.height); hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawFocusRect(hdc, &rc); TkWinReleaseDrawableDC(d, hdc, &dcState); diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 41e5e6b..0d249dd 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.4 2006/11/21 02:21:27 jenglish Exp $ + * $Id: ttkWinXPTheme.c,v 1.5 2007/01/11 15:35:41 dkf Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -565,7 +565,7 @@ ThumbElementDraw( return; elementData->procs->DrawThemeBackground(elementData->hTheme, - elementData->hDC, elementData->info->partId, stateId, + elementData->hDC, elementData->info->partId, (int) stateId, &rc, NULL); FreeElementData(elementData); |