epan: Remove unused format_uri() function

Used with the GTK GUI, not used for a long time.
This commit is contained in:
João Valverde 2021-11-30 22:07:09 +00:00
parent 1e0cc18ae8
commit a9c36dfb75
3 changed files with 0 additions and 69 deletions

View File

@ -686,7 +686,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
format_text_chr@Base 1.12.0~rc1
format_text_string@Base 3.3.0
format_text_wsp@Base 1.9.1
format_uri@Base 1.9.1
fragment_add@Base 1.9.1
fragment_add_check@Base 1.9.1
fragment_add_multiple_ok@Base 1.9.1

View File

@ -897,57 +897,6 @@ uri_str_to_bytes(const char *uri_str, GByteArray *bytes)
return TRUE;
}
/*
* Given a GByteArray, generate a string from it that shows non-printable
* characters as percent-style escapes, and return a pointer to it.
*/
gchar *
format_uri(wmem_allocator_t* allocator, const GByteArray *bytes, const gchar *reserved_chars)
{
FMTBUF_VARS;
static const guchar reserved_def[] = ":/?#[]@!$&'()*+,;= ";
const guchar *reserved = reserved_def;
guint8 c;
guint byte_index, i;
gboolean is_reserved = FALSE;
if (! bytes)
return "";
if (reserved_chars)
reserved = reserved_chars;
for (byte_index = 0; byte_index < bytes->len; byte_index++) {
/*
* Make sure there is enough room for this character, if it
* expands to a percent plus 2 hex digits (which is the most
* it can expand to), and also enough room for a terminating '\0'.
*/
FMTBUF_EXPAND(2);
c = bytes->data[byte_index];
is_reserved = FALSE;
if (!g_ascii_isprint(c) || c == '%') {
is_reserved = TRUE;
} else {
for (i = 0; reserved[i]; i++) {
if (c == reserved[i])
is_reserved = TRUE;
}
}
if (!is_reserved) {
FMTBUF_PUTCHAR(c);
} else {
FMTBUF_PUTCHAR('%');
FMTBUF_PUTCHAR(hex[c >> 4]);
FMTBUF_PUTCHAR(hex[c & 0xF]);
}
}
fmtbuf[column] = '\0';
return fmtbuf;
}
/**
* Create a copy of a GByteArray
*

View File

@ -188,23 +188,6 @@ gboolean hex_str_to_bytes_encoding(const char *hex_str, GByteArray *bytes, const
WS_DLL_PUBLIC
gboolean uri_str_to_bytes(const char *uri_str, GByteArray *bytes);
/** Turn a byte array into an RFC 3986 percent-encoded string.
*
* @param allocator The wmem scope
* @param bytes The GByteArray that will receive the bytes. This
* must be initialized by the caller.
* @param reserved_chars Normally the "gen-delims" and "sub-delims"
* from RFC 3986 (":/?#[]@" and "!$&'()*+,;=" respectively)
* plus space (hex value 20) are treated as reserved characters.
* If this variable is non-NULL, its contents will be used
* instead.
* @note Any non-printing character determined by isprint(), along
* with the % character itself are always reserved.
* @see uri_str_to_bytes(), format_text(), isprint()
*/
WS_DLL_PUBLIC
gchar* format_uri(wmem_allocator_t* allocator, const GByteArray *bytes, const gchar *reserved_chars);
/** Turn a OID string representation (dot notation) into a byte array.
*
* @param oid_str The OID string (dot notaion).