Functional reformat #7
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I used this library in one of my projects and I realized that there are two main problems:
unsigned char
is a problem when the user is trying to input a string in the functions and more important the non usage of theconst char *
don't allow the user to input literal strings to the functions.Addressing the above problems I made the following changes:
char
instead ofunsigned char
for character of a base64encoded value. They are ascii characters and so they should be
char
.uint8_t
instead ofunsigend char
when dealing with bytes. It'sbetter to use such kind of standards because they are guaranteed to be 8 bit.
size_t
orssize_t
instead ofunsigned int
when dealing withlengths.It's better because it'll be the same used in string libraries when
building across different architectures (e.g. Arduino).
error of redefinition of functions if the library is used in different files
in a project.
N.B. for one line functions I'm using the
inline
keywordconst char *
instead ofunsigend char[]
when dealing with strings.that is important to allow the user to pass a literal string to the function.