diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2025-04-01 08:13:35 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2025-04-01 08:13:35 (GMT) |
| commit | 79ed51d25a48dce0d084a2c57f199821e58eac99 (patch) | |
| tree | 8de2f1cd37877eb5773cd0106a1de4e42703d936 /unix/tclUnixPipe.c | |
| parent | b915f649c229620e5a17add0e25b85ee99c9c91d (diff) | |
| parent | 254025c6d682cfde6e1cada371c419af7c60087b (diff) | |
| download | tcl-79ed51d25a48dce0d084a2c57f199821e58eac99.zip tcl-79ed51d25a48dce0d084a2c57f199821e58eac99.tar.gz tcl-79ed51d25a48dce0d084a2c57f199821e58eac99.tar.bz2 | |
Fix some -Wconversion warnings
Diffstat (limited to 'unix/tclUnixPipe.c')
| -rw-r--r-- | unix/tclUnixPipe.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 8d4a6b0..e1ee872 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -34,8 +34,8 @@ * the same as NULL. */ -#define MakeFile(fd) ((TclFile) INT2PTR(((int) (fd)) + 1)) -#define GetFd(file) (PTR2INT(file) - 1) +#define MakeFile(fd) ((TclFile)INT2PTR((fd) + 1)) +#define GetFd(file) ((int)PTR2INT(file) - 1) /* * This structure describes per-instance state of a pipe based channel. @@ -401,7 +401,7 @@ TclpCreateProcess( * occurred when creating the child process. * Error messages from the child process * itself are sent to errorFile. */ - size_t argc, /* Number of arguments in following array. */ + size_t argc, /* Number of arguments in following array. */ const char **argv, /* Array of argument strings in UTF-8. * argv[0] contains the name of the executable * translated using Tcl_TranslateFileName @@ -426,7 +426,8 @@ TclpCreateProcess( * process. */ { TclFile errPipeIn, errPipeOut; - int count, status, fd; + ssize_t count; + int status, fd; char errSpace[200 + TCL_INTEGER_SPACE]; Tcl_DString *volatile dsArray; char **volatile newArgv; @@ -630,7 +631,7 @@ TclpCreateProcess( char *end; errSpace[count] = 0; - errno = strtol(errSpace, &end, 10); + errno = (int)strtol(errSpace, &end, 10); Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s: %s", end, Tcl_PosixError(interp))); goto error; @@ -1003,7 +1004,7 @@ TclGetAndDetachPids( static int PipeBlockModeProc( - void *instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ int mode) /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ @@ -1043,7 +1044,7 @@ PipeBlockModeProc( static int PipeClose2Proc( - void *instanceData, /* The pipe to close. */ + void *instanceData, /* The pipe to close. */ Tcl_Interp *interp, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { @@ -1140,14 +1141,14 @@ PipeClose2Proc( static int PipeInputProc( - void *instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { PipeState *psPtr = (PipeState *)instanceData; - int bytesRead; /* How many bytes were actually read from the + ssize_t bytesRead; /* How many bytes were actually read from the * input device? */ *errorCodePtr = 0; @@ -1168,7 +1169,7 @@ PipeInputProc( *errorCodePtr = errno; return -1; } - return bytesRead; + return (int)bytesRead; } /* @@ -1191,13 +1192,13 @@ PipeInputProc( static int PipeOutputProc( - void *instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { PipeState *psPtr = (PipeState *)instanceData; - int written; + ssize_t written; *errorCodePtr = 0; @@ -1214,7 +1215,7 @@ PipeOutputProc( *errorCodePtr = errno; return -1; } - return written; + return (int)written; } /* @@ -1252,7 +1253,7 @@ PipeWatchNotifyChannelWrapper( static void PipeWatchProc( - void *instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ @@ -1300,9 +1301,9 @@ PipeWatchProc( static int PipeGetHandleProc( - void *instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - void **handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { PipeState *psPtr = (PipeState *)instanceData; |
