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

Error int b64_encode: control reaches end of non-void function #44

Open
nekoFra opened this issue Apr 25, 2024 · 2 comments
Open

Error int b64_encode: control reaches end of non-void function #44

nekoFra opened this issue Apr 25, 2024 · 2 comments

Comments

@nekoFra
Copy link

nekoFra commented Apr 25, 2024

After I included "HttpClient.h" and "b64.h", at build time it returns the following error:

`/Users/francesco/Documents/Arduino/libraries/HttpClient/b64.cpp: In function 'int b64_encode(const unsigned char*, int, unsigned char*, int)':
/Users/francesco/Documents/Arduino/libraries/HttpClient/b64.cpp:69:1: error: control reaches end of non-void function [-Werror=return-type]
69 | }
| ^
cc1plus: some warnings being treated as errors

exit status 1

Compilation error: exit status 1`

@g1llez
Copy link

g1llez commented May 12, 2024

Same here

@bentwonk
Copy link

this thread fixes this issue:
https://forum.arduino.cc/t/httpclient-library-example-with-nodemcu/1042659/11

the solution is in adding return ((aInputLen+2)/3)*4; at the end of b64.c so that it looks like:

if (aInputLen % 3 > 0)
{
// It doesn't fit neatly into a 3-byte chunk, so process what's left
b64_encode(&aInput[i3], aInputLen % 3, &aOutput[i4], aOutputLen - (i*4));
}
}
return ((aInputLen+2)/3)*4; // ADDED
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants