-typedef struct opj_stream_private
-{
- /**
- * User data, be it files, ... The actual data depends on the type of the stream.
- */
- void * m_user_data;
-
- /**
- * User data length
- */
- OPJ_UINT64 m_user_data_length;
-
- /**
- * Pointer to actual read function (NULL at the initialization of the cio.
- */
- opj_stream_read_fn m_read_fn;
-
- /**
- * Pointer to actual write function (NULL at the initialization of the cio.
- */
- opj_stream_write_fn m_write_fn;
-
- /**
- * Pointer to actual skip function (NULL at the initialization of the cio.
- * There is no seek function to prevent from back and forth slow procedures.
- */
- opj_stream_skip_fn m_skip_fn;
-
- /**
- * Pointer to actual seek function (if available).
- */
- opj_stream_seek_fn m_seek_fn;
-
- /**
- * Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
- * you should never access this data directly.
- */
- OPJ_BYTE * m_stored_data;
-
- /**
- * Pointer to the current read data.
- */
- OPJ_BYTE * m_current_data;
+typedef struct opj_stream_private {
+ /**
+ * User data, be it files, ... The actual data depends on the type of the stream.
+ */
+ void * m_user_data;
+
+ /**
+ * Pointer to function to free m_user_data (NULL at initialization)
+ * when destroying the stream. If pointer is NULL the function is not
+ * called and the m_user_data is not freed (even if non-NULL).
+ */
+ opj_stream_free_user_data_fn m_free_user_data_fn;
+
+ /**
+ * User data length
+ */
+ OPJ_UINT64 m_user_data_length;
+
+ /**
+ * Pointer to actual read function (NULL at the initialization of the cio.
+ */
+ opj_stream_read_fn m_read_fn;
+
+ /**
+ * Pointer to actual write function (NULL at the initialization of the cio.
+ */
+ opj_stream_write_fn m_write_fn;
+
+ /**
+ * Pointer to actual skip function (NULL at the initialization of the cio.
+ * There is no seek function to prevent from back and forth slow procedures.
+ */
+ opj_stream_skip_fn m_skip_fn;
+
+ /**
+ * Pointer to actual seek function (if available).
+ */
+ opj_stream_seek_fn m_seek_fn;
+
+ /**
+ * Actual data stored into the stream if read from. Data is read by chunk of fixed size.
+ * you should never access this data directly.
+ */
+ OPJ_BYTE * m_stored_data;
+
+ /**
+ * Pointer to the current read data.
+ */
+ OPJ_BYTE * m_current_data;