[PATCH 3/4] [common] Warnings and Whitespace fixes


Ian Bell <IBell@...>
 

From e6370f4a902a07394bee897e718bc654e4a899c2 Mon Sep 17 00:00:00 2001

Message-Id: <e6370f4a902a07394bee897e718bc654e4a899c2.1347023434.git.ibell@...>

In-Reply-To: <05eedcf18f3140b743286fadc59a46c032647ac9.1347023434.git.ibell@...>

References: <05eedcf18f3140b743286fadc59a46c032647ac9.1347023434.git.ibell@...>

From: Ian Bell <ibell@...>

Date: Fri, 7 Sep 2012 12:06:13 +0100

Subject: [PATCH 3/4] [common] Warnings and Whitespace fixes

 

Fixed a couple of warnings in common and also tidied up some white space.

 

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

---

common/c_cpp/src/c/Makefile.am                |    8 ++------

common/c_cpp/src/c/destroyHandle.c            |    2 +-

common/c_cpp/src/c/linux/network.c            |    2 +-

common/c_cpp/src/c/linux/platform.c           |    3 ++-

common/c_cpp/src/c/linux/port.h               |    2 ++

common/c_cpp/src/c/lookup2.c                  |    2 +-

common/c_cpp/src/c/lookup2.h                  |    2 +-

common/c_cpp/src/c/machine.c                  |    2 +-

common/c_cpp/src/c/property.c                 |   22 +++++++++++-----------

common/c_cpp/src/c/timers.c                   |    4 +---

common/c_cpp/src/c/windows/port.c             |    1 -

common/c_cpp/src/c/windows/wombat/port.h      |   10 ++++++----

common/c_cpp/src/c/windows/wombat/targetsxs.h |    1 +

common/c_cpp/src/c/wlock.h                    |    2 ++

common/c_cpp/src/cpp/Makefile.am              |    3 ++-

15 files changed, 34 insertions(+), 32 deletions(-)

 

diff --git a/common/c_cpp/src/c/Makefile.am b/common/c_cpp/src/c/Makefile.am

index 7f029d1..ea3a6e9 100644

--- a/common/c_cpp/src/c/Makefile.am

+++ b/common/c_cpp/src/c/Makefile.am

@@ -25,11 +25,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@

 lib_LTLIBRARIES = libwombatcommon.la

-CFLAGS   += -std=gnu99 -Wall \

-        -Wno-long-long -Wno-unused-parameter -Wdeclaration-after-statement

-CXXFLAGS += -Wall \

-        -Wno-long-long -Wno-unused-parameter -Wno-write-strings

-

nobase_include_HEADERS = \

     destroyHandle.h \

     list.h \

@@ -54,7 +49,8 @@ nobase_include_HEADERS = \

     wombat/wUuid.h

 if USE_GCC_FLAGS

-CPPFLAGS += -pedantic -Wno-long-long -D_GNU_SOURCE -fPIC

+CFLAGS   += -std=gnu99 -fPIC -pedantic-errors -Wmissing-prototypes -Wstrict-prototypes

+CPPFLAGS += -fPIC -pedantic-errors -Wno-long-long -D_GNU_SOURCE

endif

 LIBS     += -ldl -luuid

diff --git a/common/c_cpp/src/c/destroyHandle.c b/common/c_cpp/src/c/destroyHandle.c

index 768c937..c941227 100644

--- a/common/c_cpp/src/c/destroyHandle.c

+++ b/common/c_cpp/src/c/destroyHandle.c

@@ -38,7 +38,7 @@

  *

  * @param[in] handle The destroy handle.

  */

-void destroyHandle_freeHandle(pDestroyHandle handle)

+static void destroyHandle_freeHandle(pDestroyHandle handle)

{

               if(NULL != handle)

               {

diff --git a/common/c_cpp/src/c/linux/network.c b/common/c_cpp/src/c/linux/network.c

index 1171462..a08ace3 100644

--- a/common/c_cpp/src/c/linux/network.c

+++ b/common/c_cpp/src/c/linux/network.c

@@ -161,7 +161,7 @@ static void lookupIPAddress (void)

     char           *addrStr = "not determined";

     struct         utsname uts;

-    memset( gIPAddress, 0, 16 );

+    memset( (void *)gIPAddress, 0, 16 );

     uname (&uts);

     gHostName = strdup (uts.nodename);

diff --git a/common/c_cpp/src/c/linux/platform.c b/common/c_cpp/src/c/linux/platform.c

index 235bf3e..afe80f0 100644

--- a/common/c_cpp/src/c/linux/platform.c

+++ b/common/c_cpp/src/c/linux/platform.c

@@ -1,4 +1,5 @@

-/*

+/* $Id$

+ *

  * OpenMAMA: The open middleware agnostic messaging API

  * Copyright (C) 2011 NYSE Technologies, Inc.

  *

diff --git a/common/c_cpp/src/c/linux/port.h b/common/c_cpp/src/c/linux/port.h

index 20cc7f5..dd768d8 100644

--- a/common/c_cpp/src/c/linux/port.h

+++ b/common/c_cpp/src/c/linux/port.h

@@ -55,6 +55,7 @@

extern "C"

{

#endif

+

/* PTHREAD static locks are easy */

typedef pthread_mutex_t wthread_static_mutex_t;

#define WSTATIC_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

@@ -107,6 +108,7 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);

 #define wsocketpair(dom, type, prot, pair) (socketpair((dom),(type),(prot),(pair)))

#define wsetnonblock(s) (fcntl((s), F_SETFL, fcntl((s), F_GETFL) | O_NONBLOCK))

+

#define wread read   

 #define wwrite                write  

 

diff --git a/common/c_cpp/src/c/lookup2.c b/common/c_cpp/src/c/lookup2.c

index 5db4fc2..f4dedbb 100644

--- a/common/c_cpp/src/c/lookup2.c

+++ b/common/c_cpp/src/c/lookup2.c

@@ -1,4 +1,4 @@

-/* $Id$

+/* $Id$ */

 /*

  * This file contains a hash alogorith by Bob Jenkins. It is used unchanged,

diff --git a/common/c_cpp/src/c/lookup2.h b/common/c_cpp/src/c/lookup2.h

index 586d934..98c0303 100644

--- a/common/c_cpp/src/c/lookup2.h

+++ b/common/c_cpp/src/c/lookup2.h

@@ -1,4 +1,4 @@

-/* $Id$

+/* $Id$ */

 /*

  * This file contains header info for the hash alogorith by Bob Jenkins.

diff --git a/common/c_cpp/src/c/machine.c b/common/c_cpp/src/c/machine.c

index 20f3f1b..21199af 100644

--- a/common/c_cpp/src/c/machine.c

+++ b/common/c_cpp/src/c/machine.c

@@ -1,4 +1,4 @@

-/*

+/*

  * OpenMAMA: The open middleware agnostic messaging API

  * Copyright (C) 2011 NYSE Technologies, Inc.

  *

diff --git a/common/c_cpp/src/c/property.c b/common/c_cpp/src/c/property.c

index 90079dc..779ae63 100644

--- a/common/c_cpp/src/c/property.c

+++ b/common/c_cpp/src/c/property.c

@@ -323,19 +323,19 @@ properties_GetPropertyValueAsBoolean(const char* propertyValue)

const char*

properties_Get( wproperty_t handle, const char* name )

{

-   propertiesImpl_ *this = (propertiesImpl_ *)handle;

-   const char*      rval = NULL;

+    propertiesImpl_ *this = (propertiesImpl_ *)handle;

+    const char*      rval = NULL;

-   if( name == NULL || NULL == this || strlen( name ) == 0 )

-   {

-       return NULL;

-   }

+    if( name == NULL || NULL == this || strlen( name ) == 0 )

+    {

+        return NULL;

+    }

-   rval = (char* )wtable_lookup( this->mTable, (char* )name );

+    rval = (char* )wtable_lookup( this->mTable, (char* )name );

-   if( gPropertyDebug )fprintf( stderr, "Get property: %s\n", rval );

+    if( gPropertyDebug )fprintf( stderr, "Get property: %s\n", rval );

-   return rval;

+    return rval;

}

 int

@@ -593,12 +593,12 @@ propertiesImpl_AddProperty( propertiesImpl properties,

             return 0;

     }

-    if(-1 == (ret = wtable_insert( this->mTable, (char* )name, (caddr_t)value)))

+    if (-1 == (ret = wtable_insert( this->mTable, (char* )name, (caddr_t)value)))

     {

         return 0;

     }

-    if(0 == ret) /* If 0 is returned then data has been replaced. */

+    if (0 == ret) /* If 0 is returned then data has been replaced. */

     {

         /* If existing data in the table has now been replaced then the old data must be freed. */

         if(NULL != data)

diff --git a/common/c_cpp/src/c/timers.c b/common/c_cpp/src/c/timers.c

index 0105492..099d758 100644

--- a/common/c_cpp/src/c/timers.c

+++ b/common/c_cpp/src/c/timers.c

@@ -81,9 +81,7 @@ int createTimerHeap (timerHeap* heap)

     /* Need to make the lock recursive as it should be possible to remove timers

        in the call back */

     wthread_mutex_init (&heapImpl->mLock, &attr);

-

     wthread_mutex_init (&heapImpl->mEndingLock, NULL);

     wthread_cond_init  (&heapImpl->mEndingCond, NULL);

     RB_INIT (&heapImpl->mTimeTree);

@@ -101,7 +99,7 @@ int createTimerHeap (timerHeap* heap)

     return 0;

}

-void* dispatchEntry (void *closure)

+static void* dispatchEntry (void *closure)

{

     timerHeapImpl* heap = (timerHeapImpl*)closure;

     fd_set wakeUpDes;

diff --git a/common/c_cpp/src/c/windows/port.c b/common/c_cpp/src/c/windows/port.c

index 92890c9..eecf7f4 100644

--- a/common/c_cpp/src/c/windows/port.c

+++ b/common/c_cpp/src/c/windows/port.c

@@ -32,7 +32,6 @@ int gettimeofday( struct timeval *result, void *dummy )

     return 0;

}

-

typedef struct

{

     HANDLE mThread;

diff --git a/common/c_cpp/src/c/windows/wombat/port.h b/common/c_cpp/src/c/windows/wombat/port.h

index 5381e93..3a88c29 100644

--- a/common/c_cpp/src/c/windows/wombat/port.h

+++ b/common/c_cpp/src/c/windows/wombat/port.h

@@ -87,11 +87,12 @@ typedef __int64 w_i64_t;

#define PATH_DELIM ';'

 #define PATHSEP  "\\"

-COMMONExpDLL int

-wsocketstartup (void);

-COMMONExpDLL void

-wsocketcleanup (void);

+COMMONExpDLL

+int wsocketstartup (void);

+

+COMMONExpDLL

+void wsocketcleanup (void);

 /* Socket Pair and set non blocking */

COMMONExpDLL int

@@ -174,6 +175,7 @@ const char *index( const char *str, char c );

*/

#define PRId64 "I64d"

#define PRIu64 "I64u"

+

#ifndef INT8_MIN

#define INT8_MIN SCHAR_MIN

#endif

diff --git a/common/c_cpp/src/c/windows/wombat/targetsxs.h b/common/c_cpp/src/c/windows/wombat/targetsxs.h

index f563b41..0e6769b 100644

--- a/common/c_cpp/src/c/windows/wombat/targetsxs.h

+++ b/common/c_cpp/src/c/windows/wombat/targetsxs.h

@@ -30,6 +30,7 @@

#elif (_MSC_VER >= 1400 && _MSC_VER < 1400)

#define VC7

#endif

+

#ifndef VC7

 #ifdef VC8

diff --git a/common/c_cpp/src/c/wlock.h b/common/c_cpp/src/c/wlock.h

index 4a9c7d4..fb02e0e 100644

--- a/common/c_cpp/src/c/wlock.h

+++ b/common/c_cpp/src/c/wlock.h

@@ -27,12 +27,14 @@

#if defined (__cplusplus)

extern "C" {

#endif

+

typedef void * wLock;

 COMMONExpDLL wLock    wlock_create( void );

COMMONExpDLL void     wlock_destroy( wLock lock );

COMMONExpDLL void     wlock_lock( wLock lock );

COMMONExpDLL void     wlock_unlock( wLock lock );

+

#if defined (__cplusplus)

}

#endif

diff --git a/common/c_cpp/src/cpp/Makefile.am b/common/c_cpp/src/cpp/Makefile.am

index b8ae73e..3a9613d 100644

--- a/common/c_cpp/src/cpp/Makefile.am

+++ b/common/c_cpp/src/cpp/Makefile.am

@@ -15,7 +15,8 @@ nobase_include_HEADERS  = \

LIBS     += -ldl -lrt -lwombatcommon

 if USE_GCC_FLAGS

-CPPFLAGS += -pedantic -fpic -Wall -Wno-long-long -D_GNU_SOURCE

+CFLAGS   += -fPIC -pedantic-errors -Wmissing-prototypes -Wstrict-prototypes

+CPPFLAGS += -fPIC -pedantic-errors -Wall -Wno-long-long -D_GNU_SOURCE

endif

 CPPFLAGS   += -I@srcdir@/../c

--

1.7.9.5

 




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.