convert array of uint8 to array of chars

Hi, I'm using a library that fills an array of uint8:

uint8_t buffer[100] = {0};
uint32_t len = wifi.recv(buffer, sizeof(buffer), 3000);

I have a second library that could use this same array, but expects an array of chars as argument.

int decodedLen=base64_dec_len(buffer,len);

I get the error:
cast from 'uint8_t* {aka unsigned char*}' to 'char' loses precision [-fpermissive]

i tried some casting but not succesfully...
I'm working with UNO board, so with little memor I would like to use this same array...

The following compiles here without errors/warnings

uint8_t uBuffer[10];
char    cBuffer[10];

void checkCU(char* parm);
void checkUC(uint8_t* parm);

void setup() {
void loop() { }

void checkCU(char* parm) {
  if (parm != NULL) {
    parm[1] = 0;
void checkUC(uint8_t* parm) {
  if (parm != NULL) {
    parm[1] = 0;

I'd guess what you're seeing is a warning, not an error... In any case, the problem you may have is if the uint8_t array contains any members with a value greater than 127, they will be read as negative numbers once cast to char, which may cause the function using the array to give unexpected results. If there are no values greater than 127, then it will work just fine.

Ray L.

The different types reflect directly the usage (and the allowed ranges).

wifi.recv() will often handle binary data, while base64_dec_len() inherently only works on text.

The type system flags conversions that could create problems,
if you know what you are doing (and you should if you use casts) its OK.

I see no problem in extracting/converting a number or a base64 ASCII-string,
even if it resides in a 'binary' buffer.

So the cast can be seen as an oath that the content is compatible.