Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes #188

Merged
merged 12 commits into from
Oct 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
smtp: ensure that multichar constants are stored as expected
In order for comparisons between the values we create by shifting multiple
bytes into a single uint32_t to work as expected, the first character in
a multicharacter character literal needs to correspond to the byte with
the largest place value so that the constants when read from left to right
will match the first character with the character that has been shifted
three times and the last character with the character that hasn't been
shifted at all.
  • Loading branch information
charliemirabile committed Oct 17, 2024
commit 3308dee78d74d69aec258719fbc6b755c3bad4a0
1 change: 1 addition & 0 deletions smtp/smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ALL_SYMBOLS(VERIFY_ENCODING)

_Static_assert(__BYTE_ORDER__ == __LITTLE_ENDIAN, "Big endian byte order not supported");

_Static_assert('\x01\x02\x03\x04' == 0x01020304, "Multichar characters are in the wrong order");

#define SEND(STR) send(STR "\r\n", sizeof(STR "\r\n") - 1)
static void send(const char *msg, size_t size)
Expand Down