[PATCH] [mama] Fix some compiler warnings in example applications


Ian Bell <IBell@...>
 

commit 209b2547f7ae959ab9d4fb96fe132c04855cfed3

Author: Ian Bell <IBell@...>

Date:   Fri May 18 11:48:00 2012 +0100

 

    [mama] Fix some compiler warnings in example applications

    Signed-off-by: Ian Bell <IBell@...>

 

diff --git a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp

index 598db0e..9cbbe3c 100644

--- a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp

+++ b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp

@@ -94,7 +94,7 @@ typedef vector<const char*>      SymbolList;

 #define BUFFER_SIZE 256

-static  char* gUsageString[]=

+static const char* gUsageString[]=

{

     "mamalistencpp - Generic Mama API C++ subscriber.",

     "",

@@ -185,7 +185,7 @@ private:

     const char*              mDictTport;

     MamaTransport*           mDictTransport;

     int                      mDumpDataDict;

-    int                                                                                     mBuildDataDict;

+    bool                                                                                mBuildDataDict;

     bool                     mDictionaryComplete;

     int                      mRequireInitial;

     int                      mSnapshot;

@@ -265,16 +265,16 @@ public:

     template <class Vector>

     void displayVectorField       (Vector*            field,

                                    size_t             size,

-                                   char*              format);

+                                   const char*        format);

 

     template <class T>

-    void printData                (char*              format,

+    void printData                (const char*        format,

                                    T                  data);

     /* This is required for VC6 because it chokes on instantiating

      * the template with "unsigned char.

      */

-    void printData               (char*               format,

+    void printData               (const char*         format,

                                   unsigned char       data);

 private:

@@ -425,6 +425,7 @@ private:

 

 MamaListen::MamaListen():

+    mShutdownTime           (0),

     mBridgeImpl             (NULL),

     mMiddleware             ("wmw"),

     mDefaultQueue           (NULL),

@@ -439,6 +440,7 @@ MamaListen::MamaListen():

     mDictTport              (NULL),

     mDictTransport          (NULL),

     mDumpDataDict           (0),

+             mBuildDataDict                                 (true),

     mDictionaryComplete     (false),

     mRequireInitial         (1),

     mSnapshot               (0),

@@ -459,9 +461,7 @@ MamaListen::MamaListen():

     mPrintMessages          (false),

     mDisplayData            (true),

     mQualityForAll          (true),

-    mNewIterators           (false),

-    mShutdownTime           (0),

-              mBuildDataDict                                 (true)  

+    mNewIterators           (false)

{}

 MamaListen::~MamaListen()

@@ -557,11 +557,6 @@ void MamaListen::parseCommandLine (int argc, const char* argv[])

             mDumpDataDict = 1;

             i++;

         }

-        else if (strcmp (argv[i], "-B") == 0)

-        {

-            mBuildDataDict = false;

-            i++;

-        }

         else if (strcmp (argv[i], "-I") == 0)

         {

             mRequireInitial = 0;

@@ -671,7 +666,7 @@ void MamaListen::parseCommandLine (int argc, const char* argv[])

         {

             const char* logfileName = argv[i+1];

             if (logfileName == NULL || logfileName[0] == '-'

-                || logfileName == "")

+                || strcmp(logfileName, "") == 0)

             {

                 logfileName = "mamalistencpp.log";

                 i++;

@@ -1518,7 +1513,7 @@ void DisplayCallback::displaySpecificFields (const MamaMsg& msg,

}

 template <class T>

-void DisplayCallback::printData (char*        format,

+void DisplayCallback::printData (const char*  format,

                                  T            data)

{

     if (mMamaListen->getQuietness () < 1)

@@ -1530,7 +1525,7 @@ void DisplayCallback::printData (char*        format,

     }

}

-void DisplayCallback::printData (char*           format,

+void DisplayCallback::printData (const char*     format,

                                  unsigned char   data)

{

     if (mMamaListen->getQuietness () < 1)

@@ -1545,7 +1540,7 @@ void DisplayCallback::printData (char*           format,

template <class Vector>

void DisplayCallback::displayVectorField  (Vector*  field,

                                            size_t   size,

-                                           char*    format)

+                                           const char* format)

{

     if(mMamaListen->printVectorFields ())

     {

diff --git a/mama/c_cpp/src/examples/cpp/mamaproxycpp.cpp b/mama/c_cpp/src/examples/cpp/mamaproxycpp.cpp

index 98f61bd..851921e 100644

--- a/mama/c_cpp/src/examples/cpp/mamaproxycpp.cpp

+++ b/mama/c_cpp/src/examples/cpp/mamaproxycpp.cpp

@@ -921,22 +921,24 @@ void MamaProxy::usage (int exitStatus)

}

 MamaProxy::MamaProxy():

+    mPubManager         (NULL),

+    mPubTransport       (NULL),

+    mPubTport           (NULL),

     mPubBridge          (NULL),

-    mSubBridge          (NULL),

     mPubMiddleware      ("wmw"),

-    mSubMiddleware      ("wmw"),

     mPubDefaultQueue    (NULL),

-    mSubDefaultQueue    (NULL),

-    mPubTport           (NULL),

-    mSubTport           (NULL),

-    mQuietness          (0),

-    mFilename           (NULL),

     mPubSource          ("MAMA_PROXY"),

+    mSubTransport       (NULL),

+    mSubTport           (NULL),

+    mSubBridge          (NULL),

+    mSubMiddleware      ("wmw"),

+    mSubDefaultQueue    (NULL),

     mSubSource          (NULL),

+    mFilename           (NULL),

     sendSync            (false),

-    mPubTransport       (NULL),

-    mSubTransport       (NULL),

-    mPubManager         (NULL),

-    mMamaLogLevel       (MAMA_LOG_LEVEL_WARN)

+    mQuietness          (0),

+    mMamaLogLevel       (MAMA_LOG_LEVEL_WARN),

+    managerCallback     (NULL),

+    syncTimer           (NULL)

{}

diff --git a/mama/c_cpp/src/examples/cpp/mamasymbollistsubscribercpp.cpp b/mama/c_cpp/src/examples/cpp/mamasymbollistsubscribercpp.cpp

index 5dce30f..4f5975f 100644

--- a/mama/c_cpp/src/examples/cpp/mamasymbollistsubscribercpp.cpp

+++ b/mama/c_cpp/src/examples/cpp/mamasymbollistsubscribercpp.cpp

@@ -91,7 +91,7 @@ private:

     MamaTransport*           mDictTransport;

     bool                     mDictionaryComplete;

     int                      mQuietness;

-    int                                                                                     mBuildDataDict;

+    bool                                                                                mBuildDataDict;

     const char*              mSourceName;

     MamaDictionary*          mDictionary;

     void*                    mSubscriptionCallback;

@@ -401,13 +401,13 @@ MamaSymbolListSubscriber::MamaSymbolListSubscriber ():

     mDictTransport                     (NULL),

     mDictionaryComplete                (false),

     mQuietness                         (0),

+             mBuildDataDict                     (true),

     mSourceName                        (NULL),

     mDictionary                        (NULL),

     mSubscriptionCallback              (NULL),

     mSymbolListSubscriptionCallback    (NULL),

     mQueueGroup                        (NULL),

-    mMamaLogLevel                      (MAMA_LOG_LEVEL_WARN),

-              mBuildDataDict                     (true)

+    mMamaLogLevel                      (MAMA_LOG_LEVEL_WARN)

{}

  

 MamaSymbolListSubscriber::~MamaSymbolListSubscriber ()



Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.