Commit b3b22bb8 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Set an function UINT32_TO_STRING for C

parent 53060c99
......@@ -88,7 +88,12 @@ if ('UIN8' == STRING_TO_UINT32("UIN8")) ...
uint32_t value_str;
printf("type: %.4s", UINT32_TO_STRING(value_str, 'UIN8'));
@endcode*/
#define UINT32_TO_STRING(uint32_print, x) ((char*)&(uint32_print=htonl(x)))
#ifdef __cplusplus
#define UINT32_TO_STRING(uint32_str, x) ((char*)&(uint32_str=htonl(x)))
#else
char* blc_uint32_to_string(uint32_t *string, uint32_t x);
#define UINT32_TO_STRING(uint32_str, x) blc_uint32_to_string(&uint32_str, x)
#endif
///Shorcut to use in formated string to define a maximal size of the receiving string.
#define SCAN_CONV(size_max, format) "%" STRINGIFY_CONTENT(size_max)format
......
......@@ -34,7 +34,6 @@ FILE *blc_log_file = NULL;
char const *blc_program_name="";
size_t blc_get_type_size(uint32_t type)
{
uint32_t type_str;
......@@ -53,7 +52,6 @@ size_t blc_get_type_size(uint32_t type)
return 0;
}
//Envoie un message de warning avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. To be used with PRINT_WARNING.
void print_warning(const char *name_of_file, const char* name_of_function, int numero_of_line, const char *message, ...)
{
......@@ -271,5 +269,11 @@ char const *blc_get_filename_extension(char const *filename){
return ext+1;
}
extern "C"{
char* blc_uint32_to_string(uint32_t *string, uint32_t x){
*string=htonl(x);
return (char*)string;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment