diff options
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r-- | generic/tclFileName.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c index d9d7b62..e4c484d 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.17 2001/08/23 17:37:07 vincentdarley Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.18 2001/08/23 18:20:50 hobbs Exp $ */ #include "tclInt.h" @@ -538,9 +538,9 @@ Tcl_SplitPath(path, argcPtr, argvPtr) * of pointers to path elements. */ { Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */ - Tcl_Obj *tmpPtr; - int i, size; - char *p; + Tcl_Obj *tmpPtr, *eltPtr; + int i, size, len; + char *p, *str; /* * Perform the splitting, using objectified, vfs-aware code. @@ -555,11 +555,8 @@ Tcl_SplitPath(path, argcPtr, argvPtr) size = 1; for (i = 0; i < *argcPtr; i++) { - int len; - Tcl_Obj *elt; - - Tcl_ListObjIndex(NULL, resultPtr, i, &elt); - Tcl_GetStringFromObj(elt, &len); + Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr); + Tcl_GetStringFromObj(eltPtr, &len); size += len + 1; } @@ -578,13 +575,9 @@ Tcl_SplitPath(path, argcPtr, argvPtr) p = (char *) &(*argvPtr)[(*argcPtr) + 1]; for (i = 0; i < *argcPtr; i++) { - int len; - Tcl_Obj *elt; - char *str; - - Tcl_ListObjIndex(NULL, resultPtr, i, &elt); - str = Tcl_GetStringFromObj(elt, &len); - strncpy(p, str, len+1); + Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr); + str = Tcl_GetStringFromObj(eltPtr, &len); + memcpy((VOID *) p, (VOID *) str, (size_t) len+1); p += len+1; } @@ -1048,7 +1041,7 @@ TclpNativeJoinPath(prefix, joining) * slashes. */ - Tcl_SetObjLength(prefix, length + strlen(p)); + Tcl_SetObjLength(prefix, length + (int) strlen(p)); dest = Tcl_GetString(prefix) + length; for (; *p != '\0'; p++) { @@ -1087,7 +1080,7 @@ TclpNativeJoinPath(prefix, joining) * trailing slashes. */ - Tcl_SetObjLength(prefix, length + strlen(p)); + Tcl_SetObjLength(prefix, length + (int) strlen(p)); dest = Tcl_GetString(prefix) + length; for (; *p != '\0'; p++) { if ((*p == '/') || (*p == '\\')) { |