mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 20:47:51 +01:00
add some comments
This commit is contained in:
parent
c6c0fd1ce2
commit
4446456159
1 changed files with 7 additions and 0 deletions
|
@ -522,6 +522,8 @@ guess_type(const char* path)
|
||||||
{
|
{
|
||||||
#ifdef WITH_MAGIC
|
#ifdef WITH_MAGIC
|
||||||
const char* mime_type = NULL;
|
const char* mime_type = NULL;
|
||||||
|
|
||||||
|
/* creat magic cookie */
|
||||||
const int flags =
|
const int flags =
|
||||||
MAGIC_MIME_TYPE |
|
MAGIC_MIME_TYPE |
|
||||||
MAGIC_SYMLINK |
|
MAGIC_SYMLINK |
|
||||||
|
@ -534,14 +536,19 @@ guess_type(const char* path)
|
||||||
girara_debug("failed creating the magic cookie\n");
|
girara_debug("failed creating the magic cookie\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ... and load mime database */
|
||||||
if (magic_load(magic, NULL) < 0) {
|
if (magic_load(magic, NULL) < 0) {
|
||||||
girara_debug("failed loading the magic database: %s\n", magic_error(magic));
|
girara_debug("failed loading the magic database: %s\n", magic_error(magic));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get the mime type */
|
||||||
mime_type = magic_file(magic, path);
|
mime_type = magic_file(magic, path);
|
||||||
if (mime_type == NULL) {
|
if (mime_type == NULL) {
|
||||||
girara_debug("failed guessing filetype: %s\n", magic_error(magic));
|
girara_debug("failed guessing filetype: %s\n", magic_error(magic));
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (magic != NULL) {
|
if (magic != NULL) {
|
||||||
magic_close(magic);
|
magic_close(magic);
|
||||||
|
|
Loading…
Reference in a new issue