mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
styling
This commit is contained in:
parent
8eb76e46a8
commit
52a11813a6
|
@ -25,19 +25,16 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h> //for sscanf
|
#include <stdio.h> /* for sscanf */
|
||||||
|
|
||||||
//TODO: rewrite
|
/* TODO: rewrite */
|
||||||
unsigned char * hex_string_to_bin(char hex_string[])
|
unsigned char * hex_string_to_bin(char hex_string[])
|
||||||
{
|
{
|
||||||
size_t len = strlen(hex_string);
|
size_t len = strlen(hex_string);
|
||||||
unsigned char *val = malloc(len);
|
unsigned char *val = malloc(len);
|
||||||
char *pos = hex_string;
|
char *pos = hex_string;
|
||||||
int i=0;
|
int i;
|
||||||
while(i < len) {
|
for(i = 0; i < len; ++i, pos+=2)
|
||||||
sscanf(pos,"%2hhx",&val[i]);
|
sscanf(pos,"%2hhx",&val[i]);
|
||||||
pos+=2;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user