mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -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>
|
%MappedType QList<QSslError::SslError>
|
||||||
|
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||||
|
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include <QList>
|
#include <QSslError>
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertFromTypeCode
|
%ConvertFromTypeCode
|
||||||
// Create the list.
|
PyObject *l = PyList_New( sipCpp->size() );
|
||||||
PyObject *l;
|
|
||||||
|
|
||||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
if ( !l )
|
||||||
return NULL;
|
return 0;
|
||||||
|
|
||||||
// Set the list elements.
|
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
|
||||||
for ( int i = 0; it != sipCpp->end(); ++it, ++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 );
|
Py_DECREF( l );
|
||||||
return NULL;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
PyList_SET_ITEM( l, i, tobj );
|
|
||||||
|
PyList_SetItem( l, i, eobj );
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertToTypeCode
|
%ConvertToTypeCode
|
||||||
// Check the type if that is all that is required.
|
PyObject *iter = PyObject_GetIter( sipPy );
|
||||||
if ( sipIsErr == NULL )
|
|
||||||
return PyList_Check( sipPy );
|
|
||||||
|
|
||||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
if ( !sipIsErr )
|
||||||
|
|
||||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
|
||||||
{
|
{
|
||||||
*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 );
|
return sipGetState( sipTransferObj );
|
||||||
%End
|
%End
|
||||||
};
|
};
|
||||||
|
@ -392,48 +392,101 @@ setCaChain set the CA chain
|
|||||||
|
|
||||||
|
|
||||||
%MappedType QList<QSslError::SslError>
|
%MappedType QList<QSslError::SslError>
|
||||||
|
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||||
|
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%TypeHeaderCode
|
||||||
#include <QList>
|
#include <QSslError>
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertFromTypeCode
|
%ConvertFromTypeCode
|
||||||
// Create the list.
|
PyObject *l = PyList_New( sipCpp->size() );
|
||||||
PyObject *l;
|
|
||||||
|
|
||||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
if ( !l )
|
||||||
return NULL;
|
return 0;
|
||||||
|
|
||||||
// Set the list elements.
|
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
|
||||||
for ( int i = 0; it != sipCpp->end(); ++it, ++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 );
|
Py_DECREF( l );
|
||||||
return NULL;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
PyList_SET_ITEM( l, i, tobj );
|
|
||||||
|
PyList_SetItem( l, i, eobj );
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertToTypeCode
|
%ConvertToTypeCode
|
||||||
// Check the type if that is all that is required.
|
PyObject *iter = PyObject_GetIter( sipPy );
|
||||||
if ( sipIsErr == NULL )
|
|
||||||
return PyList_Check( sipPy );
|
|
||||||
|
|
||||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
if ( !sipIsErr )
|
||||||
|
|
||||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
|
||||||
{
|
{
|
||||||
*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 );
|
return sipGetState( sipTransferObj );
|
||||||
%End
|
%End
|
||||||
};
|
};
|
||||||
|
@ -333,48 +333,101 @@ class CORE_EXPORT QgsPkiConfigBundle
|
|||||||
|
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
% MappedType QList<QSslError::SslError>
|
% MappedType QList<QSslError::SslError>
|
||||||
|
/ TypeHintIn = "Iterable[QSslError.SslError]",
|
||||||
|
TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]" /
|
||||||
{
|
{
|
||||||
% TypeHeaderCode
|
% TypeHeaderCode
|
||||||
#include <QList>
|
#include <QSslError>
|
||||||
% End
|
% End
|
||||||
|
|
||||||
% ConvertFromTypeCode
|
% ConvertFromTypeCode
|
||||||
// Create the list.
|
PyObject *l = PyList_New( sipCpp->size() );
|
||||||
PyObject *l;
|
|
||||||
|
|
||||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
if ( !l )
|
||||||
return NULL;
|
return 0;
|
||||||
|
|
||||||
// Set the list elements.
|
for ( int i = 0; i < sipCpp->size(); ++i )
|
||||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
|
||||||
for ( int i = 0; it != sipCpp->end(); ++it, ++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 );
|
Py_DECREF( l );
|
||||||
return NULL;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
PyList_SET_ITEM( l, i, tobj );
|
|
||||||
|
PyList_SetItem( l, i, eobj );
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
% End
|
% End
|
||||||
|
|
||||||
% ConvertToTypeCode
|
% ConvertToTypeCode
|
||||||
// Check the type if that is all that is required.
|
PyObject *iter = PyObject_GetIter( sipPy );
|
||||||
if ( sipIsErr == NULL )
|
|
||||||
return PyList_Check( sipPy );
|
|
||||||
|
|
||||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
if ( !sipIsErr )
|
||||||
|
|
||||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
|
||||||
{
|
{
|
||||||
*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 );
|
return sipGetState( sipTransferObj );
|
||||||
% End
|
% End
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user