Mercurial > hg > orthanc-python
changeset 256:10d11de0fcd5
handle None for 'bytes'
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Tue, 22 Jul 2025 17:18:37 +0200 |
| parents | e75a76d11a71 |
| children | aa668ce77d61 |
| files | CodeAnalysis/GenerateOrthancSDK.py Sources/Autogenerated/sdk_GlobalFunctions.impl.h Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h |
| diffstat | 7 files changed, 30 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/CodeAnalysis/GenerateOrthancSDK.py Wed Jul 16 15:53:28 2025 +0200 +++ b/CodeAnalysis/GenerateOrthancSDK.py Tue Jul 22 17:18:37 2025 +0200 @@ -303,8 +303,8 @@ if arg['sdk_type'] == 'const void *': call_args.append(arg['name'] + '.buf') elif arg['sdk_type'] == 'const_void_pointer_with_size': - call_args.append(arg['name'] + '.buf') - call_args.append(arg['name'] + '.len') + call_args.append('(' + arg['name'] + '.len > 0 ? ' + arg['name'] + '.buf' + ' : NULL)') + call_args.append('(' + arg['name'] + '.len > 0 ? ' + arg['name'] + '.len' + ' : 0)') elif arg['sdk_type'] == 'enumeration': call_args.append('static_cast<%s>(%s)' % (arg['sdk_enumeration'], arg['name'])) elif arg['sdk_type'] == 'const_object':
--- a/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Tue Jul 22 17:18:37 2025 +0200 @@ -64,7 +64,7 @@ { PythonThreadsAllower allower; - OrthancPluginAuditLog(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginResourceType>(arg1), arg2, arg3, arg4.buf, arg4.len); + OrthancPluginAuditLog(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginResourceType>(arg1), arg2, arg3, (arg4.len > 0 ? arg4.buf : NULL), (arg4.len > 0 ? arg4.len : 0)); } PyBuffer_Release(&arg4); @@ -119,7 +119,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast<OrthancPluginCompressionType>(arg2), arg3); + code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), static_cast<OrthancPluginCompressionType>(arg2), arg3); } PyBuffer_Release(&arg0); if (code == OrthancPluginErrorCode_Success) @@ -255,7 +255,7 @@ OrthancPlugins::OrthancString s; { PythonThreadsAllower allower; - s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); + s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0))); } PyBuffer_Release(&arg0); if (s.GetContent() == NULL) @@ -284,7 +284,7 @@ OrthancPlugins::OrthancString s; { PythonThreadsAllower allower; - s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); + s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0))); } PyBuffer_Release(&arg0); if (s.GetContent() == NULL) @@ -391,7 +391,7 @@ OrthancPluginDicomInstance* obj; { PythonThreadsAllower allower; - obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); + obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0); if (obj == NULL) @@ -424,7 +424,7 @@ OrthancPluginFindMatcher* obj; { PythonThreadsAllower allower; - obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); + obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0); if (obj == NULL) @@ -526,7 +526,7 @@ OrthancPluginImage* obj; { PythonThreadsAllower allower; - obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); + obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), arg2); } PyBuffer_Release(&arg0); if (obj == NULL) @@ -593,7 +593,7 @@ OrthancPlugins::OrthancString s; { PythonThreadsAllower allower; - s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); + s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); } PyBuffer_Release(&arg0); if (s.GetContent() == NULL) @@ -655,7 +655,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginEnqueueValue(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); + code = OrthancPluginEnqueueValue(OrthancPlugins::GetGlobalContext(), arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); @@ -1262,7 +1262,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); + code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0), arg3, arg4); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1295,7 +1295,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); + code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0), arg3, arg4); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1856,7 +1856,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); + code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1887,7 +1887,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); + code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1918,7 +1918,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); + code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1949,7 +1949,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); + code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); if (code == OrthancPluginErrorCode_Success) @@ -1979,7 +1979,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginSetAttachmentCustomData(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); + code = OrthancPluginSetAttachmentCustomData(OrthancPlugins::GetGlobalContext(), arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); @@ -2189,7 +2189,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginStoreKeyValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2.buf, arg2.len); + code = OrthancPluginStoreKeyValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, (arg2.len > 0 ? arg2.buf : NULL), (arg2.len > 0 ? arg2.len : 0)); } PyBuffer_Release(&arg2); @@ -2222,7 +2222,7 @@ OrthancPluginDicomInstance* obj; { PythonThreadsAllower allower; - obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); + obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), arg2); } PyBuffer_Release(&arg0); if (obj == NULL) @@ -2256,7 +2256,7 @@ OrthancPluginImage* obj; { PythonThreadsAllower allower; - obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginImageFormat>(arg2)); + obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), static_cast<OrthancPluginImageFormat>(arg2)); } PyBuffer_Release(&arg0); if (obj == NULL) @@ -2289,7 +2289,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); + code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1);
--- a/Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h Tue Jul 22 17:18:37 2025 +0200 @@ -50,7 +50,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginFindAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); + code = OrthancPluginFindAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0);
--- a/Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h Tue Jul 22 17:18:37 2025 +0200 @@ -50,7 +50,7 @@ long value; { PythonThreadsAllower allower; - value = OrthancPluginFindMatcherIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); + value = OrthancPluginFindMatcherIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0); return PyLong_FromLong(value);
--- a/Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h Tue Jul 22 17:18:37 2025 +0200 @@ -50,7 +50,7 @@ { PythonThreadsAllower allower; - OrthancPluginAnswerBuffer(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len, arg2); + OrthancPluginAnswerBuffer(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0), arg2); } PyBuffer_Release(&arg0); @@ -328,7 +328,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginSendMultipartItem(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); + code = OrthancPluginSendMultipartItem(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0); @@ -366,7 +366,7 @@ { PythonThreadsAllower allower; - OrthancPluginSendHttpStatus(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1.buf, arg1.len); + OrthancPluginSendHttpStatus(OrthancPlugins::GetGlobalContext(), self->object_, arg0, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1); @@ -498,7 +498,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginSendStreamChunk(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); + code = OrthancPluginSendStreamChunk(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0);
--- a/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h Tue Jul 22 17:18:37 2025 +0200 @@ -57,7 +57,7 @@ OrthancPluginErrorCode code; { PythonThreadsAllower allower; - code = OrthancPluginWorklistAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginWorklistQuery_Object*>(arg0)->object_, arg1.buf, arg1.len); + code = OrthancPluginWorklistAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0 == Py_None ? NULL : reinterpret_cast<sdk_OrthancPluginWorklistQuery_Object*>(arg0)->object_, (arg1.len > 0 ? arg1.buf : NULL), (arg1.len > 0 ? arg1.len : 0)); } PyBuffer_Release(&arg1);
--- a/Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h Wed Jul 16 15:53:28 2025 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h Tue Jul 22 17:18:37 2025 +0200 @@ -50,7 +50,7 @@ long value; { PythonThreadsAllower allower; - value = OrthancPluginWorklistIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); + value = OrthancPluginWorklistIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, (arg0.len > 0 ? arg0.buf : NULL), (arg0.len > 0 ? arg0.len : 0)); } PyBuffer_Release(&arg0); return PyLong_FromLong(value);
