mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
uri: rename nibbletohex() function to hex2nibble()
It converts a hex digit to a nibble, not the other way around.
This commit is contained in:
parent
f22d4e9587
commit
da2b4e1809
1 changed files with 3 additions and 3 deletions
6
uri.c
6
uri.c
|
|
@ -16,7 +16,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
nibble2hex(char c)
|
hex2nibble(char c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
|
@ -201,8 +201,8 @@ uri_parse(const char *uri, size_t len,
|
||||||
encoded_len -= prefix_len;
|
encoded_len -= prefix_len;
|
||||||
decoded_len += prefix_len;
|
decoded_len += prefix_len;
|
||||||
|
|
||||||
if (nibble2hex(next[1]) <= 15 && nibble2hex(next[2]) <= 15) {
|
if (hex2nibble(next[1]) <= 15 && hex2nibble(next[2]) <= 15) {
|
||||||
*p++ = nibble2hex(next[1]) << 4 | nibble2hex(next[2]);
|
*p++ = hex2nibble(next[1]) << 4 | hex2nibble(next[2]);
|
||||||
decoded_len++;
|
decoded_len++;
|
||||||
encoded_len -= 3;
|
encoded_len -= 3;
|
||||||
encoded = next + 3;
|
encoded = next + 3;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue