diff --git a/src/ChangeLog b/src/ChangeLog index ef611695c..ed9e8f376 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Roland Illig + + * util.c (get_compression_type): Use an enumeration instead of + an int for the return type. + * util.h: Likewise. + 2005-07-13 Roland Illig * view.c: Always call display() before close_error_pipe() to make diff --git a/src/util.c b/src/util.c index f65ce1941..48aee1349 100644 --- a/src/util.c +++ b/src/util.c @@ -894,11 +894,8 @@ char *get_current_wd (char *buffer, int size) } #endif /* !USE_VFS */ -/* This function returns 0 if the file is not in not compressed by - * one of the supported compressors (gzip, bzip, bzip2). Otherwise, - * the compression type is returned, as defined in util.h - * Warning: this function moves the current file pointer */ -int get_compression_type (int fd) +enum compression_type +get_compression_type (int fd) { unsigned char magic[4]; diff --git a/src/util.h b/src/util.h index d38e3d5b2..9c66c7052 100644 --- a/src/util.h +++ b/src/util.h @@ -181,14 +181,16 @@ int mc_mkstemps(char **pname, const char *prefix, const char *suffix); char *mc_realpath(const char *path, char resolved_path[]); -enum { +enum compression_type { COMPRESSION_NONE, COMPRESSION_GZIP, COMPRESSION_BZIP, COMPRESSION_BZIP2 }; -int get_compression_type (int fd); +/* Looks for ``magic'' bytes at the start of the VFS file to guess the + * compression type. Side effect: modifies the file position. */ +enum compression_type get_compression_type (int fd); const char *decompress_extension (int type); /* Hook functions */