Added more space for proxies
Fixed a bug in protoutils.h->string_to_bytes where an extra NULL caused memory errors.
This commit is contained in:
parent
36f4f4e1b8
commit
5bc0d88bf1
3 changed files with 114 additions and 138 deletions
11
multiaddr.h
11
multiaddr.h
|
@ -20,8 +20,8 @@ int strpos(char *haystack, char *needle)
|
||||||
}
|
}
|
||||||
struct maddr
|
struct maddr
|
||||||
{
|
{
|
||||||
char string[200];
|
char string[800];
|
||||||
uint8_t bytes[100];
|
uint8_t bytes[400];
|
||||||
int bsize[1];
|
int bsize[1];
|
||||||
};
|
};
|
||||||
struct maddr new_maddr_fb(uint8_t * byteaddress,int size)//Construct new address from bytes
|
struct maddr new_maddr_fb(uint8_t * byteaddress,int size)//Construct new address from bytes
|
||||||
|
@ -39,14 +39,14 @@ struct maddr new_maddr_fb(uint8_t * byteaddress,int size)//Construct new address
|
||||||
struct maddr new_maddr_fs(char * straddress)//Construct new address from string
|
struct maddr new_maddr_fs(char * straddress)//Construct new address from string
|
||||||
{
|
{
|
||||||
struct maddr anewaddr;
|
struct maddr anewaddr;
|
||||||
bzero(anewaddr.string, 100);
|
bzero(anewaddr.string, 800);
|
||||||
strcpy(anewaddr.string, straddress);
|
strcpy(anewaddr.string, straddress);
|
||||||
anewaddr.bsize[0] = 0;
|
anewaddr.bsize[0] = 0;
|
||||||
if(string_to_bytes(anewaddr.bytes,anewaddr.bsize,anewaddr.string,sizeof(anewaddr.string))==1)
|
if(string_to_bytes(anewaddr.bytes,anewaddr.bsize,anewaddr.string,sizeof(anewaddr.string))==1)
|
||||||
{
|
{
|
||||||
int betta;
|
int betta;
|
||||||
//printf("BSIZE: %u\n", anewaddr.bsize[0]);
|
//printf("BSIZE: %u\n", anewaddr.bsize[0]);
|
||||||
for(betta=anewaddr.bsize[0];betta<100;betta++)
|
for(betta=anewaddr.bsize[0];betta<400;betta++)
|
||||||
{
|
{
|
||||||
anewaddr.bytes[betta] = '\0';
|
anewaddr.bytes[betta] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ int m_encapsulate(struct maddr * result, char * string)
|
||||||
if(result!=NULL&&string!=NULL)
|
if(result!=NULL&&string!=NULL)
|
||||||
{
|
{
|
||||||
int success = 0;
|
int success = 0;
|
||||||
char pstr[100];
|
char pstr[800];
|
||||||
|
bzero(pstr,800);
|
||||||
strcpy(pstr,result->string);
|
strcpy(pstr,result->string);
|
||||||
strcat(pstr,string+1);
|
strcat(pstr,string+1);
|
||||||
if(string_to_bytes(result->bytes,result->bsize,pstr,sizeof(pstr)))
|
if(string_to_bytes(result->bytes,result->bsize,pstr,sizeof(pstr)))
|
||||||
|
|
169
protoutils.h
169
protoutils.h
|
@ -258,7 +258,7 @@ char * int2ip(int inputintip)
|
||||||
//I didn't feel another address_bytes_to_string was necesarry sry guys
|
//I didn't feel another address_bytes_to_string was necesarry sry guys
|
||||||
int bytes_to_string(char * resultzx, uint8_t * catx,int xbsize)
|
int bytes_to_string(char * resultzx, uint8_t * catx,int xbsize)
|
||||||
{
|
{
|
||||||
bzero(resultzx,200);
|
bzero(resultzx,800);
|
||||||
uint8_t * bytes = NULL;
|
uint8_t * bytes = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
size = xbsize;
|
size = xbsize;
|
||||||
|
@ -348,8 +348,8 @@ int bytes_to_string(char * resultzx, uint8_t * catx,int xbsize)
|
||||||
|
|
||||||
char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
{
|
{
|
||||||
static char astb__stringy[200] = "\0";
|
static char astb__stringy[800] = "\0";
|
||||||
bzero(astb__stringy,200);
|
bzero(astb__stringy,800);
|
||||||
int code = 0;
|
int code = 0;
|
||||||
code = xx->deccode;
|
code = xx->deccode;
|
||||||
switch(code)
|
switch(code)
|
||||||
|
@ -381,8 +381,8 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
{
|
{
|
||||||
if(atoi(abc)<65536&&atoi(abc)>0)
|
if(atoi(abc)<65536&&atoi(abc)>0)
|
||||||
{
|
{
|
||||||
static char himm_woot[4] = "\0";
|
static char himm_woot[5] = "\0";
|
||||||
bzero(himm_woot, 4);
|
bzero(himm_woot, 5);
|
||||||
strcpy(himm_woot, Int_To_Hex(atoi(abc)));
|
strcpy(himm_woot, Int_To_Hex(atoi(abc)));
|
||||||
if(himm_woot[2] == '\0')
|
if(himm_woot[2] == '\0')
|
||||||
{//manual switch
|
{//manual switch
|
||||||
|
@ -406,6 +406,7 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
himm_woot[2] = swap2;
|
himm_woot[2] = swap2;
|
||||||
himm_woot[3] = swap3;
|
himm_woot[3] = swap3;
|
||||||
}
|
}
|
||||||
|
himm_woot[4]='\0';
|
||||||
return himm_woot;
|
return himm_woot;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -418,8 +419,8 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
{
|
{
|
||||||
if(atoi(abc)<65536&&atoi(abc)>0)
|
if(atoi(abc)<65536&&atoi(abc)>0)
|
||||||
{
|
{
|
||||||
static char himm_woot2[4] = "\0";
|
static char himm_woot2[5] = "\0";
|
||||||
bzero(himm_woot2, 4);
|
bzero(himm_woot2, 5);
|
||||||
strcpy(himm_woot2, Int_To_Hex(atoi(abc)));
|
strcpy(himm_woot2, Int_To_Hex(atoi(abc)));
|
||||||
if(himm_woot2[2] == '\0')
|
if(himm_woot2[2] == '\0')
|
||||||
{//Manual Switch2be
|
{//Manual Switch2be
|
||||||
|
@ -443,6 +444,7 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
himm_woot2[2] = swap2;
|
himm_woot2[2] = swap2;
|
||||||
himm_woot2[3] = swap3;
|
himm_woot2[3] = swap3;
|
||||||
}
|
}
|
||||||
|
himm_woot2[4]='\0';
|
||||||
return himm_woot2;
|
return himm_woot2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -474,6 +476,7 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
case 42://IPFS - !!!
|
case 42://IPFS - !!!
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return "ERR";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 480://http
|
case 480://http
|
||||||
|
@ -511,127 +514,99 @@ char * address_string_to_bytes(struct protocol * xx, char * abc,size_t getsznow)
|
||||||
}
|
}
|
||||||
int string_to_bytes(uint8_t * finalbytes,int * realbbsize,char * strx, size_t strsize)
|
int string_to_bytes(uint8_t * finalbytes,int * realbbsize,char * strx, size_t strsize)
|
||||||
{
|
{
|
||||||
static char xxx[200] = "\0";
|
if(strx[0] != '/')
|
||||||
bzero(xxx,200);
|
{
|
||||||
int sigmalf = 0;
|
printf("Error, must start with '/'\n");
|
||||||
char * totpch;
|
return 0;
|
||||||
|
}
|
||||||
|
char xxx[800];
|
||||||
|
bzero(xxx,800);
|
||||||
|
//Getting total words
|
||||||
|
int totalwords = 0;
|
||||||
|
char * totp;
|
||||||
char totalwordstest[strsize];
|
char totalwordstest[strsize];
|
||||||
bzero(totalwordstest,strsize);
|
bzero(totalwordstest,strsize);
|
||||||
strcat(totalwordstest, strx);
|
strcat(totalwordstest, strx);
|
||||||
int totalwords = 0;
|
totp = strtok(totalwordstest, "/");
|
||||||
totpch = strtok(totalwordstest, "/");
|
while(totp != NULL)
|
||||||
while(totpch != NULL)
|
|
||||||
{
|
{
|
||||||
totpch = strtok (NULL, "/");
|
totp = strtok (NULL, "/");
|
||||||
totalwords++;
|
totalwords++;
|
||||||
}
|
}
|
||||||
int processedwords = 0;
|
//Initializing variables to store our processed HEX in:
|
||||||
char processedsofar[100];
|
int malf=0; //In case something goes wrong this will be 1.
|
||||||
bzero(processedsofar,100);
|
char processed[800];//HEX CONTAINER
|
||||||
char str[strsize]; //This string will be bad later.
|
bzero(processed,800);
|
||||||
bzero(str,strsize);
|
//Now Setting up variables for calculating which is the first
|
||||||
nextproc:
|
//and second word:
|
||||||
strcpy(str,strx);
|
int firstorsecond = 1; //1=Protocol && 2 = Address
|
||||||
if(str[0] == '/')
|
char pstring[800];//We do not want to harm the initial string.
|
||||||
{
|
bzero(pstring,800);
|
||||||
char * pch;
|
strcat(pstring,strx);
|
||||||
pch = strtok (str,"/");
|
//Starting to extract words and process them:
|
||||||
|
char * wp;
|
||||||
|
char * end;
|
||||||
|
wp=strtok_r(pstring,"/",&end);
|
||||||
load_protocols();
|
load_protocols();
|
||||||
for(int ax=0;ax<processedwords;ax++)
|
|
||||||
{
|
|
||||||
pch = strtok (NULL, "/");
|
|
||||||
}
|
|
||||||
while(pch != NULL)
|
|
||||||
{
|
|
||||||
if(proto_with_name(pch))
|
|
||||||
{
|
|
||||||
strcat(processedsofar, "/");
|
|
||||||
strcat(processedsofar, pch);
|
|
||||||
struct protocol * protx;
|
struct protocol * protx;
|
||||||
//printf("PCH-P:%s\n",pch);
|
while(wp)
|
||||||
protx = proto_with_name(pch);
|
|
||||||
char cut[3]="\0";
|
|
||||||
bzero(cut,3);
|
|
||||||
strcat(cut,Int_To_Hex(protx->deccode));
|
|
||||||
cut[2] = '\0';
|
|
||||||
char finipbit[3] = "\0";
|
|
||||||
bzero(finipbit,3);
|
|
||||||
finipbit[0] = cut[0];
|
|
||||||
finipbit[1] = cut[1];
|
|
||||||
finipbit[2] = '\0';
|
|
||||||
//Address
|
|
||||||
pch = strtok (NULL, "/"); // Move to supposed address
|
|
||||||
strcat(processedsofar, "/");
|
|
||||||
strcat(processedsofar, pch);
|
|
||||||
//printf("PCH-A:%s\n",pch);
|
|
||||||
char addr[60] = "\0";
|
|
||||||
bzero(addr,60);
|
|
||||||
strcat(addr, pch);
|
|
||||||
//If both are ok:
|
|
||||||
strcat(xxx,finipbit);
|
|
||||||
if(address_string_to_bytes(protx, addr,sizeof(addr)))
|
|
||||||
{
|
{
|
||||||
if(address_string_to_bytes(protx, addr,sizeof(addr)) == "ERR")
|
if(firstorsecond==1)//This is the Protocol
|
||||||
{
|
{
|
||||||
sigmalf = 1;
|
if(proto_with_name(wp))
|
||||||
|
{
|
||||||
|
protx=proto_with_name(wp);
|
||||||
|
//printf("PROTOCOL: %s\n",protx->name);
|
||||||
|
strcat(processed, Int_To_Hex(protx->deccode));
|
||||||
|
firstorsecond=2;//Since the next word will be an address
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcat(xxx,address_string_to_bytes(protx, addr,sizeof(addr)));
|
printf("\nNo such protocol!\n\n");
|
||||||
|
malf=1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else//This is the address
|
||||||
|
{
|
||||||
|
//printf("ADDRESS: %s\n",wp);
|
||||||
|
if(address_string_to_bytes(protx, wp,strlen(wp)) == "ERR")
|
||||||
|
{
|
||||||
|
malf = 1;
|
||||||
|
//printf("\n\nTRIGGERED!!!!!!!!!!!!!!!!!!!!!!!\n\n");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sigmalf = 1;
|
strcat(processed,address_string_to_bytes(protx, wp,strlen(wp)));
|
||||||
|
//printf("Addressinbytes: %s\n",address_string_to_bytes(protx, wp,strlen(wp)));
|
||||||
}
|
}
|
||||||
pch = strtok (NULL, "/"); // Next step.
|
protx=NULL;//Since right now it doesn't need that assignment anymore.
|
||||||
processedwords++;
|
firstorsecond=1;//Since the next word will be an protocol
|
||||||
processedwords++;
|
}
|
||||||
|
wp=strtok_r(NULL,"/",&end);
|
||||||
|
}
|
||||||
|
protx=NULL;
|
||||||
|
unload_protocols();
|
||||||
|
//printf("Processed contains: %s \n",processed);
|
||||||
|
|
||||||
}
|
if(malf==1)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//This only gets triggered if the string has a wrong format
|
|
||||||
//Or unknown protocol!
|
|
||||||
printf("ERROR: MALFORMED STRING\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
if(processedwords != totalwords)
|
|
||||||
{
|
{
|
||||||
goto nextproc;
|
bzero(finalbytes,400);
|
||||||
}
|
|
||||||
unload_protocols();
|
|
||||||
if(sigmalf != 1)
|
|
||||||
{
|
|
||||||
//printf("S2B_RESULT: %s\n", xxx);
|
|
||||||
//static uint8_t finalbytes[100] = {0};
|
|
||||||
bzero(finalbytes,100);
|
|
||||||
//printf("XXX: %s\n",xxx);
|
//printf("XXX: %s\n",xxx);
|
||||||
memcpy(finalbytes, Hex_To_Var(xxx), 100);
|
memcpy(finalbytes, Hex_To_Var(processed), 400);
|
||||||
realbbsize[0] = 0;
|
realbbsize[0] = 0;
|
||||||
for(int i=0;i<100;i++)
|
for(int i=0;i<400;i++)
|
||||||
{
|
{
|
||||||
if(finalbytes[i])
|
if(finalbytes[i])
|
||||||
{
|
{
|
||||||
realbbsize[0]++;
|
realbbsize[0]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("FB2XXX: %s\nWith size: %u\n",Var_To_Hex(finalbytes), realbbsize[0]);
|
return 1;
|
||||||
//realbsize = realsize;
|
|
||||||
//printf("REALbBSZIE: %d", realbbsize[0]);
|
|
||||||
return 1;//success
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("ERROR, MALFORMED STRING!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("ERROR, Multiaddr needs to start with '/'\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ uint32_t * Varint_To_Num_32(uint8_t TON32INPUT[60]) //VARINT TO UINT32_t
|
||||||
//
|
//
|
||||||
char * Int_To_Hex(uint64_t int2hex) //VAR[binformat] TO HEX
|
char * Int_To_Hex(uint64_t int2hex) //VAR[binformat] TO HEX
|
||||||
{
|
{
|
||||||
static char int2hex_result[200]="\0";
|
static char int2hex_result[800]="\0";
|
||||||
memset(int2hex_result,0,sizeof(int2hex_result));
|
memset(int2hex_result,0,sizeof(int2hex_result));
|
||||||
sprintf (int2hex_result, "%02lX", int2hex);
|
sprintf (int2hex_result, "%02lX", int2hex);
|
||||||
return int2hex_result;
|
return int2hex_result;
|
||||||
|
@ -78,8 +78,8 @@ uint64_t Hex_To_Int(char * hax)
|
||||||
//
|
//
|
||||||
void vthconvert(int size, char * crrz01, uint8_t * xbuf)
|
void vthconvert(int size, char * crrz01, uint8_t * xbuf)
|
||||||
{
|
{
|
||||||
uint8_t buf[100];
|
uint8_t buf[400];
|
||||||
bzero(buf,100);
|
bzero(buf,400);
|
||||||
|
|
||||||
//fixing the buf
|
//fixing the buf
|
||||||
for(int cz=0; cz<size;cz++)
|
for(int cz=0; cz<size;cz++)
|
||||||
|
@ -91,7 +91,7 @@ void vthconvert(int size, char * crrz01, uint8_t * xbuf)
|
||||||
{
|
{
|
||||||
char * crrz1 = NULL;
|
char * crrz1 = NULL;
|
||||||
crrz1 = crrz01;
|
crrz1 = crrz01;
|
||||||
char conv_proc[200]="\0";
|
char conv_proc[800]="\0";
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < (size*2); i++)
|
for(i=0; i < (size*2); i++)
|
||||||
{
|
{
|
||||||
|
@ -107,32 +107,32 @@ void vthconvert(int size, char * crrz01, uint8_t * xbuf)
|
||||||
}
|
}
|
||||||
char * Var_To_Hex(int realsize, uint8_t * TOHEXINPUT) //VAR[binformat] TO HEX
|
char * Var_To_Hex(int realsize, uint8_t * TOHEXINPUT) //VAR[binformat] TO HEX
|
||||||
{
|
{
|
||||||
for(int ix=realsize;ix<100;ix++)
|
for(int ix=realsize;ix<400;ix++)
|
||||||
{
|
{
|
||||||
TOHEXINPUT[ix] = '\0';
|
TOHEXINPUT[ix] = '\0';
|
||||||
}
|
}
|
||||||
if(TOHEXINPUT != NULL)
|
if(TOHEXINPUT != NULL)
|
||||||
{
|
{
|
||||||
static char convert_resultz1[200]="\0";
|
static char convert_resultz1[800]="\0";
|
||||||
bzero(convert_resultz1,200);
|
bzero(convert_resultz1,800);
|
||||||
vthconvert(realsize, convert_resultz1, TOHEXINPUT);
|
vthconvert(realsize, convert_resultz1, TOHEXINPUT);
|
||||||
return convert_resultz1;
|
return convert_resultz1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint8_t * Hex_To_Var(char * Hexstr) //HEX TO VAR[BINFORMAT]
|
uint8_t * Hex_To_Var(char * Hexstr) //HEX TO VAR[BINFORMAT]
|
||||||
{
|
{
|
||||||
static uint8_t buffy_HEX[100] = {0};
|
static uint8_t buffy_HEX[400] = {0};
|
||||||
bzero(buffy_HEX,100);
|
bzero(buffy_HEX,400);
|
||||||
int i;
|
int i;
|
||||||
char codo[200] = "\0";
|
char codo[800] = "\0";
|
||||||
bzero(codo,200);
|
bzero(codo,800);
|
||||||
strcpy(codo, Hexstr);
|
strcpy(codo, Hexstr);
|
||||||
char code[3];
|
char code[3];
|
||||||
bzero(code,3);
|
bzero(code,3);
|
||||||
code[3]='\0';
|
code[3]='\0';
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int fori001=0;
|
int fori001=0;
|
||||||
for(fori001=0;fori001<200;fori001++)
|
for(fori001=0;fori001<800;fori001++)
|
||||||
{
|
{
|
||||||
strncpy(&code[0],&codo[fori001],1);
|
strncpy(&code[0],&codo[fori001],1);
|
||||||
strncpy(&code[1],&codo[fori001+1],1);
|
strncpy(&code[1],&codo[fori001+1],1);
|
||||||
|
@ -149,8 +149,8 @@ uint8_t * Hex_To_Var(char * Hexstr) //HEX TO VAR[BINFORMAT]
|
||||||
//
|
//
|
||||||
void convert(char * convert_result, uint8_t * buf) //Both of them read them properly.
|
void convert(char * convert_result, uint8_t * buf) //Both of them read them properly.
|
||||||
{
|
{
|
||||||
char conv_proc[200]="\0";
|
char conv_proc[800]="\0";
|
||||||
bzero(conv_proc,200);
|
bzero(conv_proc,800);
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i < 10; i++)
|
for(i=0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -161,12 +161,12 @@ void convert(char * convert_result, uint8_t * buf) //Both of them read them
|
||||||
}
|
}
|
||||||
char * Num_To_HexVar_64(uint64_t TOHVINPUT) //UINT64 TO HEXIFIED VAR
|
char * Num_To_HexVar_64(uint64_t TOHVINPUT) //UINT64 TO HEXIFIED VAR
|
||||||
{ //Code to varint - py
|
{ //Code to varint - py
|
||||||
static char convert_result[200]="\0";//Note that the hex resulted from this will differ from py
|
static char convert_result[800]="\0";//Note that the hex resulted from this will differ from py
|
||||||
bzero(convert_result,200);
|
bzero(convert_result,800);
|
||||||
memset(convert_result,0,sizeof(convert_result));//But if you make sure the string is always 20 chars in size
|
memset(convert_result,0,sizeof(convert_result));//But if you make sure the string is always 20 chars in size
|
||||||
uint8_t buf[100] = {0};
|
uint8_t buf[400] = {0};
|
||||||
bzero(buf,100);
|
bzero(buf,400);
|
||||||
uvarint_encode64(TOHVINPUT, buf, 200);
|
uvarint_encode64(TOHVINPUT, buf, 800);
|
||||||
convert(convert_result,buf);
|
convert(convert_result,buf);
|
||||||
return convert_result;
|
return convert_result;
|
||||||
}
|
}
|
||||||
|
@ -201,13 +201,13 @@ char * Num_To_HexVar_32(uint32_t TOHVINPUT) //UINT32 TO HEXIFIED VAR
|
||||||
|
|
||||||
uint64_t HexVar_To_Num_64(char * theHEXstring) //HEXIFIED VAR TO UINT64_T
|
uint64_t HexVar_To_Num_64(char * theHEXstring) //HEXIFIED VAR TO UINT64_T
|
||||||
{ //Varint to code - py
|
{ //Varint to code - py
|
||||||
uint8_t buffy[100] = {0};
|
uint8_t buffy[400] = {0};
|
||||||
char codo[200] = "\0";
|
char codo[800] = "\0";
|
||||||
bzero(codo,200);
|
bzero(codo,800);
|
||||||
strcpy(codo, theHEXstring);
|
strcpy(codo, theHEXstring);
|
||||||
char code[3] = "\0";
|
char code[3] = "\0";
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(int i= 0;i<199;i++)
|
for(int i= 0;i<399;i++)
|
||||||
{
|
{
|
||||||
strncpy(&code[0],&codo[i],1);
|
strncpy(&code[0],&codo[i],1);
|
||||||
strncpy(&code[1],&codo[i+1],1);
|
strncpy(&code[1],&codo[i+1],1);
|
||||||
|
@ -219,21 +219,21 @@ uint64_t HexVar_To_Num_64(char * theHEXstring) //HEXIFIED VAR TO UINT64_T
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
static uint64_t decoded;
|
static uint64_t decoded;
|
||||||
uvarint_decode64 (buffy, 100, &decoded);
|
uvarint_decode64 (buffy, 400, &decoded);
|
||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
uint32_t HexVar_To_Num_32(char theHEXstring[]) //HEXIFIED VAR TO UINT32_T
|
uint32_t HexVar_To_Num_32(char theHEXstring[]) //HEXIFIED VAR TO UINT32_T
|
||||||
{ //Varint to code py
|
{ //Varint to code py
|
||||||
uint8_t buffy[100] = {0};
|
uint8_t buffy[400] = {0};
|
||||||
bzero(buffy,100);
|
bzero(buffy,400);
|
||||||
char codo[200] = "\0";
|
char codo[800] = "\0";
|
||||||
bzero(codo,200);
|
bzero(codo,800);
|
||||||
strcpy(codo, theHEXstring);
|
strcpy(codo, theHEXstring);
|
||||||
char code[3] = "\0";
|
char code[3] = "\0";
|
||||||
bzero(code,3);
|
bzero(code,3);
|
||||||
code[3] = '\0';
|
code[3] = '\0';
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(int i= 0;i<199;i++)
|
for(int i= 0;i<399;i++)
|
||||||
{
|
{
|
||||||
strncpy(&code[0],&codo[i],1);
|
strncpy(&code[0],&codo[i],1);
|
||||||
strncpy(&code[1],&codo[i+1],1);
|
strncpy(&code[1],&codo[i+1],1);
|
||||||
|
|
Loading…
Reference in a new issue