Fix minor code style issues
This commit is contained in:
parent
085644a5e5
commit
121181bf15
@ -4,22 +4,26 @@
|
|||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
#include "../stream.h"
|
#include "../stream.h"
|
||||||
|
|
||||||
typedef struct
|
struct gmio_ascii_string_buffer
|
||||||
{
|
{
|
||||||
char* ptr; /*!< Buffer contents */
|
char* ptr; /*!< Buffer contents */
|
||||||
size_t len; /*!< Size(length) of current contents */
|
size_t len; /*!< Size(length) of current contents */
|
||||||
size_t max_len; /*!< Maximum contents size(length) */
|
size_t max_len; /*!< Maximum contents size(length) */
|
||||||
} gmio_ascii_string_buffer_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct gmio_ascii_string_buffer gmio_ascii_string_buffer_t;
|
||||||
|
|
||||||
|
struct gmio_ascii_stream_fwd_iterator
|
||||||
{
|
{
|
||||||
gmio_stream_t* stream;
|
gmio_stream_t* stream;
|
||||||
gmio_ascii_string_buffer_t buffer;
|
gmio_ascii_string_buffer_t buffer;
|
||||||
size_t buffer_pos; /*!< Position indicator in buffer */
|
size_t buffer_pos; /*!< Position indicator in buffer */
|
||||||
|
|
||||||
void* cookie;
|
void* cookie;
|
||||||
void (*stream_read_hook)(void*, const gmio_ascii_string_buffer_t*);
|
void (*stream_read_hook)(void* cookie, const gmio_ascii_string_buffer_t* str_buffer);
|
||||||
} gmio_ascii_stream_fwd_iterator_t;
|
};
|
||||||
|
|
||||||
|
typedef struct gmio_ascii_stream_fwd_iterator gmio_ascii_stream_fwd_iterator_t;
|
||||||
|
|
||||||
void gmio_ascii_stream_fwd_iterator_init(gmio_ascii_stream_fwd_iterator_t* it);
|
void gmio_ascii_stream_fwd_iterator_init(gmio_ascii_stream_fwd_iterator_t* it);
|
||||||
char* gmio_current_char(const gmio_ascii_stream_fwd_iterator_t* it);
|
char* gmio_current_char(const gmio_ascii_stream_fwd_iterator_t* it);
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
|
|
||||||
typedef union
|
union gmio_uint32_float
|
||||||
{
|
{
|
||||||
uint32_t as_uint32;
|
uint32_t as_uint32;
|
||||||
float as_float;
|
float as_float;
|
||||||
} gmio_uint32_float_t;
|
};
|
||||||
|
typedef union gmio_uint32_float gmio_uint32_float_t;
|
||||||
|
|
||||||
gmio_real32_t gmio_convert_real32(uint32_t val);
|
gmio_real32_t gmio_convert_real32(uint32_t val);
|
||||||
uint32_t gmio_convert_uint32(gmio_real32_t val);
|
uint32_t gmio_convert_uint32(gmio_real32_t val);
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
#include "../stl_geom.h"
|
#include "../stl_geom.h"
|
||||||
#include "../stl_triangle.h"
|
#include "../stl_triangle.h"
|
||||||
|
|
||||||
typedef struct
|
struct gmio_stlb_readwrite_helper
|
||||||
{
|
{
|
||||||
uint32_t facet_count;
|
uint32_t facet_count;
|
||||||
uint32_t i_facet_offset;
|
uint32_t i_facet_offset;
|
||||||
void (*fix_endian_func)(gmio_stl_triangle_t*);
|
void (*fix_endian_func)(gmio_stl_triangle_t* tri);
|
||||||
} gmio_stlb_readwrite_helper;
|
};
|
||||||
|
typedef struct gmio_stlb_readwrite_helper gmio_stlb_readwrite_helper_t;
|
||||||
|
|
||||||
gmio_bool_t gmio_check_transfer(int* error, const gmio_transfer_t* trsf);
|
gmio_bool_t gmio_check_transfer(int* error, const gmio_transfer_t* trsf);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ GMIO_INLINE static void read_triangle_memcpy(const uint8_t* buffer,
|
|||||||
|
|
||||||
static void gmio_stlb_read_facets(gmio_stl_geom_creator_t* creator,
|
static void gmio_stlb_read_facets(gmio_stl_geom_creator_t* creator,
|
||||||
const uint8_t* buffer,
|
const uint8_t* buffer,
|
||||||
const gmio_stlb_readwrite_helper* rparams)
|
const gmio_stlb_readwrite_helper_t* rparams)
|
||||||
{
|
{
|
||||||
const uint32_t facet_count = rparams->facet_count;
|
const uint32_t facet_count = rparams->facet_count;
|
||||||
const uint32_t i_facet_offset = rparams->i_facet_offset;
|
const uint32_t i_facet_offset = rparams->i_facet_offset;
|
||||||
@ -49,7 +49,7 @@ int gmio_stlb_read(gmio_stl_geom_creator_t *creator,
|
|||||||
gmio_endianness_t byte_order)
|
gmio_endianness_t byte_order)
|
||||||
{
|
{
|
||||||
const gmio_endianness_t host_byte_order = gmio_host_endianness();
|
const gmio_endianness_t host_byte_order = gmio_host_endianness();
|
||||||
gmio_stlb_readwrite_helper rparams;
|
gmio_stlb_readwrite_helper_t rparams;
|
||||||
uint8_t header_data[GMIO_STLB_HEADER_SIZE];
|
uint8_t header_data[GMIO_STLB_HEADER_SIZE];
|
||||||
uint32_t total_facet_count = 0; /* Count of facets as declared in the stream */
|
uint32_t total_facet_count = 0; /* Count of facets as declared in the stream */
|
||||||
int error = GMIO_NO_ERROR; /* Helper variable to store function result error code */
|
int error = GMIO_NO_ERROR; /* Helper variable to store function result error code */
|
||||||
@ -59,7 +59,7 @@ int gmio_stlb_read(gmio_stl_geom_creator_t *creator,
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* Initialize rparams */
|
/* Initialize rparams */
|
||||||
memset(&rparams, 0, sizeof(gmio_stlb_readwrite_helper));
|
memset(&rparams, 0, sizeof(gmio_stlb_readwrite_helper_t));
|
||||||
if (host_byte_order != byte_order)
|
if (host_byte_order != byte_order)
|
||||||
rparams.fix_endian_func = gmio_stl_triangle_bswap;
|
rparams.fix_endian_func = gmio_stl_triangle_bswap;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ GMIO_INLINE static void write_triangle_memcpy(const gmio_stl_triangle_t* triangl
|
|||||||
|
|
||||||
static void gmio_stlb_write_facets(const gmio_stl_geom_t* geom,
|
static void gmio_stlb_write_facets(const gmio_stl_geom_t* geom,
|
||||||
uint8_t* buffer,
|
uint8_t* buffer,
|
||||||
const gmio_stlb_readwrite_helper* wparams)
|
const gmio_stlb_readwrite_helper_t* wparams)
|
||||||
{
|
{
|
||||||
const uint32_t facet_count = wparams->facet_count;
|
const uint32_t facet_count = wparams->facet_count;
|
||||||
const uint32_t i_facet_offset = wparams->i_facet_offset;
|
const uint32_t i_facet_offset = wparams->i_facet_offset;
|
||||||
@ -47,7 +47,7 @@ int gmio_stlb_write(const gmio_stl_geom_t *geom,
|
|||||||
const uint8_t *header_data,
|
const uint8_t *header_data,
|
||||||
gmio_endianness_t byte_order)
|
gmio_endianness_t byte_order)
|
||||||
{
|
{
|
||||||
gmio_stlb_readwrite_helper wparams;
|
gmio_stlb_readwrite_helper_t wparams;
|
||||||
const uint32_t facet_count = geom != NULL ? geom->triangle_count : 0;
|
const uint32_t facet_count = geom != NULL ? geom->triangle_count : 0;
|
||||||
uint32_t i_facet = 0;
|
uint32_t i_facet = 0;
|
||||||
int error = GMIO_NO_ERROR;
|
int error = GMIO_NO_ERROR;
|
||||||
@ -59,7 +59,7 @@ int gmio_stlb_write(const gmio_stl_geom_t *geom,
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* Initialize wparams */
|
/* Initialize wparams */
|
||||||
memset(&wparams, 0, sizeof(gmio_stlb_readwrite_helper));
|
memset(&wparams, 0, sizeof(gmio_stlb_readwrite_helper_t));
|
||||||
if (gmio_host_endianness() != byte_order)
|
if (gmio_host_endianness() != byte_order)
|
||||||
wparams.fix_endian_func = gmio_stl_triangle_bswap;
|
wparams.fix_endian_func = gmio_stl_triangle_bswap;
|
||||||
wparams.facet_count = trsf->buffer_size / GMIO_STLB_TRIANGLE_RAWSIZE;
|
wparams.facet_count = trsf->buffer_size / GMIO_STLB_TRIANGLE_RAWSIZE;
|
||||||
|
Loading…
Reference in New Issue
Block a user