b64.c | Base64 encode/decode | Messaging library
kandi X-RAY | b64.c Summary
kandi X-RAY | b64.c Summary
b64.c
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of b64.c
b64.c Key Features
b64.c Examples and Code Snippets
Community Discussions
Trending Discussions on b64.c
QUESTION
I have written a base 64 encoding / decoding library for the Arduino IDE (yes, I am aware such libraries already exist. This is for my own education as much as anything practical). My target microcontroller is an Espressif ESP32.
In my base64 decoding function, the index variable i
is affected by the presence of a Serial.println()
debug statement. It is the strangest thing I have ever seen and I cannot figure out why it should make a difference if there is debug printing or not.
Using the test program base64.ino
and the b64.cpp
functions below, here are two samples of my serial output. In the first example, I'm using a Serial.println(i);
in the function b64dec()
just after the for loop. In the second example, the Serial.println(i);
is commented out. That is the only difference and I get two drastically different results.
Am I missing something here? Is it a compiler optimization gone wonky? My understanding of C variable scoping is that there are only global, function, and parameter levels. The i
in the for loop should be the same as the int i = 0;
a few lines above it. I don't believe it's buffer eoverflow either, since the debugging output of 13 for the decoded length is accurate for a 12 character message and its NULL terminator.
This is what I expect to get any time I run it:
...ANSWER
Answered 2021-Apr-20 at 08:36You have declared an array of 4 chars:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install b64.c
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page