Salome HOME
[PATCH] Fix warnings in PyInterp/PyConsole
authorJulien Schueller <schueller@phimeca.com>
Wed, 18 Jul 2018 09:53:29 +0000 (11:53 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 20 Jul 2018 13:36:24 +0000 (15:36 +0200)
Signed-off-by: Ovidiu Mircescu <ovidiu.mircescu@edf.fr>
tools/PyConsole/src/PyConsole_Editor.cxx
tools/PyInterp/src/PyInterp.h
tools/PyInterp/src/PyInterp_Interp.cxx
tools/PyInterp/src/PyInterp_Utils.h

index d0b03e59fa9ccec258f7d9c391262e45e0752190..c8ab1fb3f1cb889afcb8fc8e99b4e13b468dc823 100644 (file)
@@ -1175,7 +1175,7 @@ void PyConsole_Editor::keyPressEvent( QKeyEvent* event )
 */
 void PyConsole_Editor::customEvent( QEvent* event )
 {
-  switch( event->type() )
+  switch( (int) event->type() )
   {
   case PyConsole_PrintEvent::EVENT_ID:
   {
index 08271e0326e5b33c5aca71d6c8fe69bdc47e05e0..b43615d4111d467e6ea673576a5185d4ce1f7f0b 100755 (executable)
@@ -42,7 +42,7 @@
 #include <Python.h>
 
 // avoid warning messages
-#ifdef WIN32
+#ifdef _MSC_VER
 #pragma warning (disable : 4786)
 #pragma warning (disable : 4251)
 #endif
index 677ddaf5343971c2fc8d7287c927da92e3e314ab..8e9dfb4995f4ce912dc35f98a83487316a90f012 100644 (file)
@@ -174,7 +174,7 @@ char* PyInterp_Interp::_argv[] = {(char*)""};
   must call virtual method initalize().
 */
 PyInterp_Interp::PyInterp_Interp():
-  _vout(0), _verr(0), _local_context(0), _global_context(0), _initialized(false)
+  _vout(0), _verr(0), _global_context(0), _local_context(0), _initialized(false)
 {
 }
 
@@ -250,7 +250,6 @@ void PyInterp_Interp::initPython()
   if (!Py_IsInitialized()){
     // Python is not initialized
     wchar_t **changed_argv = new wchar_t*[_argc]; // Setting arguments
-    size_t mbslen;
     for (int i = 0; i < _argc; i++)
     {
       changed_argv[i] = Py_DecodeLocale(_argv[i], NULL);
@@ -397,7 +396,7 @@ __join(const std::vector<std::string>& v, int begin=0, int end=-1)
   if (end == -1)
     end = v.size();
   std::stringstream ss;
-  for (size_t i = begin; i < end; ++i) {
+  for (int i = begin; i < end; ++i) {
     if (i != begin)
       ss << ",";
     ss << v[i];
@@ -418,7 +417,7 @@ __getArgsList(std::string argsString)
   bool containsList = (argsString.find('[') != std::string::npos);
   if (containsList) {
     std::vector<int> listBeginIndices, listEndIndices;
-    for (int pos = 0; pos < x.size(); ++pos) {
+    for (int pos = 0; pos < (int)x.size(); ++pos) {
       if (x[pos][0] == '[')
         listBeginIndices.push_back(pos);
       else if (x[pos][x[pos].size()-1] == ']')
@@ -426,7 +425,7 @@ __getArgsList(std::string argsString)
     }
     std::vector<std::string> extractedArgs;
     int start = 0;
-    for (int pos = 0; pos < listBeginIndices.size(); ++pos) {
+    for (int pos = 0; pos < (int)listBeginIndices.size(); ++pos) {
       int lbeg = listBeginIndices[pos];
       int lend = listEndIndices[pos];
       if (lbeg > start)
@@ -435,8 +434,8 @@ __getArgsList(std::string argsString)
       extractedArgs.push_back(__join(x, lbeg, lend+1));
       start = lend+1;
     }
-    if (start < x.size())
-      for (int k = start; k < x.size(); ++k)
+    if (start < (int)x.size())
+      for (int k = start; k < (int)x.size(); ++k)
         extractedArgs.push_back(x[k]);
     return extractedArgs;
   }
index 7ad22d962521bf792f4064d1f26b711b59750faa..e7946b2585fb32166122e2daf4480149da3cbd83 100644 (file)
@@ -73,6 +73,7 @@ public:
   ~PyLockWrapper()
   {
     PyThreadState* _currState = PyGILState_GetThisThreadState();
+    (void)_currState;
 #ifdef _DEBUG_
     if (_currState != _state)
     {