Scroll to navigation

gd_encoding(3) GETDATA gd_encoding(3)

NAME

gd_encoding — report the binary encoding of data in a Dirfile

SYNOPSIS

#include <getdata.h>

unsigned long gd_encoding(DIRFILE *dirfile, int fragment_index);

DESCRIPTION

The gd_encoding() function queries a dirfile(5) database specified by dirfile and returns the data encoding for the fragment indexed by fragment_index. The data encoding of a fragment indicate the encoding of data files associated with RAW fields defined in the specified fragment. The encoding of a fragment containing no RAW fields is ignored.

RETURN VALUE

Upon successful completion, gd_encoding() returns the binary encoding of the specified fragment, which will one of the following symbols:

GD_UNENCODED, GD_BZIP2_ENCODED, GD_FLAC_ENCODED, GD_GZIP_ENCODED, GD_LZMA_ENCODED, GD_SIE_ENCODED, GD_SLIM_ENCODED, GD_TEXT_ENCODED, GD_ZZIP_ENCODED, GD_ZZSLIM_ENCODED, GD_ENC_UNSUPPORTED.

If the encoding scheme specified in the dirfile metadata is unknown to GetData, GD_ENC_UNSUPPORTED will be returned. See gd_open(3) and dirfile-encoding(5) for the meanings of the other symbols and details on the supported encoding schemes.

On error, this function returns zero and stores a negative-valued error code in the DIRFILE object which may be retrieved by a subsequent call to gd_error(3). Possible error codes are:

GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
GD_E_BAD_INDEX
The supplied index was out of range.

A descriptive error string for the error may be obtained by calling gd_error_string(3).

HISTORY

The get_encoding() function appeared in GetData-0.5.0.

In GetData-0.7.0, this function was renamed to gd_encoding().

SEE ALSO

gd_alter_encoding(3), gd_error(3), gd_error_string(3), gd_getdata(3), gd_open(3), dirfile(5), dirfile-encoding(5)

25 December 2016 Version 0.10.0