diff options
| author | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2026-05-08 11:53:46 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2026-05-08 11:53:46 +0200 |
| commit | 5177d88bf591522d1b934e24221e16e02cd1592b (patch) | |
| tree | 1d8458cb6627ccfc673f791c5f0db45f9c06f7e0 /src/UriParseBase.c | |
| parent | a1dac799b819ba356a2faff3a98d7f5f076c24b6 (diff) | |
| parent | c3dce46c5f7cad6bc3cc91cc2c711ac089f25923 (diff) | |
Update upstream source from tag 'upstream/1.0.1+dfsg'
Update to upstream version '1.0.1+dfsg'
with Debian dir 3248cd7c10aca9ce2c693401e326390414aefe62
Diffstat (limited to 'src/UriParseBase.c')
| -rw-r--r-- | src/UriParseBase.c | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/src/UriParseBase.c b/src/UriParseBase.c index 3a4aa08..0ee66d4 100644 --- a/src/UriParseBase.c +++ b/src/UriParseBase.c @@ -38,53 +38,48 @@ */ #ifndef URI_DOXYGEN -# include "UriParseBase.h" +# include "UriParseBase.h" #endif +void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount, + unsigned char * output) { + switch (digitCount) { + case 1: + /* 0x___? -> \x00 \x0? */ + output[0] = 0; + output[1] = hexDigits[0]; + break; + case 2: + /* 0x__?? -> \0xx \x?? */ + output[0] = 0; + output[1] = 16 * hexDigits[0] + hexDigits[1]; + break; -void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount, unsigned char * output) { - switch (digitCount) { - case 1: - /* 0x___? -> \x00 \x0? */ - output[0] = 0; - output[1] = hexDigits[0]; - break; + case 3: + /* 0x_??? -> \0x? \x?? */ + output[0] = hexDigits[0]; + output[1] = 16 * hexDigits[1] + hexDigits[2]; + break; - case 2: - /* 0x__?? -> \0xx \x?? */ - output[0] = 0; - output[1] = 16 * hexDigits[0] + hexDigits[1]; - break; - - case 3: - /* 0x_??? -> \0x? \x?? */ - output[0] = hexDigits[0]; - output[1] = 16 * hexDigits[1] + hexDigits[2]; - break; - - case 4: - /* 0x???? -> \0?? \x?? */ - output[0] = 16 * hexDigits[0] + hexDigits[1]; - output[1] = 16 * hexDigits[2] + hexDigits[3]; - break; - - } + case 4: + /* 0x???? -> \0?? \x?? */ + output[0] = 16 * hexDigits[0] + hexDigits[1]; + output[1] = 16 * hexDigits[2] + hexDigits[3]; + break; + } } - - unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount) { - switch (digitCount) { - case 1: - return digits[0]; - - case 2: - return 10 * digits[0] + digits[1]; + switch (digitCount) { + case 1: + return digits[0]; - case 3: - default: - return 100 * digits[0] + 10 * digits[1] + digits[2]; + case 2: + return 10 * digits[0] + digits[1]; - } + case 3: + default: + return 100 * digits[0] + 10 * digits[1] + digits[2]; + } } |
