summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-02-03 23:10:57 (GMT)
committernijtmans <nijtmans>2009-02-03 23:10:57 (GMT)
commit6b40f13d26013e672072cb794817a2d322d8127e (patch)
treea72237070484512e9aa19c3f44b7ed7313fe1086
parent78da1e5f1b89986ba2526d799110ffc708040c21 (diff)
downloadtcl-6b40f13d26013e672072cb794817a2d322d8127e.zip
tcl-6b40f13d26013e672072cb794817a2d322d8127e.tar.gz
tcl-6b40f13d26013e672072cb794817a2d322d8127e.tar.bz2
- eliminate some unnessary type casts
- some internal const decorations - spacing
-rw-r--r--ChangeLog15
-rw-r--r--macosx/tclMacOSXFCmd.c4
-rw-r--r--unix/tclLoadDyld.c14
-rw-r--r--unix/tclUnixCompat.c6
-rw-r--r--unix/tclUnixFCmd.c12
-rw-r--r--unix/tclUnixFile.c7
-rw-r--r--win/tclWinDde.c22
-rw-r--r--win/tclWinFCmd.c6
-rw-r--r--win/tclWinInit.c4
-rw-r--r--win/tclWinLoad.c4
-rw-r--r--win/tclWinPipe.c4
-rw-r--r--win/tclWinReg.c26
-rw-r--r--win/tclWinTest.c4
13 files changed, 72 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 993b64e..b6f8800 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-02-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * macosx/tclMacOSXFCmd.c - eliminate some unnessary type casts
+ * unix/tclLoadDyld.c - some internal const decorations
+ * unix/tclUnixCompat.c - spacing
+ * unix/tclUnixFCmd.c
+ * unix/tclUnixFile.c
+ * win/tclWinDde.c
+ * win/tclWinFCmd.c
+ * win/tclWinInit.c
+ * win/tclWinLoad.c
+ * win/tclWinPipe.c
+ * win/tclWinReg.c
+ * win/tclWinTest.c
+
2009-02-03 Donal K. Fellows <dkf@users.sf.net>
* generic/tclObj.c (tclCmdNameType): [Bug 2558422]: Corrected the type
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index d1bab28..9d4e1a1 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.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: tclMacOSXFCmd.c,v 1.16 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.17 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -624,7 +624,7 @@ SetOSTypeFromAny(
Tcl_Interp *interp, /* Tcl interpreter */
Tcl_Obj *objPtr) /* Pointer to the object to convert */
{
- char *string;
+ const char *string;
int length, result = TCL_OK;
Tcl_DString ds;
Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman");
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index 93d29ab..e30742b 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.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: tclLoadDyld.c,v 1.30 2008/04/27 22:21:34 dkf Exp $
+ * RCS: @(#) $Id: tclLoadDyld.c,v 1.31 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -629,14 +629,14 @@ TclpLoadMemory(
uint32_t ms = 0;
#ifndef __LP64__
const struct mach_header *mh = NULL;
- #define mh_size sizeof(struct mach_header)
- #define mh_magic MH_MAGIC
- #define arch_abi 0
+# define mh_size sizeof(struct mach_header)
+# define mh_magic MH_MAGIC
+# define arch_abi 0
#else
const struct mach_header_64 *mh = NULL;
- #define mh_size sizeof(struct mach_header_64)
- #define mh_magic MH_MAGIC_64
- #define arch_abi CPU_ARCH_ABI64
+# define mh_size sizeof(struct mach_header_64)
+# define mh_magic MH_MAGIC_64
+# define arch_abi CPU_ARCH_ABI64
#endif
if ((size_t) codeSize >= sizeof(struct fat_header)
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index e61f17d..727eaaf 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -6,7 +6,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixCompat.c,v 1.16 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclUnixCompat.c,v 1.17 2009/02/03 23:10:57 nijtmans Exp $
*
*/
@@ -127,7 +127,7 @@ static int CopyGrp(struct group *tgtPtr, char *buf, int buflen);
static int CopyHostent(struct hostent *tgtPtr, char *buf,
int buflen);
static int CopyPwd(struct passwd *tgtPtr, char *buf, int buflen);
-static int CopyString(char *src, char *buf, int buflen);
+static int CopyString(const char *src, char *buf, int buflen);
#endif
#endif /* TCL_THREADS */
@@ -772,7 +772,7 @@ CopyArray(
#ifdef NEED_COPYSTRING
static int
CopyString(
- char *src, /* String to copy. */
+ const char *src, /* String to copy. */
char *buf, /* Buffer to copy into. */
int buflen) /* Size of buffer. */
{
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index 2523800..75fc727 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.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: tclUnixFCmd.c,v 1.71 2008/12/16 23:24:13 nijtmans Exp $
+ * RCS: @(#) $Id: tclUnixFCmd.c,v 1.72 2009/02/03 23:10:57 nijtmans Exp $
*
* Portions of this code were derived from NetBSD source code which has the
* following copyright notice:
@@ -86,7 +86,7 @@ static int SetPermissionsAttribute(Tcl_Interp *interp,
int objIndex, Tcl_Obj *fileName,
Tcl_Obj *attributePtr);
static int GetModeFromPermString(Tcl_Interp *interp,
- char *modeStringPtr, mode_t *modePtr);
+ const char *modeStringPtr, mode_t *modePtr);
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
static int GetReadOnlyAttribute(Tcl_Interp *interp, int objIndex,
Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
@@ -1600,7 +1600,7 @@ SetPermissionsAttribute(
mode_t newMode;
int result = TCL_ERROR;
const char *native;
- char *modeStringPtr = TclGetString(attributePtr);
+ const char *modeStringPtr = TclGetString(attributePtr);
int scanned = TclParseAllWhiteSpace(modeStringPtr, -1);
/*
@@ -1713,7 +1713,7 @@ TclpObjListVolumes(void)
static int
GetModeFromPermString(
Tcl_Interp *interp, /* The interp we are using for errors. */
- char *modeStringPtr, /* Permissions string */
+ const char *modeStringPtr, /* Permissions string */
mode_t *modePtr) /* pointer to the mode value */
{
mode_t newMode;
@@ -1906,10 +1906,10 @@ TclpObjNormalizePath(
Tcl_Obj *pathPtr,
int nextCheckpoint)
{
- char *currentPathEndPosition;
+ const char *currentPathEndPosition;
int pathLen;
char cur;
- char *path = Tcl_GetStringFromObj(pathPtr, &pathLen);
+ const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen);
#ifndef NO_REALPATH
char normPath[MAXPATHLEN];
Tcl_DString ds;
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index a24966c..8eabbbb 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.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: tclUnixFile.c,v 1.53 2008/04/27 22:21:34 dkf Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.54 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -314,7 +314,7 @@ TclpMatchInDirectory(
matchHiddenPat = (pattern[0] == '.')
|| ((pattern[0] == '\\') && (pattern[1] == '.'));
- matchHidden = matchHiddenPat
+ matchHidden = matchHiddenPat
|| (types && (types->perm & TCL_GLOB_PERM_HIDDEN));
while ((entryPtr = TclOSreaddir(d)) != NULL) { /* INTL: Native. */
Tcl_DString utfDs;
@@ -1080,7 +1080,8 @@ ClientData
TclNativeCreateNativeRep(
Tcl_Obj *pathPtr)
{
- char *nativePathPtr, *str;
+ char *nativePathPtr;
+ const char *str;
Tcl_DString ds;
Tcl_Obj *validPathPtr;
int len;
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 30f50ce..1425e94 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.33 2008/10/14 22:43:29 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinDde.c,v 1.34 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -711,7 +711,7 @@ DdeServerProc(
}
if (convPtr != NULL) {
- char *returnString;
+ const char *returnString;
len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINANSI);
Tcl_DStringInit(&dString);
@@ -722,7 +722,7 @@ DdeServerProc(
if (stricmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) {
returnString =
Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len);
- ddeReturn = DdeCreateDataHandle(ddeInstance, returnString,
+ ddeReturn = DdeCreateDataHandle(ddeInstance, (char *)returnString,
(DWORD) len+1, 0, ddeItem, CF_TEXT, 0);
} else {
if (Tcl_IsSafe(convPtr->riPtr->interp)) {
@@ -735,7 +735,7 @@ DdeServerProc(
returnString = Tcl_GetStringFromObj(variableObjPtr,
&len);
ddeReturn = DdeCreateDataHandle(ddeInstance,
- returnString, (DWORD) len+1, 0, ddeItem,
+ (char *)returnString, (DWORD) len+1, 0, ddeItem,
CF_TEXT, 0);
} else {
ddeReturn = NULL;
@@ -1345,7 +1345,7 @@ Tcl_DdeObjCmd(
case DDE_EXECUTE: {
int dataLength;
- char *dataString = Tcl_GetStringFromObj(objv[firstArg + 2],
+ const char *dataString = Tcl_GetStringFromObj(objv[firstArg + 2],
&dataLength);
if (dataLength == 0) {
@@ -1364,7 +1364,7 @@ Tcl_DdeObjCmd(
break;
}
- ddeData = DdeCreateDataHandle(ddeInstance, dataString,
+ ddeData = DdeCreateDataHandle(ddeInstance, (char *)dataString,
(DWORD) dataLength+1, 0, 0, CF_TEXT, 0);
if (ddeData != NULL) {
if (async) {
@@ -1387,7 +1387,7 @@ Tcl_DdeObjCmd(
break;
}
case DDE_REQUEST: {
- char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length);
+ const char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length);
if (length == 0) {
Tcl_SetObjResult(interp,
@@ -1404,7 +1404,7 @@ Tcl_DdeObjCmd(
result = TCL_ERROR;
} else {
Tcl_Obj *returnObjPtr;
- ddeItem = DdeCreateStringHandle(ddeInstance, itemString,
+ ddeItem = DdeCreateStringHandle(ddeInstance, (char *)itemString,
CP_WINANSI);
if (ddeItem != NULL) {
ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem,
@@ -1435,8 +1435,8 @@ Tcl_DdeObjCmd(
break;
}
case DDE_POKE: {
- char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length);
- char *dataString;
+ const char *itemString = Tcl_GetStringFromObj(objv[firstArg + 2], &length);
+ const char *dataString;
if (length == 0) {
Tcl_SetObjResult(interp,
@@ -1457,7 +1457,7 @@ Tcl_DdeObjCmd(
ddeItem = DdeCreateStringHandle(ddeInstance, itemString,
CP_WINANSI);
if (ddeItem != NULL) {
- ddeData = DdeClientTransaction(dataString, (DWORD) length+1,
+ ddeData = DdeClientTransaction((char *)dataString, (DWORD) length+1,
hConv, ddeItem, CF_TEXT, XTYP_POKE, 5000, NULL);
if (ddeData == NULL) {
SetDdeError(interp);
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index c0de916..5b8e0d8 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.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: tclWinFCmd.c,v 1.56 2008/12/16 23:24:13 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.57 2009/02/03 23:10:58 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -1611,7 +1611,7 @@ GetWinFileAttributes(
*/
int len;
- char *str = Tcl_GetStringFromObj(fileName,&len);
+ const char *str = Tcl_GetStringFromObj(fileName,&len);
if (len < 4) {
if (len == 0) {
@@ -1721,7 +1721,7 @@ ConvertFileNameFormat(
Tcl_DString ds;
Tcl_DString dsTemp;
TCHAR *nativeName;
- char *tempString;
+ const char *tempString;
int tempLen;
WIN32_FIND_DATAT data;
HANDLE handle;
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index f1e72de..1d348a7 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.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: tclWinInit.c,v 1.80 2008/10/26 18:43:27 dkf Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.81 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -180,7 +180,7 @@ TclpInitLibraryPath(
#define LIBRARY_SIZE 32
Tcl_Obj *pathPtr;
char installLib[LIBRARY_SIZE];
- char *bytes;
+ const char *bytes;
pathPtr = Tcl_NewObj();
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index 7202b24..af19ff1 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.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: tclWinLoad.c,v 1.22 2008/10/26 18:43:27 dkf Exp $
+ * RCS: @(#) $Id: tclWinLoad.c,v 1.23 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -66,7 +66,7 @@ TclpDlopen(
*/
Tcl_DString ds;
- char *fileName = Tcl_GetString(pathPtr);
+ const char *fileName = Tcl_GetString(pathPtr);
nativeName = Tcl_WinUtfToTChar(fileName, -1, &ds);
handle = tclWinProcs->loadLibraryProc(nativeName);
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 10caad7..b1dd26f 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.69 2008/12/03 09:51:45 dkf Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.70 2009/02/03 23:10:58 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -1173,7 +1173,7 @@ TclpCreateProcess(
* tcl dll.
*/
Tcl_Obj *tclExePtr, *pipeDllPtr;
- char *start, *end;
+ const char *start, *end;
int i, fileExists;
Tcl_DString pipeDll;
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index c695b94..16b4b3e 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.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: tclWinReg.c,v 1.44 2008/10/26 18:43:27 dkf Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.45 2009/02/03 23:10:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -589,7 +589,7 @@ GetKeyNames(
Tcl_Obj *keyNameObj, /* Key to enumerate. */
Tcl_Obj *patternObj) /* Optional match pattern. */
{
- char *pattern; /* Pattern being matched against subkeys */
+ const char *pattern; /* Pattern being matched against subkeys */
HKEY key; /* Handle to the key being examined */
DWORD subKeyCount; /* Number of subkeys to list */
DWORD maxSubKeyLen; /* Maximum string length of any subkey */
@@ -615,17 +615,17 @@ GetKeyNames(
return TCL_ERROR;
}
- /*
+ /*
* Determine how big a buffer is needed for enumerating subkeys, and
* how many subkeys there are
*/
result = (*regWinProcs->regQueryInfoKeyProc)
- (key, NULL, NULL, NULL, &subKeyCount, &maxSubKeyLen, NULL, NULL,
+ (key, NULL, NULL, NULL, &subKeyCount, &maxSubKeyLen, NULL, NULL,
NULL, NULL, NULL, NULL);
if (result != ERROR_SUCCESS) {
Tcl_SetObjResult(interp, Tcl_NewObj());
- Tcl_AppendResult(interp, "unable to query key \"",
+ Tcl_AppendResult(interp, "unable to query key \"",
Tcl_GetString(keyNameObj), "\": ", NULL);
AppendSystemError(interp, result);
RegCloseKey(key);
@@ -707,7 +707,7 @@ GetType(
DWORD result;
DWORD type;
Tcl_DString ds;
- char *valueName;
+ const char *valueName;
const char *nativeValue;
int length;
@@ -776,7 +776,7 @@ GetValue(
Tcl_Obj *valueNameObj) /* Name of value to get. */
{
HKEY key;
- char *valueName;
+ const char *valueName;
const char *nativeValue;
DWORD result, length, type;
Tcl_DString data, buf;
@@ -913,7 +913,7 @@ GetValueNames(
Tcl_Obj *resultPtr;
DWORD index, size, maxSize, result;
Tcl_DString buffer, ds;
- char *pattern, *name;
+ const char *pattern, *name;
/*
* Attempt to open the key for enumeration.
@@ -1304,7 +1304,7 @@ SetValue(
DWORD result;
HKEY key;
int length;
- char *valueName;
+ const char *valueName;
Tcl_DString nameBuf;
if (typeObj == NULL) {
@@ -1321,7 +1321,7 @@ SetValue(
}
valueName = Tcl_GetStringFromObj(valueNameObj, &length);
- valueName = (char *) Tcl_WinUtfToTChar(valueName, length, &nameBuf);
+ valueName = Tcl_WinUtfToTChar(valueName, length, &nameBuf);
if (type == REG_DWORD || type == REG_DWORD_BIG_ENDIAN) {
int value;
@@ -1375,9 +1375,9 @@ SetValue(
Tcl_DStringFree(&buf);
} else if (type == REG_SZ || type == REG_EXPAND_SZ) {
Tcl_DString buf;
- char *data = Tcl_GetStringFromObj(dataObj, &length);
+ const char *data = Tcl_GetStringFromObj(dataObj, &length);
- data = (char *) Tcl_WinUtfToTChar(data, length, &buf);
+ data = Tcl_WinUtfToTChar(data, length, &buf);
/*
* Include the null in the length, padding if needed for Unicode.
@@ -1441,7 +1441,7 @@ BroadcastValue(
LRESULT result, sendResult;
UINT timeout = 3000;
int len;
- char *str;
+ const char *str;
Tcl_Obj *objPtr;
if ((objc != 3) && (objc != 5)) {
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index 29e4974..35e7348 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.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: tclWinTest.c,v 1.24 2008/10/16 22:34:19 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinTest.c,v 1.25 2009/02/03 23:10:58 nijtmans Exp $
*/
#include "tclInt.h"
@@ -189,7 +189,7 @@ TestvolumetypeCmd(
#define VOL_BUF_SIZE 32
int found;
char volType[VOL_BUF_SIZE];
- char *path;
+ const char *path;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?name?");