Commit ba7ef11e authored by Petri Hintukainen's avatar Petri Hintukainen

Make block input close function optional

parent 274ccf76
......@@ -40,9 +40,12 @@ extern "C" {
typedef struct udfread_block_input udfread_block_input;
struct udfread_block_input {
/* Close input. Optional. */
int (*close) (udfread_block_input *);
/* Read block(s) from input. Mandatory. */
int (*read) (udfread_block_input *, uint32_t lba, void *buf, uint32_t nblocks, int flags);
uint32_t (*size) (udfread_block_input *); /* size in blocks */
/* Input size in blocks. Optional. */
uint32_t (*size) (udfread_block_input *);
};
......
......@@ -1140,7 +1140,9 @@ int udfread_open(udfread *udf, const char *path)
result = udfread_open_input(udf, input);
if (result < 0) {
input->close(input);
if (input->close) {
input->close(input);
}
}
return result;
......@@ -1150,7 +1152,9 @@ void udfread_close(udfread *udf)
{
if (udf) {
if (udf->input) {
udf->input->close(udf->input);
if (udf->input->close) {
udf->input->close(udf->input);
}
udf->input = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment