dtdocbook: resolve 49 compiler warnings.
authorPeter Howkins <flibble@users.sf.net>
Tue, 6 Jan 2015 17:22:50 +0000 (17:22 +0000)
committerPeter Howkins <flibble@users.sf.net>
Tue, 6 Jan 2015 17:22:50 +0000 (17:22 +0000)
cde/programs/dtdocbook/instant/browse.c
cde/programs/dtdocbook/lib/tptregexp/regexp.c
cde/programs/dtdocbook/tcl/tclEvent.c
cde/programs/dtdocbook/tcl/tclInterp.c
cde/programs/dtdocbook/tcl/tclUnixChan.c
cde/programs/dtdocbook/tcl/tclUnixFile.c
cde/programs/dtdocbook/tcl/tclUnixNotfy.c
cde/programs/dtdocbook/tcl/tclUnixPipe.c

index a19a8544fb4fa4c8e75b30b5a855006527085003..5dd7dab3965328d0e2c3a5e8dfb7adf2bef44934 100644 (file)
@@ -162,7 +162,7 @@ Browse()
            if (av[1] && isdigit(*av[1])) {
                n = atoi(av[1]);
                if (n < ce->ndcont) {
-                   printf(ce->dcont[n]);
+                   printf("%s", ce->dcont[n]);
                    fputs("\n", stdout);
                }
                else if (ce->ndcont == 0)
index c866d5030d45e15d154ff33dcbb1b504b50491bd..a5b946734055663226838977a06b4e0f4f3a4106 100644 (file)
@@ -47,6 +47,7 @@
  */
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include <tptregexp.h>
 #include "regmagic.h"
 
index 09425ffb4a6d2a0e4c0aba664faf8eb04f88b248..7ab162c3badc5871589f90e9d6b6e3134bbd5389 100644 (file)
@@ -671,7 +671,7 @@ Tcl_CreateTimerHandler(milliseconds, proc, clientData)
     timerHandlerPtr->proc = proc;
     timerHandlerPtr->clientData = clientData;
     id++;
-    timerHandlerPtr->token = (Tcl_TimerToken) id;
+    timerHandlerPtr->token = (Tcl_TimerToken) (intptr_t) id;
 
     /*
      * Add the event to the queue in the correct position
index f2516193dfe092b8f3ca3f5dfc93863e44d0bf30..ae410daa714c14307c3186fa693f525d81fa0fc2 100644 (file)
@@ -880,7 +880,7 @@ AliasHelper(curInterp, slaveInterp, masterInterp, masterPtr,
 
     do {
         hPtr = Tcl_CreateHashEntry(&(masterPtr->targetTable),
-                (char *) aliasCounter, &new);
+                (char *) (intptr_t) aliasCounter, &new);
        aliasCounter++;
     } while (new == 0);
 
index 37ea6c707ab7a889f79a2f8207b2cf996fe713d6..6154af1000bbd3b931f28a721b3b0c8e85a9abe8 100644 (file)
@@ -201,7 +201,7 @@ CommonBlockModeProc(instanceData, inFile, outFile, mode)
     int fd;
 
     if (inFile != NULL) {
-        fd = (int) Tcl_GetFileInfo(inFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
         curStatus = fcntl(fd, F_GETFL);
         if (mode == TCL_MODE_BLOCKING) {
             curStatus &= (~(O_NONBLOCK));
@@ -214,7 +214,7 @@ CommonBlockModeProc(instanceData, inFile, outFile, mode)
         curStatus = fcntl(fd, F_GETFL);
     }
     if (outFile != NULL) {
-        fd = (int) Tcl_GetFileInfo(outFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
         curStatus = fcntl(fd, F_GETFL);
         if (mode == TCL_MODE_BLOCKING) {
             curStatus &= (~(O_NONBLOCK));
@@ -262,7 +262,7 @@ FilePipeInputProc(instanceData, inFile, buf, toRead, errorCodePtr)
                                          * read from the input device? */
 
     *errorCodePtr = 0;
-    fd = (int) Tcl_GetFileInfo(inFile, NULL);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
     
     /*
      * Assume there is always enough input available. This will block
@@ -311,7 +311,7 @@ FilePipeOutputProc(instanceData, outFile, buf, toWrite, errorCodePtr)
     int fd;
 
     *errorCodePtr = 0;
-    fd = (int) Tcl_GetFileInfo(outFile, NULL);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
     written = write(fd, buf, (size_t) toWrite);
     if (written > -1) {
         return written;
@@ -356,7 +356,7 @@ FileCloseProc(instanceData, interp, inFile, outFile)
        if (inFile == outFile) {
            outFile = NULL;
        }
-        fd = (int) Tcl_GetFileInfo(inFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
         Tcl_FreeFile(inFile);
 
        if (close(fd) < 0) {
@@ -365,7 +365,7 @@ FileCloseProc(instanceData, interp, inFile, outFile)
     }
 
     if (outFile != NULL) {
-        fd = (int) Tcl_GetFileInfo(outFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
         Tcl_FreeFile(outFile);        
        if ((close(fd) < 0) && (errorCode == 0)) {
            errorCode = errno;
@@ -412,9 +412,9 @@ FileSeekProc(instanceData, inFile, outFile, offset, mode, errorCodePtr)
 
     *errorCodePtr = 0;
     if (inFile != (Tcl_File) NULL) {
-        fd = (int) Tcl_GetFileInfo(inFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
     } else if (outFile != (Tcl_File) NULL) {
-        fd = (int) Tcl_GetFileInfo(outFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
     } else {
         *errorCodePtr = EFAULT;
         return -1;
@@ -509,14 +509,14 @@ PipeCloseProc(instanceData, interp, inFile, outFile)
     errorCode = 0;
     pipePtr = (PipeState *) instanceData;
     if (pipePtr->readFile != NULL) {
-        fd = (int) Tcl_GetFileInfo(pipePtr->readFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(pipePtr->readFile, NULL);
         Tcl_FreeFile(pipePtr->readFile);
        if (close(fd) < 0) {
            errorCode = errno;
        }
     }
     if (pipePtr->writeFile != NULL) {
-        fd = (int) Tcl_GetFileInfo(pipePtr->writeFile, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(pipePtr->writeFile, NULL);
         Tcl_FreeFile(pipePtr->writeFile);
        if ((close(fd) < 0) && (errorCode == 0)) {
            errorCode = errno;
@@ -626,7 +626,7 @@ Tcl_OpenFileChannel(interp, fileName, modeString, permissions)
     }
     
     sprintf(channelName, "file%d", fd);
-    file = Tcl_GetFile((ClientData) fd, TCL_UNIX_FD);
+    file = Tcl_GetFile((ClientData) (intptr_t) fd, TCL_UNIX_FD);
     
     chan = Tcl_CreateChannel(&fileChannelType, channelName,
             (channelPermissions & TCL_READABLE) ? file : NULL,
@@ -698,12 +698,12 @@ Tcl_MakeFileChannel(inFd, outFd, mode)
     outFile = (Tcl_File) NULL;
     
     if (mode & TCL_READABLE) {
-       sprintf(channelName, "file%d", (int) inFd);
+       sprintf(channelName, "file%d", (int) (intptr_t) inFd);
         inFile = Tcl_GetFile(inFd, TCL_UNIX_FD);
     }
     
     if (mode & TCL_WRITABLE) {
-       sprintf(channelName, "file%d", (int) outFd);
+       sprintf(channelName, "file%d", (int) (intptr_t) outFd);
         outFile = Tcl_GetFile(outFd, TCL_UNIX_FD);
     }
 
@@ -758,11 +758,11 @@ TclCreateCommandChannel(readFile, writeFile, errorFile, numPids, pidPtr)
      */
 
     if (readFile) {
-       channelId = (int) Tcl_GetFileInfo(readFile, NULL);
+       channelId = (int) (intptr_t) Tcl_GetFileInfo(readFile, NULL);
     } else if (writeFile) {
-       channelId = (int) Tcl_GetFileInfo(writeFile, NULL);
+       channelId = (int) (intptr_t) Tcl_GetFileInfo(writeFile, NULL);
     } else if (errorFile) {
-       channelId = (int) Tcl_GetFileInfo(errorFile, NULL);
+       channelId = (int) (intptr_t) Tcl_GetFileInfo(errorFile, NULL);
     } else {
        channelId = 0;
     }
@@ -926,7 +926,7 @@ WaitForConnect(statePtr, fileToWaitFor, errorCodePtr)
         state = TclWaitForFile(fileToWaitFor, TCL_WRITABLE | TCL_EXCEPTION,
                 timeOut);
         if (!(statePtr->flags & TCP_ASYNC_SOCKET)) {
-            sock = (int) Tcl_GetFileInfo(statePtr->sock, NULL);
+            sock = (int) (intptr_t) Tcl_GetFileInfo(statePtr->sock, NULL);
             flags = fcntl(sock, F_GETFL);
             flags &= (~(O_NONBLOCK));
             (void) fcntl(sock, F_SETFL, flags);
@@ -982,7 +982,7 @@ TcpInputProc(instanceData, inFile, buf, bufSize, errorCodePtr)
     int state;                         /* Of waiting for connection. */
 
     *errorCodePtr = 0;
-    sock = (int) Tcl_GetFileInfo(inFile, NULL);
+    sock = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
     statePtr = (TcpState *) instanceData;
 
     state = WaitForConnect(statePtr, inFile, errorCodePtr);
@@ -1040,7 +1040,7 @@ TcpOutputProc(instanceData, outFile, buf, toWrite, errorCodePtr)
     int state;                         /* Of waiting for connection. */
 
     *errorCodePtr = 0;
-    sock = (int) Tcl_GetFileInfo(outFile, NULL);
+    sock = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
     statePtr = (TcpState *) instanceData;
     state = WaitForConnect(statePtr, outFile, errorCodePtr);
     if (state != 0) {
@@ -1086,7 +1086,7 @@ TcpCloseProc(instanceData, interp, inFile, outFile)
 
     statePtr = (TcpState *) instanceData;
     sockFile = statePtr->sock;
-    sock = (int) Tcl_GetFileInfo(sockFile, NULL);
+    sock = (int) (intptr_t) Tcl_GetFileInfo(sockFile, NULL);
     
     /*
      * Delete a file handler that may be active for this socket if this
@@ -1156,7 +1156,7 @@ TcpGetOptionProc(instanceData, optionName, dsPtr)
     char buf[128];
 
     statePtr = (TcpState *) instanceData;
-    sock = (int) Tcl_GetFileInfo(statePtr->sock, NULL);
+    sock = (int) (intptr_t) Tcl_GetFileInfo(statePtr->sock, NULL);
     if (optionName != (char *) NULL) {
         len = strlen(optionName);
     }
@@ -1355,7 +1355,7 @@ bindError:
     if (asyncConnect) {
         statePtr->flags = TCP_ASYNC_CONNECT;
     }
-    statePtr->sock = Tcl_GetFile((ClientData) sock, TCL_UNIX_FD);
+    statePtr->sock = Tcl_GetFile((ClientData) (intptr_t) sock, TCL_UNIX_FD);
     
     return statePtr;
 
@@ -1478,7 +1478,7 @@ Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
     statePtr->acceptProcData = (ClientData) NULL;
 
     sprintf(channelName, "sock%d",
-           (int) Tcl_GetFileInfo(statePtr->sock, NULL));
+           (int) (intptr_t) Tcl_GetFileInfo(statePtr->sock, NULL));
 
     chan = Tcl_CreateChannel(&tcpChannelType, channelName, statePtr->sock,
            statePtr->sock, (ClientData) statePtr);
@@ -1521,7 +1521,7 @@ Tcl_MakeTcpClientChannel(sock)
     statePtr->acceptProc = NULL;
     statePtr->acceptProcData = (ClientData) NULL;
 
-    sprintf(channelName, "sock%d", (int) sock);
+    sprintf(channelName, "sock%d", (int) (intptr_t) sock);
     
     chan = Tcl_CreateChannel(&tcpChannelType, channelName, sockFile, sockFile,
             (ClientData) statePtr);
@@ -1585,7 +1585,7 @@ Tcl_OpenTcpServer(interp, port, myHost, acceptProc, acceptProcData)
     Tcl_CreateFileHandler(statePtr->sock, TCL_READABLE, TcpAccept,
             (ClientData) statePtr);
     sprintf(channelName, "sock%d",
-           (int) Tcl_GetFileInfo(statePtr->sock, NULL));
+           (int) (intptr_t) Tcl_GetFileInfo(statePtr->sock, NULL));
     chan = Tcl_CreateChannel(&tcpChannelType, channelName, NULL, NULL,
             (ClientData) statePtr);
     return chan;
@@ -1625,13 +1625,13 @@ TcpAccept(data, mask)
     sockState = (TcpState *) data;
 
     len = sizeof(struct sockaddr_in);
-    newsock = accept((int) Tcl_GetFileInfo(sockState->sock, NULL),
+    newsock = accept((int) (intptr_t) Tcl_GetFileInfo(sockState->sock, NULL),
            (struct sockaddr *)&addr, &len);
     if (newsock < 0) {
         return;
     }
     
-    newFile = Tcl_GetFile((ClientData) newsock, TCL_UNIX_FD);
+    newFile = Tcl_GetFile((ClientData) (intptr_t) newsock, TCL_UNIX_FD);
     if (newFile) {
         newSockState = (TcpState *) ckalloc((unsigned) sizeof(TcpState));
 
@@ -1713,7 +1713,7 @@ TclGetDefaultStdChannel(type)
            break;
     }
 
-    channel = Tcl_MakeFileChannel((ClientData) fd, (ClientData) fd, mode);
+    channel = Tcl_MakeFileChannel((ClientData) (intptr_t) fd, (ClientData) (intptr_t) fd, mode);
 
     /*
      * Set up the normal channel options for stdio handles.
@@ -1755,7 +1755,7 @@ void
 TclClosePipeFile(file)
     Tcl_File file;
 {
-    int fd = (int) Tcl_GetFileInfo(file, NULL);
+    int fd = (int) (intptr_t) Tcl_GetFileInfo(file, NULL);
     close(fd);
     Tcl_FreeFile(file);
 }
@@ -1827,7 +1827,7 @@ Tcl_GetOpenFile(interp, string, forWriting, checkUsage, filePtr)
             || (chanTypePtr == &tcpChannelType)) {
         tf = Tcl_GetChannelFile(chan,
                 (forWriting ? TCL_WRITABLE : TCL_READABLE));
-        fd = (int) Tcl_GetFileInfo(tf, NULL);
+        fd = (int) (intptr_t) Tcl_GetFileInfo(tf, NULL);
 
         /*
          * The call to fdopen below is probably dangerous, since it will
index 3326cdb7ce1b057d110b15550c6b97a38111e1a1..183386658e691cfcc22d314d3060a3a47b0cbb98 100644 (file)
@@ -269,7 +269,7 @@ TclOpenFile(fname, mode)
     fd = open(fname, mode, 0600);
     if (fd != -1) {
         fcntl(fd, F_SETFD, FD_CLOEXEC);
-        return Tcl_GetFile((ClientData)fd, TCL_UNIX_FD);
+        return Tcl_GetFile((ClientData) (intptr_t) fd, TCL_UNIX_FD);
     }
     return NULL;
 }
@@ -298,7 +298,7 @@ TclCloseFile(file)
     int fd;
     int result;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
     if (type != TCL_UNIX_FD) {
        panic("Tcl_CloseFile: unexpected file type");
     }
@@ -343,7 +343,7 @@ TclReadFile(file, shouldBlock, buf, toRead)
 {
     int type, fd;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
     if (type != TCL_UNIX_FD) {
        panic("Tcl_ReadFile: unexpected file type");
     }
@@ -377,7 +377,7 @@ TclWriteFile(file, shouldBlock, buf, toWrite)
 {
     int type, fd;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
     if (type != TCL_UNIX_FD) {
        panic("Tcl_WriteFile: unexpected file type");
     }
@@ -410,7 +410,7 @@ TclSeekFile(file, offset, whence)
 {
     int type, fd;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
     if (type != TCL_UNIX_FD) {
        panic("Tcl_SeekFile: unexpected file type");
     }
@@ -449,7 +449,7 @@ TclCreateTempFile(contents)
     unlink(fileName);
 
     if ((file != NULL) && (length > 0)) {
-       int fd = (int)Tcl_GetFileInfo(file, NULL);
+       int fd = (int) (intptr_t) Tcl_GetFileInfo(file, NULL);
        while (1) {
            if (write(fd, contents, length) != -1) {
                break;
index 70062d220f2e1b13d58e7208f7c26ae5747b7cdf..3a51a7f842d2663b3d2a723a953799de00035974 100644 (file)
@@ -101,7 +101,7 @@ Tcl_WatchFile(file, mask)
     int fd, type, index;
     fd_mask bit;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
 
     if (type != TCL_UNIX_FD) {
        panic("Tcl_WatchFile: unexpected file type");
@@ -159,7 +159,7 @@ Tcl_FileReady(file, mask)
     int index, result, type, fd;
     fd_mask bit;
 
-    fd = (int) Tcl_GetFileInfo(file, &type);
+    fd = (int) (intptr_t) Tcl_GetFileInfo(file, &type);
     if (type != TCL_UNIX_FD) {
        panic("Tcl_FileReady: unexpected file type");
     }
index 816b0b3e2099ceecef82de9feabe8eb2aa6ea2c4..e345ce034e8b0ff16020b4c6563b28920c3b2cba 100644 (file)
@@ -170,7 +170,7 @@ SetupStdFile(file, type)
        }
     }
     if (file) {
-       fd = (int)Tcl_GetFileInfo(file, NULL);
+       fd = (int) (intptr_t) Tcl_GetFileInfo(file, NULL);
        if (fd != targetFd) {
            if (dup2(fd, targetFd) == -1) {
                return 0;
@@ -450,8 +450,8 @@ TclCreatePipe(readPipe, writePipe)
     fcntl(pipeIds[0], F_SETFD, FD_CLOEXEC);
     fcntl(pipeIds[1], F_SETFD, FD_CLOEXEC);
 
-    *readPipe = Tcl_GetFile((ClientData)pipeIds[0], TCL_UNIX_FD);
-    *writePipe = Tcl_GetFile((ClientData)pipeIds[1], TCL_UNIX_FD);
+    *readPipe = Tcl_GetFile((ClientData) (intptr_t) pipeIds[0], TCL_UNIX_FD);
+    *writePipe = Tcl_GetFile((ClientData) (intptr_t) pipeIds[1], TCL_UNIX_FD);
     return 1;
 }
 \f
@@ -494,7 +494,7 @@ Tcl_CreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
 
     if (inPipePtr) {
        if (inFile) {
-           *inPipePtr = (int) Tcl_GetFileInfo(inFile, NULL);
+           *inPipePtr = (int) (intptr_t) Tcl_GetFileInfo(inFile, NULL);
            Tcl_FreeFile(inFile);
        } else {
            *inPipePtr = -1;
@@ -502,7 +502,7 @@ Tcl_CreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
     }
     if (outPipePtr) {
        if (outFile) {
-           *outPipePtr = (int) Tcl_GetFileInfo(outFile, NULL);
+           *outPipePtr = (int) (intptr_t) Tcl_GetFileInfo(outFile, NULL);
            Tcl_FreeFile(outFile);
        } else {
            *outPipePtr = -1;
@@ -510,7 +510,7 @@ Tcl_CreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
     }
     if (errFilePtr) {
        if (errFile) {
-           *errFilePtr = (int) Tcl_GetFileInfo(errFile, NULL);
+           *errFilePtr = (int) (intptr_t) Tcl_GetFileInfo(errFile, NULL);
            Tcl_FreeFile(errFile);
        } else {
            *errFilePtr = -1;