Work in progress
FossilOrigin-Name: 155605fd55cbb193d4f5ac8c704930c050a11cda541f1a5cdb93c57a8c51534f
This commit is contained in:
@ -4,7 +4,10 @@
|
||||
|
||||
uint8_t * bstr16_create_from_str(const char *s)
|
||||
{
|
||||
int l = strlen(s);
|
||||
uint8_t * mem;
|
||||
int msize;
|
||||
int l;
|
||||
l = strlen(s);
|
||||
if (s[0]!='.')
|
||||
return bstr16_create((uint8_t*)s,l);
|
||||
|
||||
@ -19,10 +22,10 @@ uint8_t * bstr16_create_from_str(const char *s)
|
||||
|
||||
/* the string starts with ".x" - read hexbytes */
|
||||
l-=2;
|
||||
int msize=l/2;
|
||||
msize=l/2;
|
||||
if(l&1)
|
||||
msize++;
|
||||
uint8_t * mem = malloc(2+msize);
|
||||
mem = malloc(2+msize);
|
||||
*((uint16_t*)mem)=msize;
|
||||
cw_format_scan_hex_bytes(mem+2,s+2,l);
|
||||
return mem;
|
||||
|
||||
Reference in New Issue
Block a user