No easy access to min()/max() macro, rewrite code
authorPeter Howkins <flibble@users.sourceforge.net>
Mon, 12 Mar 2012 00:14:33 +0000 (00:14 +0000)
committerPeter Howkins <flibble@users.sourceforge.net>
Mon, 12 Mar 2012 00:14:33 +0000 (00:14 +0000)
cde/lib/tt/slib/mp_rpc_implement.C
cde/lib/tt/slib/mp_signature.C
cde/lib/tt/slib/mp_typedb.C

index 9679f0903ecc5ce0ef274a51885913c77d7885ac..22c22387ee1096cfe293b193f9adaf8f688ecf1d 100644 (file)
@@ -50,7 +50,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #if defined(linux)
-# include <g++/minmax.h>
+/*# include <g++/minmax.h>*/
 #else
 # include <macros.h>
 #endif
@@ -313,7 +313,7 @@ _tt_service_rpc(svc_req *rqstp, SVCXPRT *transp)
                        return;
                    }
 
-                   _Tt_string  &svr_cookie =
+                   const _Tt_string    &svr_cookie =
                        _tt_s_mp->initial_s_session->auth_cookie();
                    if (clnt_cookie != svr_cookie) {
                        svcerr_auth(transp, AUTH_BADCRED);
@@ -791,8 +791,13 @@ _tt_rpc_add_pattern_with_context(SVCXPRT *transp)
        // introduced into protocol version 2, it can be assumed that
        // the caller is using at least xdr version 3.
        //
-       _Tt_xdr_version xvers( max(_tt_global->xdr_version(),
-                                  TT_CONTEXTS_XDR_VERSION) );
+//     _Tt_xdr_version xvers( max(_tt_global->xdr_version(),
+//                                TT_CONTEXTS_XDR_VERSION) );
+       if(_tt_global->xdr_version() > TT_CONTEXTS_XDR_VERSION) {
+               _Tt_xdr_version xvers(_tt_global->xdr_version() );
+       } else {
+               _Tt_xdr_version xvers(TT_CONTEXTS_XDR_VERSION);
+       }
 
        _tt_rpc_add_pattern(transp);
 }
index 017f3831c26bb552e5252350e3ca85934b08773a..259317b31b41b8e10164dd5b7e8cbce91442832b 100644 (file)
@@ -36,7 +36,7 @@
  */
 #include <stdlib.h>
 #if defined(linux)
-# include <g++/minmax.h>
+/*# include <g++/minmax.h>*/
 #else
 # include <macros.h>
 #endif
@@ -748,12 +748,18 @@ xdr_version_required() const
 {
        int version = TT_TYPESDB_DEFAULT_XDR_VERSION;
        if (_contexts->count() > 0) {
-               version = max(version, TT_CONTEXTS_XDR_VERSION);
+               if(TT_CONTEXTS_XDR_VERSION > version) {
+                       version = TT_CONTEXTS_XDR_VERSION;
+               }
+//             version = max(version, TT_CONTEXTS_XDR_VERSION);
        }
        switch (_pattern_category) {
            case TT_HANDLE_PUSH:
            case TT_HANDLE_ROTATE:
-               version = max(version, TT_PUSH_ROTATE_XDR_VERSION);
+               if(TT_PUSH_ROTATE_XDR_VERSION > version) {
+                       version = TT_PUSH_ROTATE_XDR_VERSION;
+               }
+//             version = max(version, TT_PUSH_ROTATE_XDR_VERSION);
                break;
        }
        return version;
@@ -765,7 +771,10 @@ xdr_version_required_(const _Tt_signature_list_ptr &sigs)
        int version = TT_TYPESDB_DEFAULT_XDR_VERSION;
        _Tt_signature_list_cursor       sigC( sigs );
        while (sigC.next()) {
-               version = max(version, sigC->xdr_version_required());
+               if(sigC->xdr_version_required() > version) {
+                       version = sigC->xdr_version_required();
+               }
+//             version = max(version, sigC->xdr_version_required());
        }
        return version;
 }
index ecf356f5281a01edaabe21c424104a52582e10f8..5ff381e170e1c9d3886e9ad944ff572437f9d0ca 100644 (file)
@@ -40,7 +40,7 @@
 //
 #include <stdlib.h>
 #if defined(linux)
-# include <g++/minmax.h>
+/*# include <g++/minmax.h>*/
 #else
 # include <macros.h>
 #endif
@@ -2050,11 +2050,17 @@ xdr_version_required() const
        int version = TT_TYPESDB_DEFAULT_XDR_VERSION;
        _Tt_ptype_table_cursor  ptypes(ptable);
        while (ptypes.next()) {
-               version = max(version, ptypes->xdr_version_required());
+               if(ptypes->xdr_version_required() > version) {
+                       version = ptypes->xdr_version_required();
+               }
+//             version = max(version, ptypes->xdr_version_required());
        }
        _Tt_otype_table_cursor  otypes(otable);
        while (otypes.next()) {
-               version = max(version, otypes->xdr_version_required());
+               if(otypes->xdr_version_required() > version) {
+                       version = otypes->xdr_version_required();
+               }
+//             version = max(version, otypes->xdr_version_required());
        }
        return version;
 }