]> andersk Git - splint.git/blobdiff - src/osd.c
Fixed problem with NULL being changed.
[splint.git] / src / osd.c
index 71b5de41f10f4f0978283258913a93d7b2e164eb..171d8777c364e0017d9c411aa0a74e72d9cf3339 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -62,7 +62,6 @@
 # include "splintMacros.nf"
 # include "basic.h"
 # include "osd.h"
-# include "portab.h"
 
 /* from stat.h */
 /*@ignore@*/
@@ -184,7 +183,7 @@ osd_getPath (cstring path, cstring file, cstring *returnPath)
       *fullPath == '\0' || 
       (*file == CONNECTCHAR || (file[0] != '\0' && file[1] == ':'))
 # else
-    (*file == CONNECTCHAR)
+      (*file == CONNECTCHAR)
 # endif
       )
     {
@@ -204,8 +203,8 @@ osd_getPath (cstring path, cstring file, cstring *returnPath)
       /* Path specified. Loop through directories in path looking for the */
       /* first occurrence of the file.                             */
       
-      while (nextdir (&fullPath, &dirPtr, &dirLen) &&
-            rVal == OSD_FILENOTFOUND)
+      while (nextdir (&fullPath, &dirPtr, &dirLen) 
+            && rVal == OSD_FILENOTFOUND)
        {
          if ((dirLen + strlen (file) + 2) <= MAXPATHLEN)
            {
@@ -302,7 +301,7 @@ osd_fileExists (cstring filespec)
 {
 # ifdef UNIX
   struct stat buf;
-  return (stat (cstring_toCharsSafe (filespec), &buf) == 0);
+  /*@i3@*/ return (stat (cstring_toCharsSafe (filespec), &buf) == 0); /* spurious */
 # else
 # if defined (WIN32) || defined (OS2)
   FILE *test = fileTable_openReadFile (context_fileTable (), filespec);
@@ -345,7 +344,7 @@ osd_executableFileExists (/*@unused@*/ char *filespec)
     { 
       /* mask by file type */
       /*@-unrecog@*/ /* S_IFMT is not defined */
-      if ((buf.st_mode & S_IFMT) != S_IFDIR /*@=unrecog@*/) /* not a directory */
+      /*@i32@*/ if ((buf.st_mode & S_IFMT) != S_IFDIR /*@=unrecog@*/) /* not a directory */ /* spurious */
        {
          /* as long as it is an executable file */
 # if defined(__IBMC__) && defined(OS2)
@@ -360,12 +359,12 @@ osd_executableFileExists (/*@unused@*/ char *filespec)
                   | (buf.st_mode & S_IXGRP) |
                   (buf.st_mode & S_IXOTH)
 # endif
-                  ) != 0);
+                  /*@i4@*/ ) != 0); /* spurious */
 # endif
        }
     }
 # endif
-  return (FALSE);
+  /*@i4@*/ return (FALSE); /* spurious */
 
 }
 
@@ -453,7 +452,7 @@ nextdir (d_char *current_dir, d_char *dir, size_t *len)
 # endif
 }
 
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
 extern /*@external@*/ int _flushall (void) /*@modifies fileSystem@*/ ;
 # endif
 
@@ -464,7 +463,7 @@ int osd_system (cstring cmd)
 {
   int res;
     /* system ("printenv"); */
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
   (void) _flushall (); 
 # endif
 
@@ -479,7 +478,7 @@ extern /*@external@*/ int unlink (const char *) /*@modifies fileSystem@*/ ;
 /*@=redecl@*/
 # endif
 
-static s_tempError = FALSE;
+static bool s_tempError = FALSE;
 
 void osd_setTempError (void)
 {
@@ -515,7 +514,7 @@ osd_getPid ()
 # if defined (WIN32) || defined (OS2) && defined (__IBMC__)
   int pid = _getpid ();
 # else
-  pid_t pid = getpid ();
+  __pid_t pid = getpid ();
 # endif
 
   return (int) pid;
@@ -1037,7 +1036,6 @@ cstring osd_absolutePath (cstring cwd, cstring filename)
 
 cstring osd_outputPath (cstring filename)
 {
-  /*@i2534 fix this junky code once and for all! */
 # if defined (UNIX) || defined (OS2)
   char *rel_buffer;
   char *rel_buf_p;
@@ -1078,7 +1076,6 @@ cstring osd_outputPath (cstring filename)
        }
       else
        {
-         /*@i324 ! splint didn't report an errors for: return ++path_p; */
          cstring_free (rel_buffer);
          return cstring_fromCharsNew (path_p + 1);
        }
@@ -1166,7 +1163,7 @@ cstring osd_outputPath (cstring filename)
       while ((*rel_buf_p++ = *path_p++) != '\0') ;
 
       
-      /*@=usereleased@*/ /*@i523! shouldn't need these */
+      /*@=usereleased@*/ /* Splint limitation: shouldn't need these */
       --rel_buf_p;
 
       if (osd_isConnectChar (*(rel_buf_p-1)))
This page took 0.165338 seconds and 4 git commands to generate.