From 5b13f1d368442b4edfeba1b28cdd7546f4e27256 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Fri, 21 May 2010 12:18:17 +0000 Subject: installData.tcl: Make sure that copyDir only receives normalized paths. tclPlatDecls.h: Fix inclusion for CYGWIN. tclPathObj.c: Fix Tcl_SetStringObj usage for CYGWIN. *.c: Fix various minor other gcc warnings, like signed<->unsigned mismatch. --- ChangeLog | 15 +++++++++++++ generic/tclFileName.c | 9 ++++---- generic/tclPathObj.c | 52 ++++++++++++++++++++++++++++---------------- generic/tclPlatDecls.h | 12 +++------- tools/installData.tcl | 26 +++++++++++----------- win/tclWinChan.c | 12 +++++----- win/tclWinConsole.c | 4 ++-- win/tclWinDde.c | 59 +++++++++++++++++++++++++------------------------- win/tclWinNotify.c | 4 ++-- 9 files changed, 108 insertions(+), 85 deletions(-) diff --git a/ChangeLog b/ChangeLog index be38c82..ba841f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-05-21 Jan Nijtmans + + * tools/installData.tcl Make sure that copyDir only receives normalized + paths. Backported from trunk. + * generic/tclPlatDecls.h. Fix inclusion for CYGWIN. Backported + from trunk (although for trunk this was moved to tclWinPort.h) + * generic/tclPathObj.c Fix Tcl_SetStringObj usage for CYGWIN. This + function can only be used with unshared objects. This causes a crash + on CYGWIN. (backported from trunk) + * generic/tclFileName.c Don't declare cygwin_conv_to_win32_path here. + * win/tclWinChan.c Fix various minor other gcc warnings, like + * win/tclWinConsole.c signed<->unsigned mismatch. Backported from + * win/tclWinDde.c trunk. + * win/tclWinNotify.c + 2010-05-19 Alexandre Ferrieux * generic/tclDictObj.c: Backport of fix for [Bug 3004007], EIAS diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 893f68c..847f954 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.86.2.4 2009/08/21 19:03:20 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.86.2.5 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclInt.h" @@ -1891,7 +1891,7 @@ TclGlob( * for existence and type. */ if (types == NULL) { - /* + /* * We just want to check for existence. In this case we * make it easy on Tcl_FSMatchInDirectory and its * sub-implementations by not bothering them (even though @@ -1903,7 +1903,7 @@ TclGlob( } result = TCL_OK; } else { - /* + /* * We want to check for the correct type. Tcl_FSMatchInDirectory * is documented to do this for us, if we give it a NULL pattern. */ @@ -1952,7 +1952,7 @@ TclGlob( if (pathPrefix == NULL) { Tcl_Panic("Called TclGlob with TCL_GLOBMODE_TAILS and pathPrefix==NULL"); } - + pre = Tcl_GetStringFromObj(pathPrefix, &prefixLen); if (prefixLen > 0 && (strchr(separators, pre[prefixLen-1]) == NULL)) { @@ -2434,7 +2434,6 @@ DoGlob( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; cygwin_conv_to_win32_path(Tcl_DStringValue(&append), winbuf); diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 13eeb2b..de39f44 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.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: tclPathObj.c,v 1.66.2.11 2010/01/05 18:58:12 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.66.2.12 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclInt.h" @@ -113,7 +113,7 @@ typedef struct FsPath { #define PATHOBJ(pathPtr) ((FsPath *) (pathPtr)->internalRep.otherValuePtr) #define SETPATHOBJ(pathPtr,fsPathPtr) \ - ((pathPtr)->internalRep.otherValuePtr = (VOID *) (fsPathPtr)) + ((pathPtr)->internalRep.otherValuePtr = (void *) (fsPathPtr)) #define PATHFLAGS(pathPtr) (PATHOBJ(pathPtr)->flags) /* @@ -239,7 +239,7 @@ TclFSNormalizeAbsolutePath( retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } - Tcl_GetStringFromObj(retVal, &curLen); + (void) Tcl_GetStringFromObj(retVal, &curLen); if (curLen == 0) { Tcl_AppendToObj(retVal, dirSep, 1); } @@ -261,10 +261,11 @@ TclFSNormalizeAbsolutePath( if (retVal == NULL) { const char *path = TclGetString(pathPtr); + retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } - Tcl_GetStringFromObj(retVal, &curLen); + (void) Tcl_GetStringFromObj(retVal, &curLen); if (curLen == 0) { Tcl_AppendToObj(retVal, dirSep, 1); } @@ -322,6 +323,7 @@ TclFSNormalizeAbsolutePath( if (tclPlatform == TCL_PLATFORM_WINDOWS) { int i; + for (i = 0; i < curLen; i++) { if (linkStr[i] == '\\') { linkStr[i] = '/'; @@ -707,6 +709,7 @@ TclPathPart( } else { Tcl_Obj *root = Tcl_NewStringObj(fileName, (int) (length - strlen(extension))); + Tcl_IncrRefCount(root); return root; } @@ -879,7 +882,6 @@ Tcl_FSJoinPath( if ((i == (elements-2)) && (i == 0) && (elt->typePtr == &tclFsPathType) && !(elt->bytes != NULL && (elt->bytes[0] == '\0'))) { Tcl_Obj *tail; - Tcl_PathType type; Tcl_ListObjIndex(NULL, listObj, i+1, &tail); type = TclGetPathType(tail, NULL, NULL, NULL); @@ -929,7 +931,7 @@ Tcl_FSJoinPath( /* * Otherwise we don't have an easy join, and we must let the - * more general code below handle things + * more general code below handle things. */ } else if (tclPlatform == TCL_PLATFORM_UNIX) { if (res != NULL) { @@ -937,7 +939,7 @@ Tcl_FSJoinPath( } return tail; } else { - const char *str = Tcl_GetString(tail); + const char *str = TclGetString(tail); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (strchr(str, '\\') == NULL) { @@ -1150,7 +1152,6 @@ Tcl_FSConvertToPathType( return TCL_OK; } - if (pathPtr->bytes == NULL) { UpdateStringOfFsPath(pathPtr); } @@ -1738,9 +1739,7 @@ Tcl_FSGetTranslatedPath( * translated result we need, and can store it for future use. */ - Tcl_Obj *translatedCwdPtr; - - translatedCwdPtr = Tcl_FSGetTranslatedPath(interp, + Tcl_Obj *translatedCwdPtr = Tcl_FSGetTranslatedPath(interp, srcFsPathPtr->cwdPtr); if (translatedCwdPtr == NULL) { return NULL; @@ -1851,8 +1850,7 @@ Tcl_FSGetNormalizedPath( */ Tcl_Obj *dir, *copy; - int cwdLen; - int pathType; + int cwdLen, pathType; ClientData clientData = NULL; pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr); @@ -1951,6 +1949,7 @@ Tcl_FSGetNormalizedPath( * TclFSNormalizeToUniquePath call above should have already * set this up. Not changing out of fear of the unknown. */ + fsPathPtr->nativePathPtr = clientData; } PATHFLAGS(pathPtr) = 0; @@ -2007,6 +2006,7 @@ Tcl_FSGetNormalizedPath( Tcl_Obj *absolutePath = fsPathPtr->translatedPathPtr; const char *path = TclGetString(absolutePath); + Tcl_IncrRefCount(absolutePath); /* @@ -2027,8 +2027,8 @@ Tcl_FSGetNormalizedPath( * In particular, capture the cwd value and save so it can be * stored in the cwdPtr field below. */ - useThisCwd = Tcl_FSGetCwd(interp); + useThisCwd = Tcl_FSGetCwd(interp); } else { /* * We don't ask for the type of 'pathPtr' here, because that is @@ -2105,7 +2105,7 @@ Tcl_FSGetNormalizedPath( fsPathPtr->normPathPtr = pathPtr; } - } + } if (useThisCwd != NULL) { /* * We just need to free an object we allocated above for relative @@ -2417,6 +2417,9 @@ SetFsPathFromAny( FsPath *fsPathPtr; Tcl_Obj *transPtr; char *name; +#if defined(__CYGWIN__) && defined(__WIN32__) + int copied = 0; +#endif ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); if (pathPtr->typePtr == &tclFsPathType) { @@ -2447,7 +2450,7 @@ SetFsPathFromAny( char *expandedUser; Tcl_DString temp; int split; - char separator='/'; + char separator = '/'; split = FindSplitPos(name, separator); if (split != len) { @@ -2562,7 +2565,6 @@ SetFsPathFromAny( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; /* @@ -2575,6 +2577,11 @@ SetFsPathFromAny( if (len > 0) { cygwin_conv_to_win32_path(name, winbuf); TclWinNoBackslash(winbuf); + if (Tcl_IsShared(transPtr)) { + copied = 1; + transPtr = Tcl_DuplicateObj(transPtr); + Tcl_IncrRefCount(transPtr); + } Tcl_SetStringObj(transPtr, winbuf, -1); } } @@ -2605,6 +2612,11 @@ SetFsPathFromAny( SETPATHOBJ(pathPtr, fsPathPtr); PATHFLAGS(pathPtr) = 0; pathPtr->typePtr = &tclFsPathType; +#if defined(__CYGWIN__) && defined(__WIN32__) + if (copied) { + Tcl_DecrRefCount(transPtr); + } +#endif return TCL_OK; } @@ -2632,6 +2644,7 @@ FreeFsPathInternalRep( if (fsPathPtr->nativePathPtr != NULL && fsPathPtr->fsRecPtr != NULL) { Tcl_FSFreeInternalRepProc *freeProc = fsPathPtr->fsRecPtr->fsPtr->freeInternalRepProc; + if (freeProc != NULL) { (*freeProc)(fsPathPtr->nativePathPtr); fsPathPtr->nativePathPtr = NULL; @@ -2648,7 +2661,7 @@ FreeFsPathInternalRep( } } - ckfree((char*) fsPathPtr); + ckfree((char *) fsPathPtr); } static void @@ -2692,6 +2705,7 @@ DupFsPathInternalRep( && srcFsPathPtr->nativePathPtr != NULL) { Tcl_FSDupInternalRepProc *dupProc = srcFsPathPtr->fsRecPtr->fsPtr->dupInternalRepProc; + if (dupProc != NULL) { copyFsPathPtr->nativePathPtr = (*dupProc)(srcFsPathPtr->nativePathPtr); @@ -2801,7 +2815,7 @@ TclNativePathInFilesystem( int len; - Tcl_GetStringFromObj(pathPtr, &len); + (void) Tcl_GetStringFromObj(pathPtr, &len); if (len == 0) { /* * We reject the empty path "". diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 5718b96..7597527 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -6,7 +6,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclPlatDecls.h,v 1.27.2.1 2010/02/07 22:16:54 nijtmans Exp $ + * RCS: @(#) $Id: tclPlatDecls.h,v 1.27.2.2 2010/05/21 12:18:17 nijtmans Exp $ */ #ifndef _TCLPLATDECLS @@ -26,18 +26,12 @@ /* * Pull in the typedef of TCHAR for windows. */ -#if defined(__CYGWIN__) - typedef char TCHAR; -#elif defined(__WIN32__) && !defined(_TCHAR_DEFINED) +#if defined(__WIN32__) && !defined(_TCHAR_DEFINED) # include # ifndef _TCHAR_DEFINED /* Borland seems to forget to set this. */ - typedef _TCHAR TCHAR; -# define _TCHAR_DEFINED -# endif -# if defined(_MSC_VER) && defined(__STDC__) - /* MSVC++ misses this. */ typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED # endif #endif diff --git a/tools/installData.tcl b/tools/installData.tcl index cf067a3..5bdcd0c 100644 --- a/tools/installData.tcl +++ b/tools/installData.tcl @@ -1,6 +1,6 @@ #!/bin/sh #\ - exec tclsh "$0" ${1+"$@"} +exec tclsh "$0" ${1+"$@"} #---------------------------------------------------------------------- # @@ -16,38 +16,38 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: installData.tcl,v 1.1 2004/08/18 19:59:09 kennykb Exp $ +# RCS: @(#) $Id: installData.tcl,v 1.1.16.1 2010/05/21 12:18:17 nijtmans Exp $ # #---------------------------------------------------------------------- -proc copyDir { d1 d2 } { +proc copyDir {d1 d2} { - puts [format {%*sCreating %s} [expr { 4 * [info level] }] {} \ + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \ [file tail $d2]] file delete -force -- $d2 file mkdir $d2 - + foreach ftail [glob -directory $d1 -nocomplain -tails *] { set f [file join $d1 $ftail] - if { [file isdirectory $f] && [string compare CVS $ftail] } { + if {[file isdirectory $f] && [string compare CVS $ftail]} { copyDir $f [file join $d2 $ftail] - } elseif { [file isfile $f] } { + } elseif {[file isfile $f]} { file copy -force $f [file join $d2 $ftail] - if { $::tcl_platform(platform) eq {unix} } { + if {$::tcl_platform(platform) eq {unix}} { file attributes [file join $d2 $ftail] -permissions 0644 } else { file attributes [file join $d2 $ftail] -readonly 1 } } } - - if { $::tcl_platform(platform) eq {unix} } { + + if {$::tcl_platform(platform) eq {unix}} { file attributes $d2 -permissions 0755 } else { file attributes $d2 -readonly 1 } -} - -copyDir [lindex $argv 0] [lindex $argv 1] +} + +copyDir [file normalize [lindex $argv 0]] [file normalize [lindex $argv 1]] diff --git a/win/tclWinChan.c b/win/tclWinChan.c index b4dbbd9..38882d2 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.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: tclWinChan.c,v 1.49.4.1 2008/05/23 21:10:45 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.49.4.2 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclWinInt.h" @@ -491,7 +491,7 @@ FileSeekProc( oldPosHigh = 0; oldPos = SetFilePointer(infoPtr->handle, 0, &oldPosHigh, FILE_CURRENT); - if (oldPos == INVALID_SET_FILE_POINTER) { + if (oldPos == (LONG)INVALID_SET_FILE_POINTER) { DWORD winError = GetLastError(); if (winError != NO_ERROR) { @@ -503,7 +503,7 @@ FileSeekProc( newPosHigh = (offset < 0 ? -1 : 0); newPos = SetFilePointer(infoPtr->handle, offset, &newPosHigh, moveMethod); - if (newPos == INVALID_SET_FILE_POINTER) { + if (newPos == (LONG)INVALID_SET_FILE_POINTER) { DWORD winError = GetLastError(); if (winError != NO_ERROR) { @@ -566,7 +566,7 @@ FileWideSeekProc( newPosHigh = Tcl_WideAsLong(offset >> 32); newPos = SetFilePointer(infoPtr->handle, Tcl_WideAsLong(offset), &newPosHigh, moveMethod); - if (newPos == INVALID_SET_FILE_POINTER) { + if (newPos == (LONG)INVALID_SET_FILE_POINTER) { DWORD winError = GetLastError(); if (winError != NO_ERROR) { @@ -608,7 +608,7 @@ FileTruncateProc( oldPosHigh = 0; oldPos = SetFilePointer(infoPtr->handle, 0, &oldPosHigh, FILE_CURRENT); - if (oldPos == INVALID_SET_FILE_POINTER) { + if (oldPos == (LONG)INVALID_SET_FILE_POINTER) { DWORD winError = GetLastError(); if (winError != NO_ERROR) { TclWinConvertError(winError); @@ -623,7 +623,7 @@ FileTruncateProc( newPosHigh = Tcl_WideAsLong(length >> 32); newPos = SetFilePointer(infoPtr->handle, Tcl_WideAsLong(length), &newPosHigh, FILE_BEGIN); - if (newPos == INVALID_SET_FILE_POINTER) { + if (newPos == (LONG)INVALID_SET_FILE_POINTER) { DWORD winError = GetLastError(); if (winError != NO_ERROR) { TclWinConvertError(winError); diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 1480199..2b01b0c 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.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: tclWinConsole.c,v 1.19 2006/03/27 18:08:51 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.19.8.1 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1187,7 +1187,7 @@ ConsoleReaderThread( DWORD err; err = GetLastError(); - if (err == EOF) { + if (err == (DWORD)EOF) { infoPtr->readFlags = CONSOLE_EOF; } } diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 46e0e55..88e11d8 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.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: tclWinDde.c,v 1.31.8.1 2010/01/31 23:51:37 nijtmans Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.31.8.2 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclInt.h" @@ -710,7 +710,7 @@ DdeServerProc( } if (convPtr != NULL) { - char *returnString; + BYTE *returnString; len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINANSI); Tcl_DStringInit(&dString); @@ -719,7 +719,7 @@ DdeServerProc( DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINANSI); if (stricmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) { - returnString = + returnString = (BYTE *) Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); @@ -731,8 +731,8 @@ DdeServerProc( convPtr->riPtr->interp, utilString, NULL, TCL_GLOBAL_ONLY); if (variableObjPtr != NULL) { - returnString = Tcl_GetStringFromObj(variableObjPtr, - &len); + returnString = (BYTE *) Tcl_GetStringFromObj( + variableObjPtr, &len); ddeReturn = DdeCreateDataHandle(ddeInstance, returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT, 0); @@ -885,7 +885,7 @@ MakeDdeConnection( HCONV ddeConv; ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, 0); - ddeTopic = DdeCreateStringHandle(ddeInstance, name, 0); + ddeTopic = DdeCreateStringHandle(ddeInstance, (void *) name, 0); ddeConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -986,7 +986,7 @@ DdeServicesOnAck( ATOM service = (ATOM)LOWORD(lParam); ATOM topic = (ATOM)HIWORD(lParam); struct DdeEnumServices *es; - TCHAR sz[255]; + char sz[255]; #ifdef _WIN64 es = (struct DdeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA); @@ -994,14 +994,14 @@ DdeServicesOnAck( es = (struct DdeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); #endif - if ((es->service == (ATOM)NULL || es->service == service) - && (es->topic == (ATOM)NULL || es->topic == topic)) { + if ((es->service == (ATOM)0 || es->service == service) + && (es->topic == (ATOM)0 || es->topic == topic)) { Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL); Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp); - GlobalGetAtomName(service, sz, 255); + GlobalGetAtomNameA(service, sz, 255); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1)); - GlobalGetAtomName(topic, sz, 255); + GlobalGetAtomNameA(topic, sz, 255); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1)); /* @@ -1037,7 +1037,7 @@ DdeEnumWindowsCallback( HWND hwndTarget, LPARAM lParam) { - LRESULT dwResult = 0; + DWORD dwResult = 0; struct DdeEnumServices *es = (struct DdeEnumServices *) lParam; SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, @@ -1057,8 +1057,8 @@ DdeGetServicesList( es.interp = interp; es.result = TCL_OK; es.service = (serviceName == NULL) - ? (ATOM)NULL : GlobalAddAtom(serviceName); - es.topic = (topicName == NULL) ? (ATOM)NULL : GlobalAddAtom(topicName); + ? (ATOM)0 : GlobalAddAtom(serviceName); + es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtom(topicName); Tcl_ResetResult(interp); /* our list is to be appended to result. */ DdeCreateClient(&es); @@ -1067,10 +1067,10 @@ DdeGetServicesList( if (IsWindow(es.hwnd)) { DestroyWindow(es.hwnd); } - if (es.service != (ATOM)NULL) { + if (es.service != (ATOM)0) { GlobalDeleteAtom(es.service); } - if (es.topic != (ATOM)NULL) { + if (es.topic != (ATOM)0) { GlobalDeleteAtom(es.topic); } return es.result; @@ -1318,7 +1318,7 @@ Tcl_DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, serviceName, + ddeService = DdeCreateStringHandle(ddeInstance, (void *) serviceName, CP_WINANSI); } @@ -1327,7 +1327,7 @@ Tcl_DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, + ddeTopic = DdeCreateStringHandle(ddeInstance, (void *) topicName, CP_WINANSI); } } @@ -1344,8 +1344,8 @@ Tcl_DdeObjCmd( case DDE_EXECUTE: { int dataLength; - char *dataString = Tcl_GetStringFromObj(objv[firstArg + 2], - &dataLength); + BYTE *dataString = (BYTE *) Tcl_GetStringFromObj( + objv[firstArg + 2], &dataLength); if (dataLength == 0) { Tcl_SetObjResult(interp, @@ -1403,7 +1403,7 @@ Tcl_DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, (void *)itemString, CP_WINANSI); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1413,13 +1413,13 @@ Tcl_DdeObjCmd( result = TCL_ERROR; } else { DWORD tmp; - char *dataString = DdeAccessData(ddeData, &tmp); + const BYTE *dataString = DdeAccessData(ddeData, &tmp); if (binary) { returnObjPtr = Tcl_NewByteArrayObj(dataString, (int) tmp); } else { - returnObjPtr = Tcl_NewStringObj(dataString, -1); + returnObjPtr = Tcl_NewStringObj((const char *)dataString, -1); } DdeUnaccessData(ddeData); DdeFreeDataHandle(ddeData); @@ -1435,7 +1435,7 @@ Tcl_DdeObjCmd( } case DDE_POKE: { char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length); - char *dataString; + BYTE *dataString; if (length == 0) { Tcl_SetObjResult(interp, @@ -1443,7 +1443,8 @@ Tcl_DdeObjCmd( result = TCL_ERROR; goto cleanup; } - dataString = Tcl_GetStringFromObj(objv[firstArg + 3], &length); + dataString = (BYTE *) Tcl_GetStringFromObj(objv[firstArg + 3], + &length); hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1453,7 +1454,7 @@ Tcl_DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString, CP_WINANSI); if (ddeItem != NULL) { ddeData = DdeClientTransaction(dataString, (DWORD) length+1, @@ -1598,8 +1599,8 @@ Tcl_DdeObjCmd( objPtr = Tcl_ConcatObj(objc, objv); string = Tcl_GetStringFromObj(objPtr, &length); - ddeItemData = DdeCreateDataHandle(ddeInstance, string, - (DWORD) length+1, 0, 0, CF_TEXT, 0); + ddeItemData = DdeCreateDataHandle(ddeInstance, + (BYTE *) string, (DWORD) length+1, 0, 0, CF_TEXT, 0); if (async) { ddeData = DdeClientTransaction((LPBYTE) ddeItemData, @@ -1641,7 +1642,7 @@ Tcl_DdeObjCmd( length = DdeGetData(ddeData, NULL, 0, 0); Tcl_SetObjLength(resultPtr, length); string = Tcl_GetString(resultPtr); - DdeGetData(ddeData, string, (DWORD) length, 0); + DdeGetData(ddeData, (BYTE *) string, (DWORD) length, 0); Tcl_SetObjLength(resultPtr, (int) strlen(string)); if (Tcl_ListObjIndex(NULL, resultPtr, 0, &objPtr) != TCL_OK) { diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index d1cbf74..3a520e2 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.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: tclWinNotify.c,v 1.21 2005/11/04 00:06:50 dkf Exp $ + * RCS: @(#) $Id: tclWinNotify.c,v 1.21.10.1 2010/05/21 12:18:17 nijtmans Exp $ */ #include "tclInt.h" @@ -500,7 +500,7 @@ Tcl_WaitForEvent( PostQuitMessage((int) msg.wParam); status = -1; - } else if (result == -1) { + } else if (result == (DWORD)-1) { /* * We got an error from the system. I have no idea why this would * happen, so we'll just unwind. -- cgit v0.12