From 80ff2e30eb922109860b0a113b152c07bec664b0 Mon Sep 17 00:00:00 2001 From: adv Date: Mon, 30 Dec 2013 12:35:58 +0000 Subject: [PATCH] Indexes for sequences corrected. --- src/HYDROPy/CAS/NCollection_Sequence.sip | 12 ++++++------ src/HYDROPy/HYDROData_SequenceOfObjects.sip | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/HYDROPy/CAS/NCollection_Sequence.sip b/src/HYDROPy/CAS/NCollection_Sequence.sip index 12f90611..ed07ef94 100644 --- a/src/HYDROPy/CAS/NCollection_Sequence.sip +++ b/src/HYDROPy/CAS/NCollection_Sequence.sip @@ -40,7 +40,7 @@ template return NULL; // Set the list elements. - for (int i = 0; i < sipCpp->Length(); ++i) + for (int i = 1; i <= sipCpp->Length(); ++i) { TYPE *t = new TYPE(sipCpp->Value(i)); PyObject *tobj; @@ -53,7 +53,7 @@ template return NULL; } - PyList_SET_ITEM(l, i, tobj); + PyList_SET_ITEM(l, i - 1, tobj); } return l; @@ -82,7 +82,7 @@ template return 1; } - NCollection_Sequence *ql = new NCollection_Sequence; + NCollection_Sequence *aSeq = new NCollection_Sequence; len = PySequence_Size(sipPy); for (SIP_SSIZE_T i = 0; i < len; ++i) @@ -97,16 +97,16 @@ template { sipReleaseType(t, sipType_TYPE, state); - delete ql; + delete aSeq; return 0; } - ql->Append(*t); + aSeq->Append(*t); sipReleaseType(t, sipType_TYPE, state); } - *sipCppPtr = ql; + *sipCppPtr = aSeq; return sipGetState(sipTransferObj); %End diff --git a/src/HYDROPy/HYDROData_SequenceOfObjects.sip b/src/HYDROPy/HYDROData_SequenceOfObjects.sip index be9b94cc..3af3646b 100644 --- a/src/HYDROPy/HYDROData_SequenceOfObjects.sip +++ b/src/HYDROPy/HYDROData_SequenceOfObjects.sip @@ -38,7 +38,7 @@ return NULL; // Set the list elements. - for (int i = 0; i < sipCpp->Length(); ++i) + for (int i = 1; i <= sipCpp->Length(); ++i) { HYDROData_Entity* aPntr = createPointer(sipCpp->Value(i)); @@ -54,7 +54,7 @@ return NULL; } - PyList_SET_ITEM(l, i, tobj); + PyList_SET_ITEM(l, i - 1, tobj); } return l; @@ -83,7 +83,7 @@ return 1; } - NCollection_Sequence *ql = + NCollection_Sequence *aSeq = new NCollection_Sequence; len = PySequence_Size(sipPy); @@ -100,17 +100,17 @@ { sipReleaseType(t, sipType_HYDROData_Entity, state); - delete ql; + delete aSeq; return 0; } Handle_HYDROData_Entity anEnt( t ); - ql->Append( anEnt ); + aSeq->Append( anEnt ); //sipReleaseType(t, sipType_HYDROData_Entity, state); } - *sipCppPtr = ql; + *sipCppPtr = aSeq; return sipGetState(sipTransferObj); %End -- 2.39.2