ds: formatting tweaks
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <ctype.h>
|
||||
#include <fx/core/stringstream.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <fx/ds/uuid.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -15,31 +15,43 @@ struct fx_uuid_p {
|
||||
/*** PRIVATE FUNCTIONS ********************************************************/
|
||||
|
||||
static fx_status uuid_to_cstr(
|
||||
const struct fx_uuid_p *uuid, char out[FX_UUID_STRING_MAX])
|
||||
const struct fx_uuid_p *uuid,
|
||||
char out[FX_UUID_STRING_MAX])
|
||||
{
|
||||
snprintf(
|
||||
out, FX_UUID_STRING_MAX,
|
||||
out,
|
||||
FX_UUID_STRING_MAX,
|
||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%"
|
||||
"02x%02x",
|
||||
uuid->uuid_bytes.uuid_bytes[0], uuid->uuid_bytes.uuid_bytes[1],
|
||||
uuid->uuid_bytes.uuid_bytes[2], uuid->uuid_bytes.uuid_bytes[3],
|
||||
uuid->uuid_bytes.uuid_bytes[4], uuid->uuid_bytes.uuid_bytes[5],
|
||||
uuid->uuid_bytes.uuid_bytes[6], uuid->uuid_bytes.uuid_bytes[7],
|
||||
uuid->uuid_bytes.uuid_bytes[8], uuid->uuid_bytes.uuid_bytes[9],
|
||||
uuid->uuid_bytes.uuid_bytes[10], uuid->uuid_bytes.uuid_bytes[11],
|
||||
uuid->uuid_bytes.uuid_bytes[12], uuid->uuid_bytes.uuid_bytes[13],
|
||||
uuid->uuid_bytes.uuid_bytes[14], uuid->uuid_bytes.uuid_bytes[15]);
|
||||
uuid->uuid_bytes.uuid_bytes[0],
|
||||
uuid->uuid_bytes.uuid_bytes[1],
|
||||
uuid->uuid_bytes.uuid_bytes[2],
|
||||
uuid->uuid_bytes.uuid_bytes[3],
|
||||
uuid->uuid_bytes.uuid_bytes[4],
|
||||
uuid->uuid_bytes.uuid_bytes[5],
|
||||
uuid->uuid_bytes.uuid_bytes[6],
|
||||
uuid->uuid_bytes.uuid_bytes[7],
|
||||
uuid->uuid_bytes.uuid_bytes[8],
|
||||
uuid->uuid_bytes.uuid_bytes[9],
|
||||
uuid->uuid_bytes.uuid_bytes[10],
|
||||
uuid->uuid_bytes.uuid_bytes[11],
|
||||
uuid->uuid_bytes.uuid_bytes[12],
|
||||
uuid->uuid_bytes.uuid_bytes[13],
|
||||
uuid->uuid_bytes.uuid_bytes[14],
|
||||
uuid->uuid_bytes.uuid_bytes[15]);
|
||||
return FX_SUCCESS;
|
||||
}
|
||||
|
||||
static void uuid_get_bytes(
|
||||
const struct fx_uuid_p *uuid, unsigned char bytes[FX_UUID_NBYTES])
|
||||
const struct fx_uuid_p *uuid,
|
||||
unsigned char bytes[FX_UUID_NBYTES])
|
||||
{
|
||||
memcpy(bytes, uuid->uuid_bytes.uuid_bytes, FX_UUID_NBYTES);
|
||||
}
|
||||
|
||||
static void uuid_get_uuid_bytes(
|
||||
const struct fx_uuid_p *uuid, union fx_uuid_bytes *bytes)
|
||||
const struct fx_uuid_p *uuid,
|
||||
union fx_uuid_bytes *bytes)
|
||||
{
|
||||
memcpy(bytes, &uuid->uuid_bytes, sizeof *bytes);
|
||||
}
|
||||
@@ -52,11 +64,22 @@ static union fx_uuid_bytes *uuid_ptr(struct fx_uuid_p *uuid)
|
||||
/*** PUBLIC FUNCTIONS *********************************************************/
|
||||
|
||||
fx_uuid *fx_uuid_create_from_bytes(
|
||||
unsigned char u00, unsigned char u01, unsigned char u02,
|
||||
unsigned char u03, unsigned char u04, unsigned char u05,
|
||||
unsigned char u06, unsigned char u07, unsigned char u08,
|
||||
unsigned char u09, unsigned char u10, unsigned char u11,
|
||||
unsigned char u12, unsigned char u13, unsigned char u14, unsigned char u15)
|
||||
unsigned char u00,
|
||||
unsigned char u01,
|
||||
unsigned char u02,
|
||||
unsigned char u03,
|
||||
unsigned char u04,
|
||||
unsigned char u05,
|
||||
unsigned char u06,
|
||||
unsigned char u07,
|
||||
unsigned char u08,
|
||||
unsigned char u09,
|
||||
unsigned char u10,
|
||||
unsigned char u11,
|
||||
unsigned char u12,
|
||||
unsigned char u13,
|
||||
unsigned char u14,
|
||||
unsigned char u15)
|
||||
{
|
||||
fx_uuid *uuid = fx_uuid_create();
|
||||
if (!uuid) {
|
||||
@@ -171,7 +194,11 @@ void fx_uuid_get_bytes(const fx_uuid *uuid, unsigned char bytes[FX_UUID_NBYTES])
|
||||
|
||||
void fx_uuid_get_uuid_bytes(const fx_uuid *uuid, union fx_uuid_bytes *bytes)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC(FX_TYPE_UUID, uuid_get_uuid_bytes, uuid, bytes);
|
||||
FX_CLASS_DISPATCH_STATIC(
|
||||
FX_TYPE_UUID,
|
||||
uuid_get_uuid_bytes,
|
||||
uuid,
|
||||
bytes);
|
||||
}
|
||||
|
||||
union fx_uuid_bytes *fx_uuid_ptr(fx_uuid *uuid)
|
||||
|
||||
Reference in New Issue
Block a user