Closed nemequ closed 8 years ago
This bit me indirectly: I went and implemented my own, since I couldn't find them in the option documentation. Oops.
Argh, I figured out why these are the way they are. If the options parameter is NULL
they return the default value for that codec. I still think it might be better to move those to options.c, but that file already has some similar functions.
'options.c' already has squash_options_get_(string|bool|int|size)
functions, but they can't handle NULL
options. Maybe something like
int squash_options_get_int (SquashOptions* options, const char* key, SquashCodec* codec);
int squash_options_get_int_index (SquashOptions* options, int index, SquashCodec* codec);
int squash_options_get_int_wide (SquashOptions* options, const wchar_t* key, SquashCodec* codec);
If the codec parameter comes last it's more likely certain languages will be able to specify a default value if that argument is omitted.
Fixed now, thanks to @Dr-Emann! The patch is greatly appreciated :)
These should be part of the SquashOption API, not SquashCodec. The SquashOption struct includes the codec, so this should be trivial.