Zip: define MAX_PATH if not defined already

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add a comment about the subsurface_zip_mode type

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add subsurface_zip_contains()

If a zip file is open for reading subsurface_zip_contains() can
be used to see if the file contains a certain filepath.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: use 'const char *' for interface methods

This will prevent the warning about obsolete 'const char *' to 'char *'
conversation.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add the NULL_BUFFER error

This error type will be used to identify if a sepcific buffer
pointer is NULL or if it's requested size is 0.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add the ERROR_MODE error

ERROR_MODE will be used if the user attempts to perform an
operation that the current mode does not support. It will also
be a prevention for entering read or write modes multiple times.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add the function subsurface_zip_read_buffer()

This function provides the interface to read a memory buffer
instead of a file. For internal use it will copy the contents of the
buffer 'buf' of size 'sz'.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: move the buffer open routine to a static funtion

The interface behind _read and _read_buffer is the same,
so we can move it into a static function.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: specify 'unsigned long' when determining file size

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: make sure that _init() is called before _read_buffer()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: rename 'is_init' to 'init'

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: remove the 'status' element of the zip struct

We are not going to track the status, by setting it inside each
interface call. This is a bit redundant and it will inflate the
number of lines when doing error checking on the user side.

Return statuses should be enough to handle error checking.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add body for subsurface_zip_extract()

This is now usable, but it lacks the calls to check if a
folder exists and to create it. TODO.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
OS: add the subsurface_mkdir() wrapper

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: add mkdir() functionality to subsurface_zip_extract()

Extracting a file from zip that is stored in a folder means
that we need to create any folders in which the file is stored.

subsurface_zip_extract() should now take care of creating both the
provided 'outpath' (only one level of path creation allowed) and
the entire tree of the file inner to the zip archive.

For example calling:
    subsurface_zip_extract(.., "zf1/zf2/file.txt", "./");
will create the tree "./zf1/zf2" and extract "file.txt" inside.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: reduce the scope of 'bufsize' and 'buf' in _extract()

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Zip: move the extract/mkdir routine to a static function

By doing this we can use a simple 'if NULL' check to decide
if we want to extract all files. The function _extract_all()
is now pretty much just a wrapper for _extract(), where
'filepath' is NULL.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>