Function

Giocontent_type_guess

Declaration [src]

gchar*
g_content_type_guess (
  const gchar* filename,
  const guchar* data,
  gsize data_size,
  gboolean* result_uncertain
)

Description [src]

Guesses the content type based on example data. If the function is uncertain, result_uncertain will be set to TRUE. Either filename or data may be NULL, in which case the guess will be based solely on the other argument.

Parameters

filename

Type: const gchar*

A path, or NULL.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.
data

Type: An array of guchar

A stream of data, or NULL.

The argument can be NULL.
The length of the array is specified in the data_size argument.
The data is owned by the caller of the function.
data_size

Type: gsize

The size of data.

result_uncertain

Type: gboolean*

Return location for the certainty of the result, or NULL.

The argument will be set by the function.
The argument can be NULL.

Return value

Type: gchar*

A string indicating a guessed content type for the given data. Free with g_free().

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.