Fix BSD and Sun problems after coverity fixes
authorUlrich Wilkens <mail@uwilkens.de>
Thu, 31 May 2018 20:47:27 +0000 (22:47 +0200)
committerJon Trulson <jon@radscan.com>
Thu, 31 May 2018 23:46:03 +0000 (17:46 -0600)
12 files changed:
cde/config/cf/sun.cf
cde/lib/DtTerm/Term/TermParseTable.c
cde/lib/tt/lib/mp/mp_rpc_client.C
cde/lib/tt/slib/mp_observer.C
cde/programs/dtappbuilder/src/libABobjXm/objxm_config.c
cde/programs/dtcalc/functions.c
cde/programs/dtfile/dtcopy/fsrtns.c
cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C
cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h
cde/programs/dtinfo/dtinfo/src/Templates.C
cde/programs/dtlogin/session.c
cde/programs/dtspcd/main.c

index 4c53beba8f56f2349720b4d11c4ce2c7f26da303..956da3ff05e6649d9595081995a99b8b288ec361 100644 (file)
@@ -178,9 +178,12 @@ XCOMM Gnu C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion
 #ifndef CplusplusLibC
 #define CplusplusLibC          -L/opt/solarisstudio/lib -lCrun
 #endif
+#ifndef OptimizedCplusplusDebugFlags
+# define OptimizedCplusplusDebugFlags  -O2 -erroff=attrskipunsup
+#endif
 #ifndef  CplusplusDependIncludes
 #if CplusplusCompilerMajorVersion > 3
-# define CplusplusDependIncludes       -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd
+# define CplusplusDependIncludes       -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd -I/opt/solarisstudio/prod/include/CC/std
 #elif CplusplusCompilerMajorVersion > 2
 # define CplusplusDependIncludes       -I/opt/SUNWspro/SC3.0/include/CC
 #else
index 46a8cfa055f29f84cdb9378f05cec93e53abe337..6452626c2e19091b55bc9a85eead2eb3bee09186 100644 (file)
@@ -554,7 +554,6 @@ esc_P_table[] =
  {  '0',  '9', &_DtTermStateP,  _DtTermEnterNum,     /* enter number */ },
  {  '|',  '|',  &_DtTermStateUserKey, _DtTermParseUserKeyClear, /* DECUDK  */ },
  {  '{',  '{',  &_DtTermStateDLCharSet, _DtTermPrimParserNextState, },
- {                                                /* down-line-load char set */ },
  {  0x00, 0xFF, &stateStart   ,      _DtTermPrintState   /* end of table */ },
 };
 StateTableRec _DtTermStateP  = {False, esc_P_table, pre_parse_table};
index c393a4888d8edb7e4fb1c260e4085b755c6866bf..6c2a8177d1ab014b87d589656bdda75ed3462c14 100644 (file)
@@ -91,9 +91,13 @@ _Tt_rpc_client(int conn_socket)
        _program = 0;
        _version = 0;
        _server_uid = 0;
-       _clnt_stat = NULL;
+       _clnt_stat = RPC_SUCCESS;
+#if defined(OPT_TLI)
+       _server_addr = 0;
+#else
        _server_addr.sin_family = 0;
        _server_addr.sin_port = 0;
+#endif
 }
 
 
index bb1a2e22c10ac929b6abb70ee4d58f3d61590fa4..49ab304954e4860147aa1e63872db77b9949a15f 100644 (file)
@@ -49,7 +49,7 @@ _Tt_observer()
        _reliability = TT_DISCARD;
        _opnum = -1;
 
-       _scope = NULL;
+       _scope = TT_SCOPE_NONE;
        _state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists
 }
 
index 119a9911450faf1fa69e78ed19d78f554bf5e7eb..4dce682f53f9fc1811753bdcbe03d67129201265 100644 (file)
@@ -428,7 +428,7 @@ config_attachment(
             attachment = &(obj->attachments->south);
             break;
         default:
-            return;
+            return OK;
     }
     if (attachment->type == AB_ATTACH_OBJ)
     {
index f3ba5f1a0fc57914a097ebfa346051852f6a381e..f1d4bcf19c1d764ad6c19cd2c042de0b05904502 100644 (file)
@@ -37,6 +37,9 @@
 #include <errno.h>
 #include <string.h>
 #include <math.h>
+#if defined(sun)
+#include <ieeefp.h>
+#endif
 #include "calctool.h"
 
 extern char *base_str[] ;       /* Strings for each base value. */
@@ -1729,13 +1732,13 @@ do_round(double result, int ndigits)
     int temp;
 
     if (isnan(result)) return result;
-#if defined(_AIX) || defined(__aix) || defined(__sparc)
+#if defined(_AIX) || defined(__aix) || defined(sun)
     temp = finite(result);
     if (!temp)
        return (temp > 0) ? HUGE : -HUGE;
 #else
     if ((temp = isinf(result))) return (temp > 0) ? HUGE : -HUGE;
-#endif /* _AIX or sparc*/
+#endif /* _AIX or sun */
 
     if (ndigits >= 0 && ndigits < MAX_DIGITS)
     {
@@ -1843,13 +1846,13 @@ try_compute_i(double guess, double *result, int method)
 
        new_w = w - f / f_prime;
 
-#if defined(_AIX) || defined(__aix) || defined(__sparc)
+#if defined(_AIX) || defined(__aix) || defined(sun)
        if (!(!isnan(new_w) && finite(new_w)))
            return FALSE;
 #else
        if (!(!isnan(new_w) && !isinf(new_w)))
            return FALSE;
-#endif /* _AIX or sparc */
+#endif /* _AIX or sun */
 
        if (new_w == w || (w != 0.0 && fabs((new_w - w) / w) < FIN_EPSILON))
            break;
index 5e5243a497c3a4396dd9e102947d80db7c5e4e16..fceb02c53a2fff1f5c0bcb8a4c0cf421ec4c5027 100644 (file)
@@ -62,6 +62,7 @@
 #include <dirent.h>
 #include <sys/file.h>
 #include <string.h>
+#include <limits.h>
 #include "fsrtns.h"
 
 
index b89215f32b8226e7a185230ce9704487e8c75c3a..e0c0e1390c54d417e0cee39ef8fcd95d1ceb5cbc 100644 (file)
@@ -77,11 +77,15 @@ btree::btree(const char* store_name)
 
 btree::~btree()
 {
-   if ( btree_DB->sync(btree_DB, 0) == RET_ERROR )
-      throw(stringException("btree sync failed"));
+   if ( btree_DB->sync(btree_DB, 0) == RET_ERROR ) {
+      cerr << "btree sync failed";
+      std::exit(1);
+   }
 
-   if ( btree_DB->close(btree_DB) == RET_ERROR )
-      throw(stringException("btree close failed"));
+   if ( btree_DB->close(btree_DB) == RET_ERROR ) {
+      cerr << "btree close failed";
+      std::exit(1);
+   }
 }
 
 void btree::clean()
index 2792bc2db23af3e213e466d4758f8cb8df8713d1..6cc5703ab5a9a0ecb3b50230c937323125b19162 100644 (file)
@@ -68,6 +68,8 @@
 
 #endif
 
+#include <cstdlib>
+
 #include "dstr/index_agent.h"
 #include "btree_berkeley/db.h"
 
index 6d104c72aa799347316b399e4e8fc75fac4c4db6..e03f05c61749551cad761f7fdec8ed12d5e94775 100644 (file)
@@ -420,7 +420,6 @@ typedef Stack<NTerminal*> _stkNTPtr_;
 /* Basic subdir refs */
 typedef CC_TPtrDlist<sr_DtCvSegment> _ccTPtrDLstCvSegmnt_;
 
-#endif
 #endif
 
 #if defined(sun) | defined(hpux)
index d0b73cfa5ced08444af94f3d6ca1d396d7777a20..1226c810875bc707583b37f6e218e86b5e090bf0 100644 (file)
@@ -1910,7 +1910,7 @@ RunGreeter( struct display *d, struct greet_info *greet,
     char       *p;
     char       **env;
     char       *path;
-    struct greet_state state = {};
+    struct greet_state state;
     int        notify_dt;
     int                dupfp = -1;
     int                dupfp2 = -1;
index 51808a8675199885481b02135d950398f8052ef4..b2ebf875da99b0dd9a06900919e9790049cbb4e8 100644 (file)
@@ -226,7 +226,7 @@ int main(int argc, XeString *argv)
       /* Open an error log with whatever name the library wants to use */
       SPC_Open_Log(log_path, FALSE);
       SPC_Print_Protocol = spc_logF;
-      if(NULL == (stderr = freopen(log_path, "a", stderr))) {
+      if(NULL == freopen(log_path, "a", stderr)) {
         printf("Unable to reopen '%s' as stderr\n", log_path);
         exit(EXIT_FAILURE);
       }