Skip to content

Commit 4b6fadd

Browse files
committed
Remove legacy 7.1 method from vtkBase64Utilities
Remove an unsafe decode method.
1 parent e4d7f03 commit 4b6fadd

File tree

2 files changed

+0
-88
lines changed

2 files changed

+0
-88
lines changed

IO/Core/vtkBase64Utilities.cxx

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -210,76 +210,6 @@ int vtkBase64Utilities::DecodeTriplet(unsigned char i0,
210210
return 3;
211211
}
212212

213-
#if !defined(VTK_LEGACY_REMOVE)
214-
//----------------------------------------------------------------------------
215-
unsigned long vtkBase64Utilities::Decode(const unsigned char *input,
216-
unsigned long length,
217-
unsigned char *output,
218-
unsigned long max_input_length)
219-
{
220-
VTK_LEGACY_REPLACED_BODY(Decode, "VTK 7.1", DecodeSafely);
221-
222-
const unsigned char *ptr = input;
223-
unsigned char *optr = output;
224-
225-
// Decode complete triplet
226-
227-
if (max_input_length)
228-
{
229-
const unsigned char *end = input + max_input_length;
230-
while (ptr < end)
231-
{
232-
int len =
233-
vtkBase64Utilities::DecodeTriplet(ptr[0], ptr[1], ptr[2], ptr[3],
234-
&optr[0], &optr[1], &optr[2]);
235-
optr += len;
236-
if(len < 3)
237-
{
238-
return optr - output;
239-
}
240-
ptr += 4;
241-
}
242-
}
243-
else
244-
{
245-
unsigned char *oend = output + length;
246-
while ((oend - optr) >= 3)
247-
{
248-
int len =
249-
vtkBase64Utilities::DecodeTriplet(ptr[0], ptr[1], ptr[2], ptr[3],
250-
&optr[0], &optr[1], &optr[2]);
251-
optr += len;
252-
if(len < 3)
253-
{
254-
return optr - output;
255-
}
256-
ptr += 4;
257-
}
258-
259-
// Decode the last triplet
260-
261-
unsigned char temp;
262-
if (oend - optr == 2)
263-
{
264-
int len =
265-
vtkBase64Utilities::DecodeTriplet(ptr[0], ptr[1], ptr[2], ptr[3],
266-
&optr[0], &optr[1], &temp);
267-
optr += (len > 2 ? 2 : len);
268-
}
269-
else if (oend - optr == 1)
270-
{
271-
unsigned char temp2;
272-
int len =
273-
vtkBase64Utilities::DecodeTriplet(ptr[0], ptr[1], ptr[2], ptr[3],
274-
&optr[0], &temp, &temp2);
275-
optr += (len > 2 ? 2 : len);
276-
}
277-
}
278-
279-
return optr - output;
280-
}
281-
#endif
282-
283213
//----------------------------------------------------------------------------
284214
size_t vtkBase64Utilities::DecodeSafely(const unsigned char *input,
285215
size_t inputLen,

IO/Core/vtkBase64Utilities.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class VTKIOCORE_EXPORT vtkBase64Utilities : public vtkObject
7979
unsigned char *output,
8080
int mark_end = 0);
8181

82-
8382
/**
8483
* Decode 4 bytes into 3 bytes.
8584
* Return the number of bytes actually decoded (0 to 3, inclusive).
@@ -92,23 +91,6 @@ class VTKIOCORE_EXPORT vtkBase64Utilities : public vtkObject
9291
unsigned char *o1,
9392
unsigned char *o2);
9493

95-
/**
96-
* Decode bytes from the input buffer and store the decoded stream
97-
* into the output buffer until 'length' bytes have been decoded.
98-
* Return the real length of the decoded stream (which should be equal to
99-
* 'length'). Note that the output buffer must be allocated by the caller.
100-
* If 'max_input_length' is not 0, then it specifies the number of
101-
* encoded bytes that should be at most read from the input buffer. In
102-
* that case the 'length' parameter is ignored. This enables the caller
103-
* to decode a stream without actually knowing how much decoded data to
104-
* expect (of course, the buffer must be large enough).
105-
* \deprecated: This method can easily overrun its buffers, use DecodeSafely.
106-
*/
107-
VTK_LEGACY(static unsigned long Decode(const unsigned char *input,
108-
unsigned long length,
109-
unsigned char *output,
110-
unsigned long max_input_length = 0));
111-
11294
/**
11395
* Decode 4 bytes at a time from the input buffer and store the decoded
11496
* stream into the output buffer. The required output buffer size must be

0 commit comments

Comments
 (0)