epan: Update format_text() API documentation

This commit is contained in:
João Valverde 2022-09-27 19:22:32 +01:00 committed by A Wireshark GitLab Utility
parent d7b1a2b4a8
commit cdfa3116d2
1 changed files with 10 additions and 24 deletions

View File

@ -48,8 +48,7 @@ int get_token_len(const guchar *linep, const guchar *lineend,
const guchar **next_token);
/** Given a wmem scope, a not-necessarily-null-terminated string,
* expected to be in UTF-8 but possibly containing invalid sequences
* (as it may have come from packet data), and the length of the string,
* expected to be in UTF-8 and the length of the string,
* generate a valid UTF-8 string from it, allocated in the specified
* wmem scope, that:
*
@ -61,8 +60,7 @@ int get_token_len(const guchar *linep, const guchar *lineend,
* shows non-printable Unicode-but-not-ASCII characters as
* their universal character names;
*
* shows illegal UTF-8 sequences as a sequence of bytes represented
* as C-style hex escapes;
* Replaces illegal UTF-8 sequences with U+FFFD (replacement character) ;
*
* and return a pointer to it.
*
@ -76,23 +74,7 @@ int get_token_len(const guchar *linep, const guchar *lineend,
WS_DLL_PUBLIC
gchar* format_text(wmem_allocator_t* allocator, const guchar *string, size_t len);
/** Given a wmem scope and a null-terminated string, expected to be in
* UTF-8 but possibly containing invalid sequences (as it may have come
* from packet data), and the length of the string, generate a valid
* UTF-8 string from it, allocated in the specified wmem scope, that:
*
* shows printable Unicode characters as themselves;
*
* shows non-printable ASCII characters as C-style escapes (octal
* if not one of the standard ones such as LF -> '\n');
*
* shows non-printable Unicode-but-not-ASCII characters as
* their universal character names;
*
* shows illegal UTF-8 sequences as a sequence of bytes represented
* as C-style hex escapes;
*
* and return a pointer to it.
/** Same as format_text() but accepts a nul-terminated string.
*
* @param allocator The wmem scope
* @param string A pointer to the input string
@ -104,10 +86,9 @@ WS_DLL_PUBLIC
gchar* format_text_string(wmem_allocator_t* allocator, const guchar *string);
/**
* Given a string, generate a string from it that shows non-printable
* characters as C-style escapes except a whitespace character
* Same as format_text() but replaces any whitespace characters
* (space, tab, carriage return, new line, vertical tab, or formfeed)
* which will be replaced by a space, and return a pointer to it.
* with a space.
*
* @param allocator The wmem scope
* @param line A pointer to the input string
@ -124,6 +105,11 @@ gchar* format_text_wsp(wmem_allocator_t* allocator, const guchar *line, size
* (space, tab, carriage return, new line, vertical tab, or formfeed)
* which will be replaced by a space, and return a pointer to it.
*
* This does *not* treat the input string as UTF-8.
*
* This is useful for displaying binary data that frequently but not always
* contains text; otherwise the number of C escape codes makes it unreadable.
*
* @param allocator The wmem scope
* @param string A pointer to the input string
* @param len The length of the input string