why return this worning loss data conversion ?

 

Hi  when i run a library of Bernd Kreuss base64

//+------------------------------------------------------------------+
//| Encoding data in base64                                          |
//+------------------------------------------------------------------+
void _Base64Encode(string in,string &out)
  {
   int i=0,pad=0,len=StringLen(in);
//---- Let's go through and encode
   while(i<len)
     {
      //---- Extracting bytes
      int b3,b2,b1=StringGetChar(in,i);
      i++;
      if(i>=len) { b2=0; b3=0; pad=2; }
      else
        {
         b2=StringGetChar(in,i);
         i++;
         if(i>=len) { b3=0; pad=1; }
         else       { b3=StringGetChar(in,i); i++; }
        }
      //----
      int c1=(b1 >> 2);
      int c2=(((b1 & 0x3) << 4) | (b2 >> 4));
      int c3=(((b2 & 0xf) << 2) | (b3 >> 6));
      int c4=(b3 & 0x3f);

      out=out+CharToStr(_ExtBase64Encode[c1]);
      out=out+CharToStr(_ExtBase64Encode[c2]);
      switch(pad)
        {
         case 0:
           out=out+CharToStr(_ExtBase64Encode[c3]);
           out=out+CharToStr(_ExtBase64Encode[c4]);
           break;
         case 1:
           out=out+CharToStr(_ExtBase64Encode[c3]);
           out=out+"=";
           break;
         case 2:
           out=out+"==";
           break;
        }
     }
//----
  }

return me the  error   here  out=out+CharToStr(_ExtBase64Encode[c3]);

possible loss of data due to type conversion    common_functions.mqh    2036    25
nayone  know  how  fixit  i try to converti to string

 
faustf:

Hi  when i run a library of Bernd Kreuss base64

return me the  error   here  out=out+CharToStr(_ExtBase64Encode[c3]);

possible loss of data due to type conversion    common_functions.mqh    2036    25
nayone  know  how  fixit  i try to converti to string

What is the signature of
_ExtBase64Encode
 
faustf:

Hi  when i run a library of Bernd Kreuss base64

return me the  error   here  out=out+CharToStr(_ExtBase64Encode[c3]);

possible loss of data due to type conversion    common_functions.mqh    2036    25
nayone  know  how  fixit  i try to converti to string

Who is " Bernd Kreuss " ? Are we supposed to know him and know what you are talking about ?
 
Dominik Christian Egert #:
What is the signature of

i suppose is  this

static int _ExtBase64Encode[64]={ 'A','B','C','D','E','F','G','H','I','J','K','L','M',
                                 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
                                 'a','b','c','d','e','f','g','h','i','j','k','l','m',
                                 'n','o','p','q','r','s','t','u','v','w','x','y','z',
                                 '0','1','2','3','4','5','6','7','8','9','+','/'      };
                                 
static int _ExtBase64Decode[256]={
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  62,  -1,  -1,  -1,  63,
                    52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  -1,  -1,  -1,  -2,  -1,  -1,
                    -1,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
                    15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  -1,  -1,  -1,  -1,  -1,
                    -1,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,
                    41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
                    -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1 };
 
faustf #:

i suppose is  this

Jup. It's an int. CharToStr has uchar as input.

Change the call to this:

CharToStr((uchar)_ExtBase64Encode[c3]);
EDIT:

Or change this

static int 
to this:

static uchar
EDIT: fixed a typo
 

i change  declaration integer  to uchar  , but now  retorn me  only  this  error


//+------------------------------------------------------------------+
//| Decodin data in Base64                                           |
//+------------------------------------------------------------------+
void _Base64Decode(string in,string &out)
  {
   int i=0,len=StringLen(in);
   int shift=0,accum=0;
//---- Going to the end
   while(i<len)
     {
      //---- Extracting the code
      int value=_ExtBase64Decode[StringGetChar(in,i)];
      if(value<0 || value>63) break; // End or incorrect encoding
      //---- Reversing the code
      accum<<=6;
      shift+=6;
      accum|=value;
      if(shift>=8)
        {
         shift-=8;
         value=accum >> shift;
         out=out+CharToStr(value & 0xFF);
        //out = out + IntegerToString(value & 0xFF);
        } 
      i++;
     }
//----
  }
//+------------------------------------------------------------------+

in

 out=out+CharToStr(value & 0xFF);

possible loss of data due to type conversion    common_functions.mqh    2077    34

i try to modify

CharToStr((ucahr)value & 0xFF]);

but tell me uchar  not  exist like variable

 
faustf #:

i change  declaration integer  to uchar  , but now  retorn me  only  this  error


in

possible loss of data due to type conversion    common_functions.mqh    2077    34

i try to modify

but tell me uchar  not  exist like variable


This is an int.

value & 0xFF
You need to cast it again...


(uchar)(value & 0xFF)

Second: seemse a typo on your side.

EDIT;

You copied my typo...
 
myth now  work  thanks  so very much