diff options
author | nijtmans <nijtmans> | 2009-08-02 21:40:16 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2009-08-02 21:40:16 (GMT) |
commit | 08a5c69704132511cb35781483e60ef2e5e534f7 (patch) | |
tree | 7a1b6fcc8666e39d05f77ebe57d7307be060e470 /win | |
parent | f52a66c46958afc32b7e66a2cf5f8861d6b241f4 (diff) | |
download | tk-08a5c69704132511cb35781483e60ef2e5e534f7.zip tk-08a5c69704132511cb35781483e60ef2e5e534f7.tar.gz tk-08a5c69704132511cb35781483e60ef2e5e534f7.tar.bz2 |
eliminate various gcc and msvc compiler warnings
Diffstat (limited to 'win')
-rw-r--r-- | win/.cvsignore | 13 | ||||
-rwxr-xr-x | win/configure | 3 | ||||
-rw-r--r-- | win/tcl.m4 | 3 | ||||
-rw-r--r-- | win/tkWinClipboard.c | 6 | ||||
-rw-r--r-- | win/tkWinDialog.c | 6 | ||||
-rw-r--r-- | win/tkWinDraw.c | 4 | ||||
-rw-r--r-- | win/tkWinImage.c | 28 | ||||
-rw-r--r-- | win/tkWinMenu.c | 12 | ||||
-rw-r--r-- | win/tkWinWm.c | 8 | ||||
-rw-r--r-- | win/tkWinX.c | 31 | ||||
-rw-r--r-- | win/ttkWinXPTheme.c | 8 |
11 files changed, 70 insertions, 52 deletions
diff --git a/win/.cvsignore b/win/.cvsignore index 9a89827..83300ce 100644 --- a/win/.cvsignore +++ b/win/.cvsignore @@ -1,5 +1,6 @@ Debug Release +autom4te.cache *.opt *.ncb *.plg @@ -8,10 +9,16 @@ Release *.obj *.i *.asm +*.lib +*.res +*.ilk +*.pdb Makefile -tcl.hpj -tclConfig.sh +tk.hpj +tkConfig.sh +config.status *.exe *.dll -wish.exe.manifest +*.exp +*.manifest .#* diff --git a/win/configure b/win/configure index 95e320e..41a6ef0 100755 --- a/win/configure +++ b/win/configure @@ -3675,6 +3675,9 @@ _ACEOF MAKE_EXE="\${CC} -Fe\$@" LIBPREFIX="" + CFLAGS_DEBUG="${CFLAGS_DEBUG} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" + CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" + EXTRA_CFLAGS="" CFLAGS_WARNING="-W3" LDFLAGS_DEBUG="-debug:full" @@ -751,6 +751,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ MAKE_EXE="\${CC} -Fe\[$]@" LIBPREFIX="" + CFLAGS_DEBUG="${CFLAGS_DEBUG} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" + CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE" + EXTRA_CFLAGS="" CFLAGS_WARNING="-W3" LDFLAGS_DEBUG="-debug:full" diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 6c021dd..db8c011 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.10 2008/11/08 18:44:40 dkf Exp $ + * RCS: @(#) $Id: tkWinClipboard.c,v 1.11 2009/08/02 21:40:17 nijtmans Exp $ */ #include "tkWinInt.h" @@ -295,7 +295,7 @@ TkWinClipboardRender( * encoding before placing it on the clipboard. */ - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { + if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) { Tcl_DStringInit(&ds); Tcl_UtfToUniCharDString(rawText, -1, &ds); ckfree(rawText); @@ -385,7 +385,7 @@ UpdateClipboard( * possible. */ - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { + if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) { SetClipboardData(CF_UNICODETEXT, NULL); } else { SetClipboardData(CF_TEXT, NULL); diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 59bf138..14600a7 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.63 2009/04/24 17:29:47 hobbs Exp $ + * RCS: @(#) $Id: tkWinDialog.c,v 1.64 2009/08/02 21:40:17 nijtmans Exp $ * */ @@ -1812,7 +1812,9 @@ Tk_ChooseDirectoryObjCmd( objPtr = Tcl_GetVar2Ex(interp, "::tk::winChooseDirFlags", NULL, TCL_GLOBAL_ONLY); if (objPtr != NULL) { - Tcl_GetIntFromObj(NULL, objPtr, &(bInfo.ulFlags)); + int flags; + Tcl_GetIntFromObj(NULL, objPtr, &flags); + bInfo.ulFlags = flags; } /* diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 9d1a7cd..edb804c 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.23 2008/11/22 20:05:32 patthoyts Exp $ + * RCS: @(#) $Id: tkWinDraw.c,v 1.24 2009/08/02 21:40:16 nijtmans Exp $ */ #include "tkWinInt.h" @@ -745,7 +745,7 @@ RenderObject( HPEN pen, WinDrawFunc func) { - RECT rect; + RECT rect = {0,0,0,0}; HPEN oldPen; HBRUSH oldBrush; POINT *winPoints = ConvertPoints(points, npoints, mode, &rect); diff --git a/win/tkWinImage.c b/win/tkWinImage.c index 1aa9c20..aa8e66f 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.12 2008/10/17 23:18:38 nijtmans Exp $ + * RCS: @(#) $Id: tkWinImage.c,v 1.13 2009/08/02 21:40:17 nijtmans Exp $ */ #include "tkWinInt.h" @@ -70,7 +70,7 @@ ImageGetPixel( int x, int y) { unsigned long pixel = 0; - unsigned char *srcPtr = &(image->data[(y * image->bytes_per_line) + unsigned char *srcPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line) + ((x * image->bits_per_pixel) / NBBY)]); switch (image->bits_per_pixel) { @@ -118,7 +118,7 @@ PutPixel( int x, int y, unsigned long pixel) { - unsigned char *destPtr = &(image->data[(y * image->bytes_per_line) + unsigned char *destPtr = (unsigned char *) &(image->data[(y * image->bytes_per_line) + ((x * image->bits_per_pixel) / NBBY)]); switch (image->bits_per_pixel) { @@ -370,16 +370,16 @@ XGetImageZPixmap( unsigned char *p, *pend; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, depth, ZPixmap, 0, (char *) data, width, height, 32, (int) ((width + 31) >> 3) & ~1); if (ret_image == NULL) { - ckfree(data); + ckfree((char *) data); goto cleanup; } @@ -406,13 +406,13 @@ XGetImageZPixmap( unsigned char *p; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 8, ZPixmap, 0, (char *) data, width, height, 8, (int) width); if (ret_image == NULL) { ckfree((char *) data); @@ -437,13 +437,13 @@ XGetImageZPixmap( } } else if (depth == 16) { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *) ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 16, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 16, ZPixmap, 0, (char *) data, width, height, 16, 0 /* will be calc'ed from bitmap_pad */); if (ret_image == NULL) { ckfree((char *) data); @@ -463,13 +463,13 @@ XGetImageZPixmap( } } else { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(width * height * 4); + data = (unsigned char *) ckalloc(width * height * 4); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; goto cleanup; } - ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, data, + ret_image = XCreateImage(display, NULL, 32, ZPixmap, 0, (char *) data, width, height, 0, (int) width * 4); if (ret_image == NULL) { ckfree((char *) data); @@ -486,7 +486,7 @@ XGetImageZPixmap( unsigned int byte_width, h, w; byte_width = ((width * 3 + 3) & ~(unsigned)3); - smallBitBase = ckalloc(byte_width * height); + smallBitBase = (unsigned char *) ckalloc(byte_width * height); if (!smallBitBase) { ckfree((char *) ret_image->data); ckfree((char *) ret_image); @@ -513,7 +513,7 @@ XGetImageZPixmap( */ for (h = 0; h < height; h++) { - bigBitData = ret_image->data + h * ret_image->bytes_per_line; + bigBitData = (unsigned char *) ret_image->data + h * ret_image->bytes_per_line; smallBitData = smallBitBase + h * byte_width; for (w = 0; w < width; w++) { diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 1909f34..f499804 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.67 2009/05/21 22:52:06 patthoyts Exp $ + * RCS: @(#) $Id: tkWinMenu.c,v 1.68 2009/08/02 21:40:17 nijtmans Exp $ */ #define OEMRESOURCE @@ -2911,8 +2911,7 @@ MenuSelectEvent( TkMenu *menuPtr) /* the menu we have selected. */ { XVirtualEvent event; - POINTS rootPoint; - DWORD msgPos; + union {DWORD msgpos; POINTS point;} root; event.type = VirtualEvent; event.serial = menuPtr->display->request; @@ -2924,10 +2923,9 @@ MenuSelectEvent( event.subwindow = None; event.time = TkpGetMS(); - msgPos = GetMessagePos(); - rootPoint = MAKEPOINTS(msgPos); - event.x_root = rootPoint.x; - event.y_root = rootPoint.y; + root.msgpos = GetMessagePos(); + event.x_root = root.point.x; + event.y_root = root.point.y; event.state = TkWinGetModifierState(); event.same_screen = 1; event.name = Tk_GetUid("MenuSelect"); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index c272e65..85523a7 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.139 2009/06/02 09:26:57 patthoyts Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.140 2009/08/02 21:40:17 nijtmans Exp $ */ #include "tkWinInt.h" @@ -1729,7 +1729,7 @@ ReadIconOrCursorFromFile( * Read it in. */ - dwBytesRead = Tcl_Read(channel, lpIR->IconImages[i].lpBits, + dwBytesRead = Tcl_Read(channel, (char *)lpIR->IconImages[i].lpBits, (int) lpIDE[i].dwBytesInRes); if (dwBytesRead != lpIDE[i].dwBytesInRes) { Tcl_AppendResult(interp, "Error reading file", NULL); @@ -4388,7 +4388,7 @@ WmIconphotoCmd( bmInfo.bmiHeader.biCompression = BI_RGB; iconInfo.hbmColor = CreateDIBSection( NULL, &bmInfo, - DIB_RGB_COLORS, &bgraPixelPtr, NULL, 0 ); + DIB_RGB_COLORS, (void **)&bgraPixelPtr, NULL, 0 ); if ( !iconInfo.hbmColor ) { ckfree((char *) lpIR); Tcl_AppendResult(interp, "failed to create color bitmap for \"", @@ -4415,7 +4415,7 @@ WmIconphotoCmd( bmInfo.bmiHeader.biBitCount = 1; iconInfo.hbmMask = CreateDIBSection( NULL, &bmInfo, - DIB_RGB_COLORS, &bgraMaskPtr, NULL, 0 ); + DIB_RGB_COLORS, (void **)&bgraMaskPtr, NULL, 0 ); if ( !iconInfo.hbmMask ) { DeleteObject(iconInfo.hbmColor); ckfree((char *) lpIR); diff --git a/win/tkWinX.c b/win/tkWinX.c index 4609a94..a91c3bd 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.60 2008/12/28 22:59:47 dkf Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.61 2009/08/02 21:40:17 nijtmans Exp $ */ /* @@ -260,6 +260,7 @@ TkWinXInit( INITCOMMONCONTROLSEX comctl; CHARSETINFO lpCs; DWORD lpCP; + int useWide; if (childClassInitialized != 0) { return; @@ -272,7 +273,8 @@ TkWinXInit( Tcl_Panic("Unable to load common controls?!"); } - if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { + useWide = (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS); + if (useWide) { tkWinProcs = &unicodeProcs; } else { tkWinProcs = &asciiProcs; @@ -302,7 +304,7 @@ TkWinXInit( * Initialize input language info */ - if (GetLocaleInfo(LANGIDFROMLCID(GetKeyboardLayout(0)), + if (GetLocaleInfo(LANGIDFROMLCID((DWORD)GetKeyboardLayout(0)), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR)) && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) { @@ -409,7 +411,7 @@ TkWinGetPlatformId(void) KEY_READ, &hKey) != ERROR_SUCCESS) { tkWinTheme = TK_THEME_WIN_XP; } else { - RegQueryValueEx(hKey, szCurrent, NULL, NULL, pBuffer, &dwSize); + RegQueryValueEx(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize); RegCloseKey(hKey); if (strcmp(pBuffer, "Windows Standard") == 0) { tkWinTheme = TK_THEME_WIN_CLASSIC; @@ -1011,8 +1013,9 @@ GenerateXEvent( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (message == WM_MOUSEWHEEL) { - POINTS rootPoint = MAKEPOINTS(lParam); + union {LPARAM lParam; POINTS point;} root; POINT pos; + root.lParam = lParam; /* * Redirect mousewheel events to the window containing the cursor. @@ -1020,8 +1023,8 @@ GenerateXEvent( * platforms work. */ - pos.x = rootPoint.x; - pos.y = rootPoint.y; + pos.x = root.point.x; + pos.y = root.point.y; hwnd = WindowFromPoint(pos); } @@ -1132,17 +1135,15 @@ GenerateXEvent( unsigned int state = GetState(message, wParam, lParam); Time time = TkpGetMS(); POINT clientPoint; - POINTS rootPoint; /* Note: POINT and POINTS are different */ - DWORD msgPos; + union {DWORD msgpos; POINTS point;} root; /* Note: POINT and POINTS are different */ /* * Compute the screen and window coordinates of the event. */ - msgPos = GetMessagePos(); - rootPoint = MAKEPOINTS(msgPos); - clientPoint.x = rootPoint.x; - clientPoint.y = rootPoint.y; + root.msgpos = GetMessagePos(); + clientPoint.x = root.point.x; + clientPoint.y = root.point.y; ScreenToClient(hwnd, &clientPoint); /* @@ -1153,8 +1154,8 @@ GenerateXEvent( event.xbutton.subwindow = None; event.xbutton.x = clientPoint.x; event.xbutton.y = clientPoint.y; - event.xbutton.x_root = rootPoint.x; - event.xbutton.y_root = rootPoint.y; + event.xbutton.x_root = root.point.x; + event.xbutton.y_root = root.point.y; event.xbutton.state = state; event.xbutton.time = time; event.xbutton.same_screen = True; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index b4e35f2..d4cb16c 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.24 2009/03/25 23:39:34 nijtmans Exp $ + * $Id: ttkWinXPTheme.c,v 1.25 2009/08/02 21:40:17 nijtmans Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -27,7 +27,11 @@ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #include <windows.h> #include <uxtheme.h> -#include <tmschema.h> +#if defined(_MSC_VER) && (NTDDI_VERSION >= NTDDI_LONGHORN) +# include <vssym32.h> +#else +# include <tmschema.h> +#endif #include <tkWinInt.h> |