From: Julien Schueller Date: Wed, 18 Jul 2018 09:53:29 +0000 (+0200) Subject: [PATCH] Fix warnings in PyInterp/PyConsole X-Git-Tag: SHAPER_V9_1_0RC1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a45e77c806c5781b1af32271d99a9b1b2c69086;p=modules%2Fgui.git [PATCH] Fix warnings in PyInterp/PyConsole Signed-off-by: Ovidiu Mircescu --- diff --git a/tools/PyConsole/src/PyConsole_Editor.cxx b/tools/PyConsole/src/PyConsole_Editor.cxx index d0b03e59f..c8ab1fb3f 100644 --- a/tools/PyConsole/src/PyConsole_Editor.cxx +++ b/tools/PyConsole/src/PyConsole_Editor.cxx @@ -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: { diff --git a/tools/PyInterp/src/PyInterp.h b/tools/PyInterp/src/PyInterp.h index 08271e032..b43615d41 100755 --- a/tools/PyInterp/src/PyInterp.h +++ b/tools/PyInterp/src/PyInterp.h @@ -42,7 +42,7 @@ #include // avoid warning messages -#ifdef WIN32 +#ifdef _MSC_VER #pragma warning (disable : 4786) #pragma warning (disable : 4251) #endif diff --git a/tools/PyInterp/src/PyInterp_Interp.cxx b/tools/PyInterp/src/PyInterp_Interp.cxx index 677ddaf53..8e9dfb499 100644 --- a/tools/PyInterp/src/PyInterp_Interp.cxx +++ b/tools/PyInterp/src/PyInterp_Interp.cxx @@ -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& 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 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 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; } diff --git a/tools/PyInterp/src/PyInterp_Utils.h b/tools/PyInterp/src/PyInterp_Utils.h index 7ad22d962..e7946b258 100644 --- a/tools/PyInterp/src/PyInterp_Utils.h +++ b/tools/PyInterp/src/PyInterp_Utils.h @@ -73,6 +73,7 @@ public: ~PyLockWrapper() { PyThreadState* _currState = PyGILState_GetThisThreadState(); + (void)_currState; #ifdef _DEBUG_ if (_currState != _state) {