How to deal with void* parameters to MagickWand API methods? #5743
-
The function Then in the implementation it casts it to I understand the code, but what I am confused about is this thing accepting a I want to know what does it expect as a Note:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Typically, We'll correct the |
Beta Was this translation helpful? Give feedback.
Typically,
void*
is used to pass a buffer of raw data, however, you always need to first cast the pointer to interpret it. Since SetStringInfo*() typically operated on strings, it was built aroundunsigned char*
. Signed/unsigned characters are typically utilized whenever their is a length associated with data. Whereas, with void pointers, a length would not make sense given void is a general declaration that can hold any pointer type.We'll correct the
const
issue. The profile isconst void*
and therefore we would assumeconst unsigned char*
when placing it in a StringInfo container.