[fixed]created new files misc_tools.(c|h) and moved hex_string_to_bin() there.

This commit is contained in:
Konstantin Kowalski
2013-07-27 12:10:41 -04:00
parent 4edf2207fe
commit b3fa1fc8f4
13 changed files with 85 additions and 84 deletions
+1 -16
View File
@@ -30,6 +30,7 @@
//#include "../core/network.h"
#include "../core/DHT.c"
#include "../core/friend_requests.c"
#include "misc_tools.h"
#include <string.h>
@@ -114,22 +115,6 @@ void printpacket(uint8_t * data, uint32_t length, IP_Port ip_port)
printf("\n--------------------END-----------------------------\n\n\n");
}
//TODO: rewrite
unsigned char * hex_string_to_bin(char hex_string[])
{
size_t len = strlen(hex_string);
unsigned char * val = malloc(len);
char * pos = hex_string;
int i=0;
while(i < len)
{
sscanf(pos,"%2hhx",&val[i]);
pos+=2;
i++;
}
return val;
}
int main(int argc, char *argv[])
{
//memcpy(self_client_id, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", 32);