mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
Fix QList<QSslError::SslError> sip conversion code
The old version was not Qt6 compatible
This commit is contained in:
parent
842da3b5ca
commit
c79178720c
@ -392,48 +392,101 @@ setCaChain set the CA chain
|
||||
|
||||
|
||||
%MappedType QList<QSslError::SslError>
|
||||
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <QList>
|
||||
#include <QSslError>
|
||||
%End
|
||||
|
||||
%ConvertFromTypeCode
|
||||
// Create the list.
|
||||
PyObject *l;
|
||||
PyObject *l = PyList_New( sipCpp->size() );
|
||||
|
||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
||||
return NULL;
|
||||
if ( !l )
|
||||
return 0;
|
||||
|
||||
// Set the list elements.
|
||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
||||
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
|
||||
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||
{
|
||||
PyObject *tobj;
|
||||
PyObject *eobj = sipConvertFromEnum( static_cast<int>( sipCpp->at( i ) ),
|
||||
sipType_QSslError_SslError );
|
||||
|
||||
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
|
||||
if ( !eobj )
|
||||
{
|
||||
Py_DECREF( l );
|
||||
return NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
PyList_SET_ITEM( l, i, tobj );
|
||||
|
||||
PyList_SetItem( l, i, eobj );
|
||||
}
|
||||
|
||||
return l;
|
||||
%End
|
||||
|
||||
%ConvertToTypeCode
|
||||
// Check the type if that is all that is required.
|
||||
if ( sipIsErr == NULL )
|
||||
return PyList_Check( sipPy );
|
||||
PyObject *iter = PyObject_GetIter( sipPy );
|
||||
|
||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
||||
|
||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
||||
if ( !sipIsErr )
|
||||
{
|
||||
*qlist << ( QSslError::SslError )PyLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
|
||||
PyErr_Clear();
|
||||
Py_XDECREF( iter );
|
||||
|
||||
return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) );
|
||||
}
|
||||
|
||||
*sipCppPtr = qlist;
|
||||
if ( !iter )
|
||||
{
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QSslError::SslError> *ql = new QList<QSslError::SslError>;
|
||||
|
||||
for ( Py_ssize_t i = 0; ; ++i )
|
||||
{
|
||||
PyErr_Clear();
|
||||
PyObject *itm = PyIter_Next( iter );
|
||||
|
||||
if ( !itm )
|
||||
{
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
int v = sipConvertToEnum( itm, sipType_QSslError_SslError );
|
||||
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
PyErr_Format( PyExc_TypeError,
|
||||
"index %zd has type '%s' but 'QSslError.SslError' is expected",
|
||||
i, sipPyTypeName( Py_TYPE( itm ) ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ql->append( static_cast<QSslError::SslError>( v ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
}
|
||||
|
||||
Py_DECREF( iter );
|
||||
|
||||
*sipCppPtr = ql;
|
||||
|
||||
return sipGetState( sipTransferObj );
|
||||
%End
|
||||
};
|
||||
|
@ -392,48 +392,101 @@ setCaChain set the CA chain
|
||||
|
||||
|
||||
%MappedType QList<QSslError::SslError>
|
||||
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <QList>
|
||||
#include <QSslError>
|
||||
%End
|
||||
|
||||
%ConvertFromTypeCode
|
||||
// Create the list.
|
||||
PyObject *l;
|
||||
PyObject *l = PyList_New( sipCpp->size() );
|
||||
|
||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
||||
return NULL;
|
||||
if ( !l )
|
||||
return 0;
|
||||
|
||||
// Set the list elements.
|
||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
||||
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
|
||||
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||
{
|
||||
PyObject *tobj;
|
||||
PyObject *eobj = sipConvertFromEnum( static_cast<int>( sipCpp->at( i ) ),
|
||||
sipType_QSslError_SslError );
|
||||
|
||||
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
|
||||
if ( !eobj )
|
||||
{
|
||||
Py_DECREF( l );
|
||||
return NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
PyList_SET_ITEM( l, i, tobj );
|
||||
|
||||
PyList_SetItem( l, i, eobj );
|
||||
}
|
||||
|
||||
return l;
|
||||
%End
|
||||
|
||||
%ConvertToTypeCode
|
||||
// Check the type if that is all that is required.
|
||||
if ( sipIsErr == NULL )
|
||||
return PyList_Check( sipPy );
|
||||
PyObject *iter = PyObject_GetIter( sipPy );
|
||||
|
||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
||||
|
||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
||||
if ( !sipIsErr )
|
||||
{
|
||||
*qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
|
||||
PyErr_Clear();
|
||||
Py_XDECREF( iter );
|
||||
|
||||
return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) );
|
||||
}
|
||||
|
||||
*sipCppPtr = qlist;
|
||||
if ( !iter )
|
||||
{
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QSslError::SslError> *ql = new QList<QSslError::SslError>;
|
||||
|
||||
for ( Py_ssize_t i = 0; ; ++i )
|
||||
{
|
||||
PyErr_Clear();
|
||||
PyObject *itm = PyIter_Next( iter );
|
||||
|
||||
if ( !itm )
|
||||
{
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
int v = sipConvertToEnum( itm, sipType_QSslError_SslError );
|
||||
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
PyErr_Format( PyExc_TypeError,
|
||||
"index %zd has type '%s' but 'QSslError.SslError' is expected",
|
||||
i, sipPyTypeName( Py_TYPE( itm ) ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ql->append( static_cast<QSslError::SslError>( v ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
}
|
||||
|
||||
Py_DECREF( iter );
|
||||
|
||||
*sipCppPtr = ql;
|
||||
|
||||
return sipGetState( sipTransferObj );
|
||||
%End
|
||||
};
|
||||
|
@ -333,48 +333,101 @@ class CORE_EXPORT QgsPkiConfigBundle
|
||||
|
||||
#ifdef SIP_RUN
|
||||
% MappedType QList<QSslError::SslError>
|
||||
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||
{
|
||||
% TypeHeaderCode
|
||||
#include <QList>
|
||||
#include <QSslError>
|
||||
% End
|
||||
|
||||
% ConvertFromTypeCode
|
||||
// Create the list.
|
||||
PyObject *l;
|
||||
PyObject *l = PyList_New( sipCpp->size() );
|
||||
|
||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
||||
return NULL;
|
||||
if ( !l )
|
||||
return 0;
|
||||
|
||||
// Set the list elements.
|
||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
||||
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
|
||||
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||
{
|
||||
PyObject *tobj;
|
||||
PyObject *eobj = sipConvertFromEnum( static_cast<int>( sipCpp->at( i ) ),
|
||||
sipType_QSslError_SslError );
|
||||
|
||||
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
|
||||
if ( !eobj )
|
||||
{
|
||||
Py_DECREF( l );
|
||||
return NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
PyList_SET_ITEM( l, i, tobj );
|
||||
|
||||
PyList_SetItem( l, i, eobj );
|
||||
}
|
||||
|
||||
return l;
|
||||
% End
|
||||
|
||||
% ConvertToTypeCode
|
||||
// Check the type if that is all that is required.
|
||||
if ( sipIsErr == NULL )
|
||||
return PyList_Check( sipPy );
|
||||
PyObject *iter = PyObject_GetIter( sipPy );
|
||||
|
||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
||||
|
||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
||||
if ( !sipIsErr )
|
||||
{
|
||||
*qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
|
||||
PyErr_Clear();
|
||||
Py_XDECREF( iter );
|
||||
|
||||
return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) );
|
||||
}
|
||||
|
||||
*sipCppPtr = qlist;
|
||||
if ( !iter )
|
||||
{
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QSslError::SslError> *ql = new QList<QSslError::SslError>;
|
||||
|
||||
for ( Py_ssize_t i = 0; ; ++i )
|
||||
{
|
||||
PyErr_Clear();
|
||||
PyObject *itm = PyIter_Next( iter );
|
||||
|
||||
if ( !itm )
|
||||
{
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
int v = sipConvertToEnum( itm, sipType_QSslError_SslError );
|
||||
|
||||
if ( PyErr_Occurred() )
|
||||
{
|
||||
PyErr_Format( PyExc_TypeError,
|
||||
"index %zd has type '%s' but 'QSslError.SslError' is expected",
|
||||
i, sipPyTypeName( Py_TYPE( itm ) ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
delete ql;
|
||||
Py_DECREF( iter );
|
||||
*sipIsErr = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ql->append( static_cast<QSslError::SslError>( v ) );
|
||||
|
||||
Py_DECREF( itm );
|
||||
}
|
||||
|
||||
Py_DECREF( iter );
|
||||
|
||||
*sipCppPtr = ql;
|
||||
|
||||
return sipGetState( sipTransferObj );
|
||||
% End
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user