Fix braces

This commit is contained in:
Thomas Pointhuber 2018-10-11 22:37:09 +02:00 committed by Maciej Suminski
parent 6ac444f587
commit ce471ec898
3 changed files with 33 additions and 14 deletions

View File

@ -110,11 +110,14 @@ wxString PYTHON_ACTION_PLUGIN::CallRetStrMethod( const char* aMethod, PyObject*
#if PY_MAJOR_VERSION >= 3
const char* str_res = NULL;
PyObject* temp_bytes = PyUnicode_AsEncodedString( result, "UTF-8", "strict" );
if ( temp_bytes != NULL ) {
if ( temp_bytes != NULL )
{
str_res = PyBytes_AS_STRING( temp_bytes );
str_res = strdup( str_res );
Py_DECREF( temp_bytes );
} else {
}
else
{
wxLogMessage( "cannot encode unicode python string" );
}
#else

View File

@ -99,7 +99,8 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec
PyObject* result = CallMethod( aMethod, aArglist );
if ( result == Py_None ) {
if ( result == Py_None )
{
Py_DECREF( result );
return ret;
}
@ -109,11 +110,14 @@ wxString PYTHON_FOOTPRINT_WIZARD::CallRetStrMethod( const char* aMethod, PyObjec
#if PY_MAJOR_VERSION >= 3
const char* str_res = NULL;
PyObject* temp_bytes = PyUnicode_AsEncodedString( result, "UTF-8", "strict" );
if ( temp_bytes != NULL ) {
if ( temp_bytes != NULL )
{
str_res = PyBytes_AS_STRING( temp_bytes );
str_res = strdup( str_res );
Py_DECREF( temp_bytes );
} else {
}
else
{
wxLogMessage( "cannot encode unicode python string" );
}
#else
@ -219,7 +223,8 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
Py_DECREF( arglist );
if ( result == Py_None ) {
if ( result == Py_None )
{
Py_DECREF( result );
return ret;
}
@ -229,11 +234,14 @@ wxString PYTHON_FOOTPRINT_WIZARD::GetParameterPageName( int aPage )
#if PY_MAJOR_VERSION >= 3
const char* str_res = NULL;
PyObject* temp_bytes = PyUnicode_AsEncodedString( result, "UTF-8", "strict" );
if ( temp_bytes != NULL ) {
if ( temp_bytes != NULL )
{
str_res = PyBytes_AS_STRING( temp_bytes );
str_res = strdup( str_res );
Py_DECREF( temp_bytes );
} else {
}
else
{
wxLogMessage( "cannot encode unicode python string" );
}
#else

View File

@ -250,13 +250,17 @@ static void pcbnewRunPythonMethodWithReturnedString( const char* aMethodName, wx
PyObject* str = PyDict_GetItemString(localDict, "result" );
#if PY_MAJOR_VERSION >= 3
const char* str_res = NULL;
if(str) {
if(str)
{
PyObject* temp_bytes = PyUnicode_AsEncodedString( str, "UTF-8", "strict" );
if ( temp_bytes != NULL ) {
if ( temp_bytes != NULL )
{
str_res = PyBytes_AS_STRING( temp_bytes );
str_res = strdup( str_res );
Py_DECREF( temp_bytes );
} else {
}
else
{
wxLogMessage( "cannot encode unicode python string" );
}
}
@ -422,12 +426,15 @@ wxArrayString PyArrayStringToWx( PyObject* aArrayString )
#if PY_MAJOR_VERSION >= 3
const char* str_res = NULL;
PyObject* temp_bytes = PyUnicode_AsEncodedString( element, "UTF-8", "strict" );
if ( temp_bytes != NULL ) {
if ( temp_bytes != NULL )
{
str_res = PyBytes_AS_STRING( temp_bytes );
str_res = strdup( str_res );
Py_DECREF( temp_bytes );
ret.Add( FROM_UTF8( str_res ), 1 );
} else {
}
else
{
wxLogMessage( "cannot encode unicode python string" );
}
#else
@ -454,7 +461,8 @@ wxString PyErrStringWithTraceback()
PyErr_Fetch( &type, &value, &traceback );
PyErr_NormalizeException( &type, &value, &traceback );
if ( traceback == NULL ) {
if ( traceback == NULL )
{
traceback = Py_None;
Py_INCREF( traceback );
}