gd_encoding(3)

πŸ’– gd_encoding β€” bestie, what's the vibe of this data?? πŸ’–

okay so this is gd_encoding(3), a page from the GETDATA manual, and honestly? she's a little icon. she tells you how the data in your dirfile is encoded. let's get into it ✨


✨ SYNOPSIS ✨

#include <getdata.h>

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

like yes, that's the whole thing. two arguments. she's lowkey simple and we love her for it 🫢


🌸 DESCRIPTION 🌸

okay so gd_encoding() goes and queries a dirfile(5) database β€” that's the one you pass in as dirfile β€” and it hands you back the data encoding for the fragment indexed by fragment_index. πŸ’…

now what does that even mean, bestie? the data encoding of a fragment tells you the encoding of the data files that are associated with the RAW fields defined in that specific fragment. that's it. that's the tea. πŸ“

also, tiny lil detail: if a fragment has no RAW fields in it, its encoding is literally ignored. not relevant. don't worry about her. πŸ™ˆ

πŸ‘‘ RETURN VALUE πŸ‘‘

when everything goes right, gd_encoding() returns the binary encoding of the fragment you asked about, and it's gonna be one of these symbols, periodt:

  • 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

and if the encoding scheme in the dirfile metadata is something GetData has never heard of? yeah, it's giving mystery, it's giving unknown β€” you get GD_ENC_UNSUPPORTED. 😭 if you wanna know what all the other symbols actually mean and which encoding schemes are supported, go read gd_open(3) and dirfile-encoding(5). iykyk. ✨

πŸ’€ on error though β€” she returns zero, and she stashes a negative-valued error code inside the DIRFILE object. you can grab that bad boy with a later call to gd_error(3). no cap.

the possible error codes are:

  • GD_E_BAD_DIRFILE β€” the dirfile you gave her was invalid. not it. 🚫
  • GD_E_BAD_INDEX β€” the index you passed was out of range. bestie. it's literally out of range. 😭

and if you want a cute lil descriptive error string for whatever went wrong, just call gd_error_string(3). she'll tell you the whole story. πŸŽ€


🌈 HISTORY 🌈

  • the get_encoding() function first showed up in GetData-0.5.0. iconic debut. ⭐
  • then in GetData-0.7.0, she got renamed to gd_encoding(). glow up fr fr. πŸ’…

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! πŸ₯³ this was Version 0.10.0, dated 25 December 2016, and it's the gd_encoding(3) page from the GETDATA manual. merry christmas to whoever wrote that date, we appreciate you. go forth and check your encodings. mwah πŸ’–βœ¨πŸŽ€