aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-10-23 21:48:43 -0400
committerDavid Robillard <d@drobilla.net>2022-10-23 21:48:43 -0400
commit09f40d2e1e5f987b97410535435a7a1db7323511 (patch)
treef1c41534a2cfbb611158395318805692ed575085 /src
parent83cd85ce89590ab06e78a3ff0adf10f636c4103e (diff)
downloadserd-09f40d2e1e5f987b97410535435a7a1db7323511.tar.gz
serd-09f40d2e1e5f987b97410535435a7a1db7323511.tar.bz2
serd-09f40d2e1e5f987b97410535435a7a1db7323511.zip
Use uppercase integer literal suffixes
Diffstat (limited to 'src')
-rw-r--r--src/n3.c6
-rw-r--r--src/node.c4
-rw-r--r--src/serdi.c2
-rw-r--r--src/stack.h2
-rw-r--r--src/string_utils.h72
5 files changed, 43 insertions, 43 deletions
diff --git a/src/n3.c b/src/n3.c
index fd26d69f..2cbfb55a 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -112,17 +112,17 @@ read_UCHAR(SerdReader* const reader, const Ref dest, uint32_t* const char_code)
uint32_t c = code;
switch (size) {
case 4:
- buf[3] = (uint8_t)(0x80u | (c & 0x3Fu));
+ buf[3] = (uint8_t)(0x80U | (c & 0x3FU));
c >>= 6;
c |= (16 << 12); // set bit 4
SERD_FALLTHROUGH;
case 3:
- buf[2] = (uint8_t)(0x80u | (c & 0x3Fu));
+ buf[2] = (uint8_t)(0x80U | (c & 0x3FU));
c >>= 6;
c |= (32 << 6); // set bit 5
SERD_FALLTHROUGH;
case 2:
- buf[1] = (uint8_t)(0x80u | (c & 0x3Fu));
+ buf[1] = (uint8_t)(0x80U | (c & 0x3FU));
c >>= 6;
c |= 0xC0; // set bits 6 and 7
SERD_FALLTHROUGH;
diff --git a/src/node.c b/src/node.c
index 11a37139..f3c28cea 100644
--- a/src/node.c
+++ b/src/node.c
@@ -323,7 +323,7 @@ serd_node_new_decimal(const double d, const unsigned frac_digits)
for (; i < frac_digits - 1 && !(frac % 10); ++i, --s, frac /= 10) {
}
- node.n_bytes = node.n_chars = (size_t)(s - buf) + 1u;
+ node.n_bytes = node.n_chars = (size_t)(s - buf) + 1U;
// Write digits from last trailing zero to decimal point
for (; i < frac_digits; ++i) {
@@ -350,7 +350,7 @@ serd_node_new_integer(const int64_t i)
++s;
}
- node.n_bytes = node.n_chars = (size_t)(s - buf) + 1u;
+ node.n_bytes = node.n_chars = (size_t)(s - buf) + 1U;
// Write integer part (right to left)
do {
diff --git a/src/serdi.c b/src/serdi.c
index 34da4536..f3f7ca54 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -145,7 +145,7 @@ choose_style(const SerdSyntax input_syntax,
const bool bulk_write,
const bool full_uris)
{
- unsigned output_style = 0u;
+ unsigned output_style = 0U;
if (output_syntax == SERD_NTRIPLES || ascii) {
output_style |= SERD_STYLE_ASCII;
} else if (output_syntax == SERD_TURTLE) {
diff --git a/src/stack.h b/src/stack.h
index ceb41ad5..5040ace5 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -100,7 +100,7 @@ serd_stack_pop_aligned(SerdStack* stack, size_t n_bytes)
const uint8_t pad = stack->buf[stack->size - 1];
// Pop padding and pad count
- serd_stack_pop(stack, pad + 1u);
+ serd_stack_pop(stack, pad + 1U);
}
#endif // SERD_STACK_H
diff --git a/src/string_utils.h b/src/string_utils.h
index dec6ed2f..2fcfadac 100644
--- a/src/string_utils.h
+++ b/src/string_utils.h
@@ -111,50 +111,50 @@ static inline uint32_t
utf8_num_bytes(const uint8_t leading)
{
static const uint8_t lengths[32] = {
- 1u, // 00000xxx
- 1u, // 00001xxx
- 1u, // 00010xxx
- 1u, // 00011xxx
- 1u, // 00100xxx
- 1u, // 00101xxx
- 1u, // 00110xxx
- 1u, // 00111xxx
- 1u, // 01000xxx
- 1u, // 01001xxx
- 1u, // 01010xxx
- 1u, // 01011xxx
- 1u, // 01100xxx
- 1u, // 01101xxx
- 1u, // 01110xxx
- 1u, // 01111xxx
- 0u, // 10000xxx
- 0u, // 10001xxx
- 0u, // 10010xxx
- 0u, // 10011xxx
- 0u, // 10100xxx
- 0u, // 10101xxx
- 0u, // 10110xxx
- 0u, // 10111xxx
- 2u, // 11000xxx
- 2u, // 11001xxx
- 2u, // 11010xxx
- 2u, // 11011xxx
- 3u, // 11100xxx
- 3u, // 11101xxx
- 4u, // 11110xxx
- 0u // 11111xxx
+ 1U, // 00000xxx
+ 1U, // 00001xxx
+ 1U, // 00010xxx
+ 1U, // 00011xxx
+ 1U, // 00100xxx
+ 1U, // 00101xxx
+ 1U, // 00110xxx
+ 1U, // 00111xxx
+ 1U, // 01000xxx
+ 1U, // 01001xxx
+ 1U, // 01010xxx
+ 1U, // 01011xxx
+ 1U, // 01100xxx
+ 1U, // 01101xxx
+ 1U, // 01110xxx
+ 1U, // 01111xxx
+ 0U, // 10000xxx
+ 0U, // 10001xxx
+ 0U, // 10010xxx
+ 0U, // 10011xxx
+ 0U, // 10100xxx
+ 0U, // 10101xxx
+ 0U, // 10110xxx
+ 0U, // 10111xxx
+ 2U, // 11000xxx
+ 2U, // 11001xxx
+ 2U, // 11010xxx
+ 2U, // 11011xxx
+ 3U, // 11100xxx
+ 3U, // 11101xxx
+ 4U, // 11110xxx
+ 0U // 11111xxx
};
- return lengths[leading >> 3u];
+ return lengths[leading >> 3U];
}
/// Return the code point of a UTF-8 character with known length
static inline uint32_t
parse_counted_utf8_char(const uint8_t* utf8, size_t size)
{
- uint32_t c = utf8[0] & ((1u << (8u - size)) - 1u);
+ uint32_t c = utf8[0] & ((1U << (8U - size)) - 1U);
for (size_t i = 1; i < size; ++i) {
- c = (c << 6) | (utf8[i] & 0x3Fu);
+ c = (c << 6) | (utf8[i] & 0x3FU);
}
return c;
}
@@ -171,7 +171,7 @@ parse_utf8_char(const uint8_t* utf8, size_t* size)
return parse_counted_utf8_char(utf8, *size);
default:
*size = 0;
- return 0u;
+ return 0U;
}
}