comparison Resources/Patches/orthanc-1.5.6.patch @ 14:e1b24c9a9bd8

patch Orthanc 1.5.6
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Mar 2019 16:48:25 +0100
parents
children
comparison
equal deleted inserted replaced
13:df314d38a4e0 14:e1b24c9a9bd8
1 diff --new-file -urEb Orthanc-1.5.6.orig/patched Orthanc-1.5.6/patched
2 --- Orthanc-1.5.6.orig/patched 1970-01-01 01:00:00.000000000 +0100
3 +++ Orthanc-1.5.6/patched 2019-03-04 16:41:37.532734849 +0100
4 @@ -0,0 +1 @@
5 +patched
6 diff --new-file -urEb Orthanc-1.5.6.orig/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Orthanc-1.5.6/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
7 --- Orthanc-1.5.6.orig/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 2019-03-04 16:19:10.126165813 +0100
8 +++ Orthanc-1.5.6/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 2019-03-04 16:19:39.330128951 +0100
9 @@ -145,6 +145,13 @@
10 }
11
12
13 + void MemoryBuffer::Swap(MemoryBuffer& other)
14 + {
15 + std::swap(buffer_.data, other.buffer_.data);
16 + std::swap(buffer_.size, other.buffer_.size);
17 + }
18 +
19 +
20 OrthancPluginMemoryBuffer MemoryBuffer::Release()
21 {
22 OrthancPluginMemoryBuffer result = buffer_;
23 @@ -1024,11 +1031,11 @@
24 {
25 CheckImageAvailable();
26
27 - OrthancPluginMemoryBuffer tmp;
28 - OrthancPluginCompressPngImage(GetGlobalContext(), &tmp, GetPixelFormat(),
29 + OrthancPlugins::MemoryBuffer answer;
30 + OrthancPluginCompressPngImage(GetGlobalContext(), *answer, GetPixelFormat(),
31 GetWidth(), GetHeight(), GetPitch(), GetBuffer());
32
33 - target.Assign(tmp);
34 + target.Swap(answer);
35 }
36
37
38 @@ -1037,11 +1044,11 @@
39 {
40 CheckImageAvailable();
41
42 - OrthancPluginMemoryBuffer tmp;
43 - OrthancPluginCompressJpegImage(GetGlobalContext(), &tmp, GetPixelFormat(),
44 + OrthancPlugins::MemoryBuffer answer;
45 + OrthancPluginCompressJpegImage(GetGlobalContext(), *answer, GetPixelFormat(),
46 GetWidth(), GetHeight(), GetPitch(), GetBuffer(), quality);
47
48 - target.Assign(tmp);
49 + target.Swap(answer);
50 }
51
52
53 @@ -1580,16 +1587,16 @@
54 ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
55 }
56
57 - OrthancPluginMemoryBuffer answer;
58 + OrthancPlugins::MemoryBuffer answer;
59 uint16_t status;
60 OrthancPluginErrorCode code = OrthancPluginCallPeerApi
61 - (GetGlobalContext(), &answer, NULL, &status, peers_,
62 + (GetGlobalContext(), *answer, NULL, &status, peers_,
63 static_cast<uint32_t>(index), OrthancPluginHttpMethod_Get, uri.c_str(),
64 0, NULL, NULL, NULL, 0, timeout_);
65
66 if (code == OrthancPluginErrorCode_Success)
67 {
68 - target.Assign(answer);
69 + target.Swap(answer);
70 return (status == 200);
71 }
72 else
73 @@ -1704,16 +1711,16 @@
74 ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
75 }
76
77 - OrthancPluginMemoryBuffer answer;
78 + OrthancPlugins::MemoryBuffer answer;
79 uint16_t status;
80 OrthancPluginErrorCode code = OrthancPluginCallPeerApi
81 - (GetGlobalContext(), &answer, NULL, &status, peers_,
82 + (GetGlobalContext(), *answer, NULL, &status, peers_,
83 static_cast<uint32_t>(index), OrthancPluginHttpMethod_Post, uri.c_str(),
84 0, NULL, NULL, body.empty() ? NULL : body.c_str(), body.size(), timeout_);
85
86 if (code == OrthancPluginErrorCode_Success)
87 {
88 - target.Assign(answer);
89 + target.Swap(answer);
90 return (status == 200);
91 }
92 else
93 @@ -1732,16 +1739,15 @@
94 ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
95 }
96
97 - OrthancPluginMemoryBuffer answer;
98 + OrthancPlugins::MemoryBuffer answer;
99 uint16_t status;
100 OrthancPluginErrorCode code = OrthancPluginCallPeerApi
101 - (GetGlobalContext(), &answer, NULL, &status, peers_,
102 + (GetGlobalContext(), *answer, NULL, &status, peers_,
103 static_cast<uint32_t>(index), OrthancPluginHttpMethod_Put, uri.c_str(),
104 0, NULL, NULL, body.empty() ? NULL : body.c_str(), body.size(), timeout_);
105
106 if (code == OrthancPluginErrorCode_Success)
107 {
108 - OrthancPluginFreeMemoryBuffer(GetGlobalContext(), &answer);
109 return (status == 200);
110 }
111 else
112 @@ -1769,16 +1775,15 @@
113 ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_ParameterOutOfRange);
114 }
115
116 - OrthancPluginMemoryBuffer answer;
117 + OrthancPlugins::MemoryBuffer answer;
118 uint16_t status;
119 OrthancPluginErrorCode code = OrthancPluginCallPeerApi
120 - (GetGlobalContext(), &answer, NULL, &status, peers_,
121 - static_cast<uint32_t>(index), OrthancPluginHttpMethod_Put, uri.c_str(),
122 + (GetGlobalContext(), *answer, NULL, &status, peers_,
123 + static_cast<uint32_t>(index), OrthancPluginHttpMethod_Delete, uri.c_str(),
124 0, NULL, NULL, NULL, 0, timeout_);
125
126 if (code == OrthancPluginErrorCode_Success)
127 {
128 - OrthancPluginFreeMemoryBuffer(GetGlobalContext(), &answer);
129 return (status == 200);
130 }
131 else
132 diff --new-file -urEb Orthanc-1.5.6.orig/Plugins/Samples/Common/OrthancPluginCppWrapper.h Orthanc-1.5.6/Plugins/Samples/Common/OrthancPluginCppWrapper.h
133 --- Orthanc-1.5.6.orig/Plugins/Samples/Common/OrthancPluginCppWrapper.h 2019-03-04 16:19:10.126165813 +0100
134 +++ Orthanc-1.5.6/Plugins/Samples/Common/OrthancPluginCppWrapper.h 2019-03-04 16:19:42.018125583 +0100
135 @@ -129,6 +129,8 @@
136 // This transfers ownership from "other" to "this"
137 void Assign(OrthancPluginMemoryBuffer& other);
138
139 + void Swap(MemoryBuffer& other);
140 +
141 OrthancPluginMemoryBuffer Release();
142
143 const char* GetData() const