HttpClient
HttpClient copied to clipboard
Error int b64_encode: control reaches end of non-void function
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`
Same here
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 }