From 10cceff344c538de89bea6e07e55229a2c7de79e Mon Sep 17 00:00:00 2001
From: Wim Lavrijsen <WLavrijsen@lbl.gov>
Date: Thu, 21 Oct 2010 15:14:35 +0000
Subject: [PATCH] fix clang warnings

git-svn-id: http://root.cern.ch/svn/root/trunk@36396 27541ba8-7e3a-0410-8455-c3a389f83636
---
 bindings/pyroot/src/Converters.cxx |  2 +-
 bindings/pyroot/src/Pythonize.cxx  | 28 ++++++++++++++++------------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/bindings/pyroot/src/Converters.cxx b/bindings/pyroot/src/Converters.cxx
index f165e3cbf7d..3947d32ed2d 100644
--- a/bindings/pyroot/src/Converters.cxx
+++ b/bindings/pyroot/src/Converters.cxx
@@ -680,7 +680,7 @@ Bool_t PyROOT::T##name##ArrayConverter::ToMemory( PyObject* value, void* address
          PyErr_SetString( PyExc_ValueError, "buffer too large for value" );  \
          return kFALSE;                                                      \
       }                                                                      \
-      memcpy( *(type**)address, buf, 0 < buflen ? buflen : sizeof(type) );   \
+      memcpy( *(type**)address, buf, 0 < buflen ? ((size_t) buflen) : sizeof(type) );\
    } else                                                                    \
       *(type**)address = (type*)buf;                                         \
    return kTRUE;                                                             \
diff --git a/bindings/pyroot/src/Pythonize.cxx b/bindings/pyroot/src/Pythonize.cxx
index ae2f7274ecd..7bacffb9671 100644
--- a/bindings/pyroot/src/Pythonize.cxx
+++ b/bindings/pyroot/src/Pythonize.cxx
@@ -889,16 +889,6 @@ static int PyObject_Compare( PyObject* one, PyObject* other ) {
       return repr;                                                            \
    }                                                                          \
                                                                               \
-   PyObject* name##StringCompare( PyObject* self, PyObject* obj )             \
-   {                                                                          \
-      PyObject* data = CallPyObjMethod( self, #func );                        \
-      int result = PyObject_Compare( data, obj );                             \
-      Py_DECREF( data );                                                      \
-      if ( PyErr_Occurred() )                                                 \
-         return 0;                                                            \
-      return PyInt_FromLong( result );                                        \
-   }                                                                          \
-                                                                              \
    PyObject* name##StringIsEqual( PyObject* self, PyObject* obj )             \
    {                                                                          \
       PyObject* data = CallPyObjMethod( self, #func );                        \
@@ -919,12 +909,26 @@ static int PyObject_Compare( PyObject* one, PyObject* other ) {
       return result;                                                          \
    }
 
-   PYROOT_IMPLEMENT_STRING_PYTHONIZATION( Stl, c_str )
+   // Only define StlStringCompare:
+   // TStringCompare is unused and generates a warning;
+#define PYROOT_IMPLEMENT_STRING_PYTHONIZATION_CMP( name, func )               \
+   PyObject* name##StringCompare( PyObject* self, PyObject* obj )             \
+   {                                                                          \
+      PyObject* data = CallPyObjMethod( self, #func );                        \
+      int result = PyObject_Compare( data, obj );                             \
+      Py_DECREF( data );                                                      \
+      if ( PyErr_Occurred() )                                                 \
+         return 0;                                                            \
+      return PyInt_FromLong( result );                                        \
+   }                                                                          \
+                                                                              \
+   PYROOT_IMPLEMENT_STRING_PYTHONIZATION( name, func )
+   PYROOT_IMPLEMENT_STRING_PYTHONIZATION_CMP( Stl, c_str )
    PYROOT_IMPLEMENT_STRING_PYTHONIZATION(   T, Data )
 
 
 //- TObjString behavior --------------------------------------------------------
-   PYROOT_IMPLEMENT_STRING_PYTHONIZATION( TObj, GetName )
+   PYROOT_IMPLEMENT_STRING_PYTHONIZATION_CMP( TObj, GetName )
 
 //____________________________________________________________________________
    PyObject* TObjStringLength( PyObject* self )
-- 
GitLab